1 -- The JTAG state machine
2 -- This is implemented based on the IEEE 1149.1 standard
5 use ieee.std_logic_1164.ALL;
9 entity c4m_jtag_tap_fsm is
20 CAPTURE: out std_logic;
26 architecture rtl of c4m_jtag_tap_fsm is
27 type TAPSTATE_TYPE is (
39 signal STATE: TAPSTATE_TYPE;
40 signal DRSTATE: std_logic;
41 signal IRSTATE: std_logic;
42 signal NEXT_STATE: TAPSTATE_TYPE;
43 signal NEXT_DRSTATE: std_logic;
44 signal NEXT_IRSTATE: std_logic;
46 -- Generate outputs from the state
49 RESET <= '1' when STATE = TestLogicReset else '0';
50 CAPTURE <= '1' when STATE = CaptureState else '0';
51 SHIFT <= '1' when STATE = ShiftState else '0';
52 UPDATE <= '1' when STATE = UpdateState else '0';
59 STATE <= TestLogicReset;
60 elsif rising_edge(TCK) then
62 DRSTATE <= NEXT_DRSTATE;
63 IRSTATE <= NEXT_IRSTATE;
68 '0' when NEXT_STATE = TestLogicReset else
69 '0' when NEXT_STATE = RunTestIdle else
70 '1' when NEXT_STATE = SelectDRScan else
71 '0' when NEXT_STATE = SelectIRScan else
74 '0' when NEXT_STATE = TestLogicReset else
75 '0' when NEXT_STATE = RunTestIdle else
76 '0' when NEXT_STATE = SelectDRScan else
77 '1' when NEXT_STATE = SelectIRScan else
83 when TestLogicReset =>
85 NEXT_STATE <= RunTestIdle;
87 NEXT_STATE <= TestLogicReset;
92 NEXT_STATE <= RunTestIdle;
94 NEXT_STATE <= SelectDRScan;
99 NEXT_STATE <= CaptureState;
101 NEXT_STATE <= SelectIRScan;
106 NEXT_STATE <= CaptureState;
108 NEXT_STATE <= TestLogicReset;
113 NEXT_STATE <= ShiftState;
120 NEXT_STATE <= ShiftState;
129 NEXT_STATE <= UpdateState;
141 NEXT_STATE <= ShiftState;
143 NEXT_STATE <= UpdateState;
148 NEXT_STATE <= RunTestIdle;
150 NEXT_STATE <= SelectDRScan;
154 NEXT_STATE <= TestLogicReset;