From f883b1c858c91f4977d565eb47d6215de1190a96 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Tue, 22 Sep 2026 07:20:46 -0400 Subject: [PATCH] Commentary. No functional change --- include/verilated.h | 8 +++----- include/verilated_covergroup.h | 4 ++-- include/verilated_force.h | 6 +++--- include/verilated_profiler.h | 2 +- include/verilated_sym_props.h | 6 +++--- include/verilated_threads.h | 2 +- include/verilated_timing.h | 7 +++---- include/verilated_trace.h | 6 +++--- include/verilatedos.h | 2 +- src/V3Ast.h | 2 +- src/V3AstAttr.h | 4 ++-- src/V3AstNodeDType.h | 22 +++++++++++----------- src/V3AstNodeExpr.h | 6 +++--- src/V3AstNodeOther.h | 12 ++++++------ src/V3AstNodes.cpp | 2 +- src/V3Combine.cpp | 4 ++-- src/V3Const.cpp | 28 ++++++++++++++-------------- src/V3Control.cpp | 12 ++++++------ src/V3DfgBreakCycles.cpp | 8 ++++---- src/V3DfgContext.h | 19 ++++++++++--------- src/V3DfgSynthesize.cpp | 6 +++--- src/V3EmitCHeaders.cpp | 2 +- src/V3EmitCSyms.cpp | 26 +++++++++++++------------- src/V3EmitMk.cpp | 4 ++-- src/V3File.cpp | 6 +++--- src/V3Force.cpp | 32 ++++++++++++++++---------------- src/V3FsmDetect.cpp | 2 +- src/V3HashTable.h | 2 +- src/V3InstrCount.cpp | 6 +++--- src/V3OptionParser.cpp | 2 +- src/V3OptionParser.h | 2 +- src/V3OrderMTaskContraction.cpp | 6 +++--- src/V3OrderMoveGraph.h | 4 ++-- src/V3Param.cpp | 2 +- src/V3Simulate.h | 6 +++--- src/V3SplitVar.cpp | 16 ++++++++-------- src/V3StackCount.cpp | 6 +++--- src/V3String.h | 4 ++-- src/V3Trace.cpp | 2 +- src/V3Tristate.cpp | 14 +++++++------- src/V3Unroll.h | 2 +- 41 files changed, 156 insertions(+), 158 deletions(-) diff --git a/include/verilated.h b/include/verilated.h index 20e251a40..9b4c30208 100644 --- a/include/verilated.h +++ b/include/verilated.h @@ -261,7 +261,7 @@ class VL_SCOPED_CAPABILITY VerilatedLockGuard final { VL_UNCOPYABLE(VerilatedLockGuard); private: - VerilatedMutex& m_mutexr; + VerilatedMutex& m_mutexr; // Mutex protecting the guard public: /// Construct and hold given mutex lock until destruction or unlock() @@ -380,8 +380,7 @@ class VerilatedEvalLoop final { const uint32_t m_convergeLimit; // --converge-limit from compiler command line // Where to record --prof-exec sections, or null if not profiling VlExecutionProfilerBase* m_profilerp = nullptr; - // Whether this is the top level model during profiling - bool m_profTopLevel = false; + bool m_profTopLevel = false; // Top level model during profiling public: // CONSTRUCTORS @@ -607,9 +606,8 @@ protected: // List of free descriptors in the MCT region [4, 32) std::vector m_fdFreeMct VL_GUARDED_BY(m_fdMutex); - // Magic to check for bad construction static constexpr uint64_t MAGIC = 0xC35F9A6E5298EE6EULL; // SHA256 "VerilatedContext" - uint64_t m_magic = MAGIC; + uint64_t m_magic = MAGIC; // Magic to check for bad construction private: // CONSTRUCTORS diff --git a/include/verilated_covergroup.h b/include/verilated_covergroup.h index 04b5dd9c5..c82328172 100644 --- a/include/verilated_covergroup.h +++ b/include/verilated_covergroup.h @@ -240,8 +240,8 @@ protected: }; template class View final { - T* m_beginp; - T* m_endp; + T* m_beginp; // First element of the viewed slice + T* m_endp; // One past the last element of the viewed slice public: View(T* datap, uint64_t size) diff --git a/include/verilated_force.h b/include/verilated_force.h index 8b3155540..d790d9109 100644 --- a/include/verilated_force.h +++ b/include/verilated_force.h @@ -105,9 +105,9 @@ private: int m_msb; // Inclusive upper bit for scalar path or element index for unpacked int m_rhsLsb; // Destination index that maps to RHS index 0 const void* m_rhsDatap; // Pointer to RHS storage - int m_bitLsb = 0; - int m_bitMsb = 0; - int m_elemWidth = 0; + int m_bitLsb = 0; // Bit's LSB + int m_bitMsb = 0; // Bit's MSB + int m_elemWidth = 0; // Element width }; std::vector m_entries; // Sorted by msb, non-overlapping diff --git a/include/verilated_profiler.h b/include/verilated_profiler.h index cb57ae219..b9be9432c 100644 --- a/include/verilated_profiler.h +++ b/include/verilated_profiler.h @@ -169,7 +169,7 @@ class VlExecutionProfiler final : public VlExecutionProfilerBase { // STATE VerilatedContext& m_context; // The context this profiler is under static thread_local ExecutionTrace t_trace; // thread-local trace buffers - mutable VerilatedMutex m_mutex; + mutable VerilatedMutex m_mutex; // Mutex protecting traces // Map from thread id to &t_trace of given thread std::map m_traceps VL_GUARDED_BY(m_mutex); diff --git a/include/verilated_sym_props.h b/include/verilated_sym_props.h index 030e14507..562d7604e 100644 --- a/include/verilated_sym_props.h +++ b/include/verilated_sym_props.h @@ -38,8 +38,8 @@ // See also V3Ast::VNumRange class VerilatedRange final { - int m_left = 0; - int m_right = 0; + int m_left = 0; // Left side of range (pre-':') + int m_right = 0; // Right side of range (post-':') protected: friend class VerilatedVarProps; @@ -283,7 +283,7 @@ class VerilatedVar final : public VerilatedVarProps { m_forceControlSignals; // Force control signals protected: - const bool m_isParam; + const bool m_isParam; // From a parameter friend class VerilatedScope; // CONSTRUCTORS VerilatedVar(const char* namep, void* datap, VerilatedVarType vltype, diff --git a/include/verilated_threads.h b/include/verilated_threads.h index 205761545..95a61db0f 100644 --- a/include/verilated_threads.h +++ b/include/verilated_threads.h @@ -140,7 +140,7 @@ class VlWorkerThread final { }; // MEMBERS - mutable VerilatedMutex m_mutex; + mutable VerilatedMutex m_mutex; // Protection mutex std::condition_variable_any m_cv; // Only notify the condition_variable if the worker is waiting bool m_waiting VL_GUARDED_BY(m_mutex) = false; diff --git a/include/verilated_timing.h b/include/verilated_timing.h index 84802c319..81025d9c9 100644 --- a/include/verilated_timing.h +++ b/include/verilated_timing.h @@ -71,13 +71,12 @@ class VlFileLineDebug final { // MEMBERS #ifdef VL_DEBUG - const char* m_filename = nullptr; - int m_lineno = 0; + const char* m_filename = nullptr; // Filename from sources, nullptr for unlnown + int m_lineno = 0; // Line number from sources #endif public: // CONSTRUCTORS - // Construct VlFileLineDebug() = default; VlFileLineDebug(const char* filename, int lineno) #ifdef VL_DEBUG @@ -431,7 +430,7 @@ class VlForkSyncState final { public: size_t m_counter = 0; // When reaches 0, resume suspended coroutine VlCoroutineHandle m_susp; // Coroutine to resume - bool m_inited = false; + bool m_inited = false; // Initialization complete size_t m_pendingDones = 0; // done() calls seen before init() (e.g. early killed branch) bool m_inDone = false; // Guard against re-entrant resume recursion from nested kills bool m_resumePending = false; // Join reached zero again while inside done() diff --git a/include/verilated_trace.h b/include/verilated_trace.h index de8f89946..354cd37b4 100644 --- a/include/verilated_trace.h +++ b/include/verilated_trace.h @@ -147,9 +147,9 @@ private: struct CallbackRecord final { union { // The callback - const initCb_t m_initCb; - const dumpCb_t m_dumpCb; - const cleanupCb_t m_cleanupCb; + const initCb_t m_initCb; // Init-callback constructor + const dumpCb_t m_dumpCb; // Dump-callback constructor + const cleanupCb_t m_cleanupCb; // Cleanup-callback constructor }; const uint32_t m_fidx; // The index of the tracing function void* const m_userp; // The user pointer to pass to the callback (the symbol table) diff --git a/include/verilatedos.h b/include/verilatedos.h index 7568d752f..a0f1ba1c3 100644 --- a/include/verilatedos.h +++ b/include/verilatedos.h @@ -747,7 +747,7 @@ namespace vlstd { template struct reverse_wrapper final { - const T& m_v; + const T& m_v; // Pre-wrapped iterator explicit reverse_wrapper(const T& a_v) : m_v(a_v) {} // Need () constructor diff --git a/src/V3Ast.h b/src/V3Ast.h index 36e28df06..97e2b7138 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -391,7 +391,7 @@ protected: RELINK_OP4 }; AstNode* m_oldp = nullptr; // The old node that was linked to this point in the tree - AstNode* m_backp = nullptr; + AstNode* m_backp = nullptr; // Saved AstNode::m_backp of the unlinked node, to relink AstNode** m_iterpp = nullptr; RelinkWhatEn m_chg = RELINK_BAD; diff --git a/src/V3AstAttr.h b/src/V3AstAttr.h index eb130ef9c..6623605b8 100644 --- a/src/V3AstAttr.h +++ b/src/V3AstAttr.h @@ -1764,8 +1764,8 @@ inline std::ostream& operator<<(std::ostream& os, const VLifetime& rhs) { class VNumRange final { public: - int m_left = 0; - int m_right = 0; + int m_left = 0; // Left side of range (pre-':') + int m_right = 0; // Right side of range (post-':') bool m_ranged = false; // Has a range bool operator==(const VNumRange& rhs) const { return m_left == rhs.m_left && m_right == rhs.m_right && m_ranged == rhs.m_ranged; diff --git a/src/V3AstNodeDType.h b/src/V3AstNodeDType.h index 887e93ba7..74b3b3adc 100644 --- a/src/V3AstNodeDType.h +++ b/src/V3AstNodeDType.h @@ -250,8 +250,8 @@ class AstNodeUOrStructDType VL_NOT_FINAL : public AstNodeDType { // // @astgen ptr := m_classOrPackagep : Optional[AstNodeModule] // Package emitted with string m_name; // Name from upper typedef, if any - const int m_uniqueNum; - bool m_packed; + const int m_uniqueNum; // Unique ID distinguishing this dtype instance, for hashing/naming + bool m_packed; // Packed struct/union, else unpacked bool m_isFourstate = false; // V3Width computes; true if any member is 4-state bool m_constrainedRand = false; // True if struct has constraint expression bool m_emitToString = false; // Generate to_string() for this struct/union if set @@ -319,7 +319,7 @@ public: class AstEnumItem final : public AstNode { // @astgen op1 := rangep : Optional[AstRange] // Range for name appending // @astgen op2 := valuep : Optional[AstNodeExpr] - string m_name; + string m_name; // Name of item public: // Parents: ENUM @@ -693,10 +693,10 @@ public: class AstCoverCrossDType final : public AstNodeDType { // Borrowed pointer to VlCoverCrossT. const uint32_t m_dimensions; - const uint32_t m_tuples; - const uint32_t m_bins; - const uint32_t m_autoBins; - const uint64_t m_binWords; + const uint32_t m_tuples; // Fixed capacity number of cross tuples (VlCoverCrossT's Tuples) + const uint32_t m_bins; // Fixed capacity number of explicit bins (VlCoverCrossT's Bins) + const uint32_t m_autoBins; // Fixed capacity number of auto bins (VlCoverCrossT's AutoBins) + const uint64_t m_binWords; // Fixed capacity selection words (VlCoverCrossT's BinWords) public: AstCoverCrossDType(FileLine* fl, uint32_t dimensions, uint32_t tuples, uint32_t bins, @@ -767,8 +767,8 @@ class AstDefImplicitDType final : public AstNodeDType { // This allows "var enum {...} a,b" to share the enum definition for both variables // After link, these become typedefs // @astgen op1 := childDTypep : Optional[AstNodeDType] - string m_name; - const int m_uniqueNum; + string m_name; // Data type name + const int m_uniqueNum; // Unique ID distinguishing this dtype instance, for hashing/naming public: AstDefImplicitDType(FileLine* fl, const string& name, VFlagChildDType, AstNodeDType* dtp) @@ -883,7 +883,7 @@ public: private: string m_name; // Name from upper typedef, if any - const int m_uniqueNum; + const int m_uniqueNum; // Unique ID distinguishing this dtype instance, for hashing/naming // dist-ast-dump-suppress // Skip dumping cache TableMap m_tableMap; // Created table for V3Width only to remove duplicates @@ -1051,7 +1051,7 @@ class AstMemberDType final : public AstNodeDType { string m_name; // Name of variable string m_tag; // Holds the string of the verilator tag -- used in JSON output. int m_lsb = -1; // Within this level's packed struct, the LSB of the first bit of the member - bool m_constrainedRand = false; + bool m_constrainedRand = false; // Member has a constraint expression VRandAttr m_rand; // Randomizability of this member (rand, randc, etc) public: AstMemberDType(FileLine* fl, const string& name, VFlagChildDType, AstNodeDType* dtp, diff --git a/src/V3AstNodeExpr.h b/src/V3AstNodeExpr.h index 8cd0625e4..70f5c0f72 100644 --- a/src/V3AstNodeExpr.h +++ b/src/V3AstNodeExpr.h @@ -1475,7 +1475,7 @@ class AstExprStmt final : public AstNodeExpr { // @astgen op1 := stmtsp : List[AstNode] // @astgen op2 := resultp : AstNodeExpr private: - bool m_hasResult = true; + bool m_hasResult = true; // Returns result via resultp() public: AstExprStmt(FileLine* fl, AstNode* stmtsp, AstNodeExpr* resultp) @@ -2035,7 +2035,7 @@ class AstParseRef final : public AstNodeExpr { // @astgen op1 := lhsp : Optional[AstNodeExpr] // @astgen op2 := ftaskrefp : Optional[AstNodeFTaskRef] - string m_name; + string m_name; // Name of the variable/function/task public: AstParseRef(FileLine* fl, const string& name, AstNodeExpr* lhsp = nullptr, @@ -2637,7 +2637,7 @@ class AstScopeName final : public AstNodeExpr { // For display %m and DPI context imports // Parents: AstSFormatF, AstNodeFTaskRef, AstNodeFTask std::string m_scopeAttr; - std::string m_scopeEntr; + std::string m_scopeEntr; // Scope path for the DPI import/export context name bool m_dpiExport = false; // Is for dpiExport const bool m_forFormat; // Is for a format %m static std::string scopeNameFormatter(const std::string& text); diff --git a/src/V3AstNodeOther.h b/src/V3AstNodeOther.h index 341497728..f3fe00acb 100644 --- a/src/V3AstNodeOther.h +++ b/src/V3AstNodeOther.h @@ -2107,10 +2107,10 @@ class AstTypedef final : public AstNode { // @astgen op1 := childDTypep : Optional[AstNodeDType] // @astgen op4 := attrsp : List[AstNode] // Attributes during early parse - string m_name; + string m_name; // Name of the typedef string m_tag; // Holds the string of the verilator tag -- used in JSON output. uint32_t m_declTokenNum; // Declaration token number - bool m_attrPublic = false; + bool m_attrPublic = false; // Marked with public; keep even if unused bool m_isHideLocal : 1; // Verilog local bool m_isHideProtected : 1; // Verilog protected bool m_isUnderClass : 1; // Underneath class @@ -2747,10 +2747,10 @@ class AstCoverOtherDecl final : public AstNodeCoverDecl { // Coverage analysis point declaration // Used for other than toggle types of coverage string m_linescov; - string m_fsmVar; - string m_fsmFrom; - string m_fsmTo; - string m_fsmTag; + string m_fsmVar; // FSM state variable name + string m_fsmFrom; // FSM source state label + string m_fsmTo; // FSM destination state label + string m_fsmTag; // FSM arc kind tag (e.g. reset, reset_include, default) int m_offset; // Offset column numbers to uniq-ify IFs public: AstCoverOtherDecl(FileLine* fl, const string& page, const string& comment, diff --git a/src/V3AstNodes.cpp b/src/V3AstNodes.cpp index f500cf0c1..46d449c50 100644 --- a/src/V3AstNodes.cpp +++ b/src/V3AstNodes.cpp @@ -3854,7 +3854,7 @@ string AstVar::dpiArgType(bool named, bool forReturn) const { } string AstVar::dpiTmpVarType(const string& varName) const { class converter final : public DpiTypesToStringConverter { - const string m_name; + const string m_name; // Variable name string arraySuffix(const AstVar* varp, size_t n) const { if (const AstUnpackArrayDType* const unpackp = VN_CAST(varp->dtypep()->skipRefp(), UnpackArrayDType)) { diff --git a/src/V3Combine.cpp b/src/V3Combine.cpp index fe7f99c4f..14f178142 100644 --- a/src/V3Combine.cpp +++ b/src/V3Combine.cpp @@ -44,8 +44,8 @@ class CombineVisitor final : VNVisitor { // TYPES using funcit_t = std::list::iterator; struct CFuncs final { - std::list m_fast; - std::list m_slow; + std::list m_fast; // Functions that are not slow + std::list m_slow; // Functions marked for slow files }; // STATE diff --git a/src/V3Const.cpp b/src/V3Const.cpp index 9d63f93a7..ac7233218 100644 --- a/src/V3Const.cpp +++ b/src/V3Const.cpp @@ -110,12 +110,12 @@ class ConstBitOpTreeVisitor final : public VNVisitorConst { class LeafInfo final { // Leaf node (either AstConst or AstVarRef) // MEMBERS - bool m_polarity = true; + bool m_polarity = true; // Invert result due to NOT int m_lsb = 0; // LSB of actually used bit of m_refp->varp() int m_msb = 0; // MSB of actually used bit of m_refp->varp() int m_wordIdx = -1; // -1 means AstWordSel is not used. - AstVarRef* m_refp = nullptr; - const AstConst* m_constp = nullptr; + AstVarRef* m_refp = nullptr; // Leaf's variable reference + const AstConst* m_constp = nullptr; // Leaf's constant public: // CONSTRUCTORS @@ -187,9 +187,9 @@ class ConstBitOpTreeVisitor final : public VNVisitorConst { }; struct BitPolarityEntry final { // Found bit polarity during iterate() - LeafInfo m_info; - bool m_polarity = false; - int m_bit = 0; + LeafInfo m_info; // Leaf (variable or constant) bit polarity was found on + bool m_polarity = false; // Polarity the bit must have to match + int m_bit = 0; // Bit index within the leaf that was tested BitPolarityEntry(const LeafInfo& info, bool pol, int bit) : m_info{info} , m_polarity{pol} @@ -198,8 +198,8 @@ class ConstBitOpTreeVisitor final : public VNVisitorConst { }; struct FrozenNodeInfo final { // Context when a frozen node is found - bool m_polarity; - int m_lsb; + bool m_polarity; // Polarity the frozen node must match + int m_lsb; // LSB position of the frozen node bool operator<(const FrozenNodeInfo& other) const { if (m_lsb != other.m_lsb) return m_lsb < other.m_lsb; return m_polarity < other.m_polarity; @@ -207,12 +207,12 @@ class ConstBitOpTreeVisitor final : public VNVisitorConst { }; class Restorer final { // Restore the original state unless disableRestore() is called - ConstBitOpTreeVisitor& m_visitor; - const size_t m_polaritiesSize; - const size_t m_frozenSize; - const unsigned m_ops; - const bool m_polarity; - bool m_restore = true; + ConstBitOpTreeVisitor& m_visitor; // Visitor whose state is saved and restored + const size_t m_polaritiesSize; // Saved m_visitor.m_bitPolarities size to truncate back to + const size_t m_frozenSize; // Saved m_visitor.m_frozenNodes size to truncate back to + const unsigned m_ops; // Saved m_visitor.m_ops to restore + const bool m_polarity; // Saved m_visitor.m_polarity to restore + bool m_restore = true; // Whether the destructor still needs to restore state public: explicit Restorer(ConstBitOpTreeVisitor& visitor) diff --git a/src/V3Control.cpp b/src/V3Control.cpp index f3cac1352..3c66b2b78 100644 --- a/src/V3Control.cpp +++ b/src/V3Control.cpp @@ -709,8 +709,8 @@ public: // Tracks what matches are known to hit against V3ControlScopeTraceEntries class V3ControlScopeTraceEntryMatch final { public: - const V3ControlScopeTraceEntry* m_entryp; - const string m_scopepart; + const V3ControlScopeTraceEntry* m_entryp; // Entry the match refers to + const string m_scopepart; // Scope prefix being matched against the entry V3ControlScopeTraceEntryMatch(const V3ControlScopeTraceEntry* entryp, const string& scopepart) : m_entryp{entryp} , m_scopepart{scopepart} {} @@ -780,8 +780,8 @@ public: // Resolve modules and files in the design class V3ControlResolverHierWorkerEntry final { - const int m_workers; - FileLine* const m_flp; + const int m_workers; // Number of workers requested for the hierarchical block + FileLine* const m_flp; // Location the worker count was specified at public: explicit V3ControlResolverHierWorkerEntry(int workers, FileLine* flp) @@ -798,9 +798,9 @@ class V3ControlResolver final { V3ControlScopeTraceResolver m_scopeTraces; // Regexp to trace enables std::unordered_map> m_profileData; // Access to profile_data records - uint8_t m_mode = NONE; + uint8_t m_mode = NONE; // Kind of profile_data records is currently active std::unordered_map m_hierWorkers; - FileLine* m_profileFileLine = nullptr; + FileLine* m_profileFileLine = nullptr; // Location profile_data was read from V3ControlResolver() = default; ~V3ControlResolver() = default; diff --git a/src/V3DfgBreakCycles.cpp b/src/V3DfgBreakCycles.cpp index cb6d5888d..6e2760456 100644 --- a/src/V3DfgBreakCycles.cpp +++ b/src/V3DfgBreakCycles.cpp @@ -152,9 +152,9 @@ class TraceDriver final : public DfgVisitor { // TYPES // Key for caching the result of a trace struct CacheKey final { - DfgVertex* m_vtxp; - uint32_t m_lsb; - uint32_t m_msb; + DfgVertex* m_vtxp; // Vertex being traced + uint32_t m_lsb; // LSB of the range within m_vtxp being traced + uint32_t m_msb; // MSB of the range within m_vtxp being traced CacheKey() = delete; CacheKey(DfgVertex* vtxp, uint32_t lsb, uint32_t msb) @@ -484,7 +484,7 @@ class TraceDriver final : public DfgVisitor { m_splicep = nullptr; struct Driver final { - DfgVertex* m_vtxp; + DfgVertex* m_vtxp; // Vertex driving this range uint32_t m_lsb; // LSB of driven range (internal, not Verilog) uint32_t m_msb; // MSB of driven range (internal, not Verilog) Driver() = delete; diff --git a/src/V3DfgContext.h b/src/V3DfgContext.h index ea71efe0b..853057dd2 100644 --- a/src/V3DfgContext.h +++ b/src/V3DfgContext.h @@ -409,17 +409,18 @@ public: // Sub contexts - keep sorted by type V3DfgAstToDfgContext m_ast2DfgContext; - V3DfgBinToOneHotContext m_binToOneHotContext; - V3DfgBreakCyclesContext m_breakCyclesContext; + V3DfgBinToOneHotContext m_binToOneHotContext; // Statistics context for V3DfgBinToOneHot + V3DfgBreakCyclesContext m_breakCyclesContext; // Statistics context for V3DfgBreakCycles V3DfgCseContext m_cseContext0{"1st"}; V3DfgCseContext m_cseContext1{"2nd"}; - V3DfgDfgToAstContext m_dfg2AstContext; - V3DfgPeepholeContext m_peepholeContext; - V3DfgPushDownSelsContext m_pushDownSelsContext; - V3DfgRegularizeContext m_regularizeContext; - V3DfgRemoveSelectsContext m_removeSelectsContext; - V3DfgRemoveUnobservableContext m_removeUnobservableContext; - V3DfgSynthesisContext m_synthContext; + V3DfgDfgToAstContext m_dfg2AstContext; // Statistics context for V3DfgDfgToAst + V3DfgPeepholeContext m_peepholeContext; // Statistics context for V3DfgPeephole + V3DfgPushDownSelsContext m_pushDownSelsContext; // Statistics context for V3DfgPushDownSels + V3DfgRegularizeContext m_regularizeContext; // Statistics context for V3DfgRegularize + V3DfgRemoveSelectsContext m_removeSelectsContext; // Stats context for V3DfgRemoveSelects + V3DfgRemoveUnobservableContext + m_removeUnobservableContext; // Stats context for V3DfgRemoveUnobservable + V3DfgSynthesisContext m_synthContext; // Statistics context for V3DfgSynthesize // CONSTRUCTOR V3DfgContext() = default; diff --git a/src/V3DfgSynthesize.cpp b/src/V3DfgSynthesize.cpp index c0ebfd9f5..706b1fa29 100644 --- a/src/V3DfgSynthesize.cpp +++ b/src/V3DfgSynthesize.cpp @@ -257,9 +257,9 @@ class AstToDfgConverter final : public VNVisitor { // Represents a DFG assignment contributed by the AST assignment with the above 'lhsp'. // There might be multiple of these if 'lhsp' is a concatenation. struct Assignment final { - DfgVertexSplice* m_lhsp; - uint32_t m_idx; - DfgVertex* m_rhsp; + DfgVertexSplice* m_lhsp; // Splice vertex being driven + uint32_t m_idx; // Position (bit or array index) within m_lhsp being driven + DfgVertex* m_rhsp; // Vertex driving that position Assignment() = delete; Assignment(DfgVertexSplice* lhsp, uint32_t idx, DfgVertex* rhsp) : m_lhsp{lhsp} diff --git a/src/V3EmitCHeaders.cpp b/src/V3EmitCHeaders.cpp index dd8b28322..e7b07ddd7 100644 --- a/src/V3EmitCHeaders.cpp +++ b/src/V3EmitCHeaders.cpp @@ -39,7 +39,7 @@ class EmitCHeader final : public EmitCConstInit { // METHODS class CoverCountVisitor final : public VNVisitorConst { - int m_bins = 0; + int m_bins = 0; // Running total of coverage bins counted so far void visit(AstNodeCoverDecl* nodep) override { // Each module class owns the counters for declarations it emits; diff --git a/src/V3EmitCSyms.cpp b/src/V3EmitCSyms.cpp index c60977558..f319245b4 100644 --- a/src/V3EmitCSyms.cpp +++ b/src/V3EmitCSyms.cpp @@ -46,11 +46,11 @@ class EmitCSyms final : EmitCBaseVisitorConst { // TYPES struct ScopeData final { - const AstNode* m_nodep; - const std::string m_symName; - const std::string m_prettyName; - const std::string m_defName; - const int m_timeunit; + const AstNode* m_nodep; // Scope symbol-table entry corresponds to + const std::string m_symName; // Mangled name used to build __Vscopep_ variable + const std::string m_prettyName; // Pretty (unprotected) name for display + const std::string m_defName; // Name registered for this scope + const int m_timeunit; // Timeunit of this scope std::string m_type; // TODO: this should be an enum ScopeData(const AstNode* nodep, const std::string& symName, const std::string& prettyName, const std::string& defName, int timeunit, const std::string& type) @@ -74,20 +74,20 @@ class EmitCSyms final : EmitCBaseVisitorConst { , m_modportName{modportName} {} }; struct ScopeFuncData final { - const AstScopeName* const m_scopep; - const AstCFunc* const m_cfuncp; - const AstNodeModule* const m_modp; + const AstScopeName* const m_scopep; // Scope the DPI export function is registered under + const AstCFunc* const m_cfuncp; // DPI export function + const AstNodeModule* const m_modp; // Module containing the DPI export function ScopeFuncData(const AstScopeName* scopep, const AstCFunc* funcp, const AstNodeModule* modp) : m_scopep{scopep} , m_cfuncp{funcp} , m_modp{modp} {} }; struct ScopeVarData final { - const std::string m_scopeName; - const std::string m_varBasePretty; - const AstVar* const m_varp; - const AstNodeModule* const m_modp; - const AstScope* const m_scopep; + const std::string m_scopeName; // Full name of the scope containing the variable + const std::string m_varBasePretty; // Pretty base name of the variable, without scope + const AstVar* const m_varp; // Public variable + const AstNodeModule* const m_modp; // Module containing the variable + const AstScope* const m_scopep; // Scope containing the variable ScopeVarData(const std::string& scopeName, const std::string& varBasePretty, const AstVar* varp, const AstNodeModule* modp, const AstScope* scopep) : m_scopeName{scopeName} diff --git a/src/V3EmitMk.cpp b/src/V3EmitMk.cpp index 3a3e560f2..32e3b9b11 100644 --- a/src/V3EmitMk.cpp +++ b/src/V3EmitMk.cpp @@ -102,8 +102,8 @@ private: const int64_t intervalsNum = std::min(topScore + 1, MAX_INTERVALS_NUM); struct Interval final { - uint64_t m_lowerBound = 0; - int m_size = 0; + uint64_t m_lowerBound = 0; // Lowest score included in this histogram bucket + int m_size = 0; // Number of scores that fell into this bucket }; std::vector intervals; diff --git a/src/V3File.cpp b/src/V3File.cpp index 18f6eb050..5ae649faa 100644 --- a/src/V3File.cpp +++ b/src/V3File.cpp @@ -70,7 +70,7 @@ class V3FileDependImp final { class DependFile final { // A single file const bool m_target; // True if write, else read - bool m_exists = true; + bool m_exists = true; // File exists const string m_filename; // Filename struct stat m_stat; // Stat information VHashSha256 m_hash; // SHA hash of file contents @@ -365,8 +365,8 @@ class VInFilterImp final { #else int m_pid = 0; // fork() process id - always zero as disabled #endif - bool m_pidExited = false; - int m_pidStatus = 0; + bool m_pidExited = false; // waitpid() reaped the filter process + int m_pidStatus = 0; // Exit status of the filter process int m_writeFd = 0; // File descriptor TO filter int m_readFd = 0; // File descriptor FROM filter diff --git a/src/V3Force.cpp b/src/V3Force.cpp index 76bcdc97b..1d8610aa3 100644 --- a/src/V3Force.cpp +++ b/src/V3Force.cpp @@ -46,9 +46,9 @@ class ForceState final { public: struct ForceRange VL_NOT_FINAL { int m_rangeLsb = 0; // VlForceVec range: bit index or array element index - int m_rangeMsb = 0; + int m_rangeMsb = 0; // VlForceVec range: bit index or array element index int m_padLsb = 0; // Bit positions for RHS padding - int m_padMsb = 0; + int m_padMsb = 0; // Bit positions for RHS padding }; struct ForceInfo final : ForceRange { @@ -75,13 +75,13 @@ public: }; struct VarForceInfo final { - AstVarScope* m_forceVecVscp = nullptr; - AstVarScope* m_forceRdVscp = nullptr; - AstVarScope* m_forceEnVscp = nullptr; - AstVarScope* m_forceValVscp = nullptr; - AstVarScope* m_varVscp = nullptr; - AstVar* m_varp = nullptr; - AstScope* m_scopep = nullptr; + AstVarScope* m_forceVecVscp = nullptr; // Scope of the __VforceVec (VlForceVec) variable + AstVarScope* m_forceRdVscp = nullptr; // Scope of the __VforceRd (read-back) variable + AstVarScope* m_forceEnVscp = nullptr; // Scope of the __VforceEn (force enable) variable + AstVarScope* m_forceValVscp = nullptr; // Scope of the __VforceVal (force value) variable + AstVarScope* m_varVscp = nullptr; // Scope of the forced (original) variable + AstVar* m_varp = nullptr; // The forced (original) variable + AstScope* m_scopep = nullptr; // Scope containing the forced variable std::unordered_map m_forces; std::unordered_map m_forcePathToIndex; int m_nextForcePathIndex = 1; // Start at 1 so 0 can be the base path (whole signal) @@ -125,19 +125,19 @@ public: }; struct ForceHelperVars final { - AstVar* m_rdVarp = nullptr; - AstVar* m_enVarp = nullptr; - AstVar* m_valVarp = nullptr; + AstVar* m_rdVarp = nullptr; // The __VforceRd (read-back) variable + AstVar* m_enVarp = nullptr; // The __VforceEn (force enable) variable + AstVar* m_valVarp = nullptr; // The __VforceVal (force value) variable }; struct ArraySelInfo final { - std::vector m_sels; - bool m_hasBitSel = false; + std::vector m_sels; // Array selects collected along the path, outer first + bool m_hasBitSel = false; // Bit-select was found along the path too }; struct ForceRangeInfo final : ForceRange { - bool m_hasArraySel = false; - ArraySelInfo m_arrayInfo; + bool m_hasArraySel = false; // LHS has an array select + ArraySelInfo m_arrayInfo; // Array-select information collected for the LHS }; private: diff --git a/src/V3FsmDetect.cpp b/src/V3FsmDetect.cpp index ada820d4e..ae92f0459 100644 --- a/src/V3FsmDetect.cpp +++ b/src/V3FsmDetect.cpp @@ -634,7 +634,7 @@ class FsmDetectVisitor final : public VNVisitor { } class RegisterAlwaysAnalyzer final { - AstScope* const m_scopep; + AstScope* const m_scopep; // Scope containing the always block(s) being analyzed public: explicit RegisterAlwaysAnalyzer(AstScope* scopep) diff --git a/src/V3HashTable.h b/src/V3HashTable.h index ae87f1322..c5d200dd9 100644 --- a/src/V3HashTable.h +++ b/src/V3HashTable.h @@ -131,7 +131,7 @@ private: // The entry comes first, so it starts the slot whatever its alignment. // It is a union so it is alive only while the slot is occupied. union { - Entry m_entry; + Entry m_entry; // Stored entry; alive only while the slot is occupied }; size_t m_hash = 0; // Hash of the entry, or zero when the slot is free diff --git a/src/V3InstrCount.cpp b/src/V3InstrCount.cpp index 1d0e75ff2..87010e009 100644 --- a/src/V3InstrCount.cpp +++ b/src/V3InstrCount.cpp @@ -50,9 +50,9 @@ class InstrCountVisitor final : public VNVisitorConst { // Little class to cleanly call startVisitBase/endVisitBase class VisitBase final { // MEMBERS - uint32_t m_savedCount; - AstNode* const m_nodep; - InstrCountVisitor* const m_visitor; + uint32_t m_savedCount; // Count before visit applied + AstNode* const m_nodep; // Node helper is visiting + InstrCountVisitor* const m_visitor; // Visitor whose start/endVisitBase are called public: // CONSTRUCTORS diff --git a/src/V3OptionParser.cpp b/src/V3OptionParser.cpp index 84a6c20ba..77ee3415b 100644 --- a/src/V3OptionParser.cpp +++ b/src/V3OptionParser.cpp @@ -130,7 +130,7 @@ V3OPTION_PARSER_DEF_ACT_CB_CLASS(ActionCbPartialMatchVal, void(const char*, cons template <> class V3OptionParser::Impl::ActionCbVal final : public ActionBase { - std::function m_cb; + std::function m_cb; // Callback function public: using CbType = std::function; diff --git a/src/V3OptionParser.h b/src/V3OptionParser.h index 01d20fdb5..e3241d9e1 100644 --- a/src/V3OptionParser.h +++ b/src/V3OptionParser.h @@ -61,7 +61,7 @@ public: private: // MEMBERS - const std::unique_ptr m_pimpl; + const std::unique_ptr m_pimpl; // Implementation class // METHODS ActionIfs* find(const char* optp) VL_MT_DISABLED; diff --git a/src/V3OrderMTaskContraction.cpp b/src/V3OrderMTaskContraction.cpp index 382f9f921..4a1288658 100644 --- a/src/V3OrderMTaskContraction.cpp +++ b/src/V3OrderMTaskContraction.cpp @@ -429,9 +429,9 @@ class Contraction final { // functions are efficient enough and using more optimized methods (e.g.: sorting networks) // has no measurable benefit. struct alignas(16) SortingRecord final { - uint64_t m_cp; - uint32_t m_id; - uint8_t m_idx; + uint64_t m_cp; // Critical path cost of the neighbor (primary sort key) + uint32_t m_id; // Id of the neighbor (tiebreaker sort key) + uint8_t m_idx; // Index of the neighbor within 'neighbors' static_assert(PART_SIBLING_EDGE_LIMIT <= std::numeric_limits::max(), "m_idx must fit all indices into 'neighbors'"); bool operator<(const SortingRecord& that) const { diff --git a/src/V3OrderMoveGraph.h b/src/V3OrderMoveGraph.h index b793684eb..01e0904a6 100644 --- a/src/V3OrderMoveGraph.h +++ b/src/V3OrderMoveGraph.h @@ -110,8 +110,8 @@ class OrderMoveDomScope final { // Key type for map below class DomScopeMapKey final { - const AstSenTree* const m_domainp; - const AstScope* const m_scopep; + const AstSenTree* const m_domainp; // Domain the vertices belong to + const AstScope* const m_scopep; // Scope the vertices belong to public: DomScopeMapKey(const AstSenTree* domainp, const AstScope* scopep) diff --git a/src/V3Param.cpp b/src/V3Param.cpp index ddd58e83b..44ca49ee8 100644 --- a/src/V3Param.cpp +++ b/src/V3Param.cpp @@ -2258,7 +2258,7 @@ class ParamProcessor final { // deparameterize a class and delete its parameter pins, so no pointer to a // child may remain pending when its parent is resolved. class DeferredResolverVisitor final : public VNVisitor { - ParamProcessor& m_processor; + ParamProcessor& m_processor; // Processor used to resolve deferred references std::set m_reachedDecls; bool firstReach(const AstNode* const declp) { return m_reachedDecls.insert(declp).second; } diff --git a/src/V3Simulate.h b/src/V3Simulate.h index f15cb174d..da07e9f1a 100644 --- a/src/V3Simulate.h +++ b/src/V3Simulate.h @@ -101,9 +101,9 @@ private: // We want to re-use allocated constants across calls to clear(), but we want to be able // to 'clear()' fast, so we use a generation number based allocator. struct ConstAllocator final { - size_t m_generation = 0; - size_t m_nextFree = 0; - std::deque m_constps; + size_t m_generation = 0; // Generation as of last clear(); invalidates m_nextFree cheaply + size_t m_nextFree = 0; // Index of the next unused constant in m_constps + std::deque m_constps; // Pool of allocated constants, reused across generations AstConst* allocate(size_t currentGeneration, AstNode* nodep) { if (m_generation != currentGeneration) { m_generation = currentGeneration; diff --git a/src/V3SplitVar.cpp b/src/V3SplitVar.cpp index 917123be6..48fa53cfe 100644 --- a/src/V3SplitVar.cpp +++ b/src/V3SplitVar.cpp @@ -371,7 +371,7 @@ public: void add(AstSel* nodep) { m_sels.insert(nodep); } void remove(AstNode* nodep) { struct Visitor final : public VNVisitor { - RefsInModule& m_parent; + RefsInModule& m_parent; // RefsInModule instance to remove entries from void visit(AstNode* nodep) override { iterateChildren(nodep); } void visit(AstVar* nodep) override { m_parent.m_vars.erase(nodep); } void visit(AstVarRef* nodep) override { m_parent.m_refs.erase(nodep); } @@ -406,18 +406,18 @@ public: struct SplitVarRefs final { std::map m_refs; - std::unordered_set m_hasXref; + std::unordered_set m_hasXref; // Vars also referenced via a hierarchical AstVarXRef }; class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl { using VarSet = std::set; - VarSet m_foundTargetVar; - UnpackRefMap m_refs; - AstNodeModule* m_modp = nullptr; + VarSet m_foundTargetVar; // Target-of-split variables found so far in the current context + UnpackRefMap m_refs; // References to unpacked-array variables, collected for splitting + AstNodeModule* m_modp = nullptr; // Module currently being visited // AstNodeStmt, AstCell, or AstAlways(Public) for sensitivity AstNode* m_contextp = nullptr; - const AstNodeFTask* m_inFTaskp = nullptr; - size_t m_numSplit = 0; + const AstNodeFTask* m_inFTaskp = nullptr; // Task/function currently being visited, if any + size_t m_numSplit = 0; // Number of variables split so far // List for SplitPackedVarVisitor SplitVarRefs m_forPackedSplit; V3UniqueNames m_tempNames; // For generating unique temporary variable names @@ -816,7 +816,7 @@ public: // Split variable class SplitNewVar final { const int m_lsb; // LSB in the original bitvector - const int m_bitwidth; + const int m_bitwidth; // Width of this split-out piece AstVar* m_varp; // The LSB of this variable is always 0, not m_lsb public: SplitNewVar(int lsb, int bitwidth, AstVar* varp = nullptr) diff --git a/src/V3StackCount.cpp b/src/V3StackCount.cpp index d49b3671b..82110fbf1 100644 --- a/src/V3StackCount.cpp +++ b/src/V3StackCount.cpp @@ -39,9 +39,9 @@ class StackCountVisitor final : public VNVisitorConst { // Little class to cleanly call startVisitBase/endVisitBase class VisitBase final { // MEMBERS - uint32_t m_savedCount; - AstNode* const m_nodep; - StackCountVisitor* const m_visitor; + uint32_t m_savedCount; // Count before visit applied + AstNode* const m_nodep; // Node this RAII helper is visiting + StackCountVisitor* const m_visitor; // Visitor whose start/endVisitBase are called public: // CONSTRUCTORS diff --git a/src/V3String.h b/src/V3String.h index 07f078c61..2945ef933 100644 --- a/src/V3String.h +++ b/src/V3String.h @@ -201,8 +201,8 @@ private: // TODO use this wherever there is currently a "string m_name" class VName final { - string m_name; - string m_hashed; + string m_name; // Pre-hashed symbol name + string m_hashed; // Hashed version of symbol name static std::map s_dehashMap; // hashed -> original decoder static size_t s_maxLength; // Length at which to start hashing diff --git a/src/V3Trace.cpp b/src/V3Trace.cpp index f8001d90d..8b931fb58 100644 --- a/src/V3Trace.cpp +++ b/src/V3Trace.cpp @@ -222,7 +222,7 @@ class TraceVisitor final : public VNVisitor { m_ifaceMemberVscps; class TraceInitDeclCollector final : public VNVisitor { - std::vector& m_declps; + std::vector& m_declps; // Output: trace declarations found so far std::set m_seenFuncps; void visit(AstTraceDecl* nodep) override { m_declps.push_back(nodep); } diff --git a/src/V3Tristate.cpp b/src/V3Tristate.cpp index 434e203d6..76b6e2129 100644 --- a/src/V3Tristate.cpp +++ b/src/V3Tristate.cpp @@ -420,13 +420,13 @@ class TristateVisitor final : public TristateBaseVisitor { // TYPES struct RefStrength final { - AstNodeVarRef* m_varrefp; + AstNodeVarRef* m_varrefp; // Variable reference this strength/enable info was found on AstNodeAssign* m_assignp; // Assignment containing m_varrefp const AstNodeProcedure* m_procedurep; // Process containing m_assignp, if procedural AstNodeExpr* m_enLhsp; // Procedural enable LHS with same footprint as m_varrefp AstNodeVarRef* m_enVarrefp; // Variable reference within m_enLhsp to retarget AstNodeExpr* m_enRhsp; // Procedural enable value matching m_enLhsp - VStrength m_strength; + VStrength m_strength; // Drive strength of the assignment/procedural write AstDelay* m_delayp; // Explicit delay on the continuous assignment RefStrength(AstNodeVarRef* varrefp, AstNodeAssign* assignp, const AstNodeProcedure* procedurep, AstNodeExpr* enLhsp, @@ -442,13 +442,13 @@ class TristateVisitor final : public TristateBaseVisitor { , m_delayp{delayp} {} }; struct LhsProjection final { - AstNodeExpr* m_lhsp; - AstNodeVarRef* m_varrefp; - AstNodeExpr* m_enp; + AstNodeExpr* m_lhsp; // LHS giving the enable assign + AstNodeVarRef* m_varrefp; // Variable reference within m_lhsp to retarget to enable var + AstNodeExpr* m_enp; // Procedural enable value to assign through m_lhsp }; struct ProceduralEnable final { - AstNodeExpr* m_lhsp; - AstNodeExpr* m_rhsp; + AstNodeExpr* m_lhsp; // Enable LHS piece to concat onto the combined assignment LHS + AstNodeExpr* m_rhsp; // Enable value piece to concat onto the combined assignment RHS }; using RefStrengthVec = std::vector; using VarMap = std::map; diff --git a/src/V3Unroll.h b/src/V3Unroll.h index 0b8e89c57..3fbd94c32 100644 --- a/src/V3Unroll.h +++ b/src/V3Unroll.h @@ -30,7 +30,7 @@ class UnrollGenVisitor; class GenForUnroller final { // MEMBERS - UnrollGenVisitor* const m_unrollerp; + UnrollGenVisitor* const m_unrollerp; // Unroller implementation class public: // CONSTRUCTOR