This repository has been archived by the owner on Oct 13, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
TEST_Reg_RS.vhd
264 lines (239 loc) · 7.1 KB
/
TEST_Reg_RS.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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
----------------------------------------------------------------------------------
-- Company/University: Technical University of Crete (TUC) - GR
-- Engineer: Spyridakis Christos
-- Bellonias Panagiotis
--
-- Create Date: 18:35:19 10/26/2018
-- Design Name:
-- Module Name: Tomasulo/TEST_Reg_RS.vhd
-- Project Name: Tomasulo
-- Target Devices: NONE
-- Tool versions: Xilinx ISE 14.7 --TODO: VIVADO
-- Description: Introduction in Dynamic Instruction Scheduling (Advanced Computer Architecture)
-- implementing Tomasulo's Algorithm
--
--
-- VHDL Test Bench Created by ISE for module: Reg_RS
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
-- Notes:
-- This testbench has been automatically generated using types std_logic and
-- std_logic_vector for the ports of the unit under test. Xilinx recommends
-- that these types always be used for the top-level I/O of a design in order
-- to guarantee that the testbench will bind correctly to the post-implementation
-- simulation model.
--------------------------------------------------------------------------------
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY TEST_Reg_RS IS
END TEST_Reg_RS;
ARCHITECTURE behavior OF TEST_Reg_RS IS
-- Component Declaration for the Unit Under Test (UUT)
COMPONENT Reg_RS
PORT(
CLK : IN std_logic;
RST : IN std_logic;
ID : IN std_logic_vector(4 downto 0);
Available : OUT std_logic;
ISSUE : IN std_logic;
Op_ISSUE : IN std_logic_vector(1 downto 0);
Vj_ISSUE : IN std_logic_vector(31 downto 0);
Qj : IN std_logic_vector(4 downto 0);
Vk_ISSUE : IN std_logic_vector(31 downto 0);
Qk : IN std_logic_vector(4 downto 0);
CDB_V : IN std_logic_vector(31 downto 0);
CDB_Q : IN std_logic_vector(4 downto 0);
Ready : OUT std_logic;
Op : OUT std_logic_vector(1 downto 0);
Tag : OUT std_logic_vector(4 downto 0);
Vj : OUT std_logic_vector(31 downto 0);
Vk : OUT std_logic_vector(31 downto 0);
Accepted : IN std_logic
);
END COMPONENT;
--Inputs
signal CLK : std_logic := '0';
signal RST : std_logic := '0';
signal ID : std_logic_vector(4 downto 0) := (others => '0');
signal ISSUE : std_logic := '0';
signal Op_ISSUE : std_logic_vector(1 downto 0) := (others => '0');
signal Vj_ISSUE : std_logic_vector(31 downto 0) := (others => '0');
signal Qj : std_logic_vector(4 downto 0) := (others => '0');
signal Vk_ISSUE : std_logic_vector(31 downto 0) := (others => '0');
signal Qk : std_logic_vector(4 downto 0) := (others => '0');
signal CDB_V : std_logic_vector(31 downto 0) := (others => '0');
signal CDB_Q : std_logic_vector(4 downto 0) := (others => '0');
signal Accepted : std_logic := '0';
--Outputs
signal Available : std_logic;
signal Ready : std_logic;
signal Op : std_logic_vector(1 downto 0);
signal Tag : std_logic_vector(4 downto 0);
signal Vj : std_logic_vector(31 downto 0);
signal Vk : std_logic_vector(31 downto 0);
-- Clock period definitions
constant CLK_period : time := 10 ns;
BEGIN
-- Instantiate the Unit Under Test (UUT)
uut: Reg_RS PORT MAP (
CLK => CLK,
RST => RST,
ID => ID,
Available => Available,
ISSUE => ISSUE,
Op_ISSUE => Op_ISSUE,
Vj_ISSUE => Vj_ISSUE,
Qj => Qj,
Vk_ISSUE => Vk_ISSUE,
Qk => Qk,
CDB_V => CDB_V,
CDB_Q => CDB_Q,
Ready => Ready,
Op => Op,
Tag => Tag,
Vj => Vj,
Vk => Vk,
Accepted => Accepted
);
-- Clock process definitions
CLK_process :process
begin
CLK <= '0';
wait for CLK_period/2;
CLK <= '1';
wait for CLK_period/2;
end process;
-- Stimulus process
stim_proc: process
begin
-- hold reset state for 100 ns.
wait for 100 ns;
ID <="10101";
------------------------------------------------------------CC:1
RST <='1';
--
ISSUE <='0';
Op_ISSUE <="01";
Vj_ISSUE <="00000000000000000000000000000000";
Qj <="00000";
Vk_ISSUE <="00000000000000000000000000000000";
Qk <="00000";
--
CDB_V <="00000000000000000000000000000000";
CDB_Q <="00000";
--
Accepted <='0';
wait for CLK_period*1;
------------------------------------------------------------CC:2
RST <='0';
--
ISSUE <='0';
Op_ISSUE <="00";
Vj_ISSUE <="00000000000000000000000000000000";
Qj <="00000";
Vk_ISSUE <="00000000000000000000000000000000";
Qk <="00000";
--
CDB_V <="00000000000000000000000000000000";
CDB_Q <="00000";
--
Accepted <='0';
wait for CLK_period*3;
------------------------------------------------------------CC:5 ISSUE with k valid
RST <='0';
--
ISSUE <='1';
Op_ISSUE <="01";
Vj_ISSUE <="00000000000000000000000000000001";
Qj <="00001";
Vk_ISSUE <="00000000000000000000000000000010";
Qk <="00000";
--
CDB_V <="00000000000000000000000000000000";
CDB_Q <="00000";
--
Accepted <='0';
wait for CLK_period*1;
------------------------------------------------------------CC:6 CDB_Q = J_Q
RST <='0';
--
ISSUE <='0';
Op_ISSUE <="11";
Vj_ISSUE <="00000000000000000000000000000010";
Qj <="01000";
Vk_ISSUE <="00000000100000000100000000000000";
Qk <="01010";
--
CDB_V <="00000000000000000000000000000100";
CDB_Q <="00001";
--
Accepted <='0';
wait for CLK_period*1;
------------------------------------------------------------CC:7 RS Accepted
RST <='0';
--
ISSUE <='0';
Op_ISSUE <="10";
Vj_ISSUE <="00000010000000000000100001000000";
Qj <="01010";
Vk_ISSUE <="00000010000000001000000001000000";
Qk <="01001";
--
CDB_V <="00001000000000001000000000000100";
CDB_Q <="00011";
--
Accepted <='1';
wait for CLK_period*1;
------------------------------------------------------------CC:8 STALL
RST <='0';
--
ISSUE <='0';
Op_ISSUE <="00";
Vj_ISSUE <="10000000000000000001000000000000";
Qj <="01000";
Vk_ISSUE <="00000000000001000000000000000000";
Qk <="01010";
--
CDB_V <="00000000000000001000000000000100";
CDB_Q <="00110";
--
Accepted <='0';
wait for CLK_period*2;
------------------------------------------------------------CC:10 Operation Completed
RST <='0';
--
ISSUE <='0';
Op_ISSUE <="01";
Vj_ISSUE <="10000000100000100001000010000000";
Qj <="01110";
Vk_ISSUE <="00000000100001001000000010000000";
Qk <="01011";
--
CDB_V <="00000000000000001000000000000100";
CDB_Q <="10101";
--
Accepted <='0';
wait for CLK_period*1;
---------------------------------------------------------CC:11 END
RST <='0';
--
ISSUE <='0';
Op_ISSUE <="10";
Vj_ISSUE <="10000000100000100001011110000000";
Qj <="01011";
Vk_ISSUE <="00000000100001001000100010000000";
Qk <="00011";
--
CDB_V <="00000000010010001000000010100100";
CDB_Q <="10010";
--
Accepted <='0';
wait for CLK_period*1;
wait;
end process;
END;