-
Notifications
You must be signed in to change notification settings - Fork 0
/
cputest125.v
executable file
·198 lines (187 loc) · 2.93 KB
/
cputest125.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 23:23:13 12/05/2018
// Design Name: zzcpu
// Module Name: Z:/Desktop/cpu/zzcpu/cputest125.v
// Project Name: zzcpu
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: zzcpu
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module cputest125;
// Inputs
reg clk;
reg rst;
reg [15:0] l;
reg data_ready;
reg tbre;
reg tsre;
// Outputs
wire [15:0] light;
wire [17:0] Ram1Addr;
wire Ram1OE;
wire Ram1WE;
wire Ram1EN;
wire [17:0] Ram2Addr;
wire Ram2OE;
wire Ram2WE;
wire Ram2EN;
wire wrn;
wire rdn;
// Bidirs
wire [15:0] Ram1Data;
wire [15:0] Ram2Data;
// Instantiate the Unit Under Test (UUT)
zzcpu uut (
.clk(clk),
.rst(rst),
.light(light),
.l(l),
.Ram1Addr(Ram1Addr),
.Ram1Data(Ram1Data),
.Ram1OE(Ram1OE),
.Ram1WE(Ram1WE),
.Ram1EN(Ram1EN),
.Ram2Addr(Ram2Addr),
.Ram2Data(Ram2Data),
.Ram2OE(Ram2OE),
.Ram2WE(Ram2WE),
.Ram2EN(Ram2EN),
.data_ready(data_ready),
.tbre(tbre),
.tsre(tsre),
.wrn(wrn),
.rdn(rdn)
);
initial begin
// Initialize Inputs
clk = 1;
rst = 1;
l = 0;
data_ready = 0;
tbre = 0;
tsre = 0;
// Wait 100 ns for global reset to finish
#10;
// Add stimulus here
#5;
rst = 1'b0;
#5;
rst = 1'b1;
#5;
clk = 0;
l = 16'h6AFF; // LI R2 FF
#5;
clk = 1;
#5;
clk = 0;
l = 16'h6BC0; // LI R3 C0
#5;
clk = 1;
#5;
clk = 0;
l = 16'h3360; // SLL R3 R3 0
#5;
clk = 1;
#5;
clk = 0;
l = 16'h6DFF; // LI R5 FF
#5;
clk = 1;
#5;
clk = 0;
l = 16'h35A0; // SLL R5 R5 0
#5;
clk = 1;
#5;
clk = 0;
l = 16'h4D83; // ADDIU R5 R3
#5;
clk = 1;
#5;
clk = 0;
l = 16'h6961; // LI R1 61
#5;
clk = 1;
#5;
clk = 0;
l = 16'h4901; // ADDIU R1 1
#5;
clk = 1;
#5;
clk = 0;
l = 16'hDB02; // SW R3 R1 2
#5;
clk = 1;
#5;
clk = 0;
l = 16'h9B82; // LW R3 R4 2
#5;
clk = 1;
#5;
clk = 0;
l = 16'hDB81; // SW R3 R4 1
#5;
clk = 1;
#5;
clk = 0;
l = 16'h9B21; // LW R3 R1 1
#5;
clk = 1;
#5;
clk = 0;
l = 16'h2CFA; // BNEZ R4 FA
#5;
clk = 1;
#5;
clk = 0;
l = 16'h4D01;
#5;
clk = 1;
#5;
clk = 0;
l = 16'h4D01; // ADDIU R5 1
#5;
clk = 1;
#5;
clk = 0;
l = 16'h2DF7; // BNEZ R5 F7
#5;
clk = 1;
#5;
clk = 0;
l = 16'h0800; // NOP
#5;
clk = 1;
#5;
clk = 0;
#5;
clk = 1;
#5;
clk = 0;
#5;
clk = 1;
#5;
clk = 0;
#5;
clk = 1;
#5;
clk = 0;
#5;
clk = 1;
#5;
clk = 0;
end
endmodule