diff --git a/src/V3Const.cpp b/src/V3Const.cpp index 08cbe161b..a0b7484ab 100644 --- a/src/V3Const.cpp +++ b/src/V3Const.cpp @@ -2219,6 +2219,7 @@ private: TREEOPV("AstExtend {$lhsp.castExtend}", "replaceExtend(nodep, nodep->lhsp()->castExtend()->lhsp())"); TREEOPV("AstExtendS{$lhsp.castExtendS}", "replaceExtend(nodep, nodep->lhsp()->castExtendS()->lhsp())"); TREEOPV("AstReplicate{$lhsp, $rhsp.isOne, $lhsp->width()==nodep->width()}", "replaceWLhs(nodep)"); // {1{lhs}}->lhs + TREEOPV("AstReplicateN{$lhsp, $rhsp.isOne, $lhsp->width()==nodep->width()}", "replaceWLhs(nodep)"); // {1{lhs}}->lhs // Next rule because AUTOINST puts the width of bits in // to pins, even when the widths are exactly the same across the hierarchy. TREEOPV("AstSel{operandSelExtend(nodep)}", "DONE"); diff --git a/src/V3EmitC.cpp b/src/V3EmitC.cpp index eb1072fca..a26f9c6d6 100644 --- a/src/V3EmitC.cpp +++ b/src/V3EmitC.cpp @@ -1392,9 +1392,6 @@ void EmitCImp::emitVarResets(AstNodeModule* modp) { if (varp->isIO() && modp->isTop() && optSystemC()) { // System C top I/O doesn't need loading, as the lower level subinst code does it. } - else if (varp->basicp() && varp->basicp()->keyword() == AstBasicDTypeKwd::STRING) { - // Constructor deals with it - } else if (varp->isParam()) { if (!varp->valuep()) nodep->v3fatalSrc("No init for a param?"); // If a simple CONST value we initialize it using an enum @@ -1413,6 +1410,9 @@ void EmitCImp::emitVarResets(AstNodeModule* modp) { varp->v3fatalSrc("InitArray under non-arrayed var"); } } + else if (varp->basicp() && varp->basicp()->keyword() == AstBasicDTypeKwd::STRING) { + // Constructor deals with it + } else { int vects = 0; // This isn't very robust and may need cleanup for other data types diff --git a/src/V3Width.cpp b/src/V3Width.cpp index 435511d5a..6361e1d7b 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -708,7 +708,9 @@ private: // However a later operation may have changed the node->signed w/o changing // the number's sign. So we don't: nodep->dtypeChgSigned(nodep->num().isSigned()); if (vup && vup->c()->prelim()) { - if (nodep->num().sized()) { + if (nodep->num().isString()) { + nodep->dtypeSetString(); + } else if (nodep->num().sized()) { nodep->dtypeChgWidth(nodep->num().width(), nodep->num().width()); } else { nodep->dtypeChgWidth(nodep->num().width(), nodep->num().widthMin()); diff --git a/src/V3WidthCommit.h b/src/V3WidthCommit.h index ba2a8d1af..e2deb28fe 100644 --- a/src/V3WidthCommit.h +++ b/src/V3WidthCommit.h @@ -72,8 +72,9 @@ class WidthCommitVisitor : public AstNVisitor { public: // METHODS static AstConst* newIfConstCommitSize (AstConst* nodep) { - if ((nodep->dtypep()->width() != nodep->num().width()) - || !nodep->num().sized()) { // Need to force the number rrom unsized to sized + if (((nodep->dtypep()->width() != nodep->num().width()) + || !nodep->num().sized()) + && !nodep->num().isString()) { // Need to force the number rrom unsized to sized V3Number num (nodep->fileline(), nodep->dtypep()->width()); num.opAssign(nodep->num()); num.isSigned(nodep->isSigned());