mirror of
https://github.com/steveicarus/iverilog.git
synced 2026-08-28 16:53:45 +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.
55 lines
827 B
Verilog
55 lines
827 B
Verilog
module top();
|
|
|
|
reg CLK;
|
|
reg [3:0] D;
|
|
reg EN1;
|
|
reg EN2;
|
|
reg EN3;
|
|
reg [3:0] Q;
|
|
|
|
always @(posedge CLK) begin
|
|
if (EN1) Q[1] <= D[1];
|
|
if (EN2) Q[2] <= D[2];
|
|
if (EN3) Q[3] <= D[3];
|
|
end
|
|
|
|
reg failed;
|
|
|
|
(* ivl_synthesis_off *)
|
|
initial begin
|
|
failed = 0;
|
|
$monitor("%b %b %b %b %b %b", CLK, EN1, EN2, EN3, D, Q);
|
|
CLK = 0;
|
|
EN1 = 0;
|
|
EN2 = 0;
|
|
EN3 = 0;
|
|
D = 4'b0000;
|
|
#1 CLK = 1;
|
|
#1 CLK = 0;
|
|
if (Q !== 4'bxxxx) failed = 1;
|
|
EN1 = 1;
|
|
D = 4'b0000;
|
|
#1 CLK = 1;
|
|
#1 CLK = 0;
|
|
if (Q !== 4'bxx0x) failed = 1;
|
|
EN1 = 0;
|
|
EN2 = 1;
|
|
D = 4'b1111;
|
|
#1 CLK = 1;
|
|
#1 CLK = 0;
|
|
if (Q !== 4'bx10x) failed = 1;
|
|
EN2 = 0;
|
|
EN3 = 1;
|
|
D = 4'b0000;
|
|
#1 CLK = 1;
|
|
#1 CLK = 0;
|
|
if (Q !== 4'b010x) failed = 1;
|
|
#1;
|
|
if (failed)
|
|
$display("FAILED");
|
|
else
|
|
$display("PASSED");
|
|
end
|
|
|
|
endmodule
|