9086/cpu/testbench.v

32 lines
490 B
Coq
Raw Normal View History

2023-02-08 09:18:00 +00:00
module tb;
2023-02-08 12:07:42 +00:00
wire clock;
reg reset;
reg clk_enable;
wire [19:0]address_bus;
wire [15:0]data_bus;
wire rd,wr,romcs,HALT;
2023-02-08 09:18:00 +00:00
processor p(clock,reset,address_bus,data_bus,rd,wr,HALT);
2023-02-08 12:07:42 +00:00
rom bootrom(address_bus,data_bus,rd,romcs);
2023-02-08 09:18:00 +00:00
`define CPU_SPEED 1000
2023-02-08 12:07:42 +00:00
clock_gen #(.FREQ(1000)) u1(clk_enable, clock);
2023-02-08 12:07:42 +00:00
assign romcs=0;
2023-02-08 09:18:00 +00:00
2023-02-08 12:07:42 +00:00
initial begin
$dumpfile("test.lx2");
$dumpvars(0,p);
clk_enable <= 1;
2023-02-08 09:18:00 +00:00
2023-02-08 12:07:42 +00:00
#($random%500)
reset = 0;
#(`CPU_SPEED)
2023-02-08 12:07:42 +00:00
reset = 1;
#(`CPU_SPEED*30)
2023-02-08 12:07:42 +00:00
#50 $finish;
end
2023-02-08 09:18:00 +00:00
endmodule