-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregFile_tb.v
More file actions
69 lines (55 loc) · 1.24 KB
/
Copy pathregFile_tb.v
File metadata and controls
69 lines (55 loc) · 1.24 KB
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
// Ritam Das & Jason Hu
module regFile_tb();
reg clock, reset;
/******************************************************************************
* Start Your Code Here
******************************************************************************/
reg wEn;
reg [4:0]read_sel1, read_sel2, write_sel;
reg [31:0] write_data;
wire [31:0] read_data1, read_data2;
// Fill in port connections
regFile uut (
.clock(clock),
.reset(reset),
.wEn(wEn), // Write Enable
.write_data(write_data),
.read_sel1(read_sel1),
.read_sel2(read_sel2),
.write_sel(write_sel),
.read_data1(read_data1),
.read_data2(read_data2)
);
always #5 clock = ~clock;
initial begin
clock = 1'b1;
reset = 1'b1;
#1;
#20;
reset = 1'b0;
// Test reads and writes to the register file here
wEn = 1'b1;
write_data = 32'd12;
read_sel1 = 5'b00000;
read_sel2 = 5'b00010;
write_sel = 5'b00000;
#20;
wEn = 1'b1;
write_data = 32'd11;
read_sel1 = 5'b00001;
read_sel2 = 5'b00010;
write_sel = 5'b00001;
#20;
wEn = 1'b1;
write_data = 32'd10;
read_sel1 = 5'b00001;
read_sel2 = 5'b00011;
write_sel = 5'b00001;
#20;
wEn = 1'b1;
write_data = 32'd9;
read_sel1 = 5'b00001;
read_sel2 = 5'b00010;
write_sel = 5'b00010;
end
endmodule