-
Notifications
You must be signed in to change notification settings - Fork 0
/
EX_MEM_TB.v
83 lines (72 loc) · 1.54 KB
/
EX_MEM_TB.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
75
76
77
78
79
80
81
82
83
`timescale 1ns / 1ps
module EX_MEM_TB;
// Inputs
reg clk;
reg hit;
reg [31:0] branchTarget;
reg zeroFlag;
reg MemRead;
reg MemWrite;
reg Branch;
reg RegWrite;
reg MemToReg;
reg [31:0] ALUResult;
reg [31:0] readData2;
reg [4:0] writeReg;
// Outputs
wire [31:0] BranchTargetOut;
wire [31:0] ALUResultOut;
wire [31:0] readData2Out;
wire [4:0] writeRegOut;
wire hitOut;
wire zeroFlagOut;
wire MemReadOut;
wire MemWriteOut;
wire BranchOut;
wire RegWriteOut;
wire MemToRegOut;
// Instantiate the Unit Under Test (UUT)
EX_MEM uut (
.clk(clk),
.hit(hit),
.branchTarget(branchTarget),
.zeroFlag(zeroFlag),
.MemRead(MemRead),
.MemWrite(MemWrite),
.Branch(Branch),
.RegWrite(RegWrite),
.MemToReg(MemToReg),
.ALUResult(ALUResult),
.readData2(readData2),
.writeReg(writeReg),
.BranchTargetOut(BranchTargetOut),
.ALUResultOut(ALUResultOut),
.readData2Out(readData2Out),
.writeRegOut(writeRegOut),
.hitOut(hitOut),
.zeroFlagOut(zeroFlagOut),
.MemReadOut(MemReadOut),
.MemWriteOut(MemWriteOut),
.BranchOut(BranchOut),
.RegWriteOut(RegWriteOut),
.MemToRegOut(MemToRegOut)
);
initial begin
// Initialize Inputs
clk = 0;
hit = 0;
branchTarget = 0;
zeroFlag = 0;
MemRead = 0;
MemWrite = 0;
Branch = 0;
RegWrite = 0;
MemToReg = 0;
ALUResult = 0;
readData2 = 0;
writeReg = 0;
// Wait 100 ns for global reset to finish
#100;
// Add stimulus here
end
endmodule