diff --git a/src/V3Simulate.h b/src/V3Simulate.h index d5a7453ac..28691d478 100644 --- a/src/V3Simulate.h +++ b/src/V3Simulate.h @@ -15,7 +15,7 @@ //************************************************************************* // // void example_usage() { -// SimulateVisitor simvis (false, false); +// SimulateVisitor simvis{false, false}; // simvis.clear(); // // Set all inputs to the constant // for (deque::iterator it = m_inVarps.begin(); it!=m_inVarps.end(); ++it) { @@ -130,7 +130,7 @@ private: const int width = itemp->width(); const int lsb = itemp->lsb(); const int msb = lsb + width - 1; - V3Number fieldNum(nump, width); + V3Number fieldNum{nump, width}; fieldNum.opSel(*nump, msb, lsb); out << itemp->name() << ": "; if (AstNodeDType* const childTypep = itemp->subDTypep()) { @@ -152,7 +152,7 @@ private: const int width = childTypep->width(); const int lsb = width * element; const int msb = lsb + width - 1; - V3Number fieldNum(nump, width); + V3Number fieldNum{nump, width}; fieldNum.opSel(*nump, msb, lsb); const int arrayElem = arrayp->lo() + element; out << arrayElem << " = " << prettyNumber(&fieldNum, childTypep); @@ -236,7 +236,7 @@ private: } if (allocNewConst) { // Need to allocate new constant - constp = new AstConst(nodep->fileline(), AstConst::DtypedValue(), nodep->dtypep(), 0); + constp = new AstConst{nodep->fileline(), AstConst::DtypedValue{}, nodep->dtypep(), 0}; // Mark as in use, add to free list for later reuse constp->user2(1); freeList.push_back(constp); @@ -683,15 +683,15 @@ private: initp = vscpnump; } else { // Assignment to unassigned variable, all bits are X // TODO generic initialization which builds X/arrays by recursion - AstConst* const outconstp = new AstConst( - nodep->fileline(), AstConst::WidthedValue(), basicp->widthMin(), 0); + AstConst* const outconstp = new AstConst{ + nodep->fileline(), AstConst::WidthedValue{}, basicp->widthMin(), 0}; if (basicp->isZeroInit()) { outconstp->num().setAllBits0(); } else { outconstp->num().setAllBitsX(); } - initp = new AstInitArray(nodep->fileline(), arrayp, outconstp); + initp = new AstInitArray{nodep->fileline(), arrayp, outconstp}; m_reclaimValuesp.push_back(initp); } const uint32_t index = fetchConst(selp->bitp())->toUInt(); @@ -706,7 +706,7 @@ private: } void handleAssignSel(AstNodeAssign* nodep, AstSel* selp) { AstVarRef* varrefp = nullptr; - V3Number lsb(nodep); + V3Number lsb{nodep}; iterateAndNextNull(nodep->rhsp()); // Value to assign handleAssignSelRecurse(nodep, selp, varrefp /*ref*/, lsb /*ref*/, 0); if (!m_checkOnly && optimizable()) { @@ -719,8 +719,8 @@ private: } else if (AstConst* const vscpnump = fetchConstNull(vscp)) { outconstp = vscpnump; } else { // Assignment to unassigned variable, all bits are X or 0 - outconstp = new AstConst(nodep->fileline(), AstConst::WidthedValue(), - varrefp->varp()->widthMin(), 0); + outconstp = new AstConst{nodep->fileline(), AstConst::WidthedValue{}, + varrefp->varp()->widthMin(), 0}; if (varrefp->varp()->basicp() && varrefp->varp()->basicp()->isZeroInit()) { outconstp->num().setAllBits0(); } else { @@ -742,7 +742,7 @@ private: lsbRef = fetchConst(selp->lsbp())->num(); return; // And presumably still optimizable() } else if (AstSel* const subselp = VN_CAST(selp->lhsp(), Sel)) { - V3Number sublsb(nodep); + V3Number sublsb{nodep}; handleAssignSelRecurse(nodep, subselp, outVarrefpRef, sublsb /*ref*/, depth + 1); if (optimizable()) { lsbRef = sublsb; @@ -829,7 +829,7 @@ private: if (hit) break; iterateAndNextNull(ep); if (optimizable()) { - V3Number match(nodep, 1); + V3Number match{nodep, 1}; match.opEq(fetchConst(nodep->exprp())->num(), fetchConst(ep)->num()); if (match.isNeqZero()) { iterateAndNextNull(itemp->bodysp()); @@ -1097,7 +1097,7 @@ private: } AstConst* const resultConstp - = new AstConst(nodep->fileline(), AstConst::String(), result); + = new AstConst{nodep->fileline(), AstConst::String{}, result}; setValue(nodep, resultConstp); m_reclaimValuesp.push_back(resultConstp); } diff --git a/src/V3Table.cpp b/src/V3Table.cpp index 822407b4c..0944bb589 100644 --- a/src/V3Table.cpp +++ b/src/V3Table.cpp @@ -92,8 +92,8 @@ public: = elemDType->isString() ? elemDType : v3Global.rootp()->findBitDType(width, width, VSigning::UNSIGNED); - AstUnpackArrayDType* const tableDTypep - = new AstUnpackArrayDType(m_fl, subDTypep, new AstRange(m_fl, size, 0)); + AstUnpackArrayDType* const tableDTypep = new AstUnpackArrayDType{ + m_fl, subDTypep, new AstRange{m_fl, static_cast(size), 0}}; v3Global.rootp()->typeTablep()->addTypesp(tableDTypep); // Create table initializer (with default value 0) AstConst* const defaultp = elemDType->isString() @@ -106,7 +106,7 @@ public: UASSERT_OBJ(!m_varScopep, m_fl, "Table variable already created"); // Default value is zero/empty string so don't add it if (value.isString() ? value.toString().empty() : value.isEqZero()) return; - m_initp->addIndexValuep(index, new AstConst(m_fl, value)); + m_initp->addIndexValuep(index, new AstConst{m_fl, value}); } AstVarScope* varScopep() { @@ -247,14 +247,14 @@ private: // We will need a table index variable, create it here. AstVar* const indexVarp - = new AstVar(fl, VVarType::BLOCKTEMP, "__Vtableidx" + cvtToStr(m_modTables), - VFlagBitPacked(), m_inWidthBits); + = new AstVar{fl, VVarType::BLOCKTEMP, "__Vtableidx" + cvtToStr(m_modTables), + VFlagBitPacked{}, static_cast(m_inWidthBits)}; m_modp->addStmtp(indexVarp); - AstVarScope* const indexVscp = new AstVarScope(indexVarp->fileline(), m_scopep, indexVarp); + AstVarScope* const indexVscp = new AstVarScope{indexVarp->fileline(), m_scopep, indexVarp}; m_scopep->addVarp(indexVscp); // The 'output assigned' table builder - TableBuilder outputAssignedTableBuilder(fl); + TableBuilder outputAssignedTableBuilder{fl}; outputAssignedTableBuilder.setTableSize( nodep->findBitDType(m_outVarps.size(), m_outVarps.size(), VSigning::UNSIGNED), VL_MASK_I(m_inWidthBits)); @@ -311,7 +311,7 @@ private: << simvis.whyNotMessage()); // Build output value tables and the assigned flags table - V3Number outputAssignedMask(nodep, m_outVarps.size(), 0); + V3Number outputAssignedMask{nodep, static_cast(m_outVarps.size()), 0}; for (TableOutputVar& tov : m_outVarps) { if (V3Number* const outnump = simvis.fetchOutNumberNull(tov.varScopep())) { UINFO(8, " Output " << tov.name() << " = " << *outnump << endl); @@ -333,21 +333,21 @@ private: // First var in inVars becomes the LSB of the concat AstNode* concatp = nullptr; for (AstVarScope* invscp : m_inVarps) { - AstVarRef* const refp = new AstVarRef(fl, invscp, VAccess::READ); + AstVarRef* const refp = new AstVarRef{fl, invscp, VAccess::READ}; if (concatp) { - concatp = new AstConcat(fl, refp, concatp); + concatp = new AstConcat{fl, refp, concatp}; } else { concatp = refp; } } - return new AstAssign(fl, new AstVarRef(fl, indexVscp, VAccess::WRITE), concatp); + return new AstAssign{fl, new AstVarRef{fl, indexVscp, VAccess::WRITE}, concatp}; } AstArraySel* select(FileLine* fl, AstVarScope* fromp, AstVarScope* indexp) { - AstVarRef* const fromRefp = new AstVarRef(fl, fromp, VAccess::READ); - AstVarRef* const indexRefp = new AstVarRef(fl, indexp, VAccess::READ); - return new AstArraySel(fl, fromRefp, indexRefp); + AstVarRef* const fromRefp = new AstVarRef{fl, fromp, VAccess::READ}; + AstVarRef* const indexRefp = new AstVarRef{fl, indexp, VAccess::READ}; + return new AstArraySel{fl, fromRefp, indexRefp}; } void createOutputAssigns(AstNode* nodep, AstNode* stmtsp, AstVarScope* indexVscp, @@ -362,12 +362,12 @@ private: // If this output is unassigned on some code paths, wrap the assignment in an If if (tov.mayBeUnassigned()) { - V3Number outputChgMask(nodep, m_outVarps.size(), 0); + V3Number outputChgMask{nodep, static_cast(m_outVarps.size()), 0}; outputChgMask.setBit(tov.ord(), 1); AstNode* const condp - = new AstAnd(fl, select(fl, outputAssignedTableVscp, indexVscp), - new AstConst(fl, outputChgMask)); - outsetp = new AstIf(fl, condp, outsetp); + = new AstAnd{fl, select(fl, outputAssignedTableVscp, indexVscp), + new AstConst{fl, outputChgMask}}; + outsetp = new AstIf{fl, condp, outsetp}; } stmtsp->addNext(outsetp);