Files
iverilog/ivtest/ivltests/enum_values.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

42 lines
785 B
Verilog

/*
* This program tests that enumeration values work and are
* implicitly translated to integer values.
*/
module main;
enum { RED, ORANGE, YELLOW, GREEN, BLUE, VIOLET,
BLACK = 10, WHITE = 'd11
} color1;
int var1;
initial begin
color1 = RED;
var1 = RED;
$display("color1 = %0d, var1 = %0d", color1, var1);
if (color1 !== 0) begin
$display("FAILED");
$finish;
end
if (var1 !== 0) begin
$display("FAILED");
$finish;
end
color1 = GREEN;
var1 = GREEN;
$display("color1 = %0d, var1 = %0d", color1, var1);
if (color1 !== 3) begin
$display("FAILED");
$finish;
end
if (var1 !== 3) begin
$display("FAILED");
$finish;
end
$display("PASSED");
end
endmodule // main