yosys/tests/asicworld/code_hdl_models_arbiter_tb.v

61 lines
1.0 KiB
Coq
Raw Normal View History

2013-01-05 04:13:26 -06:00
module testbench ();
2016-05-20 10:13:11 -05:00
reg clk = 0;
reg rst = 1;
reg req3 = 0;
reg req2 = 0;
reg req1 = 0;
reg req0 = 0;
2013-01-05 04:13:26 -06:00
wire gnt3;
wire gnt2;
wire gnt1;
wire gnt0;
// Clock generator
always #1 clk = ~clk;
2016-05-20 10:13:11 -05:00
integer file;
always @(posedge clk)
$fdisplay(file, "%b", {gnt3, gnt2, gnt1, gnt0});
2013-01-05 04:13:26 -06:00
initial begin
2016-05-20 10:13:11 -05:00
file = $fopen(`outfile);
repeat (5) @ (posedge clk);
rst <= 0;
2013-01-05 04:13:26 -06:00
repeat (1) @ (posedge clk);
req0 <= 1;
repeat (1) @ (posedge clk);
req0 <= 0;
repeat (1) @ (posedge clk);
req0 <= 1;
req1 <= 1;
repeat (1) @ (posedge clk);
req2 <= 1;
req1 <= 0;
repeat (1) @ (posedge clk);
req3 <= 1;
req2 <= 0;
repeat (1) @ (posedge clk);
req3 <= 0;
repeat (1) @ (posedge clk);
req0 <= 0;
repeat (1) @ (posedge clk);
#10 $finish;
end
// Connect the DUT
arbiter U (
clk,
rst,
req3,
req2,
req1,
req0,
gnt3,
gnt2,
gnt1,
gnt0
);
endmodule