mirror of
https://github.com/steveicarus/iverilog.git
synced 2026-09-03 06:53:48 +02:00
By adding ivtest to the iverilog source tree, it is easier to keep the regression test synchronized with the source that is being tested. This should be especially helpful for PRs that add a new feature, and have a matching ivtest PR with the regression test for that feature.
45 lines
791 B
Verilog
45 lines
791 B
Verilog
/*
|
|
* This program tests the synthesis of small memories, including
|
|
* aysnchronous read w/ synchronous write.
|
|
*/
|
|
module main;
|
|
|
|
reg clk;
|
|
|
|
reg Q, D;
|
|
(* ivl_synthesys_on *)
|
|
always @(negedge clk)
|
|
Q <= D;
|
|
|
|
(* ivl_synthesys_off *)
|
|
initial begin
|
|
clk = 1;
|
|
D = 0;
|
|
#2 clk = 0;
|
|
#2 clk = 1;
|
|
#2 if (Q !== 0) begin
|
|
$display("FAILED -- initial setup D=%b, Q=%b", D, Q);
|
|
$finish;
|
|
end
|
|
|
|
D = 1;
|
|
#2 clk = 0;
|
|
|
|
#2 if (Q !== 1) begin
|
|
$display("FAILED -- negedge clk failed D=%b, Q=%b", D, Q);
|
|
$finish;
|
|
end
|
|
|
|
D = 0;
|
|
#2 clk = 1;
|
|
#2 if (Q !== 1) begin
|
|
$display("FAILED -- posedge clk tripped FF. D=%b, Q=%b", D, Q);
|
|
$finish;
|
|
end
|
|
|
|
$display("PASSED");
|
|
$finish;
|
|
end
|
|
|
|
endmodule // main
|