mirror of
https://github.com/steveicarus/iverilog.git
synced 2026-09-03 16:29:25 +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.
53 lines
840 B
Verilog
53 lines
840 B
Verilog
module main;
|
|
|
|
reg clk;
|
|
reg Q, D, ce;
|
|
|
|
(* ivl_synthesis_on *)
|
|
always @(posedge clk)
|
|
if (ce)
|
|
begin
|
|
end
|
|
else
|
|
Q <= D;
|
|
|
|
(* ivl_synthesis_off *)
|
|
initial begin
|
|
clk = 0;
|
|
ce = 0;
|
|
D = 0;
|
|
#1 clk = 1;
|
|
#1 clk = 0;
|
|
|
|
if (Q !== 1'b0) begin
|
|
$display("FAILED --- initial setup failed: Q=%b, D=%b, ce=%b",
|
|
Q, D, ce);
|
|
$finish;
|
|
end
|
|
|
|
ce = 1;
|
|
D = 1;
|
|
#1 clk = 1;
|
|
#1 clk = 0;
|
|
|
|
if (Q !== 1'b0) begin
|
|
$display("FAILED --- disable didnot work: Q=%b, D=%b, ce=%b",
|
|
Q, D, ce);
|
|
$finish;
|
|
end
|
|
|
|
ce = 0;
|
|
#1 clk = 1;
|
|
#1 clk = 0;
|
|
|
|
if (Q !== 1'b1) begin
|
|
$display("FAILED --- disabled disable not OK: Q=%b, D=%b, ce=%b",
|
|
Q, D, ce);
|
|
$finish;
|
|
end
|
|
|
|
$display("PASSED");
|
|
end
|
|
|
|
endmodule // main
|