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"
24 TDO_EN: out std_logic;
27 -- The FSM state indicators
28 STATE: out TAPSTATE_TYPE;
29 NEXT_STATE: out TAPSTATE_TYPE;
30 DRSTATE: 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";
63 NEXT_STATE <= S_NEXT_STATE;
74 NEXT_STATE => S_NEXT_STATE,
79 -- The instruction register
80 IRBLOCK: c4m_jtag_irblock
90 NEXT_STATE => S_NEXT_STATE,
96 IDBLOCK: c4m_jtag_idblock
99 PART_NUMBER => PART_NUMBER,
100 MANUFACTURER => MANUFACTURER
108 NEXT_STATE => S_NEXT_STATE,
109 DRSTATE => S_DRSTATE,
114 IOBLOCK: c4m_jtag_ioblock
116 IR_WIDTH => IR_WIDTH,
125 NEXT_STATE => S_NEXT_STATE,
126 DRSTATE => S_DRSTATE,
128 CORE_OUT => CORE_OUT,
136 TDO <= IR_TDO when IR_TDO_EN = '1' else
137 ID_TDO when ID_TDO_EN = '1' else
138 IO_TDO when IO_TDO_EN = '1' else
140 TDO_EN <= IR_TDO_EN or ID_TDO_EN or IO_TDO_EN;
142 EN <= IR_TDO_EN & ID_TDO_EN & IO_TDO_EN;
143 assert EN = "000" or EN = "100" or EN = "010" or EN = "001"
144 report "TDO conflict in c4m_jtag_tap_controller"