-
Notifications
You must be signed in to change notification settings - Fork 0
/
TestMyCPU.v
115 lines (109 loc) · 2.42 KB
/
TestMyCPU.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
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
`timescale 1ns / 1ps
module TestMyCPU();
reg CLK;
reg RST;
wire [31:0] nextPC;
wire [31:0] currPC;
wire [31:0] InsData;
wire [31:0] IRIns;
wire [5:0] op;
wire [4:0] rs;
wire [4:0] rt;
wire [4:0] rd;
wire [15:0] ID_immediate;
wire RegWre;
wire RegDst;
wire [1:0] J;
//wire Flash;
wire MEM_Read;
wire MEM_Write;
wire MEMtoReg;
wire ExtSign;
wire [2:0] ALUOp;
wire [31:0] Reg_DataBusA;
wire [31:0] Reg_DataBusB;
wire [4:0] addr;
wire [31:0] extended;
wire [1:0] MEM_Con;
wire [1:0] WB_Con;
wire [2:0] ALUCon;
wire [4:0] ID_EX_Reg_RS;
wire [4:0] ID_EX_Reg_RT;
wire [4:0] ID_EX_Reg_RD;
wire [31:0] ID_EX_Reg_immediate;
wire [31:0] ID_EX_DataBusA;
wire [31:0] ID_EX_DataBusB;
wire [31:0] result;
wire EX_MEM_Write_Con;
wire EX_MEM_Read_Con;
wire [31:0] EX_MEM_ALUOut;
wire EX_MEM_MEMtoReg;
wire EX_MEM_RegWre;
wire [4:0] EX_MEM_Reg_RD;
wire [31:0] rData;
wire WB_RegWre;
wire [31:0] WB_DataBus;
wire [4:0] WB_Reg_RD;
wire stall;
wire [1:0] ForwardA;
wire [1:0] ForwardB;
wire Flash;
wire [1:0] PCSrc;
MyCPU test(
.CLK(CLK),
.RST(RST),
.nextPC(nextPC),
.currPC(currPC),
.InsData(InsData),
.IRIns(IRIns),
.op(op),
.rs(rs),
.rt(rt),
.rd(rd),
.ID_immediate(ID_immediate),
.RegWre(RegWre),
.RegDst(RegDst),
.J(J),
//.Flash(Flash),
.MEM_Read(MEM_Read),
.MEM_Write(MEM_Write),
.MEMtoReg(MEMtoReg),
.ExtSign(ExtSign),
.ALUOp(ALUOp),
.Reg_DataBusA(Reg_DataBusA),
.Reg_DataBusB(Reg_DataBusB),
.addr(addr),
.extended(extended),
.MEM_Con(MEM_Con),
.WB_Con(WB_Con),
.ALUCon(ALUCon),
.ID_EX_Reg_RS(ID_EX_Reg_RS),
.ID_EX_Reg_RT(ID_EX_Reg_RT),
.ID_EX_Reg_RD(ID_EX_Reg_RD),
.ID_EX_Reg_immediate(ID_EX_Reg_immediate),
.ID_EX_DataBusA(ID_EX_DataBusA),
.ID_EX_DataBusB(ID_EX_DataBusB),
.result(result),
.EX_MEM_Write_Con(EX_MEM_Write_Con),
.EX_MEM_Read_Con(EX_MEM_Read_Con),
.EX_MEM_ALUOut(EX_MEM_ALUOut),
.EX_MEM_MEMtoReg(EX_MEM_MEMtoReg),
.EX_MEM_RegWre(EX_MEM_RegWre),
.EX_MEM_Reg_RD(EX_MEM_Reg_RD),
.rData(rData),
.WB_RegWre(WB_RegWre),
.WB_DataBus(WB_DataBus),
.WB_Reg_RD(WB_Reg_RD),
.stall,
.ForwardA(ForwardA),
.ForwardB(ForwardB),
.Flash(Flash),
.PCSrc(PCSrc)
);
initial begin
CLK <= 0;
RST <= 0;
#50 RST <= 1;
forever #50 CLK <= ~CLK;
end
endmodule