diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index d0b16f48b..aca23c017 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -11,11 +11,11 @@ permissions: contents: write jobs: format: - runs-on: ubuntu-22.04 - name: Ubuntu 22.04 | format + runs-on: ubuntu-24.04 + name: Ubuntu 24.04 | format env: CI_OS_NAME: linux - CI_RUNS_ON: ubuntu-22.04 + CI_RUNS_ON: ubuntu-24.04 CI_COMMIT: ${{ github.sha }} steps: - name: Checkout @@ -27,7 +27,7 @@ jobs: CI_BUILD_STAGE_NAME: build run: | bash ci/ci-install.bash && - sudo apt-get install clang-format-14 yapf3 && + sudo apt-get install clang-format-18 yapf3 && sudo pip3 install gersemi mbake && git config --global user.email "action@example.com" && git config --global user.name "github action" @@ -35,7 +35,7 @@ jobs: run: | autoconf && ./configure && - make -j 2 format CLANGFORMAT=clang-format-14 && + make -j 2 format CLANGFORMAT=clang-format-18 && git status - name: Push run: | diff --git a/Makefile.in b/Makefile.in index 42ce2987d..e879202c5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -462,14 +462,14 @@ analyzer-include: format: $(MAKE) -j 5 format-c format-cmake format-exec format-py -CLANGFORMAT = clang-format-14 +CLANGFORMAT = clang-format-18 CLANGFORMAT_FLAGS = -i CLANGFORMAT_FILES = $(CHECK_CPP) $(CHECK_H) $(CHECK_YL) test_regress/t/*.c* test_regress/t/*.h format-c clang-format: $(CLANGFORMAT) --version - @$(CLANGFORMAT) --version | egrep 14.0 > /dev/null \ - || echo "*** You are not using clang-format-14, indents may differ from master's ***" + @$(CLANGFORMAT) --version | fgrep 'version 18' > /dev/null \ + || echo "*** You are not using clang-format-18, indents may differ from master's ***" $(CLANGFORMAT) $(CLANGFORMAT_FLAGS) $(CLANGFORMAT_FILES) YAMLFIX = YAMLFIX_WHITELINES=1 YAMLFIX_LINE_LENGTH=130 YAMLFIX_preserve_quotes=true yamlfix diff --git a/configure.ac b/configure.ac index 5efee99b2..5e9f2458d 100644 --- a/configure.ac +++ b/configure.ac @@ -178,7 +178,7 @@ AC_PROG_INSTALL AC_LANG_PUSH(C++) CFG_CXX_VERSION=`$CXX --version | head -1` -AC_MSG_RESULT([compiler $CXX --version = $CFG_CXX_VERSION]) +AC_MSG_RESULT([compiler version... $CXX --version = $CFG_CXX_VERSION]) AC_SUBST(CFG_CXX_VERSION) AC_MSG_CHECKING([that C++ compiler can compile simple program]) diff --git a/docs/guide/install.rst b/docs/guide/install.rst index e7438b289..57e9f72cd 100644 --- a/docs/guide/install.rst +++ b/docs/guide/install.rst @@ -157,7 +157,7 @@ Those developing Verilator itself also need these (see internals.rst): .. code-block:: shell - sudo apt-get install clang clang-format-14 cmake gdb gprof graphviz lcov + sudo apt-get install clang clang-format-18 cmake gdb gprof graphviz lcov sudo apt-get install python3-clang python3-distro yapf3 bear jq sudo pip3 install sphinx sphinx_rtd_theme sphinxcontrib-spelling breathe gersemi mbake ruff sarif-tools sudo pip3 install git+https://github.com/antmicro/astsee.git diff --git a/docs/internals.rst b/docs/internals.rst index 3ce56b65d..4230a966c 100644 --- a/docs/internals.rst +++ b/docs/internals.rst @@ -1131,7 +1131,7 @@ Indentation and Naming Style ---------------------------- We will work with contributors to fix up indentation style issues, but it -is appreciated if you could match our style: +is appreciated if you could match our style for C/C++: - Use "mixedCapsSymbols" instead of "underlined_symbols". @@ -1143,9 +1143,8 @@ is appreciated if you could match our style: calls. (This convention has not been applied retroactively.) C and Python indentation is automatically maintained with "make format" -using clang-format version 14.0.0, and yapf for Python, and is -automatically corrected in the CI actions. For those manually formatting C -code: +using clang-format version 18, and yapf for Python, and is automatically +corrected in the CI actions. For those manually formatting C code: - Use four spaces per level, and no tabs. @@ -1157,12 +1156,20 @@ code: - No spaces before semicolons, nor between a function's name and open parenthesis (only applies to functions; if/else has a following space). +Verilog indentation is not yet automatically maintained, but: + +- Use two spaces per level, and no tabs. + +- Place `begin` on the same line as the earlier starting statement + e.g. `if`, and place the `end` on a separate line indented the same as + the starting statement. + Commit messages --------------- Pull requests do not typically edit ``Changes`` in order to reduce -potential merge conflicts. Instead, contibutors should use an appropriate +potential merge conflicts. Instead, contributors should use an appropriate first line of the git commit message. Maintainers periodically run ``nodist/log_changes`` which analyzes the commit messages to suggest edits to the ``Changes`` file. @@ -1199,7 +1206,7 @@ The line's grammar should match the phrasing used in the Changes file. If the change does not affect user-visible function, also add "No functional change." if it's 99% certain not to change behavior, or "No functional change expected." if no change was expected but there may be -uncertanty. +uncertainty. The ``astgen`` Script @@ -1208,7 +1215,7 @@ The ``astgen`` Script The ``astgen`` script is used to generate some of the repetitive C++ code related to the ``AstNode`` type hierarchy. An example is the abstract ``visit`` methods in ``VNVisitor``. There are other uses; please see the ``*__gen*`` -files in the bulid directories and the ``astgen`` script for details. A +files in the build directories and the ``astgen`` script for details. A description of the more advanced features of ``astgen`` are provided here. @@ -1617,7 +1624,7 @@ Benchmarking ------------ For benchmarking the effects of changes (simulation speed, memory consumption, -verilation time, etc.), you can use `RTLMeter +Verilation time, etc.), you can use `RTLMeter `__, a benchmark suite designed for this purpose. The scripts provided with RTLMeter have many capabilities. For full details, see the `documentation of RTLMeter @@ -2039,10 +2046,8 @@ Generally, what would you do to add a new feature? 2. Make a testcase in the test_regress/t/t_EXAMPLE format, see `Testing`. -3. If grammar changes are needed, look at the git version of VerilogPerl's - src/VParseGrammar.y, as this grammar supports the full SystemVerilog - language and has a lot of back-and-forth with Verilator's grammar. Copy - the appropriate rules to src/verilog.y and modify the productions. +3. If grammar changes are needed, look at the IEEE 1800-2023 Appendix A, as + src/verilog.y generally follows the same rule layout. 4. If a new Ast type is needed, add it to the appropriate V3AstNode*.h. Follow the convention described above about the AstNode type hierarchy. diff --git a/include/verilated_funcs.h b/include/verilated_funcs.h index c18c32022..3a4f2a427 100644 --- a/include/verilated_funcs.h +++ b/include/verilated_funcs.h @@ -279,11 +279,11 @@ static inline IData VL_RTOI_I_D(double lhs) VL_PURE { return static_cast> VL_BITBIT_I((nbits)-VL_UL(1))) -#define VL_SIGN_Q(nbits, lhs) ((lhs) >> VL_BITBIT_Q((nbits)-1ULL)) -#define VL_SIGN_E(nbits, lhs) ((lhs) >> VL_BITBIT_E((nbits)-VL_EUL(1))) +#define VL_SIGN_I(nbits, lhs) ((lhs) >> VL_BITBIT_I((nbits) - VL_UL(1))) +#define VL_SIGN_Q(nbits, lhs) ((lhs) >> VL_BITBIT_Q((nbits) - 1ULL)) +#define VL_SIGN_E(nbits, lhs) ((lhs) >> VL_BITBIT_E((nbits) - VL_EUL(1))) #define VL_SIGN_W(nbits, rwp) \ - ((rwp)[VL_BITWORD_E((nbits)-VL_EUL(1))] >> VL_BITBIT_E((nbits)-VL_EUL(1))) + ((rwp)[VL_BITWORD_E((nbits) - VL_EUL(1))] >> VL_BITBIT_E((nbits) - VL_EUL(1))) #define VL_SIGNONES_E(nbits, lhs) (-(VL_SIGN_E(nbits, lhs))) // Sign bit extended up to MSB, doesn't include unsigned portion @@ -558,8 +558,8 @@ static inline void VL_ASSIGNBIT_WO(int bit, WDataOutP owp) VL_MT_SAFE { lsb += BITS_PER_DIGIT; \ } \ if (lsb < (obits)) { \ - const uint32_t msb_data = VL_SEL_IWII((obits) + 1, (rwp).data(), lsb, (obits)-lsb); \ - *chunkp = msb_data & VL_MASK_E((obits)-lsb); \ + const uint32_t msb_data = VL_SEL_IWII((obits) + 1, (rwp).data(), lsb, (obits) - lsb); \ + *chunkp = msb_data & VL_MASK_E((obits) - lsb); \ } \ _butemp.set(0, *(rwp).data() & 1); /* force update the sign */ \ (svar).write(_butemp); \ diff --git a/include/verilated_sc_trace.h b/include/verilated_sc_trace.h index 99bffa19f..4a8e18f30 100644 --- a/include/verilated_sc_trace.h +++ b/include/verilated_sc_trace.h @@ -60,7 +60,7 @@ class VerilatedScTraceBase VL_NOT_FINAL : private sc_core::sc_object, private sc_core::sc_trace_file { bool m_enableDeltaCycles = false; bool m_traceFileAdded = false; - static void stubReportHandler(const sc_core::sc_report&, const sc_core::sc_actions&){}; + static void stubReportHandler(const sc_core::sc_report&, const sc_core::sc_actions&) {}; public: void enableDeltaCycles(bool flag = true) { diff --git a/include/verilated_vcd_c.h b/include/verilated_vcd_c.h index 21a69afdb..500ec755f 100644 --- a/include/verilated_vcd_c.h +++ b/include/verilated_vcd_c.h @@ -105,7 +105,7 @@ protected: void commitTraceBuffer(Buffer*) override; // Configure sub-class - void configure(const VerilatedTraceConfig&) override{}; + void configure(const VerilatedTraceConfig&) override {}; public: //========================================================================= diff --git a/src/V3Ast.cpp b/src/V3Ast.cpp index 607f42591..d5ce5544c 100644 --- a/src/V3Ast.cpp +++ b/src/V3Ast.cpp @@ -1394,8 +1394,8 @@ void AstNode::dumpTreeFile(const string& filename, bool doDump) { static void drawChildren(std::ostream& os, const AstNode* thisp, const AstNode* childp, const std::string& childName) { if (childp) { - os << "\tn" << cvtToHex(thisp) << " -> n" << cvtToHex(childp) << " [" - << "label=\"" << childName << "\" color=red];\n"; + os << "\tn" << cvtToHex(thisp) << " -> n" << cvtToHex(childp) << " [" << "label=\"" + << childName << "\" color=red];\n"; for (const AstNode* nodep = childp; nodep; nodep = nodep->nextp()) { nodep->dumpTreeDot(os); if (nodep->nextp()) { @@ -1409,8 +1409,7 @@ static void drawChildren(std::ostream& os, const AstNode* thisp, const AstNode* } void AstNode::dumpTreeDot(std::ostream& os) const { - os << "\tn" << cvtToHex(this) << "\t[" - << "label=\"" << typeName() << "\\n" + os << "\tn" << cvtToHex(this) << "\t[" << "label=\"" << typeName() << "\\n" << name() << "\"];\n"; drawChildren(os, this, m_op1p, "op1"); drawChildren(os, this, m_op2p, "op2"); @@ -1447,8 +1446,7 @@ void AstNode::dumpTreeDotFile(const string& filename, bool doDump) { const std::unique_ptr treedotp{V3File::new_ofstream(filename)}; if (treedotp->fail()) v3fatal("Can't write file: " << filename); *treedotp << "digraph vTree{\n"; - *treedotp << "\tgraph\t[label=\"" << filename + ".dot" - << "\",\n"; + *treedotp << "\tgraph\t[label=\"" << filename + ".dot" << "\",\n"; *treedotp << "\t\t labelloc=t, labeljust=l,\n"; *treedotp << "\t\t //size=\"7.5,10\",\n" << "];\n"; diff --git a/src/V3Ast.h b/src/V3Ast.h index 0e86c79a4..380247b5d 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -2135,7 +2135,7 @@ protected: AstNode(VNType t, FileLine* fl); virtual AstNode* clone() = 0; // Generally, cloneTree is what you want instead virtual void cloneRelink() { cloneRelinkGen(); } - virtual void cloneRelinkGen(){}; // Overrides generated by 'astgen' + virtual void cloneRelinkGen() {}; // Overrides generated by 'astgen' void cloneRelinkTree(); // METHODS @@ -2174,7 +2174,8 @@ protected: virtual bool sameNode(const AstNode*) const { return true; } // Generated by 'astgen'. If do an oldp->replaceNode(newp), would cause a broken() virtual bool wouldBreakGen(const AstNode* const oldp, - const AstNode* const newp) const = 0; // Generated by 'astgen' + const AstNode* const newp) const + = 0; // Generated by 'astgen' public: // ACCESSORS diff --git a/src/V3Control.cpp b/src/V3Control.cpp index 43d2bb01f..7b4225264 100644 --- a/src/V3Control.cpp +++ b/src/V3Control.cpp @@ -479,8 +479,7 @@ class V3ControlScopeTraceResolver final { public: void addScopeTraceOn(bool on, const string& scope, int levels) { - UINFO(9, "addScopeTraceOn " << on << " '" << scope << "' " - << " levels=" << levels); + UINFO(9, "addScopeTraceOn " << on << " '" << scope << "' " << " levels=" << levels); m_entries.emplace_back(V3ControlScopeTraceEntry{scope, on, levels}); m_matchCache.clear(); } diff --git a/src/V3Delayed.cpp b/src/V3Delayed.cpp index c2ece6fd0..e5bfd8522 100644 --- a/src/V3Delayed.cpp +++ b/src/V3Delayed.cpp @@ -387,18 +387,18 @@ class DelayedVisitor final : public VNVisitor { if (bIt != blkRefs.end() && nIt != nbaRefs.end()) { const Ref& blkRef = *bIt; const Ref& nbaRef = *nIt; - vscp->v3warn(BLKANDNBLK, - "Unsupported: Blocking and non-blocking assignments to " - "potentially overlapping bits of same packed variable: " - << vscp->varp()->prettyNameQ() << '\n' - << vscp->warnContextPrimary() << '\n' - << blkRef.m_refp->warnOther() << "... Location of blocking assignment" - << " (bits [" << blkRef.m_msb << ":" << blkRef.m_lsb << "])\n" - << blkRef.m_refp->warnContextSecondary() << '\n' - << nbaRef.m_refp->warnOther() - << "... Location of nonblocking assignment" - << " (bits [" << nbaRef.m_msb << ":" << nbaRef.m_lsb << "])\n" - << nbaRef.m_refp->warnContextSecondary()); + vscp->v3warn(BLKANDNBLK, "Unsupported: Blocking and non-blocking assignments to " + "potentially overlapping bits of same packed variable: " + << vscp->varp()->prettyNameQ() << '\n' + << vscp->warnContextPrimary() << '\n' + << blkRef.m_refp->warnOther() + << "... Location of blocking assignment" << " (bits [" + << blkRef.m_msb << ":" << blkRef.m_lsb << "])\n" + << blkRef.m_refp->warnContextSecondary() << '\n' + << nbaRef.m_refp->warnOther() + << "... Location of nonblocking assignment" << " (bits [" + << nbaRef.m_msb << ":" << nbaRef.m_lsb << "])\n" + << nbaRef.m_refp->warnContextSecondary()); } return true; diff --git a/src/V3EmitXml.cpp b/src/V3EmitXml.cpp index 6545aaf35..ac90ba445 100644 --- a/src/V3EmitXml.cpp +++ b/src/V3EmitXml.cpp @@ -384,9 +384,8 @@ class HierCellsXmlVisitor final : public VNVisitorConst { && nodep->level() <= 2) { // ==2 because we don't add wrapper when in XML mode m_os << "\n"; m_os << "fileline()->xmlDetailedLocation() // - << " name=\"" << nodep->prettyName() << "\"" - << " submodname=\"" << nodep->prettyName() << "\"" - << " hier=\"" << nodep->prettyName() << "\""; + << " name=\"" << nodep->prettyName() << "\"" << " submodname=\"" + << nodep->prettyName() << "\"" << " hier=\"" << nodep->prettyName() << "\""; m_hier = nodep->prettyName() + "."; m_hasChildren = false; iterateChildrenConst(nodep); @@ -402,9 +401,8 @@ class HierCellsXmlVisitor final : public VNVisitorConst { if (nodep->modp() && nodep->modp()->dead()) return; if (!m_hasChildren) m_os << ">\n"; m_os << "fileline()->xmlDetailedLocation() << " name=\"" << nodep->name() - << "\"" - << " submodname=\"" << nodep->modName() << "\"" - << " hier=\"" << m_hier + nodep->name() << "\""; + << "\"" << " submodname=\"" << nodep->modName() << "\"" << " hier=\"" + << m_hier + nodep->name() << "\""; const std::string hier = m_hier; m_hier += nodep->name() + "."; m_hasChildren = false; diff --git a/src/V3FileLine.cpp b/src/V3FileLine.cpp index 7e7cae443..5a3eb58c7 100644 --- a/src/V3FileLine.cpp +++ b/src/V3FileLine.cpp @@ -432,8 +432,8 @@ void FileLine::v3errorEnd(std::ostringstream& sstr, const string& extra) wsstr << '\n'; std::ostringstream extrass; // extra spaced out for prefix if (!extra.empty()) { - extrass << V3Error::warnContextBegin() << std::setw(ascii().length()) << " " - << ": " << V3Error::warnContextEnd() << extra; + extrass << V3Error::warnContextBegin() << std::setw(ascii().length()) << " " << ": " + << V3Error::warnContextEnd() << extra; } if (warnIsOff(V3Error::s().errorCode())) { V3Error::s().suppressThisWarning(); diff --git a/src/V3Graph.cpp b/src/V3Graph.cpp index feb3d327c..ced3a7d26 100644 --- a/src/V3Graph.cpp +++ b/src/V3Graph.cpp @@ -330,8 +330,8 @@ void V3Graph::dumpDotFile(const string& filename, bool colorAsSubgraph) const { } } if (subgr != "") *logp << "\t"; - *logp << "\tn" << vertexp->dotName() << (n++) << "\t[fontsize=8 " - << "label=\"" << (vertexp->name() != "" ? vertexp->name() : "\\N"); + *logp << "\tn" << vertexp->dotName() << (n++) << "\t[fontsize=8 " << "label=\"" + << (vertexp->name() != "" ? vertexp->name() : "\\N"); if (vertexp->rank()) *logp << " r" << vertexp->rank(); if (vertexp->fanout() != 0.0) *logp << " f" << vertexp->fanout(); if (vertexp->color()) *logp << "\\n c" << vertexp->color(); @@ -354,8 +354,7 @@ void V3Graph::dumpDotFile(const string& filename, bool colorAsSubgraph) const { << " [" // <<"fontsize=8 label=\""<<(edge.name()!="" ? edge.name() : "\\E")<<"\"" << "fontsize=8 label=\"" << (edge.dotLabel() != "" ? edge.dotLabel() : "") - << "\"" - << " weight=" << edge.weight() << " color=" << edge.dotColor(); + << "\"" << " weight=" << edge.weight() << " color=" << edge.dotColor(); if (edge.dotStyle() != "") *logp << " style=" << edge.dotStyle(); // if (edge.cutable()) *logp << ",constraint=false"; // to rank without // following edges diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index 708470185..f6e8573fd 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -3697,9 +3697,9 @@ class LinkDotResolveVisitor final : public VNVisitor { if (foundp) { nodep->v3error("Found definition of '" << m_ds.m_dotText << (m_ds.m_dotText == "" ? "" : ".") - << nodep->prettyName() << "'" - << " as a " << foundp->nodep()->typeName() - << " but expected a " << expectWhat); + << nodep->prettyName() << "'" << " as a " + << foundp->nodep()->typeName() << " but expected a " + << expectWhat); } else if (m_ds.m_dotText == "") { UINFO(1, " ErrParseRef curSymp=se" << cvtToHex(m_curSymp) << " ds=" << m_ds.ascii()); @@ -3710,15 +3710,16 @@ class LinkDotResolveVisitor final : public VNVisitor { << expectWhat << ": " << nodep->prettyNameQ() << '\n' << (suggest.empty() ? "" : nodep->warnMore() + suggest)); } else { - nodep->v3error("Can't find definition of " - << (!baddot.empty() ? AstNode::prettyNameQ(baddot) - : nodep->prettyNameQ()) - << " in dotted " << expectWhat << ": '" - << m_ds.m_dotText + "." + nodep->prettyName() << "'\n" - << nodep->warnContextPrimary() - << (okSymp ? okSymp->cellErrorScopes( - nodep, AstNode::prettyName(m_ds.m_dotText)) - : "")); + nodep->v3error( + "Can't find definition of " + << (!baddot.empty() ? AstNode::prettyNameQ(baddot) + : nodep->prettyNameQ()) + << " in dotted " << expectWhat << ": '" + << m_ds.m_dotText + "." + nodep->prettyName() << "'\n" + << nodep->warnContextPrimary() + << (okSymp ? okSymp->cellErrorScopes( + nodep, AstNode::prettyName(m_ds.m_dotText)) + : "")); } m_ds.m_dotErr = true; } @@ -4233,8 +4234,8 @@ class LinkDotResolveVisitor final : public VNVisitor { } else { nodep->v3error("Found definition of '" << m_ds.m_dotText << (m_ds.m_dotText == "" ? "" : ".") - << nodep->prettyName() << "'" - << " as a " << foundp->nodep()->typeName() + << nodep->prettyName() << "'" << " as a " + << foundp->nodep()->typeName() << " but expected a task/function"); } } else if (VN_IS(nodep, New) && m_statep->forPrearray()) { diff --git a/src/V3Options.cpp b/src/V3Options.cpp index 96d57f204..35a81cc48 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -1399,9 +1399,8 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, m_hierBlocks.emplace(opt.mangledName(), opt); }); DECL_OPTION("-hierarchical-child", Set, &m_hierChild); - DECL_OPTION("-hierarchical-params-file", CbVal, [this](const char* optp) { - m_hierParamsFile.push_back({optp, work()}); - }); + DECL_OPTION("-hierarchical-params-file", CbVal, + [this](const char* optp) { m_hierParamsFile.push_back({optp, work()}); }); DECL_OPTION("-I", CbPartialMatch, [this, &optdir](const char* optp) { addIncDirUser(parseFileArg(optdir, optp)); }); diff --git a/src/V3PreLex.l b/src/V3PreLex.l index 8e62cdd5b..c3b533fe5 100644 --- a/src/V3PreLex.l +++ b/src/V3PreLex.l @@ -740,8 +740,8 @@ void V3PreLex::dumpStack() { // LCOV_EXCL_START std::stack tmpstack = LEXP->m_streampStack; while (!tmpstack.empty()) { const VPreStream* const streamp = tmpstack.top(); - cout << "- bufferStack[" << cvtToHex(streamp) << "]: " - << " at=" << streamp->m_curFilelinep << " nBuf=" << streamp->m_buffers.size() + cout << "- bufferStack[" << cvtToHex(streamp) + << "]: " << " at=" << streamp->m_curFilelinep << " nBuf=" << streamp->m_buffers.size() << " size0=" << (streamp->m_buffers.empty() ? 0 : streamp->m_buffers.front().length()) << (streamp->m_eof ? " [EOF]" : "") << (streamp->m_file ? " [FILE]" : "") << endl; tmpstack.pop(); diff --git a/src/V3SenExprBuilder.h b/src/V3SenExprBuilder.h index 879ff3165..498f3d61c 100644 --- a/src/V3SenExprBuilder.h +++ b/src/V3SenExprBuilder.h @@ -149,9 +149,8 @@ private: AstNodeExpr* const senp = senItemp->sensp(); const auto currp = [this, senp]() { return getCurr(senp); }; - const auto prevp = [this, flp, senp]() { - return new AstVarRef{flp, getPrev(senp), VAccess::READ}; - }; + const auto prevp + = [this, flp, senp]() { return new AstVarRef{flp, getPrev(senp), VAccess::READ}; }; const auto lsb = [=](AstNodeExpr* opp) { return new AstSel{flp, opp, 0, 1}; }; // All event signals should be 1-bit at this point diff --git a/src/V3Table.cpp b/src/V3Table.cpp index e2d1b8cd8..8c7d0669f 100644 --- a/src/V3Table.cpp +++ b/src/V3Table.cpp @@ -234,8 +234,7 @@ private: << chkvis.instrCount() << " Data=" << chkvis.dataCount() << " in width (bits)=" << m_inWidthBits << " out width (bytes)=" << m_outWidthBytes << " Spacetime=" << (space / time) << "(" - << space << "/" << time << ")" - << ": " << nodep); + << space << "/" << time << ")" << ": " << nodep); if (chkvis.optimizable()) { UINFO(3, " Table Optimize spacetime=" << (space / time) << " " << nodep); m_totalBytes += space; diff --git a/src/V3Timing.cpp b/src/V3Timing.cpp index aa64abdb5..d25a40346 100644 --- a/src/V3Timing.cpp +++ b/src/V3Timing.cpp @@ -95,7 +95,7 @@ enum ForkType : uint8_t { enum PropagationType : uint8_t { P_CALL = 1, // Propagation through call to a function/task/method - P_FORK = 2, // Propagation due to fork's behaviour + P_FORK = 2, // Propagation due to fork's behavior P_SIGNATURE = 3, // Propagation required to maintain C++ function's signature requirements }; diff --git a/src/V3TraceDecl.cpp b/src/V3TraceDecl.cpp index d244f1d19..026d7a230 100644 --- a/src/V3TraceDecl.cpp +++ b/src/V3TraceDecl.cpp @@ -685,7 +685,7 @@ public: // Now that we have everything ready, remove redundant pushPrefix/popPrefix // pairs. While functionally this is not really necessary (the trace files // might have some empty scope declarations), we do it to preserve previous - // behaviour. Note: unfortunately generating these without the redundant + // behavior. Note: unfortunately generating these without the redundant // push/pop pairs is a bit hard. It is cleaner to remove them. removeRedundantPrefixPushPop(); diff --git a/src/V3Unknown.cpp b/src/V3Unknown.cpp index 3a83bd043..2b1d1308b 100644 --- a/src/V3Unknown.cpp +++ b/src/V3Unknown.cpp @@ -129,9 +129,9 @@ class UnknownVisitor final : public VNVisitor { fl, condp, (needDly ? static_cast(new AstAssignDly{ - fl, prep, new AstVarRef{fl, varp, VAccess::READ}, m_timingControlp}) + fl, prep, new AstVarRef{fl, varp, VAccess::READ}, m_timingControlp}) : static_cast(new AstAssign{ - fl, prep, new AstVarRef{fl, varp, VAccess::READ}, m_timingControlp}))}; + fl, prep, new AstVarRef{fl, varp, VAccess::READ}, m_timingControlp}))}; newp->branchPred(VBranchPred::BP_LIKELY); newp->isBoundsCheck(true); UINFOTREE(9, newp, "", "_new"); diff --git a/src/V3Width.cpp b/src/V3Width.cpp index a12da7ed2..a487ce473 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -4561,11 +4561,12 @@ class WidthVisitor final : public VNVisitor { refp = m_vup ? VN_CAST(m_vup->dtypeNullSkipRefp(), ClassRefDType) : nullptr; } if (!refp) { // e.g. int a = new; - nodep->v3error("new() assignment not legal to non-class " - + (VN_IS(warnp, NodeDType) ? ( - "data type "s + VN_AS(warnp, NodeDType)->prettyDTypeNameQ()) - : warnp ? warnp->prettyNameQ() - : "")); + nodep->v3error( + "new() assignment not legal to non-class " + + (VN_IS(warnp, NodeDType) + ? ("data type "s + VN_AS(warnp, NodeDType)->prettyDTypeNameQ()) + : warnp ? warnp->prettyNameQ() + : "")); nodep->dtypep(m_vup->dtypep()); return; } @@ -5981,8 +5982,8 @@ class WidthVisitor final : public VNVisitor { // Must be a error according to spec // (Because we need to know if to connect to one or all instants) nodep->v3error(ucfirst(nodep->prettyOperatorName()) - << " as part of a module instance array" - << " requires " << modwidth << " or " << modwidth * numInsts + << " as part of a module instance array" << " requires " + << modwidth << " or " << modwidth * numInsts << " bits, but connection's " << nodep->exprp()->prettyTypeName() << " generates " << conwidth << " bits. (IEEE 1800-2023 23.3.3)"); @@ -5993,8 +5994,8 @@ class WidthVisitor final : public VNVisitor { if (nodep->modVarp()->direction() == VDirection::REF) { nodep->v3error("Ref connection " << nodep->modVarp()->prettyNameQ() - << " requires matching types;" - << " ref requires " << modDTypep->prettyDTypeNameQ() + << " requires matching types;" << " ref requires " + << modDTypep->prettyDTypeNameQ() << " data type but connection is " << conDTypep->prettyDTypeNameQ() << " data type."); } else if (nodep->modVarp()->isTristate()) { @@ -6023,8 +6024,7 @@ class WidthVisitor final : public VNVisitor { nodep->v3error("Illegal " << nodep->prettyOperatorName() << "," << " mismatch between port which is" << (VN_CAST(modDTypep, IfaceRefDType) ? "" : " not") - << " an interface," - << " and expression which is" + << " an interface," << " and expression which is" << (VN_CAST(conDTypep, IfaceRefDType) ? "" : " not") << " an interface."); } @@ -6045,12 +6045,11 @@ class WidthVisitor final : public VNVisitor { UINFO(1, " Related lo: " << modDTypep); UINFO(1, " Related hi: " << conDTypep); } else if ((exprArrayp && !modArrayp) || (!exprArrayp && modArrayp)) { - nodep->v3error("Illegal " << nodep->prettyOperatorName() << "," - << " mismatch between port which is" - << (modArrayp ? "" : " not") << " an array," - << " and expression which is" - << (exprArrayp ? "" : " not") - << " an array. (IEEE 1800-2023 7.6)"); + nodep->v3error( + "Illegal " + << nodep->prettyOperatorName() << "," << " mismatch between port which is" + << (modArrayp ? "" : " not") << " an array," << " and expression which is" + << (exprArrayp ? "" : " not") << " an array. (IEEE 1800-2023 7.6)"); UINFO(1, " Related lo: " << modDTypep); UINFO(1, " Related hi: " << conDTypep); } diff --git a/test_regress/t/t_var_sc_bv.cpp b/test_regress/t/t_var_sc_bv.cpp index a9be7508c..97d45745f 100644 --- a/test_regress/t/t_var_sc_bv.cpp +++ b/test_regress/t/t_var_sc_bv.cpp @@ -44,7 +44,7 @@ void compareWls(int obits, WDataInP const lwp, WDataInP const rwp) { sc_biguint<(obits)> _butemp; \ for (int i = 0; i < VL_WORDS_I(obits); ++i) { \ int msb = ((i + 1) * VL_IDATASIZE) - 1; \ - msb = (msb >= (obits)) ? ((obits)-1) : msb; \ + msb = (msb >= (obits)) ? ((obits) - 1) : msb; \ _butemp.range(msb, i* VL_IDATASIZE) = (rwp)[i]; \ } \ (svar).write(_butemp); \ diff --git a/test_regress/t/t_wrapper_clone.cpp b/test_regress/t/t_wrapper_clone.cpp index 0c10674e9..296c00321 100644 --- a/test_regress/t/t_wrapper_clone.cpp +++ b/test_regress/t/t_wrapper_clone.cpp @@ -72,8 +72,7 @@ int main(int argc, char** argv) { } else if (pid == 0) { printf("child: here we go\n"); } else { - while (wait(nullptr) > 0) - ; + while (wait(nullptr) > 0); printf("parent: here we go\n"); topp->is_parent = 1; }