1 -- The block of io cells with JTAG boundary scan support
4 use ieee.std_logic_1164.ALL;
8 entity c4m_jtag_ioblock is
10 IR_WIDTH: integer := 2;
11 IOTYPES: IOTYPE_VECTOR
18 TDO_EN: out std_logic := '0';
21 IR: in std_logic_vector(IR_WIDTH-1 downto 0);
23 -- What action to perform
24 CAPTURE: in std_logic;
28 -- The I/O access ports
29 CORE_OUT: in std_logic_vector(IOTYPES'range);
30 CORE_IN: out std_logic_vector(IOTYPES'range);
31 CORE_EN: in std_logic_vector(IOTYPES'range);
33 -- The pad connections
34 PAD_OUT: out std_logic_vector(IOTYPES'range);
35 PAD_IN: in std_logic_vector(IOTYPES'range);
36 PAD_EN: out std_logic_vector(IOTYPES'range)
40 architecture rtl of c4m_jtag_ioblock is
41 signal IOMODE: SRIOMODE_TYPE;
42 signal SAMPLEMODE: SRSAMPLEMODE_TYPE;
43 signal ISSAMPLECMD: boolean;
45 signal BDSR_IN: std_logic_vector(0 to IOTYPES'length-1);
46 signal BDSR_OUT: std_logic_vector(0 to IOTYPES'length-1);
48 constant CMD_SAMPLEPRELOAD: std_logic_vector(IR_WIDTH-1 downto 0) := c4m_jtag_cmd_samplepreload(IR_WIDTH);
49 constant CMD_EXTEST: std_logic_vector(IR_WIDTH-1 downto 0) := c4m_jtag_cmd_extest(IR_WIDTH);
52 -- JTAG baundary scan IO cells
53 IOGEN: for i in IOTYPES'low to IOTYPES'high generate
55 IOCELL: c4m_jtag_iocell
60 CORE_IN => CORE_IN(i),
61 CORE_OUT => CORE_OUT(i),
62 CORE_EN => CORE_EN(i),
64 PAD_OUT => PAD_OUT(i),
66 BDSR_IN => BDSR_IN(i-IOTYPES'low),
67 BDSR_OUT => BDSR_OUT(i-IOTYPES'low),
69 SAMPLEMODE => SAMPLEMODE,
73 BDSRCONN: for i in 0 to BDSR_IN'length-2 generate
75 BDSR_IN(i+1) <= BDSR_OUT(i);
77 BDSR_IN(BDSR_IN'low) <= TDI;
80 -- Currently SR_2Pad, SR_2Core or SR_Z are not used
81 -- We cheat by letting CMD_EXTEST handle both connection
83 -- TODO: Handle more IOMODEs
84 IOMODE <= SR_2PadCore when IR = CMD_EXTEST else
88 ISSAMPLECMD <= (IR = CMD_SAMPLEPRELOAD or IR = CMD_EXTEST);
89 SAMPLEMODE <= SR_Sample when ISSAMPLECMD and CAPTURE = '1' else
90 SR_Update when ISSAMPLECMD and UPDATE = '1' else
91 SR_Shift when ISSAMPLECMD and SHIFT = '1' else
94 TDO <= BDSR_OUT(BDSR_IN'high) when ISSAMPLECMD and SHIFT = '1' else
96 TDO_EN <= '1' when ISSAMPLECMD and SHIFT = '1' else