mirror of
https://github.com/steveicarus/iverilog.git
synced 2026-08-29 01:03:29 +02:00
Check that scalar typed parameters are handled correctly. Make sure the width of the parameter only depends on the type and not on the value assigned to the parameter. Same for parameters with a 1-bit range specification. Signed-off-by: Lars-Peter Clausen <[email protected]>
27 lines
507 B
Verilog
27 lines
507 B
Verilog
// Check that parameters with a scalar type are handled correctly
|
|
|
|
module test #(
|
|
// This should get truncated to 1'b1
|
|
parameter bit P = 2'b11
|
|
);
|
|
|
|
bit failed = 1'b0;
|
|
|
|
`define check(expr, val) \
|
|
if (expr !== val) begin \
|
|
$display("FAILED: `%s`, expected %0d, got %0d", `"expr`", val, expr); \
|
|
failed = 1'b1; \
|
|
end
|
|
|
|
initial begin
|
|
`check($bits(P), 1);
|
|
`check(P + 1'b1, 1'b0);
|
|
`check(P, 1'b1);
|
|
|
|
if (!failed) begin
|
|
$display("PASSED");
|
|
end
|
|
end
|
|
|
|
endmodule
|