Internals: Upgrade to clang-format-18 (#6333)

This commit is contained in:
Wilson Snyder 2025-08-25 20:47:48 -04:00 committed by GitHub
parent 703f0d8c5d
commit ac2859bf24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
26 changed files with 108 additions and 112 deletions

View File

@ -11,11 +11,11 @@ permissions:
contents: write contents: write
jobs: jobs:
format: format:
runs-on: ubuntu-22.04 runs-on: ubuntu-24.04
name: Ubuntu 22.04 | format name: Ubuntu 24.04 | format
env: env:
CI_OS_NAME: linux CI_OS_NAME: linux
CI_RUNS_ON: ubuntu-22.04 CI_RUNS_ON: ubuntu-24.04
CI_COMMIT: ${{ github.sha }} CI_COMMIT: ${{ github.sha }}
steps: steps:
- name: Checkout - name: Checkout
@ -27,7 +27,7 @@ jobs:
CI_BUILD_STAGE_NAME: build CI_BUILD_STAGE_NAME: build
run: | run: |
bash ci/ci-install.bash && 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 && sudo pip3 install gersemi mbake &&
git config --global user.email "action@example.com" && git config --global user.email "action@example.com" &&
git config --global user.name "github action" git config --global user.name "github action"
@ -35,7 +35,7 @@ jobs:
run: | run: |
autoconf && autoconf &&
./configure && ./configure &&
make -j 2 format CLANGFORMAT=clang-format-14 && make -j 2 format CLANGFORMAT=clang-format-18 &&
git status git status
- name: Push - name: Push
run: | run: |

View File

@ -462,14 +462,14 @@ analyzer-include:
format: format:
$(MAKE) -j 5 format-c format-cmake format-exec format-py $(MAKE) -j 5 format-c format-cmake format-exec format-py
CLANGFORMAT = clang-format-14 CLANGFORMAT = clang-format-18
CLANGFORMAT_FLAGS = -i CLANGFORMAT_FLAGS = -i
CLANGFORMAT_FILES = $(CHECK_CPP) $(CHECK_H) $(CHECK_YL) test_regress/t/*.c* test_regress/t/*.h CLANGFORMAT_FILES = $(CHECK_CPP) $(CHECK_H) $(CHECK_YL) test_regress/t/*.c* test_regress/t/*.h
format-c clang-format: format-c clang-format:
$(CLANGFORMAT) --version $(CLANGFORMAT) --version
@$(CLANGFORMAT) --version | egrep 14.0 > /dev/null \ @$(CLANGFORMAT) --version | fgrep 'version 18' > /dev/null \
|| echo "*** You are not using clang-format-14, indents may differ from master's ***" || echo "*** You are not using clang-format-18, indents may differ from master's ***"
$(CLANGFORMAT) $(CLANGFORMAT_FLAGS) $(CLANGFORMAT_FILES) $(CLANGFORMAT) $(CLANGFORMAT_FLAGS) $(CLANGFORMAT_FILES)
YAMLFIX = YAMLFIX_WHITELINES=1 YAMLFIX_LINE_LENGTH=130 YAMLFIX_preserve_quotes=true yamlfix YAMLFIX = YAMLFIX_WHITELINES=1 YAMLFIX_LINE_LENGTH=130 YAMLFIX_preserve_quotes=true yamlfix

View File

@ -178,7 +178,7 @@ AC_PROG_INSTALL
AC_LANG_PUSH(C++) AC_LANG_PUSH(C++)
CFG_CXX_VERSION=`$CXX --version | head -1` 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_SUBST(CFG_CXX_VERSION)
AC_MSG_CHECKING([that C++ compiler can compile simple program]) AC_MSG_CHECKING([that C++ compiler can compile simple program])

View File

@ -157,7 +157,7 @@ Those developing Verilator itself also need these (see internals.rst):
.. code-block:: shell .. 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 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 sphinx sphinx_rtd_theme sphinxcontrib-spelling breathe gersemi mbake ruff sarif-tools
sudo pip3 install git+https://github.com/antmicro/astsee.git sudo pip3 install git+https://github.com/antmicro/astsee.git

View File

@ -1131,7 +1131,7 @@ Indentation and Naming Style
---------------------------- ----------------------------
We will work with contributors to fix up indentation style issues, but it 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". - 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.) calls. (This convention has not been applied retroactively.)
C and Python indentation is automatically maintained with "make format" C and Python indentation is automatically maintained with "make format"
using clang-format version 14.0.0, and yapf for Python, and is using clang-format version 18, and yapf for Python, and is automatically
automatically corrected in the CI actions. For those manually formatting C corrected in the CI actions. For those manually formatting C code:
code:
- Use four spaces per level, and no tabs. - 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 - No spaces before semicolons, nor between a function's name and open
parenthesis (only applies to functions; if/else has a following space). 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 Commit messages
--------------- ---------------
Pull requests do not typically edit ``Changes`` in order to reduce 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 first line of the git commit message. Maintainers periodically run
``nodist/log_changes`` which analyzes the commit messages to suggest edits ``nodist/log_changes`` which analyzes the commit messages to suggest edits
to the ``Changes`` file. 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 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." if it's 99% certain not to change behavior, or "No
functional change expected." if no change was expected but there may be functional change expected." if no change was expected but there may be
uncertanty. uncertainty.
The ``astgen`` Script The ``astgen`` Script
@ -1208,7 +1215,7 @@ The ``astgen`` Script
The ``astgen`` script is used to generate some of the repetitive C++ code 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`` related to the ``AstNode`` type hierarchy. An example is the abstract ``visit``
methods in ``VNVisitor``. There are other uses; please see the ``*__gen*`` 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. 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, For benchmarking the effects of changes (simulation speed, memory consumption,
verilation time, etc.), you can use `RTLMeter Verilation time, etc.), you can use `RTLMeter
<https://github.com/verilator/rtlmeter>`__, a benchmark suite designed for this <https://github.com/verilator/rtlmeter>`__, a benchmark suite designed for this
purpose. The scripts provided with RTLMeter have many capabilities. For full purpose. The scripts provided with RTLMeter have many capabilities. For full
details, see the `documentation of RTLMeter 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`. 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 3. If grammar changes are needed, look at the IEEE 1800-2023 Appendix A, as
src/VParseGrammar.y, as this grammar supports the full SystemVerilog src/verilog.y generally follows the same rule layout.
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.
4. If a new Ast type is needed, add it to the appropriate V3AstNode*.h. 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. Follow the convention described above about the AstNode type hierarchy.

View File

@ -279,11 +279,11 @@ static inline IData VL_RTOI_I_D(double lhs) VL_PURE { return static_cast<int32_t
// Sign extend such that if MSB set, we get ffff_ffff, else 0s // Sign extend such that if MSB set, we get ffff_ffff, else 0s
// (Requires clean input) // (Requires clean input)
#define VL_SIGN_I(nbits, lhs) ((lhs) >> VL_BITBIT_I((nbits)-VL_UL(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_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_E(nbits, lhs) ((lhs) >> VL_BITBIT_E((nbits) - VL_EUL(1)))
#define VL_SIGN_W(nbits, rwp) \ #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))) #define VL_SIGNONES_E(nbits, lhs) (-(VL_SIGN_E(nbits, lhs)))
// Sign bit extended up to MSB, doesn't include unsigned portion // 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; \ lsb += BITS_PER_DIGIT; \
} \ } \
if (lsb < (obits)) { \ if (lsb < (obits)) { \
const uint32_t msb_data = VL_SEL_IWII((obits) + 1, (rwp).data(), lsb, (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); \ *chunkp = msb_data & VL_MASK_E((obits) - lsb); \
} \ } \
_butemp.set(0, *(rwp).data() & 1); /* force update the sign */ \ _butemp.set(0, *(rwp).data() & 1); /* force update the sign */ \
(svar).write(_butemp); \ (svar).write(_butemp); \

View File

@ -60,7 +60,7 @@ class VerilatedScTraceBase VL_NOT_FINAL : private sc_core::sc_object,
private sc_core::sc_trace_file { private sc_core::sc_trace_file {
bool m_enableDeltaCycles = false; bool m_enableDeltaCycles = false;
bool m_traceFileAdded = 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: public:
void enableDeltaCycles(bool flag = true) { void enableDeltaCycles(bool flag = true) {

View File

@ -105,7 +105,7 @@ protected:
void commitTraceBuffer(Buffer*) override; void commitTraceBuffer(Buffer*) override;
// Configure sub-class // Configure sub-class
void configure(const VerilatedTraceConfig&) override{}; void configure(const VerilatedTraceConfig&) override {};
public: public:
//========================================================================= //=========================================================================

View File

@ -1394,8 +1394,8 @@ void AstNode::dumpTreeFile(const string& filename, bool doDump) {
static void drawChildren(std::ostream& os, const AstNode* thisp, const AstNode* childp, static void drawChildren(std::ostream& os, const AstNode* thisp, const AstNode* childp,
const std::string& childName) { const std::string& childName) {
if (childp) { if (childp) {
os << "\tn" << cvtToHex(thisp) << " -> n" << cvtToHex(childp) << " [" os << "\tn" << cvtToHex(thisp) << " -> n" << cvtToHex(childp) << " [" << "label=\""
<< "label=\"" << childName << "\" color=red];\n"; << childName << "\" color=red];\n";
for (const AstNode* nodep = childp; nodep; nodep = nodep->nextp()) { for (const AstNode* nodep = childp; nodep; nodep = nodep->nextp()) {
nodep->dumpTreeDot(os); nodep->dumpTreeDot(os);
if (nodep->nextp()) { 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 { void AstNode::dumpTreeDot(std::ostream& os) const {
os << "\tn" << cvtToHex(this) << "\t[" os << "\tn" << cvtToHex(this) << "\t[" << "label=\"" << typeName() << "\\n"
<< "label=\"" << typeName() << "\\n"
<< name() << "\"];\n"; << name() << "\"];\n";
drawChildren(os, this, m_op1p, "op1"); drawChildren(os, this, m_op1p, "op1");
drawChildren(os, this, m_op2p, "op2"); drawChildren(os, this, m_op2p, "op2");
@ -1447,8 +1446,7 @@ void AstNode::dumpTreeDotFile(const string& filename, bool doDump) {
const std::unique_ptr<std::ofstream> treedotp{V3File::new_ofstream(filename)}; const std::unique_ptr<std::ofstream> treedotp{V3File::new_ofstream(filename)};
if (treedotp->fail()) v3fatal("Can't write file: " << filename); if (treedotp->fail()) v3fatal("Can't write file: " << filename);
*treedotp << "digraph vTree{\n"; *treedotp << "digraph vTree{\n";
*treedotp << "\tgraph\t[label=\"" << filename + ".dot" *treedotp << "\tgraph\t[label=\"" << filename + ".dot" << "\",\n";
<< "\",\n";
*treedotp << "\t\t labelloc=t, labeljust=l,\n"; *treedotp << "\t\t labelloc=t, labeljust=l,\n";
*treedotp << "\t\t //size=\"7.5,10\",\n" *treedotp << "\t\t //size=\"7.5,10\",\n"
<< "];\n"; << "];\n";

View File

@ -2135,7 +2135,7 @@ protected:
AstNode(VNType t, FileLine* fl); AstNode(VNType t, FileLine* fl);
virtual AstNode* clone() = 0; // Generally, cloneTree is what you want instead virtual AstNode* clone() = 0; // Generally, cloneTree is what you want instead
virtual void cloneRelink() { cloneRelinkGen(); } virtual void cloneRelink() { cloneRelinkGen(); }
virtual void cloneRelinkGen(){}; // Overrides generated by 'astgen' virtual void cloneRelinkGen() {}; // Overrides generated by 'astgen'
void cloneRelinkTree(); void cloneRelinkTree();
// METHODS // METHODS
@ -2174,7 +2174,8 @@ protected:
virtual bool sameNode(const AstNode*) const { return true; } virtual bool sameNode(const AstNode*) const { return true; }
// Generated by 'astgen'. If do an oldp->replaceNode(newp), would cause a broken() // Generated by 'astgen'. If do an oldp->replaceNode(newp), would cause a broken()
virtual bool wouldBreakGen(const AstNode* const oldp, 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: public:
// ACCESSORS // ACCESSORS

View File

@ -479,8 +479,7 @@ class V3ControlScopeTraceResolver final {
public: public:
void addScopeTraceOn(bool on, const string& scope, int levels) { void addScopeTraceOn(bool on, const string& scope, int levels) {
UINFO(9, "addScopeTraceOn " << on << " '" << scope << "' " UINFO(9, "addScopeTraceOn " << on << " '" << scope << "' " << " levels=" << levels);
<< " levels=" << levels);
m_entries.emplace_back(V3ControlScopeTraceEntry{scope, on, levels}); m_entries.emplace_back(V3ControlScopeTraceEntry{scope, on, levels});
m_matchCache.clear(); m_matchCache.clear();
} }

View File

@ -387,18 +387,18 @@ class DelayedVisitor final : public VNVisitor {
if (bIt != blkRefs.end() && nIt != nbaRefs.end()) { if (bIt != blkRefs.end() && nIt != nbaRefs.end()) {
const Ref& blkRef = *bIt; const Ref& blkRef = *bIt;
const Ref& nbaRef = *nIt; const Ref& nbaRef = *nIt;
vscp->v3warn(BLKANDNBLK, vscp->v3warn(BLKANDNBLK, "Unsupported: Blocking and non-blocking assignments to "
"Unsupported: Blocking and non-blocking assignments to " "potentially overlapping bits of same packed variable: "
"potentially overlapping bits of same packed variable: " << vscp->varp()->prettyNameQ() << '\n'
<< vscp->varp()->prettyNameQ() << '\n' << vscp->warnContextPrimary() << '\n'
<< vscp->warnContextPrimary() << '\n' << blkRef.m_refp->warnOther()
<< blkRef.m_refp->warnOther() << "... Location of blocking assignment" << "... Location of blocking assignment" << " (bits ["
<< " (bits [" << blkRef.m_msb << ":" << blkRef.m_lsb << "])\n" << blkRef.m_msb << ":" << blkRef.m_lsb << "])\n"
<< blkRef.m_refp->warnContextSecondary() << '\n' << blkRef.m_refp->warnContextSecondary() << '\n'
<< nbaRef.m_refp->warnOther() << nbaRef.m_refp->warnOther()
<< "... Location of nonblocking assignment" << "... Location of nonblocking assignment" << " (bits ["
<< " (bits [" << nbaRef.m_msb << ":" << nbaRef.m_lsb << "])\n" << nbaRef.m_msb << ":" << nbaRef.m_lsb << "])\n"
<< nbaRef.m_refp->warnContextSecondary()); << nbaRef.m_refp->warnContextSecondary());
} }
return true; return true;

View File

@ -384,9 +384,8 @@ class HierCellsXmlVisitor final : public VNVisitorConst {
&& nodep->level() <= 2) { // ==2 because we don't add wrapper when in XML mode && nodep->level() <= 2) { // ==2 because we don't add wrapper when in XML mode
m_os << "<cells>\n"; m_os << "<cells>\n";
m_os << "<cell " << nodep->fileline()->xmlDetailedLocation() // m_os << "<cell " << nodep->fileline()->xmlDetailedLocation() //
<< " name=\"" << nodep->prettyName() << "\"" << " name=\"" << nodep->prettyName() << "\"" << " submodname=\""
<< " submodname=\"" << nodep->prettyName() << "\"" << nodep->prettyName() << "\"" << " hier=\"" << nodep->prettyName() << "\"";
<< " hier=\"" << nodep->prettyName() << "\"";
m_hier = nodep->prettyName() + "."; m_hier = nodep->prettyName() + ".";
m_hasChildren = false; m_hasChildren = false;
iterateChildrenConst(nodep); iterateChildrenConst(nodep);
@ -402,9 +401,8 @@ class HierCellsXmlVisitor final : public VNVisitorConst {
if (nodep->modp() && nodep->modp()->dead()) return; if (nodep->modp() && nodep->modp()->dead()) return;
if (!m_hasChildren) m_os << ">\n"; if (!m_hasChildren) m_os << ">\n";
m_os << "<cell " << nodep->fileline()->xmlDetailedLocation() << " name=\"" << nodep->name() m_os << "<cell " << nodep->fileline()->xmlDetailedLocation() << " name=\"" << nodep->name()
<< "\"" << "\"" << " submodname=\"" << nodep->modName() << "\"" << " hier=\""
<< " submodname=\"" << nodep->modName() << "\"" << m_hier + nodep->name() << "\"";
<< " hier=\"" << m_hier + nodep->name() << "\"";
const std::string hier = m_hier; const std::string hier = m_hier;
m_hier += nodep->name() + "."; m_hier += nodep->name() + ".";
m_hasChildren = false; m_hasChildren = false;

View File

@ -432,8 +432,8 @@ void FileLine::v3errorEnd(std::ostringstream& sstr, const string& extra)
wsstr << '\n'; wsstr << '\n';
std::ostringstream extrass; // extra spaced out for prefix std::ostringstream extrass; // extra spaced out for prefix
if (!extra.empty()) { if (!extra.empty()) {
extrass << V3Error::warnContextBegin() << std::setw(ascii().length()) << " " extrass << V3Error::warnContextBegin() << std::setw(ascii().length()) << " " << ": "
<< ": " << V3Error::warnContextEnd() << extra; << V3Error::warnContextEnd() << extra;
} }
if (warnIsOff(V3Error::s().errorCode())) { if (warnIsOff(V3Error::s().errorCode())) {
V3Error::s().suppressThisWarning(); V3Error::s().suppressThisWarning();

View File

@ -330,8 +330,8 @@ void V3Graph::dumpDotFile(const string& filename, bool colorAsSubgraph) const {
} }
} }
if (subgr != "") *logp << "\t"; if (subgr != "") *logp << "\t";
*logp << "\tn" << vertexp->dotName() << (n++) << "\t[fontsize=8 " *logp << "\tn" << vertexp->dotName() << (n++) << "\t[fontsize=8 " << "label=\""
<< "label=\"" << (vertexp->name() != "" ? vertexp->name() : "\\N"); << (vertexp->name() != "" ? vertexp->name() : "\\N");
if (vertexp->rank()) *logp << " r" << vertexp->rank(); if (vertexp->rank()) *logp << " r" << vertexp->rank();
if (vertexp->fanout() != 0.0) *logp << " f" << vertexp->fanout(); if (vertexp->fanout() != 0.0) *logp << " f" << vertexp->fanout();
if (vertexp->color()) *logp << "\\n c" << vertexp->color(); 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.name()!="" ? edge.name() : "\\E")<<"\""
<< "fontsize=8 label=\"" << (edge.dotLabel() != "" ? edge.dotLabel() : "") << "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.dotStyle() != "") *logp << " style=" << edge.dotStyle();
// if (edge.cutable()) *logp << ",constraint=false"; // to rank without // if (edge.cutable()) *logp << ",constraint=false"; // to rank without
// following edges // following edges

View File

@ -3697,9 +3697,9 @@ class LinkDotResolveVisitor final : public VNVisitor {
if (foundp) { if (foundp) {
nodep->v3error("Found definition of '" nodep->v3error("Found definition of '"
<< m_ds.m_dotText << (m_ds.m_dotText == "" ? "" : ".") << m_ds.m_dotText << (m_ds.m_dotText == "" ? "" : ".")
<< nodep->prettyName() << "'" << nodep->prettyName() << "'" << " as a "
<< " as a " << foundp->nodep()->typeName() << foundp->nodep()->typeName() << " but expected a "
<< " but expected a " << expectWhat); << expectWhat);
} else if (m_ds.m_dotText == "") { } else if (m_ds.m_dotText == "") {
UINFO(1, " ErrParseRef curSymp=se" << cvtToHex(m_curSymp) UINFO(1, " ErrParseRef curSymp=se" << cvtToHex(m_curSymp)
<< " ds=" << m_ds.ascii()); << " ds=" << m_ds.ascii());
@ -3710,15 +3710,16 @@ class LinkDotResolveVisitor final : public VNVisitor {
<< expectWhat << ": " << nodep->prettyNameQ() << '\n' << expectWhat << ": " << nodep->prettyNameQ() << '\n'
<< (suggest.empty() ? "" : nodep->warnMore() + suggest)); << (suggest.empty() ? "" : nodep->warnMore() + suggest));
} else { } else {
nodep->v3error("Can't find definition of " nodep->v3error(
<< (!baddot.empty() ? AstNode::prettyNameQ(baddot) "Can't find definition of "
: nodep->prettyNameQ()) << (!baddot.empty() ? AstNode::prettyNameQ(baddot)
<< " in dotted " << expectWhat << ": '" : nodep->prettyNameQ())
<< m_ds.m_dotText + "." + nodep->prettyName() << "'\n" << " in dotted " << expectWhat << ": '"
<< nodep->warnContextPrimary() << m_ds.m_dotText + "." + nodep->prettyName() << "'\n"
<< (okSymp ? okSymp->cellErrorScopes( << nodep->warnContextPrimary()
nodep, AstNode::prettyName(m_ds.m_dotText)) << (okSymp ? okSymp->cellErrorScopes(
: "")); nodep, AstNode::prettyName(m_ds.m_dotText))
: ""));
} }
m_ds.m_dotErr = true; m_ds.m_dotErr = true;
} }
@ -4233,8 +4234,8 @@ class LinkDotResolveVisitor final : public VNVisitor {
} else { } else {
nodep->v3error("Found definition of '" nodep->v3error("Found definition of '"
<< m_ds.m_dotText << (m_ds.m_dotText == "" ? "" : ".") << m_ds.m_dotText << (m_ds.m_dotText == "" ? "" : ".")
<< nodep->prettyName() << "'" << nodep->prettyName() << "'" << " as a "
<< " as a " << foundp->nodep()->typeName() << foundp->nodep()->typeName()
<< " but expected a task/function"); << " but expected a task/function");
} }
} else if (VN_IS(nodep, New) && m_statep->forPrearray()) { } else if (VN_IS(nodep, New) && m_statep->forPrearray()) {

View File

@ -1399,9 +1399,8 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc,
m_hierBlocks.emplace(opt.mangledName(), opt); m_hierBlocks.emplace(opt.mangledName(), opt);
}); });
DECL_OPTION("-hierarchical-child", Set, &m_hierChild); DECL_OPTION("-hierarchical-child", Set, &m_hierChild);
DECL_OPTION("-hierarchical-params-file", CbVal, [this](const char* optp) { DECL_OPTION("-hierarchical-params-file", CbVal,
m_hierParamsFile.push_back({optp, work()}); [this](const char* optp) { m_hierParamsFile.push_back({optp, work()}); });
});
DECL_OPTION("-I", CbPartialMatch, DECL_OPTION("-I", CbPartialMatch,
[this, &optdir](const char* optp) { addIncDirUser(parseFileArg(optdir, optp)); }); [this, &optdir](const char* optp) { addIncDirUser(parseFileArg(optdir, optp)); });

View File

@ -740,8 +740,8 @@ void V3PreLex::dumpStack() { // LCOV_EXCL_START
std::stack<VPreStream*> tmpstack = LEXP->m_streampStack; std::stack<VPreStream*> tmpstack = LEXP->m_streampStack;
while (!tmpstack.empty()) { while (!tmpstack.empty()) {
const VPreStream* const streamp = tmpstack.top(); const VPreStream* const streamp = tmpstack.top();
cout << "- bufferStack[" << cvtToHex(streamp) << "]: " cout << "- bufferStack[" << cvtToHex(streamp)
<< " at=" << streamp->m_curFilelinep << " nBuf=" << streamp->m_buffers.size() << "]: " << " at=" << streamp->m_curFilelinep << " nBuf=" << streamp->m_buffers.size()
<< " size0=" << (streamp->m_buffers.empty() ? 0 : streamp->m_buffers.front().length()) << " size0=" << (streamp->m_buffers.empty() ? 0 : streamp->m_buffers.front().length())
<< (streamp->m_eof ? " [EOF]" : "") << (streamp->m_file ? " [FILE]" : "") << endl; << (streamp->m_eof ? " [EOF]" : "") << (streamp->m_file ? " [FILE]" : "") << endl;
tmpstack.pop(); tmpstack.pop();

View File

@ -149,9 +149,8 @@ private:
AstNodeExpr* const senp = senItemp->sensp(); AstNodeExpr* const senp = senItemp->sensp();
const auto currp = [this, senp]() { return getCurr(senp); }; const auto currp = [this, senp]() { return getCurr(senp); };
const auto prevp = [this, flp, senp]() { const auto prevp
return new AstVarRef{flp, getPrev(senp), VAccess::READ}; = [this, flp, senp]() { return new AstVarRef{flp, getPrev(senp), VAccess::READ}; };
};
const auto lsb = [=](AstNodeExpr* opp) { return new AstSel{flp, opp, 0, 1}; }; const auto lsb = [=](AstNodeExpr* opp) { return new AstSel{flp, opp, 0, 1}; };
// All event signals should be 1-bit at this point // All event signals should be 1-bit at this point

View File

@ -234,8 +234,7 @@ private:
<< chkvis.instrCount() << " Data=" << chkvis.dataCount() << chkvis.instrCount() << " Data=" << chkvis.dataCount()
<< " in width (bits)=" << m_inWidthBits << " out width (bytes)=" << " in width (bits)=" << m_inWidthBits << " out width (bytes)="
<< m_outWidthBytes << " Spacetime=" << (space / time) << "(" << m_outWidthBytes << " Spacetime=" << (space / time) << "("
<< space << "/" << time << ")" << space << "/" << time << ")" << ": " << nodep);
<< ": " << nodep);
if (chkvis.optimizable()) { if (chkvis.optimizable()) {
UINFO(3, " Table Optimize spacetime=" << (space / time) << " " << nodep); UINFO(3, " Table Optimize spacetime=" << (space / time) << " " << nodep);
m_totalBytes += space; m_totalBytes += space;

View File

@ -95,7 +95,7 @@ enum ForkType : uint8_t {
enum PropagationType : uint8_t { enum PropagationType : uint8_t {
P_CALL = 1, // Propagation through call to a function/task/method 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 P_SIGNATURE = 3, // Propagation required to maintain C++ function's signature requirements
}; };

View File

@ -685,7 +685,7 @@ public:
// Now that we have everything ready, remove redundant pushPrefix/popPrefix // Now that we have everything ready, remove redundant pushPrefix/popPrefix
// pairs. While functionally this is not really necessary (the trace files // pairs. While functionally this is not really necessary (the trace files
// might have some empty scope declarations), we do it to preserve previous // 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. // push/pop pairs is a bit hard. It is cleaner to remove them.
removeRedundantPrefixPushPop(); removeRedundantPrefixPushPop();

View File

@ -129,9 +129,9 @@ class UnknownVisitor final : public VNVisitor {
fl, condp, fl, condp,
(needDly (needDly
? static_cast<AstNode*>(new AstAssignDly{ ? static_cast<AstNode*>(new AstAssignDly{
fl, prep, new AstVarRef{fl, varp, VAccess::READ}, m_timingControlp}) fl, prep, new AstVarRef{fl, varp, VAccess::READ}, m_timingControlp})
: static_cast<AstNode*>(new AstAssign{ : static_cast<AstNode*>(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->branchPred(VBranchPred::BP_LIKELY);
newp->isBoundsCheck(true); newp->isBoundsCheck(true);
UINFOTREE(9, newp, "", "_new"); UINFOTREE(9, newp, "", "_new");

View File

@ -4561,11 +4561,12 @@ class WidthVisitor final : public VNVisitor {
refp = m_vup ? VN_CAST(m_vup->dtypeNullSkipRefp(), ClassRefDType) : nullptr; refp = m_vup ? VN_CAST(m_vup->dtypeNullSkipRefp(), ClassRefDType) : nullptr;
} }
if (!refp) { // e.g. int a = new; if (!refp) { // e.g. int a = new;
nodep->v3error("new() assignment not legal to non-class " nodep->v3error(
+ (VN_IS(warnp, NodeDType) ? ( "new() assignment not legal to non-class "
"data type "s + VN_AS(warnp, NodeDType)->prettyDTypeNameQ()) + (VN_IS(warnp, NodeDType)
: warnp ? warnp->prettyNameQ() ? ("data type "s + VN_AS(warnp, NodeDType)->prettyDTypeNameQ())
: "")); : warnp ? warnp->prettyNameQ()
: ""));
nodep->dtypep(m_vup->dtypep()); nodep->dtypep(m_vup->dtypep());
return; return;
} }
@ -5981,8 +5982,8 @@ class WidthVisitor final : public VNVisitor {
// Must be a error according to spec // Must be a error according to spec
// (Because we need to know if to connect to one or all instants) // (Because we need to know if to connect to one or all instants)
nodep->v3error(ucfirst(nodep->prettyOperatorName()) nodep->v3error(ucfirst(nodep->prettyOperatorName())
<< " as part of a module instance array" << " as part of a module instance array" << " requires "
<< " requires " << modwidth << " or " << modwidth * numInsts << modwidth << " or " << modwidth * numInsts
<< " bits, but connection's " << " bits, but connection's "
<< nodep->exprp()->prettyTypeName() << " generates " << conwidth << nodep->exprp()->prettyTypeName() << " generates " << conwidth
<< " bits. (IEEE 1800-2023 23.3.3)"); << " bits. (IEEE 1800-2023 23.3.3)");
@ -5993,8 +5994,8 @@ class WidthVisitor final : public VNVisitor {
if (nodep->modVarp()->direction() == VDirection::REF) { if (nodep->modVarp()->direction() == VDirection::REF) {
nodep->v3error("Ref connection " nodep->v3error("Ref connection "
<< nodep->modVarp()->prettyNameQ() << nodep->modVarp()->prettyNameQ()
<< " requires matching types;" << " requires matching types;" << " ref requires "
<< " ref requires " << modDTypep->prettyDTypeNameQ() << modDTypep->prettyDTypeNameQ()
<< " data type but connection is " << " data type but connection is "
<< conDTypep->prettyDTypeNameQ() << " data type."); << conDTypep->prettyDTypeNameQ() << " data type.");
} else if (nodep->modVarp()->isTristate()) { } else if (nodep->modVarp()->isTristate()) {
@ -6023,8 +6024,7 @@ class WidthVisitor final : public VNVisitor {
nodep->v3error("Illegal " << nodep->prettyOperatorName() << "," nodep->v3error("Illegal " << nodep->prettyOperatorName() << ","
<< " mismatch between port which is" << " mismatch between port which is"
<< (VN_CAST(modDTypep, IfaceRefDType) ? "" : " not") << (VN_CAST(modDTypep, IfaceRefDType) ? "" : " not")
<< " an interface," << " an interface," << " and expression which is"
<< " and expression which is"
<< (VN_CAST(conDTypep, IfaceRefDType) ? "" : " not") << (VN_CAST(conDTypep, IfaceRefDType) ? "" : " not")
<< " an interface."); << " an interface.");
} }
@ -6045,12 +6045,11 @@ class WidthVisitor final : public VNVisitor {
UINFO(1, " Related lo: " << modDTypep); UINFO(1, " Related lo: " << modDTypep);
UINFO(1, " Related hi: " << conDTypep); UINFO(1, " Related hi: " << conDTypep);
} else if ((exprArrayp && !modArrayp) || (!exprArrayp && modArrayp)) { } else if ((exprArrayp && !modArrayp) || (!exprArrayp && modArrayp)) {
nodep->v3error("Illegal " << nodep->prettyOperatorName() << "," nodep->v3error(
<< " mismatch between port which is" "Illegal "
<< (modArrayp ? "" : " not") << " an array," << nodep->prettyOperatorName() << "," << " mismatch between port which is"
<< " and expression which is" << (modArrayp ? "" : " not") << " an array," << " and expression which is"
<< (exprArrayp ? "" : " not") << (exprArrayp ? "" : " not") << " an array. (IEEE 1800-2023 7.6)");
<< " an array. (IEEE 1800-2023 7.6)");
UINFO(1, " Related lo: " << modDTypep); UINFO(1, " Related lo: " << modDTypep);
UINFO(1, " Related hi: " << conDTypep); UINFO(1, " Related hi: " << conDTypep);
} }

View File

@ -44,7 +44,7 @@ void compareWls(int obits, WDataInP const lwp, WDataInP const rwp) {
sc_biguint<(obits)> _butemp; \ sc_biguint<(obits)> _butemp; \
for (int i = 0; i < VL_WORDS_I(obits); ++i) { \ for (int i = 0; i < VL_WORDS_I(obits); ++i) { \
int msb = ((i + 1) * VL_IDATASIZE) - 1; \ 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]; \ _butemp.range(msb, i* VL_IDATASIZE) = (rwp)[i]; \
} \ } \
(svar).write(_butemp); \ (svar).write(_butemp); \

View File

@ -72,8 +72,7 @@ int main(int argc, char** argv) {
} else if (pid == 0) { } else if (pid == 0) {
printf("child: here we go\n"); printf("child: here we go\n");
} else { } else {
while (wait(nullptr) > 0) while (wait(nullptr) > 0);
;
printf("parent: here we go\n"); printf("parent: here we go\n");
topp->is_parent = 1; topp->is_parent = 1;
} }