Files
iverilog/ivtest/ivltests/pr3077640.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
659 B
Verilog

module top;
reg pass;
reg [7:0] val;
reg signed [7:0] sval;
initial begin
pass = 1'b1;
// An unsized number has an implicit width of integer width.
val = $unsigned(-4);
if (val !== 8'hfc) begin
$display("Failed unsigned, expected 8'hfc, got %h", val);
pass = 1'b0;
end
val = $unsigned(-4'sd4);
if (val !== 8'h0c) begin
$display("Failed sized unsigned, expected 8'h0c, got %h", val);
pass = 1'b0;
end
sval = $signed(4'hc);
if (sval !== -4) begin
$display("Failed signed, expected -4, got %d", sval);
pass = 1'b0;
end
if (pass) $display("PASSED");
end
endmodule