-
Notifications
You must be signed in to change notification settings - Fork 0
/
tb_IE.sv
60 lines (58 loc) · 1.43 KB
/
tb_IE.sv
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
//https://edaplayground.com/x/CnWQ
module tb_IE(r1_tb, r2_tb, Imm_tb, ALUOp_tb, ALUSrc1_tb, ALUSrc2_tb, ExecResult_tb, zero_tb, PCp_tb, b_sel_tb, b_control_tb);
output logic [31:0] r1_tb;
output logic [31:0] r2_tb;
output logic [31:0] Imm_tb;
output logic [3:0] ALUOp_tb;
output logic [0:0] ALUSrc1_tb;
output logic [0:0] ALUSrc2_tb;
output logic [31:0] PCp_tb;
output logic [2:0] b_control_tb;
input logic [31:0] ExecResult_tb;
input logic [0:0] zero_tb;
input logic [0:0] b_sel_tb; // to IF
IE dut (.r1(r1_tb),
.r2(r2_tb),
.Imm(Imm_tb),
.ALUOp(ALUOp_tb),
.ALUSrc1(ALUSrc1_tb),
.ALUSrc2(ALUSrc2_tb),
.ExecResult(ExecResult_tb),
.zero(zero_tb),
.PCp(PCp_tb),
.b_sel(b_sel_tb),
.b_control(b_control_tb)
);
initial begin
$dumpfile("dump.vcd");
$dumpvars(0, tb_IE);
// r1 + r2
ALUOp_tb = 4'b0000;
r1_tb = 32'hBABEFACE;
r2_tb = 32'hDEADBEEF;
ALUSrc1_tb = 1'b1;
ALUSrc2_tb = 1'b1;
Imm_tb = 32'h00000010;
PCp_tb = 32'h00000004;
b_control_tb = 3'b000;
// BNE
#1 ALUOp_tb = 4'b0000;
r1_tb = 32'h0000000C;
r2_tb = 32'h00000008;
ALUSrc1_tb = 1'b0;
ALUSrc2_tb = 1'b0;
Imm_tb = 32'h00000010;
PCp_tb = 32'h00000004;
b_control_tb = 3'b010;
// r1 + Imm
#1 ALUOp_tb = 4'b0000;
r1_tb = 32'hBABEFACE;
r2_tb = 32'hDEADBEEF;
ALUSrc1_tb = 1'b1;
ALUSrc2_tb = 1'b0;
Imm_tb = 32'h00000010;
PCp_tb = 32'h00000004;
b_control_tb = 3'b000;
#1 $finish;
end
endmodule