1 -- A JTAG complient tap controller implementation
2 -- This is implemented based on the IEEE 1149.1 standard
5 use ieee.std_logic_1164.ALL;
9 entity c4m_jtag_tap_controller is
11 IR_WIDTH: integer := 2;
14 MANUFACTURER: std_logic_vector(10 downto 0) := "10001111111";
15 PART_NUMBER: std_logic_vector(15 downto 0) := "0000000000000001";
16 VERSION: std_logic_vector(3 downto 0) := "0000"
26 -- The FSM state indicators
28 DRCAPTURE: out std_logic;
29 DRSHIFT: out std_logic;
30 DRUPDATE: out std_logic;
32 -- The Instruction Register
33 IR: out std_logic_vector(IR_WIDTH-1 downto 0);
35 -- The I/O access ports
36 CORE_IN: out std_logic_vector(IOS-1 downto 0);
37 CORE_EN: in std_logic_vector(IOS-1 downto 0);
38 CORE_OUT: in std_logic_vector(IOS-1 downto 0);
40 -- The pad connections
41 PAD_IN: in std_logic_vector(IOS-1 downto 0);
42 PAD_EN: out std_logic_vector(IOS-1 downto 0);
43 PAD_OUT: out std_logic_vector(IOS-1 downto 0)
45 end c4m_jtag_tap_controller;
47 architecture rtl of c4m_jtag_tap_controller is
48 signal S_STATE: TAPSTATE_TYPE;
49 signal S_NEXT_STATE: TAPSTATE_TYPE;
50 signal S_IRSTATE: std_logic;
51 signal S_DRSTATE: std_logic;
52 signal S_IR: std_logic_vector(IR_WIDTH-1 downto 0);
54 signal IR_TDO: std_logic;
55 signal IR_TDO_EN: std_logic;
56 signal ID_TDO: std_logic;
57 signal ID_TDO_EN: std_logic;
58 signal IO_TDO: std_logic;
59 signal IO_TDO_EN: std_logic;
60 signal EN: std_logic_vector(2 downto 0) := "000";
64 RESET <= '1' when S_STATE = TestLogicReset else '0';
65 DRCAPTURE <= '1' when S_STATE = Capture and S_DRSTATE = '1' else '0';
66 DRSHIFT <= '1' when S_STATE = Shift and S_DRSTATE = '1' else '0';
67 DRUPDATE <= '1' when S_STATE = Update and S_DRSTATE = '1' else '0';
76 NEXT_STATE => S_NEXT_STATE,
81 -- The instruction register
82 IRBLOCK: c4m_jtag_irblock
92 NEXT_STATE => S_NEXT_STATE,
98 IDBLOCK: c4m_jtag_idblock
100 IR_WIDTH => IR_WIDTH,
101 PART_NUMBER => PART_NUMBER,
102 MANUFACTURER => MANUFACTURER
110 NEXT_STATE => S_NEXT_STATE,
111 DRSTATE => S_DRSTATE,
116 IOBLOCK: c4m_jtag_ioblock
118 IR_WIDTH => IR_WIDTH,
127 NEXT_STATE => S_NEXT_STATE,
128 DRSTATE => S_DRSTATE,
130 CORE_OUT => CORE_OUT,
138 TDO <= IR_TDO when IR_TDO_EN = '1' else
139 ID_TDO when ID_TDO_EN = '1' else
140 IO_TDO when IO_TDO_EN = '1' else
143 EN <= IR_TDO_EN & ID_TDO_EN & IO_TDO_EN;
144 assert EN = "000" or EN = "100" or EN = "010" or EN = "001"
145 report "TDO conflict in c4m_jtag_tap_controller"