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

40 lines
676 B
Verilog

`timescale 1ns / 100ps
module main;
real x;
integer rc;
time x_int;
initial begin
rc = $sscanf("8.125", "%f", x);
if (x != 8.125) begin
$display("FAILED -- x=%f", x);
$finish;
end
if (rc !== 1) begin
$display("FAILED -- rc = %d", rc);
$finish;
end
$timeformat(-3,2,"ms",10);
rc = $sscanf("8.125", "%t", x);
x_int = x;
if (x_int != 8130000) begin
$display("FAILED -- t=%f (%h)!=(%h)", x,
$realtobits(x), $realtobits(8130000.0));
$finish;
end
if (rc !== 1) begin
$display("FAILED -- rc = %d", rc);
$finish;
end
$display("PASSED");
end
endmodule // main