Fix $fscanf of decimals overflowing variables (#4174).
This commit is contained in:
parent
0606a29f13
commit
e6f5a0495f
1
Changes
1
Changes
|
|
@ -28,6 +28,7 @@ Verilator 5.011 devel
|
||||||
* Fix linking AstRefDType if it has parameterized class ref (#4164) (#4170). [Ryszard Rozak, Antmicro Ltd]
|
* Fix linking AstRefDType if it has parameterized class ref (#4164) (#4170). [Ryszard Rozak, Antmicro Ltd]
|
||||||
* Fix crash caused by $display() optimization (#4165) (#4166). [Tudor Timi]
|
* Fix crash caused by $display() optimization (#4165) (#4166). [Tudor Timi]
|
||||||
* Fix arrays of unpacked structs (#4173). [Risto Pejašinović]
|
* Fix arrays of unpacked structs (#4173). [Risto Pejašinović]
|
||||||
|
* Fix $fscanf of decimals overflowing variables (#4174). [Ahmed El-Mahmoudy]
|
||||||
* Fix detection of wire/reg duplicates.
|
* Fix detection of wire/reg duplicates.
|
||||||
* Fix false IMPLICITSTATIC on package functions.
|
* Fix false IMPLICITSTATIC on package functions.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1373,16 +1373,18 @@ IData _vl_vsscanf(FILE* fp, // If a fscanf
|
||||||
*p = t_tmp;
|
*p = t_tmp;
|
||||||
} else if (obits <= VL_BYTESIZE) {
|
} else if (obits <= VL_BYTESIZE) {
|
||||||
CData* const p = va_arg(ap, CData*);
|
CData* const p = va_arg(ap, CData*);
|
||||||
*p = owp[0];
|
*p = VL_CLEAN_II(obits, obits, owp[0]);
|
||||||
} else if (obits <= VL_SHORTSIZE) {
|
} else if (obits <= VL_SHORTSIZE) {
|
||||||
SData* const p = va_arg(ap, SData*);
|
SData* const p = va_arg(ap, SData*);
|
||||||
*p = owp[0];
|
*p = VL_CLEAN_II(obits, obits, owp[0]);
|
||||||
} else if (obits <= VL_IDATASIZE) {
|
} else if (obits <= VL_IDATASIZE) {
|
||||||
IData* const p = va_arg(ap, IData*);
|
IData* const p = va_arg(ap, IData*);
|
||||||
*p = owp[0];
|
*p = VL_CLEAN_II(obits, obits, owp[0]);
|
||||||
} else if (obits <= VL_QUADSIZE) {
|
} else if (obits <= VL_QUADSIZE) {
|
||||||
QData* const p = va_arg(ap, QData*);
|
QData* const p = va_arg(ap, QData*);
|
||||||
*p = VL_SET_QW(owp);
|
*p = VL_CLEAN_QQ(obits, obits, VL_SET_QW(owp));
|
||||||
|
} else {
|
||||||
|
_vl_clean_inplace_w(obits, owp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // switch
|
} // switch
|
||||||
|
|
|
||||||
|
|
@ -792,7 +792,7 @@ public:
|
||||||
void visit(AstSysFuncAsTask* nodep) override {
|
void visit(AstSysFuncAsTask* nodep) override {
|
||||||
if (!nodep->lhsp()->isWide()) puts("(void)");
|
if (!nodep->lhsp()->isWide()) puts("(void)");
|
||||||
iterateAndNextConstNull(nodep->lhsp());
|
iterateAndNextConstNull(nodep->lhsp());
|
||||||
if (!nodep->lhsp()->isWide()) puts(";");
|
if (!nodep->lhsp()->isWide()) puts(";\n");
|
||||||
}
|
}
|
||||||
void visit(AstStackTraceF* nodep) override { puts("VL_STACKTRACE_N()"); }
|
void visit(AstStackTraceF* nodep) override { puts("VL_STACKTRACE_N()"); }
|
||||||
void visit(AstStackTraceT* nodep) override { puts("VL_STACKTRACE();\n"); }
|
void visit(AstStackTraceT* nodep) override { puts("VL_STACKTRACE();\n"); }
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,9 @@ module t;
|
||||||
|
|
||||||
integer v_length, v_off;
|
integer v_length, v_off;
|
||||||
|
|
||||||
|
wire signed [16:0] wire17 = 17'h1ffff;
|
||||||
|
logic signed [16:0] scan17;
|
||||||
|
|
||||||
`ifdef TEST_VERBOSE
|
`ifdef TEST_VERBOSE
|
||||||
`define verbose 1'b1
|
`define verbose 1'b1
|
||||||
`else
|
`else
|
||||||
|
|
@ -309,6 +312,11 @@ module t;
|
||||||
$fclose(file);
|
$fclose(file);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
begin
|
||||||
|
$sscanf("-1", "%d", scan17);
|
||||||
|
if (scan17 !== wire17) $stop;
|
||||||
|
end
|
||||||
|
|
||||||
$write("*-* All Finished *-*\n");
|
$write("*-* All Finished *-*\n");
|
||||||
$finish(0); // Test arguments to finish
|
$finish(0); // Test arguments to finish
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue