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 VERSION: std_logic_vector(3 downto 0)
22 TDO_EN: out std_logic;
25 -- The FSM state indicators
26 STATE: out TAPSTATE_TYPE;
27 NEXT_STATE: out TAPSTATE_TYPE;
28 DRSTATE: out std_logic;
30 -- The Instruction Register
31 IR: out std_logic_vector(IR_WIDTH-1 downto 0);
33 -- The I/O access ports
34 CORE_IN: out std_logic_vector(IOS-1 downto 0);
35 CORE_EN: in std_logic_vector(IOS-1 downto 0);
36 CORE_OUT: in std_logic_vector(IOS-1 downto 0);
38 -- The pad connections
39 PAD_IN: in std_logic_vector(IOS-1 downto 0);
40 PAD_EN: out std_logic_vector(IOS-1 downto 0);
41 PAD_OUT: out std_logic_vector(IOS-1 downto 0)
43 end c4m_jtag_tap_controller;
45 architecture rtl of c4m_jtag_tap_controller is
46 signal S_STATE: TAPSTATE_TYPE;
47 signal S_NEXT_STATE: TAPSTATE_TYPE;
48 signal S_IRSTATE: std_logic;
49 signal S_DRSTATE: std_logic;
50 signal S_IR: std_logic_vector(IR_WIDTH-1 downto 0);
52 signal IR_TDO: std_logic;
53 signal IR_TDO_EN: std_logic;
54 signal ID_TDO: std_logic;
55 signal ID_TDO_EN: std_logic;
56 signal IO_TDO: std_logic;
57 signal IO_TDO_EN: std_logic;
58 signal EN: std_logic_vector(2 downto 0) := "000";
60 -- TODO: Automate PART_NUMBER generation
61 constant PART_NUMBER: std_logic_vector(15 downto 0) := "0000000010001001";
62 -- TODO: Get manufacturer ID
63 constant MANUFACTURER: std_logic_vector(10 downto 0) := "00000000000";
66 NEXT_STATE <= S_NEXT_STATE;
77 NEXT_STATE => S_NEXT_STATE,
82 -- The instruction register
83 IRBLOCK: c4m_jtag_irblock
93 NEXT_STATE => S_NEXT_STATE,
99 IDBLOCK: c4m_jtag_idblock
101 IR_WIDTH => IR_WIDTH,
102 PART_NUMBER => PART_NUMBER,
103 MANUFACTURER => MANUFACTURER
111 NEXT_STATE => S_NEXT_STATE,
112 DRSTATE => S_DRSTATE,
117 IOBLOCK: c4m_jtag_ioblock
119 IR_WIDTH => IR_WIDTH,
128 NEXT_STATE => S_NEXT_STATE,
129 DRSTATE => S_DRSTATE,
131 CORE_OUT => CORE_OUT,
139 TDO <= IR_TDO when IR_TDO_EN = '1' else
140 ID_TDO when ID_TDO_EN = '1' else
141 IO_TDO when IO_TDO_EN = '1' else
143 TDO_EN <= IR_TDO_EN or ID_TDO_EN or IO_TDO_EN;
145 EN <= IR_TDO_EN & ID_TDO_EN & IO_TDO_EN;
146 assert EN = "000" or EN = "100" or EN = "010" or EN = "001"
147 report "TDO conflict in c4m_jtag_tap_controller"