-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpicoMIPS_testbench.sv
62 lines (54 loc) · 1.09 KB
/
picoMIPS_testbench.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
61
62
module picoMIPS_tb;
// Parameters
localparam n = 8;
//Ports
reg clk;
reg reset;
reg sw8;
reg [n-1:0] sws;
wire [n-1:0] display;
wire [ 6:0] digits;
wire [ 6:0] ten_digits;
wire [ 6:0] hun_digits;
wire [ 6:0] sign;
picoMIPS #(
.n(n)
) picoMIPS_inst (
.clk (clk),
.reset (reset),
.sw8 (sw8),
.sws (sws),
.display (display),
.digits (digits),
.ten_digits(ten_digits),
.hun_digits(hun_digits),
.sign (sign)
);
// 设置时钟
initial begin
clk = 0;
forever #5ns clk = ~clk;
end
initial begin
reset = 1; // 重置复位
#10ns reset = 0; // 下拉
end
initial begin
sw8 = 1'b0;
// 第一次输入
#10ns sw8 = 1'b1;
#20ns sw8 = 1'b0;
// 第二次输入
#10ns sw8 = 1'b1;
#20ns sw8 = 1'b0;
// 220ns再拉高
#220ns sw8 = 1'b1;
end
initial begin
// 这里是sw组的输入
sws = {n{1'b0}};
// 输入第一个
#10ns sws = 8'b00001000;
#40ns sws = 8'b00001000;
end
endmodule