Files
iverilog/ivtest/ivltests/case_wo_default.v
T
Stephen Williams cea237b407 Add ivtest to the iverilog source tree
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.
2022-01-15 10:18:50 -08:00

53 lines
813 B
Verilog

module test
(output reg [1:0] foo,
input wire foo_en1, foo_en2
/* */);
always @* begin
foo = 0;
case (1'b1)
foo_en1 : foo = 1;
foo_en2 : foo = 2;
endcase
end
endmodule // test
module main;
wire [1:0] foo;
reg foo_en1, foo_en2;
test dut (.foo(foo), .foo_en1(foo_en1), .foo_en2(foo_en2));
task fail;
begin
$display("FAILED -- foo=%b, foo_en1=%b, foo_en2=%b",
foo, foo_en1, foo_en2);
$finish;
end
endtask // fail
initial begin
foo_en1 = 0;
foo_en2 = 0;
#1 if (foo !== 2'd0)
fail;
foo_en2 = 1;
#1 if (foo !== 2'd2)
fail;
foo_en1 = 1;
#1 if (foo !== 2'd1)
fail;
foo_en2 = 0;
#1 if (foo !== 2'd1)
fail;
$display("PASSED");
end // initial begin
endmodule // main