-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTAP_Controller.vhd
161 lines (152 loc) · 3.58 KB
/
TAP_Controller.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 02/02/2021 02:02:18 PM
-- Design Name:
-- Module Name: TAP_Controller - Behavioral
-- Project Name:
-- Target Devices:
-- Tool Versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:<zxc
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx leaf cells in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity Tap is
port ( clk, rst, tms: in std_logic;
cpdr_now, shdr_now, updr_now, cpir_now, shir_now, upir_now: out std_logic
);
end Tap;
architecture arch of Tap is
type state is (TLR, RTI, SDRS, CPDR, SHDR, E1DR, PADR, E2DR, UPDR,
SIRS, CPIR, SHIR, E1IR, PAIR, E2IR, UPIR);
signal st_reg, st_nxt: state; -- present state, next state
begin
-- state register
process (clk, rst)
begin
if (rst = '1') then
st_reg <= TLR; -- initial state
elsif rising_edge(clk) then
st_reg <= st_nxt;
end if;
end process;
-- next-state and output logic
process (st_reg, tms)
begin
st_nxt <= st_reg; -- stay in current state by default
cpdr_now <= '0';
shdr_now <= '0';
updr_now <= '0';
cpir_now <= '0';
shir_now <= '0';
upir_now <= '0';
case st_reg is
when TLR =>
if tms = '0' then
st_nxt <= RTI;
end if;
when RTI =>
if tms = '1' then
st_nxt <= SDRS;
end if;
when SDRS =>
if tms = '1' then
st_nxt <= SIRS;
else
st_nxt <= CPDR;
end if;
when CPDR =>
cpdr_now <= '1';
if tms = '1' then
st_nxt <= E1DR;
else
st_nxt <= SHDR;
end if;
when SHDR =>
shdr_now <= '1';
if tms = '1' then
st_nxt <= E1DR;
end if;
when E1DR =>
if tms = '1' then
st_nxt <= UPDR;
else
st_nxt <= PADR;
end if;
when PADR =>
if tms = '1' then
st_nxt <= E2DR;
end if;
when E2DR =>
if tms = '1' then
st_nxt <= UPDR;
else
st_nxt <= SHDR;
end if;
when UPDR =>
updr_now <= '1';
if tms = '1' then
st_nxt <= SDRS;
else
st_nxt <= RTI;
end if;
when SIRS =>
if tms = '1' then
st_nxt <= TLR;
else
st_nxt <= CPIR;
end if;
when CPIR =>
cpir_now <= '1';
if tms = '1' then
st_nxt <= E1IR;
else
st_nxt <= SHIR;
end if;
when SHIR =>
shir_now <= '1';
if tms = '1' then
st_nxt <= E1IR;
end if;
when E1IR =>
if tms = '1' then
st_nxt <= UPIR;
else
st_nxt <= PAIR;
end if;
when PAIR =>
if tms = '1' then
st_nxt <= E2IR;
end if;
when E2IR =>
if tms = '1' then
st_nxt <= UPIR;
else
st_nxt <= SHIR;
end if;
when UPIR =>
upir_now <= '1';
if tms = '1' then
st_nxt <= SIRS;
else
st_nxt <= RTI;
end if;
end case;
end process;
-- Moore outputs logic
end arch;