This commit is contained in:
Wang Xuejin
2025-09-22 15:30:52 +08:00
parent baeb32304e
commit f5bf2e30fc
17 changed files with 8688 additions and 1 deletions
+47
View File
@@ -0,0 +1,47 @@
`timescale 1ns/1ps
module testbench;
// 1. 128 16
reg clk;
reg reset_n;
wire [31:0] pc_out;
integer fd;
reg [8*16:1] dump_path; // 16
//
top uut (
.clk(clk),
.reset_n(reset_n),
.pc_out(pc_out)
);
// 2.
initial begin
clk = 0;
forever #5 clk = ~clk;
end
// 3.
initial begin
//
dump_path = "./wave.vcd"; //
//
fd = $fopen(dump_path, "w");
if (fd == 0) begin
$display("ERROR: Cannot open %s for writing!", dump_path);
$finish;
end
$fclose(fd);
// +access+r
$dumpfile(dump_path);
$dumpvars(0, testbench); //
$display("Waveform will be saved to %s", dump_path);
// 仿
reset_n = 0;
#100 reset_n = 1;
#10000 $finish;
end
endmodule