Fix CVTREAL not being able to be disabled in e.g. primitive terminals.

This commit is contained in:
Wilson Snyder 2025-07-14 20:08:44 -04:00
parent caf3522364
commit 371ac07c6f
2 changed files with 9 additions and 15 deletions

View File

@ -7675,11 +7675,11 @@ class WidthVisitor final : public VNVisitor {
// SIGNED/DOUBLE METHODS
AstNodeExpr* checkCvtUS(AstNodeExpr* nodep) {
if (nodep && nodep->isDouble()) {
nodep->v3error("Expected integral (non-" << nodep->dtypep()->prettyDTypeNameQ()
<< ") input to "
<< nodep->backp()->prettyTypeName());
nodep = spliceCvtS(nodep, true, 32);
if (nodep && nodep->dtypep()->skipRefp()->isDouble()) {
nodep->v3warn(REALCVT,
"Implicit conversion of real to integer; expected integral input to "
<< nodep->backp()->prettyTypeName());
nodep = spliceCvtS(nodep, false, 32);
}
return nodep;
}

View File

@ -15,11 +15,8 @@
: ... note: In instance 't'
46 | d_real[0] = 1'b1;
| ^
%Error: t/t_var_types_bad.v:46:7: Expected integral (non-'real') input to SEL
: ... note: In instance 't'
46 | d_real[0] = 1'b1;
| ^~~~~~
%Warning-REALCVT: t/t_var_types_bad.v:46:7: Implicit conversion of real to integer
%Warning-REALCVT: t/t_var_types_bad.v:46:7: Implicit conversion of real to integer; expected integral input to SEL
: ... note: In instance 't'
46 | d_real[0] = 1'b1;
| ^~~~~~
... For warning description see https://verilator.org/warn/REALCVT?v=latest
@ -28,11 +25,8 @@
: ... note: In instance 't'
47 | d_realtime[0] = 1'b1;
| ^
%Error: t/t_var_types_bad.v:47:7: Expected integral (non-'real') input to SEL
: ... note: In instance 't'
47 | d_realtime[0] = 1'b1;
| ^~~~~~~~~~
%Warning-REALCVT: t/t_var_types_bad.v:47:7: Implicit conversion of real to integer
%Warning-REALCVT: t/t_var_types_bad.v:47:7: Implicit conversion of real to integer; expected integral input to SEL
: ... note: In instance 't'
47 | d_realtime[0] = 1'b1;
| ^~~~~~~~~~
%Error: Exiting due to