forked from antmicro/f4pga-arch-defs
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ql: pp3: installed tests: counter_gclk: enable simulation
Signed-off-by: Paweł Czarnecki <[email protected]>
- Loading branch information
Showing
2 changed files
with
67 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
quicklogic/pp3/tests/features/install_test/counter_gclk/counter_gclk_tb.v
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
`timescale 1 ps / 1 ps | ||
|
||
`default_nettype none | ||
|
||
`define STRINGIFY(x) `"x`" | ||
|
||
|
||
module tb; | ||
|
||
task assert(input a); | ||
begin | ||
if (a==0) begin | ||
$display("******************"); | ||
$display("* ASSERT FAILURE *"); | ||
$display("******************"); | ||
$dumpflush; | ||
$finish_and_return(-1); | ||
end | ||
end | ||
endtask | ||
|
||
reg clk; | ||
wire [3:0] out; | ||
integer i; | ||
|
||
|
||
`ifdef NO_SPLIT | ||
top dut ( | ||
.clk (clk), | ||
.led (out) | ||
); | ||
`else | ||
top dut ( | ||
.\clk (clk), | ||
.\led[0] (out[0]), | ||
.\led[1] (out[1]), | ||
.\led[2] (out[2]), | ||
.\led[3] (out[3]) | ||
); | ||
`endif | ||
|
||
initial begin | ||
clk = 1'b0; | ||
`ifndef F2B | ||
$sdf_annotate(`STRINGIFY(`SDF), dut); | ||
`endif | ||
$dumpfile(`STRINGIFY(`VCD)); | ||
$dumpvars; | ||
for (i=1; i<64; i=i+1) begin | ||
#1000000 clk = 1; | ||
#500000 assert(out === (i % 16)); | ||
#500000 clk = 0; | ||
end | ||
#25 $finish(); | ||
end | ||
endmodule |