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

30 lines
437 B
Verilog

// Test disable statements inside a constant function
module constfunc10();
function [31:0] pow2(input [5:0] x);
begin:body
pow2 = 1;
while (1) begin:loop
if (x == 0) disable body;
pow2 = 2 * pow2;
x = x - 1;
disable loop;
pow2 = 0;
end
end
endfunction
localparam val = pow2(8);
initial begin
$display("%0d", val);
if (val === 256)
$display("PASSED");
else
$display("FAILED");
end
endmodule