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

31 lines
730 B
Verilog

module test;
reg pass;
reg [8*40:1] str;
reg [15:0] v;
initial begin
pass = 1'b1;
v = 2;
$sformat(str, "%0d", (v + 2 - 1) * 1);
if (str[8*1:1] !== "3" || str[8*40:8*1+1] !== 0) begin
$display("FAILED 1st test, expected \"3\", got %s", str);
pass = 1'b0;
end
$sformat(str, "%0d", 'd1 - 'd2 + v);
if (str[8*1:1] !== "1" || str[8*40:8*1+1] !== 0) begin
$display("FAILED 2nd test, expected \"1\", got %s", str);
pass = 1'b0;
end
$sformat(str, "%0d", v + (-1));
if (str[8*1:1] !== "1" || str[8*40:8*1+1] !== 0) begin
$display("FAILED 3rd test, expected \"1\", got %s", str);
pass = 1'b0;
end
if (pass) $display("PASSED");
end
endmodule