-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtb_top_mips.v
74 lines (60 loc) · 1.42 KB
/
tb_top_mips.v
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
/*
To be used for Spring 2017, CSE301 Computer Architecture course, by Prof. Lee.
Prepared by Daewoo Kim, UNIST.
TODO
- Change the following instance names according to your design: RF, IM, DM
*/
module tb_top_mips;
reg clk;
reg rst;
wire [31:0] PCaddr, IM_Ins;
wire [5:0] OP;
wire [4:0] RS, RT, RD, SH;
wire [5:0] FU;
wire [31:0] RF_D1, RF_D2, SE, Branch_Addr, ALU_Result;
wire ALU_Zero;
wire [31:0] Wrtie_Data, Read_Data, WB_Data;
integer i;
top_mips DUT(
.clk(clk),
.rst(rst),
.PCaddr(PCaddr),
.IM_Ins(IM_Ins),
.OP(OP),
.RS(RS),
.RT(RT),
.RD(RD),
.SH(SH),
.FU(FU),
.RF_D1(RF_D1),
.RF_D2(RF_D2),
.SE(SE),
.ALU_Result(ALU_Result),
.ALU_Zero(ALU_Zero),
.Branch_Addr(Branch_Addr),
.Wrtie_Data(Wrtie_Data),
.Read_Data(Read_Data),
.WB_Data(WB_Data)
);
initial begin
clk = 0;
forever #5 clk = ~clk;
end
initial begin
rst = 1'b0; #10;
rst = 1'b1; #10;
// TODO: Modify the following number as necessary
#200;
// TODO: Replace IM with Instruction Memory's instance name
$display("Test ID: #%d\n", DUT.IM.memory[31]);
for ( i = 0; i < 32; i = i + 1 ) begin
// TODO: Replace RF with Register File's instance name
$display("R[%02d]: %d\n", i, DUT.RF.register[i]);
end
for ( i = 0; i < 32; i = i + 1 ) begin
// TODO: Replace DM with Data Memory's instance name
$display("DATA[%02d]: %d\n", i, DUT.DM.memory[i]);
end
$stop;
end
endmodule