-
Notifications
You must be signed in to change notification settings - Fork 0
/
tdr.vhd
176 lines (151 loc) · 3.23 KB
/
tdr.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
library ieee;
use ieee.std_logic_1164.all;
entity tdr is
port(
reset_bar, load_bar : in std_logic;
clk : in std_logic;
data_in : in std_logic_vector(7 downto 0);
data_out : out std_logic_vector(7 downto 0)
);
end tdr;
architecture tdr_struc of tdr is
signal i_data, i_data_bar : std_logic_vector(7 downto 0);
signal i_data_in : std_logic_vector(7 downto 0);
signal i_load : std_logic;
component dflipflop is
port(i_d, i_clk, i_set, i_rst: in STD_LOGIC;
o_q, o_qbar : inout STD_LOGIC);
end component;
component dLatch IS
PORT(
i_d : IN STD_LOGIC;
i_enable : IN STD_LOGIC;
o_q, o_qBar : OUT STD_LOGIC);
end component;
begin
-- D Latch to preserve bus input
l7 : dLatch port map (
i_d => data_in(7),
i_enable => i_load,
o_q => i_data_in(7),
o_qBar => open
);
-- DFF to hold bit 7 of data
bit7 : dflipflop port map (
i_d => i_data_in(7),
i_clk => clk,
i_set => '1',
i_rst => reset_bar,
o_q => i_data(7),
o_qbar => i_data_bar(7)
);
-- D Latch to preserve bus input
l6 : dLatch port map (
i_d => data_in(6),
i_enable => i_load,
o_q => i_data_in(6)
);
-- DFF to hold bit 6 of data
bit6 : dflipflop port map (
i_d => i_data_in(6),
i_clk => clk,
i_set => '1',
i_rst => reset_bar,
o_q => i_data(6),
o_qbar => i_data_bar(6)
);
-- D Latch to preserve bus input
l5 : dLatch port map (
i_d => data_in(5),
i_enable => i_load,
o_q => i_data_in(5)
);
-- DFF to hold bit 5 of data
bit5 : dflipflop port map (
i_d => i_data_in(5),
i_clk => clk,
i_set => '1',
i_rst => reset_bar,
o_q => i_data(5),
o_qbar => i_data_bar(5)
);
-- D Latch to preserve bus input
l4 : dLatch port map (
i_d => data_in(4),
i_enable => i_load,
o_q => i_data_in(4)
);
-- DFF to hold bit 4 of data
bit4 : dflipflop port map (
i_d => i_data_in(4),
i_clk => clk,
i_set => '1',
i_rst => reset_bar,
o_q => i_data(4),
o_qbar => i_data_bar(4)
);
-- D Latch to preserve bus input
l3 : dLatch port map (
i_d => data_in(3),
i_enable => i_load,
o_q => i_data_in(3)
);
-- DFF to hold bit 3 of data
bit3 : dflipflop port map (
i_d => i_data_in(3),
i_clk => clk,
i_set => '1',
i_rst => reset_bar,
o_q => i_data(3),
o_qbar => i_data_bar(3)
);
-- D Latch to preserve bus input
l2 : dLatch port map (
i_d => data_in(2),
i_enable => i_load,
o_q => i_data_in(2)
);
-- DFF to hold bit 2 of data
bit2 : dflipflop port map (
i_d => i_data_in(2),
i_clk => clk,
i_set => '1',
i_rst => reset_bar,
o_q => i_data(2),
o_qbar => i_data_bar(2)
);
-- D Latch to preserve bus input
l1 : dLatch port map (
i_d => data_in(1),
i_enable => i_load,
o_q => i_data_in(1)
);
-- DFF to hold bit 1 of data
bit1 : dflipflop port map (
i_d => i_data_in(1),
i_clk => clk,
i_set => '1',
i_rst => reset_bar,
o_q => i_data(1),
o_qbar => i_data_bar(1)
);
-- D Latch to preserve bus input
l0 : dLatch port map (
i_d => data_in(0),
i_enable => i_load,
o_q => i_data_in(0)
);
-- DFF to hold bit 0 of data
bit0 : dflipflop port map (
i_d => i_data_in(0),
i_clk => clk,
i_set => '1',
i_rst => reset_bar,
o_q => i_data(0),
o_qbar => i_data_bar(0)
);
-- Concurrent signal assignments
i_load <= not load_bar;
-- Output Driver:
data_out <= i_data;
end tdr_struc;