-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestbench.sv
58 lines (47 loc) · 1.12 KB
/
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
`timescale 1ps/1ps
module testbench();
logic clk;
logic reset;
logic [31:0] WriteData, DataAdr;
logic MemWrite;
logic [7:0] led;
// instantiate device to be tested
top dut(clk, reset, led);
// initialize test
initial
begin
reset <= 1; # 22; reset <= 0;
// #1000 $finish;
end
// generate clock to sequence tests
always
begin
clk <= 1; # 5; clk <= 0; # 5;
end
//dump fsdb
// initial begin
// $fsdbDumpfile("riscvpipe.fsdb");
// $fsdbDumpvars(0);
// end
// check results
//always @(negedge clk)
// begin
// if(MemWrite) begin
// if(DataAdr === 100 & WriteData === 25) begin
// $display("Simulation succeeded");
// $finish();//$stop;
// end else if (DataAdr !== 96) begin
// $display("Simulation failed");
// $finish(); //$stop;
// end
// end
// end
initial begin
#10800;
$finish;//主动的结束仿真
end
initial begin
$dumpfile("testbench.vcd");
$dumpvars(0, testbench); //tb模块名称
end
endmodule