From 3defaf8ffb18b521ddd95af4e53d8fce99b2ea4b Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Fri, 27 Jun 2025 20:38:01 -0400 Subject: [PATCH] Rename Verilator Config Files to Verilator Control Files. Avoids conflict with IEEE `config`. No functional change intended. --- docs/guide/exe_verilator.rst | 39 ++-- docs/guide/extensions.rst | 42 ++--- docs/guide/languages.rst | 4 +- docs/guide/simulating.rst | 2 +- docs/guide/verilating.rst | 2 +- src/CMakeLists.txt | 4 +- src/Makefile_obj.in | 2 +- src/{V3Config.cpp => V3Control.cpp} | 282 ++++++++++++++-------------- src/{V3Config.h => V3Control.h} | 4 +- src/V3ExecGraph.cpp | 8 +- src/V3FileLine.cpp | 6 +- src/V3HierBlock.cpp | 8 +- src/V3LinkParse.cpp | 12 +- src/V3OrderParallel.cpp | 6 +- src/V3PreProc.cpp | 8 +- src/V3ProtectLib.cpp | 6 +- src/V3Task.cpp | 4 +- src/V3TraceDecl.cpp | 4 +- src/verilog.y | 62 +++--- 19 files changed, 253 insertions(+), 252 deletions(-) rename src/{V3Config.cpp => V3Control.cpp} (72%) rename src/{V3Config.h => V3Control.h} (97%) diff --git a/docs/guide/exe_verilator.rst b/docs/guide/exe_verilator.rst index 684d5646d..281e390aa 100644 --- a/docs/guide/exe_verilator.rst +++ b/docs/guide/exe_verilator.rst @@ -1808,7 +1808,7 @@ Summary: them systematically. The generated file is in the Verilator Configuration format, see - :ref:`Verilator Configuration Files`. The standard file extension is ".vlt". + :ref:`Verilator Control Files`. The standard file extension is ".vlt". These files can directly be consumed by Verilator, typically by placing the filename as part of the Verilator command line options. Waiver files need to be listed on the command line before listing the files they are @@ -2049,20 +2049,20 @@ Summary: filenames. -.. _Verilator Configuration Files: +.. _Verilator Control Files: -============================= -Verilator Configuration Files -============================= +======================= +Verilator Control Files +======================= In addition to the command line, warnings and other features for the -:command:`verilator` command may be controlled with Verilator Configuration +:command:`verilator` command may be controlled with Verilator Control Files, not to be confused with IEEE Configurations blocks -(`config...endconfig`) inside a file. Typically named with the `.vlt` -extension, what makes it a Verilator Configuration File is the -:option:`\`verilator_config` directive. These files, when named `.vlt`, -are read before source code files; if this behavior is undesired, name the -config file with a `.v` suffix. +(`config...endconfig`). Typically named with the `.vlt` extension, what +makes it a Verilator Control File is the :option:`\`verilator_config` +directive. These files, when named `.vlt`, are read before source code +files; if this behavior is undesired, name the control file with a `.v` or +other suffix. An example: @@ -2074,19 +2074,20 @@ An example: This disables WIDTH warnings globally, and CASEX for a specific file. -Verilator configuration files are fed through the normal Verilog +Verilator control files are fed through the normal Verilog preprocessor prior to parsing, so "\`ifdef", "\`define", and comments may -be used as if the configuration file was standard Verilog code. +be used as if the control file was standard Verilog code. -Note that file or line-specific configuration only applies to files read -after the configuration file. It is therefore recommended to pass the -configuration file to Verilator as the first file. +Note that file or line-specific control only applies to files read +after the control file. It is therefore recommended to pass the +control file to Verilator as the first file. -The grammar of configuration commands is as follows: +The grammar of control commands is as follows: .. option:: `verilator_config - Take the remaining text and treat it as Verilator configuration commands. + Take the remaining text and treat it as Verilator Control File commands. + See :ref:`Verilator Control Files`. .. option:: clock_enable -module "" -var "" @@ -2237,7 +2238,7 @@ The grammar of configuration commands is as follows: wildcard should be designed to match a single line; it is unspecified if the wildcard is allowed to match across multiple lines. The input contents does not include :vlopt:`--std <--no-std>` standard files, nor - configuration files (with :code:`verilator_config`). Typical use for + control files (with :code:`verilator_config`). Typical use for this is to match a version number present in the Verilog sources, so that the waiver will only apply to that version of the sources. diff --git a/docs/guide/extensions.rst b/docs/guide/extensions.rst index 1d54ca0b2..dae79bdea 100644 --- a/docs/guide/extensions.rst +++ b/docs/guide/extensions.rst @@ -30,7 +30,7 @@ or "`ifdef`"'s may break other tools. Specifies the entire begin/end block should be ignored for coverage analysis. Must be inside a code block, e.g., within a begin/end pair. - Same as :option:`coverage_block_off` in :ref:`Verilator Configuration Files`. + Same as :option:`coverage_block_off` in :ref:`Verilator Control Files`. .. option:: `error [string] @@ -136,14 +136,14 @@ or "`ifdef`"'s may break other tools. .. option:: `verilator_config Take the remaining text up to the next :option:`\`verilog` mode switch - and treat it as Verilator configuration commands. See :ref:`Verilator - Configuration Files`. + and treat it as Verilator Control File commands. See :ref:`Verilator + Control Files`. .. option:: `VERILATOR_TIMING The VERILATOR_TIMING define is set when :vlopt:`--timing` is used to allow an "\`ifdef" of code dependent on this feature. Note that this define - is not affected by the :option:`timing_off` configuration file option + is not affected by the :option:`timing_off` control file option nor timing metacomments. .. option:: `verilog @@ -246,7 +246,7 @@ or "`ifdef`"'s may break other tools. the scheduling algorithm, sometimes required for correct clock behavior, and always improving performance. - Same as :option:`clock_enable` configuration file option. + Same as :option:`clock_enable` control file option. .. t_dist_docs_style ignore /*verilator&32;no_clocker*/ @@ -265,7 +265,7 @@ or "`ifdef`"'s may break other tools. Specifies the entire begin/end block should be ignored for coverage analysis purposes. - Same as :option:`coverage_block_off` configuration file option. + Same as :option:`coverage_block_off` control file option. .. option:: /*verilator&32;coverage_off*/ @@ -313,7 +313,7 @@ or "`ifdef`"'s may break other tools. submodules will be named :code:`{submodule}__DOT__{subsignal}` as C++ does not allow "." in signal names. - Same as :option:`inline` configuration file option. + Same as :option:`inline` control file option. .. option:: /*verilator&32;isolate_assignments*/ @@ -356,7 +356,7 @@ or "`ifdef`"'s may break other tools. end end - Same as :option:`isolate_assignments` configuration file option. + Same as :option:`isolate_assignments` control file option. .. option:: /*verilator&32;lint_off */ @@ -395,7 +395,7 @@ or "`ifdef`"'s may break other tools. Specifies the module the comment appears in should not be inlined into any modules that use this module. - Same as :option:`no_inline` configuration file option. + Same as :option:`no_inline` control file option. .. option:: /*verilator&32;no_inline_task*/ @@ -406,7 +406,7 @@ or "`ifdef`"'s may break other tools. must be pure; they cannot reference any variables outside the task itself. - Same as :option:`no_inline` configuration file option. + Same as :option:`no_inline` control file option. .. option:: /*verilator&32;public*/ (on parameter) @@ -440,7 +440,7 @@ or "`ifdef`"'s may break other tools. You may want to use DPI exports instead, as it's compatible with other simulators. - Same as :option:`public` configuration file option. + Same as :option:`public` control file option. .. option:: /*verilator&32;public*/ (on typedef enum) @@ -463,7 +463,7 @@ or "`ifdef`"'s may break other tools. function that accesses the variable. This is nicer as it provides an obvious entry point compatible across simulators. - Same as :option:`public` configuration file option. + Same as :option:`public` control file option. .. option:: /*verilator&32;public_[|flat|flat_rd|flat_rw]_on [@()]*/ (as scope) @@ -496,14 +496,14 @@ or "`ifdef`"'s may break other tools. the name of the signal or path to it may change based upon the module inlining which takes place. - Same as :option:`public_flat` configuration file option. + Same as :option:`public_flat` control file option. .. option:: /*verilator&32;public_flat_rd*/ (on variable) Used after an input, output, register, or wire declaration to indicate the signal should be declared public_flat (see above), but read-only. - Same as :option:`public_flat_rd` configuration file option. + Same as :option:`public_flat_rd` control file option. .. option:: /*verilator&32;public_flat_rw @()*/ (on variable) @@ -513,7 +513,7 @@ or "`ifdef`"'s may break other tools. given sensitivity edge list. Use of this is implied when using the :vlopt:`--public-flat-rw` option. - Same as :option:`public_flat_rw` configuration file option. + Same as :option:`public_flat_rw` control file option. .. option:: /*verilator&32;public_module*/ @@ -523,7 +523,7 @@ or "`ifdef`"'s may break other tools. contains public signals or \`systemc_ directives. Use of this is implied when using the :vlopt:`--public` option. - Same as :option:`public` configuration file option. + Same as :option:`public` control file option. .. option:: /*verilator&32;public_off*/ @@ -538,7 +538,7 @@ or "`ifdef`"'s may break other tools. In general, you should avoid using this attribute when unnecessary, as the performance decreases significantly with increasing usage of sc_bv. - Same as :option:`sc_bv` configuration file option. + Same as :option:`sc_bv` control file option. .. option:: /*verilator&32;sc_clock*/ @@ -556,7 +556,7 @@ or "`ifdef`"'s may break other tools. $display-like behavior. See the :file:`test_regress/t/t_dpi_display.v` file for an example. - Same as :option:`sformat` configuration file option. + Same as :option:`sformat` control file option. .. option:: /*verilator&32;split_var*/ @@ -603,7 +603,7 @@ or "`ifdef`"'s may break other tools. assign bar = tmp[1] + c; - Same as :option:`split_var` configuration file option. + Same as :option:`split_var` control file option. .. option:: /*verilator&32;tag */ @@ -618,14 +618,14 @@ or "`ifdef`"'s may break other tools. :option:`--no-timing`), and :code:`fork`/:code:`join*` blocks are converted into :code:`begin`/:code:`end` blocks. - Same as :option:`timing_off` configuration file option. + Same as :option:`timing_off` control file option. .. option:: /*verilator&32;timing_on*/ Re-enable all timing constructs after this metacomment (only applicable after :option:`timing_off`). - Same as :option:`timing_on` configuration file option. + Same as :option:`timing_on` control file option. .. option:: /*verilator&32;trace_init_task*/ diff --git a/docs/guide/languages.rst b/docs/guide/languages.rst index 62c50b706..beb66229c 100644 --- a/docs/guide/languages.rst +++ b/docs/guide/languages.rst @@ -6,7 +6,7 @@ Input Languages *************** This section describes the languages Verilator takes as input. See also -:ref:`Verilator Configuration Files`. +:ref:`Verilator Control Files`. Language Standard Support @@ -168,7 +168,7 @@ files. The :option:`/*verilator&32;timing_off*/` and the encompassed timing controls and forks, regardless of the chosen :vlopt:`--timing` or :vlopt:`--no-timing` option. This can also be achieved using the :option:`timing_off` and :option:`timing_off` options in Verilator -configuration files. +Control Files. .. _Language Limitations: diff --git a/docs/guide/simulating.rst b/docs/guide/simulating.rst index 29231ef81..c18126a8a 100644 --- a/docs/guide/simulating.rst +++ b/docs/guide/simulating.rst @@ -315,7 +315,7 @@ Suppressing Coverage Using :option:`/*verilator&32;coverage_off*/` and :option:`/*verilator&32;coverage_on*/` around a block of code will disable and enable coverage respectively around that block. Or, use the -:option:`coverage_block_off` configuration file option. +:option:`coverage_block_off` control file option. Verilator automatically disables coverage of lines and branches with a $stop in them, as it is assumed that $stop branches contain an error check diff --git a/docs/guide/verilating.rst b/docs/guide/verilating.rst index 9b0d3f15b..dd760e8ea 100644 --- a/docs/guide/verilating.rst +++ b/docs/guide/verilating.rst @@ -94,7 +94,7 @@ There are two ways to mark a module: * Write :option:`/*verilator&32;hier_block*/` metacomment in HDL code. -* Add a :option:`hier_block` line in the :ref:`Verilator Configuration Files`. +* Add a :option:`hier_block` line in the :ref:`Verilator Control Files`. Then pass the :vlopt:`--hierarchical` option to Verilator. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5294a5384..9e53bb0e9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -61,7 +61,7 @@ set(HEADERS V3Clock.h V3Combine.h V3Common.h - V3Config.h + V3Control.h V3Const.h V3Coverage.h V3CoverageJoin.h @@ -216,7 +216,7 @@ set(COMMON_SOURCES V3Clock.cpp V3Combine.cpp V3Common.cpp - V3Config.cpp + V3Control.cpp V3Const__gen.cpp V3Coverage.cpp V3CoverageJoin.cpp diff --git a/src/Makefile_obj.in b/src/Makefile_obj.in index 87a585fde..d160a3ab8 100644 --- a/src/Makefile_obj.in +++ b/src/Makefile_obj.in @@ -196,7 +196,7 @@ RAW_OBJS_PCH_ASTMT = \ V3Ast.o \ V3AstNodes.o \ V3Broken.o \ - V3Config.o \ + V3Control.o \ V3EmitCBase.o \ V3EmitCConstPool.o \ V3EmitCFunc.o \ diff --git a/src/V3Config.cpp b/src/V3Control.cpp similarity index 72% rename from src/V3Config.cpp rename to src/V3Control.cpp index f245cf9aa..69647d346 100644 --- a/src/V3Config.cpp +++ b/src/V3Control.cpp @@ -1,6 +1,6 @@ // -*- mode: C++; c-file-style: "cc-mode" -*- //************************************************************************* -// DESCRIPTION: Verilator: Configuration Files +// DESCRIPTION: Verilator: Verilator Control Files (.vlt) handling // // Code available from: https://verilator.org // @@ -16,7 +16,7 @@ #include "V3PchAstMT.h" -#include "V3Config.h" +#include "V3Control.h" #include "V3String.h" @@ -34,7 +34,7 @@ VL_DEFINE_DEBUG_FUNCTIONS; // cache of resolved entities. Entities stored in this container need an update // function that takes a reference of this type to join multiple entities into one. template -class V3ConfigWildcardResolver final { +class V3ControlWildcardResolver final { mutable V3Mutex m_mutex; // protects members // Pattern strings (wildcard, or simple name) to entities std::map m_mapPatterns VL_GUARDED_BY(m_mutex); @@ -42,11 +42,11 @@ class V3ConfigWildcardResolver final { std::map> m_mapResolved VL_GUARDED_BY(m_mutex); public: - V3ConfigWildcardResolver() = default; - ~V3ConfigWildcardResolver() = default; + V3ControlWildcardResolver() = default; + ~V3ControlWildcardResolver() = default; /// Update into maps from other - void update(const V3ConfigWildcardResolver& other) VL_MT_SAFE_EXCLUDES(m_mutex) + void update(const V3ControlWildcardResolver& other) VL_MT_SAFE_EXCLUDES(m_mutex) VL_EXCLUDES(other.m_mutex) { V3LockGuard lock{m_mutex}; V3LockGuard otherLock{other.m_mutex}; @@ -84,23 +84,23 @@ public: }; // Only public_flat_rw has the sensitity tree -class V3ConfigVarAttr final { +class V3ControlVarAttr final { public: VAttrType m_type; // Type of attribute AstSenTree* m_sentreep; // Sensitivity tree for public_flat_rw - explicit V3ConfigVarAttr(VAttrType type) + explicit V3ControlVarAttr(VAttrType type) : m_type{type} , m_sentreep{nullptr} {} - V3ConfigVarAttr(VAttrType type, AstSenTree* sentreep) + V3ControlVarAttr(VAttrType type, AstSenTree* sentreep) : m_type{type} , m_sentreep{sentreep} {} }; // Overload vector with the required update function and to apply all entries -class V3ConfigVar final : public std::vector { +class V3ControlVar final : public std::vector { public: // Update from other by copying all attributes - void update(const V3ConfigVar& node) { + void update(const V3ControlVar& node) { reserve(size() + node.size()); insert(end(), node.begin(), node.end()); } @@ -116,12 +116,12 @@ public: } }; -using V3ConfigVarResolver = V3ConfigWildcardResolver; +using V3ControlVarResolver = V3ControlWildcardResolver; //====================================================================== class WildcardContents final { - // Not mutex protected, current calling from V3Config::waive is protected by error's mutex + // Not mutex protected, current calling from V3Control::waive is protected by error's mutex // MEMBERS std::map m_mapPatterns; // Pattern match results std::deque m_lines; // Source text lines @@ -185,15 +185,15 @@ public: //###################################################################### // Function or task: Have variables and properties -class V3ConfigFTask final { - V3ConfigVarResolver m_vars; // Variables in function/task +class V3ControlFTask final { + V3ControlVarResolver m_vars; // Variables in function/task bool m_isolate = false; // Isolate function return bool m_noinline = false; // Don't inline function/task bool m_public = false; // Public function/task public: - V3ConfigFTask() = default; - void update(const V3ConfigFTask& f) { + V3ControlFTask() = default; + void update(const V3ControlFTask& f) { // Don't overwrite true with false if (f.m_isolate) m_isolate = true; if (f.m_noinline) m_noinline = true; @@ -201,7 +201,7 @@ public: m_vars.update(f.m_vars); } - V3ConfigVarResolver& vars() { return m_vars; } + V3ControlVarResolver& vars() { return m_vars; } void setIsolate(bool set) { m_isolate = set; } void setNoInline(bool set) { m_noinline = set; } @@ -217,23 +217,23 @@ public: } }; -using V3ConfigFTaskResolver = V3ConfigWildcardResolver; +using V3ControlFTaskResolver = V3ControlWildcardResolver; //###################################################################### // Modules have tasks, variables, named blocks and properties -class V3ConfigModule final { - V3ConfigFTaskResolver m_tasks; // Functions/tasks in module - V3ConfigVarResolver m_vars; // Variables in module +class V3ControlModule final { + V3ControlFTaskResolver m_tasks; // Functions/tasks in module + V3ControlVarResolver m_vars; // Variables in module std::unordered_set m_coverageOffBlocks; // List of block names for coverage_off std::set m_modPragmas; // List of Pragmas for modules bool m_inline = false; // Whether to force the inline bool m_inlineValue = false; // The inline value (on/off) public: - V3ConfigModule() = default; + V3ControlModule() = default; - void update(const V3ConfigModule& m) { + void update(const V3ControlModule& m) { m_tasks.update(m.m_tasks); m_vars.update(m.m_vars); for (const string& i : m.m_coverageOffBlocks) m_coverageOffBlocks.insert(i); @@ -246,8 +246,8 @@ public: } } - V3ConfigFTaskResolver& ftasks() { return m_tasks; } - V3ConfigVarResolver& vars() { return m_vars; } + V3ControlFTaskResolver& ftasks() { return m_tasks; } + V3ControlVarResolver& vars() { return m_vars; } void addCoverageBlockOff(const string& name) { m_coverageOffBlocks.insert(name); } void setInline(bool set) { @@ -284,7 +284,7 @@ public: } }; -using V3ConfigModuleResolver = V3ConfigWildcardResolver; +using V3ControlModuleResolver = V3ControlWildcardResolver; //###################################################################### // Files have: @@ -292,17 +292,17 @@ using V3ConfigModuleResolver = V3ConfigWildcardResolver; // - Line attributes: Attributes attached to lines // lint/coverage/tracing on/off -class V3ConfigIgnoresLine final { +class V3ControlIgnoresLine final { public: const int m_lineno; // Line number to make change at const V3ErrorCode m_code; // Error code const bool m_on; // True to enable message - V3ConfigIgnoresLine(V3ErrorCode code, int lineno, bool on) + V3ControlIgnoresLine(V3ErrorCode code, int lineno, bool on) : m_lineno{lineno} , m_code{code} , m_on{on} {} - ~V3ConfigIgnoresLine() = default; - bool operator<(const V3ConfigIgnoresLine& rh) const { + ~V3ControlIgnoresLine() = default; + bool operator<(const V3ControlIgnoresLine& rh) const { if (m_lineno < rh.m_lineno) return true; if (m_lineno > rh.m_lineno) return false; if (m_code < rh.m_code) return true; @@ -312,13 +312,13 @@ public: return (m_on > rh.m_on); } }; -std::ostream& operator<<(std::ostream& os, const V3ConfigIgnoresLine& rhs) { +std::ostream& operator<<(std::ostream& os, const V3ControlIgnoresLine& rhs) { return os << rhs.m_lineno << ", " << rhs.m_code << ", " << rhs.m_on; } // Some attributes are attached to entities of the occur on a fileline // and multiple attributes can be attached to a line -using V3ConfigLineAttribute = std::bitset; +using V3ControlLineAttribute = std::bitset; class WaiverSetting final { public: @@ -339,9 +339,9 @@ public: }; // File entity -class V3ConfigFile final { - using LineAttrMap = std::map; // Map line->bitset of attributes - using IgnLines = std::multiset; // list of {line,code,on} +class V3ControlFile final { + using LineAttrMap = std::map; // Map line->bitset of attributes + using IgnLines = std::multiset; // list of {line,code,on} using Waivers = std::vector; // List of {code,wildcard string} LineAttrMap m_lineAttrs; // Attributes to line mapping @@ -361,11 +361,11 @@ class V3ConfigFile final { } public: - V3ConfigFile() { + V3ControlFile() { m_lastIgnore.lineno = -1; m_lastIgnore.it = m_ignLines.begin(); } - void update(const V3ConfigFile& file) { + void update(const V3ControlFile& file) { // Copy in all Attributes for (const auto& itr : file.m_lineAttrs) m_lineAttrs[itr.first] |= itr.second; // Copy in all ignores @@ -377,7 +377,7 @@ public: } void addLineAttribute(int lineno, VPragmaType attr) { m_lineAttrs[lineno].set(attr); } void addIgnore(V3ErrorCode code, int lineno, bool on) { - m_ignLines.insert(V3ConfigIgnoresLine{code, lineno, on}); + m_ignLines.insert(V3ControlIgnoresLine{code, lineno, on}); m_lastIgnore.it = m_ignLines.begin(); } void addIgnoreMatch(V3ErrorCode code, const string& contents, const string& match) { @@ -433,23 +433,23 @@ public: } }; -using V3ConfigFileResolver = V3ConfigWildcardResolver; +using V3ControlFileResolver = V3ControlWildcardResolver; //###################################################################### // ScopeTrace tracking -class V3ConfigScopeTraceEntry final { +class V3ControlScopeTraceEntry final { public: const string m_scope; // Scope or regexp to match const bool m_on = false; // True to enable message int m_levels = 0; // # levels, 0 = all, 1 = only this, ... // CONSTRUCTORS - V3ConfigScopeTraceEntry(const string& scope, bool on, int levels) + V3ControlScopeTraceEntry(const string& scope, bool on, int levels) : m_scope{scope} , m_on{on} , m_levels{levels} {} - ~V3ConfigScopeTraceEntry() = default; - bool operator<(const V3ConfigScopeTraceEntry& other) const { + ~V3ControlScopeTraceEntry() = default; + bool operator<(const V3ControlScopeTraceEntry& other) const { if (m_on < other.m_on) return true; if (m_on > other.m_on) return false; if (m_levels < other.m_levels) return true; @@ -458,36 +458,36 @@ public: } }; -// Tracks what matches are known to hit against V3ConfigScopeTraceEntries -class V3ConfigScopeTraceEntryMatch final { +// Tracks what matches are known to hit against V3ControlScopeTraceEntries +class V3ControlScopeTraceEntryMatch final { public: - const V3ConfigScopeTraceEntry* m_entryp; + const V3ControlScopeTraceEntry* m_entryp; const string m_scopepart; - V3ConfigScopeTraceEntryMatch(const V3ConfigScopeTraceEntry* entryp, const string& scopepart) + V3ControlScopeTraceEntryMatch(const V3ControlScopeTraceEntry* entryp, const string& scopepart) : m_entryp{entryp} , m_scopepart{scopepart} {} - bool operator<(const V3ConfigScopeTraceEntryMatch& other) const { + bool operator<(const V3ControlScopeTraceEntryMatch& other) const { if (m_entryp < other.m_entryp) return true; if (m_entryp > other.m_entryp) return false; return m_scopepart < other.m_scopepart; } }; -class V3ConfigScopeTraceResolver final { - std::vector m_entries; // User specified on/offs and levels - std::map m_matchCache; // Matching entries for speed +class V3ControlScopeTraceResolver final { + std::vector m_entries; // User specified on/offs and levels + std::map m_matchCache; // Matching entries for speed public: void addScopeTraceOn(bool on, const string& scope, int levels) { UINFO(9, "addScopeTraceOn " << on << " '" << scope << "' " << " levels=" << levels); - m_entries.emplace_back(V3ConfigScopeTraceEntry{scope, on, levels}); + m_entries.emplace_back(V3ControlScopeTraceEntry{scope, on, levels}); m_matchCache.clear(); } - bool getEntryMatch(const V3ConfigScopeTraceEntry* entp, const string& scopepart) { + bool getEntryMatch(const V3ControlScopeTraceEntry* entp, const string& scopepart) { // Return if a entry matches the scopepart, with memoization - const V3ConfigScopeTraceEntryMatch key{entp, scopepart}; + const V3ControlScopeTraceEntryMatch key{entp, scopepart}; const auto pair = m_matchCache.emplace(key, false); if (pair.second) pair.first->second = VString::wildmatch(scopepart, entp->m_scope); return pair.first->second; @@ -532,40 +532,40 @@ public: //###################################################################### // Resolve modules and files in the design -class V3ConfigResolverHierWorkerEntry final { +class V3ControlResolverHierWorkerEntry final { const int m_workers; FileLine* const m_flp; public: - explicit V3ConfigResolverHierWorkerEntry(int workers, FileLine* flp) + explicit V3ControlResolverHierWorkerEntry(int workers, FileLine* flp) : m_workers{workers} , m_flp{flp} {} int workers() const { return m_workers; } FileLine* flp() const { return m_flp; } }; -class V3ConfigResolver final { +class V3ControlResolver final { enum ProfileDataMode : uint8_t { NONE = 0, MTASK = 1, HIER_DPI = 2 }; - V3ConfigModuleResolver m_modules; // Access to module names (with wildcards) - V3ConfigFileResolver m_files; // Access to file names (with wildcards) - V3ConfigScopeTraceResolver m_scopeTraces; // Regexp to trace enables + V3ControlModuleResolver m_modules; // Access to module names (with wildcards) + V3ControlFileResolver m_files; // Access to file names (with wildcards) + V3ControlScopeTraceResolver m_scopeTraces; // Regexp to trace enables std::unordered_map> m_profileData; // Access to profile_data records uint8_t m_mode = NONE; - std::unordered_map m_hierWorkers; + std::unordered_map m_hierWorkers; FileLine* m_profileFileLine = nullptr; - V3ConfigResolver() = default; - ~V3ConfigResolver() = default; + V3ControlResolver() = default; + ~V3ControlResolver() = default; public: - static V3ConfigResolver& s() { - static V3ConfigResolver s_singleton; + static V3ControlResolver& s() { + static V3ControlResolver s_singleton; return s_singleton; } - V3ConfigModuleResolver& modules() { return m_modules; } - V3ConfigFileResolver& files() { return m_files; } - V3ConfigScopeTraceResolver& scopeTraces() { return m_scopeTraces; } + V3ControlModuleResolver& modules() { return m_modules; } + V3ControlFileResolver& files() { return m_files; } + V3ControlScopeTraceResolver& scopeTraces() { return m_scopeTraces; } void addProfileData(FileLine* fl, const string& hierDpi, uint64_t cost) { // Empty key for hierarchical DPI wrapper costs. @@ -607,76 +607,76 @@ public: }; //###################################################################### -// V3Config +// V3Control -void V3Config::addCaseFull(const string& filename, int lineno) { - V3ConfigFile& file = V3ConfigResolver::s().files().at(filename); +void V3Control::addCaseFull(const string& filename, int lineno) { + V3ControlFile& file = V3ControlResolver::s().files().at(filename); file.addLineAttribute(lineno, VPragmaType::FULL_CASE); } -void V3Config::addCaseParallel(const string& filename, int lineno) { - V3ConfigFile& file = V3ConfigResolver::s().files().at(filename); +void V3Control::addCaseParallel(const string& filename, int lineno) { + V3ControlFile& file = V3ControlResolver::s().files().at(filename); file.addLineAttribute(lineno, VPragmaType::PARALLEL_CASE); } -void V3Config::addCoverageBlockOff(const string& filename, int lineno) { - V3ConfigFile& file = V3ConfigResolver::s().files().at(filename); +void V3Control::addCoverageBlockOff(const string& filename, int lineno) { + V3ControlFile& file = V3ControlResolver::s().files().at(filename); file.addLineAttribute(lineno, VPragmaType::COVERAGE_BLOCK_OFF); } -void V3Config::addCoverageBlockOff(const string& module, const string& blockname) { - V3ConfigResolver::s().modules().at(module).addCoverageBlockOff(blockname); +void V3Control::addCoverageBlockOff(const string& module, const string& blockname) { + V3ControlResolver::s().modules().at(module).addCoverageBlockOff(blockname); } -void V3Config::addHierWorkers(FileLine* fl, const string& model, int workers) { - V3ConfigResolver::s().addHierWorkers(fl, model, workers); +void V3Control::addHierWorkers(FileLine* fl, const string& model, int workers) { + V3ControlResolver::s().addHierWorkers(fl, model, workers); } -void V3Config::addIgnore(V3ErrorCode code, bool on, const string& filename, int min, int max) { +void V3Control::addIgnore(V3ErrorCode code, bool on, const string& filename, int min, int max) { if (filename == "*") { FileLine::globalWarnOff(code, !on); } else { - V3ConfigResolver::s().files().at(filename).addIgnore(code, min, on); - if (max) V3ConfigResolver::s().files().at(filename).addIgnore(code, max, !on); + V3ControlResolver::s().files().at(filename).addIgnore(code, min, on); + if (max) V3ControlResolver::s().files().at(filename).addIgnore(code, max, !on); } } -void V3Config::addIgnoreMatch(V3ErrorCode code, const string& filename, const string& contents, - const string& match) { - V3ConfigResolver::s().files().at(filename).addIgnoreMatch(code, contents, match); +void V3Control::addIgnoreMatch(V3ErrorCode code, const string& filename, const string& contents, + const string& match) { + V3ControlResolver::s().files().at(filename).addIgnoreMatch(code, contents, match); } -void V3Config::addInline(FileLine* fl, const string& module, const string& ftask, bool on) { +void V3Control::addInline(FileLine* fl, const string& module, const string& ftask, bool on) { if (ftask.empty()) { - V3ConfigResolver::s().modules().at(module).setInline(on); + V3ControlResolver::s().modules().at(module).setInline(on); } else { if (!on) { fl->v3error("Unsupported: no_inline for tasks"); } else { - V3ConfigResolver::s().modules().at(module).ftasks().at(ftask).setNoInline(on); + V3ControlResolver::s().modules().at(module).ftasks().at(ftask).setNoInline(on); } } } -void V3Config::addModulePragma(const string& module, VPragmaType pragma) { - V3ConfigResolver::s().modules().at(module).addModulePragma(pragma); +void V3Control::addModulePragma(const string& module, VPragmaType pragma) { + V3ControlResolver::s().modules().at(module).addModulePragma(pragma); } -void V3Config::addProfileData(FileLine* fl, const string& hierDpi, uint64_t cost) { - V3ConfigResolver::s().addProfileData(fl, hierDpi, cost); +void V3Control::addProfileData(FileLine* fl, const string& hierDpi, uint64_t cost) { + V3ControlResolver::s().addProfileData(fl, hierDpi, cost); } -void V3Config::addProfileData(FileLine* fl, const string& model, const string& key, - uint64_t cost) { - V3ConfigResolver::s().addProfileData(fl, model, key, cost); +void V3Control::addProfileData(FileLine* fl, const string& model, const string& key, + uint64_t cost) { + V3ControlResolver::s().addProfileData(fl, model, key, cost); } -void V3Config::addScopeTraceOn(bool on, const string& scope, int levels) { - V3ConfigResolver::s().scopeTraces().addScopeTraceOn(on, scope, levels); +void V3Control::addScopeTraceOn(bool on, const string& scope, int levels) { + V3ControlResolver::s().scopeTraces().addScopeTraceOn(on, scope, levels); } -void V3Config::addVarAttr(FileLine* fl, const string& module, const string& ftask, - const string& var, VAttrType attr, AstSenTree* sensep) { +void V3Control::addVarAttr(FileLine* fl, const string& module, const string& ftask, + const string& var, VAttrType attr, AstSenTree* sensep) { // Semantics: sensep only if public_flat_rw if ((attr != VAttrType::VAR_PUBLIC_FLAT_RW) && sensep) { sensep->v3error("sensitivity not expected for attribute"); @@ -688,15 +688,15 @@ void V3Config::addVarAttr(FileLine* fl, const string& module, const string& ftas if (ftask.empty()) { fl->v3error("isolate_assignments only applies to signals or functions/tasks"); } else { - V3ConfigResolver::s().modules().at(module).ftasks().at(ftask).setIsolate(true); + V3ControlResolver::s().modules().at(module).ftasks().at(ftask).setIsolate(true); } } else if (attr == VAttrType::VAR_PUBLIC) { if (ftask.empty()) { // public module, this is the only exception from var here - V3ConfigResolver::s().modules().at(module).addModulePragma( + V3ControlResolver::s().modules().at(module).addModulePragma( VPragmaType::PUBLIC_MODULE); } else { - V3ConfigResolver::s().modules().at(module).ftasks().at(ftask).setPublic(true); + V3ControlResolver::s().modules().at(module).ftasks().at(ftask).setPublic(true); } } else { fl->v3error("missing -var"); @@ -708,61 +708,61 @@ void V3Config::addVarAttr(FileLine* fl, const string& module, const string& ftas } else if (!ftask.empty()) { fl->v3error("Signals inside functions/tasks cannot be marked forceable"); } else { - V3ConfigResolver::s().modules().at(module).vars().at(var).push_back( - V3ConfigVarAttr{attr}); + V3ControlResolver::s().modules().at(module).vars().at(var).push_back( + V3ControlVarAttr{attr}); } } else { - V3ConfigModule& mod = V3ConfigResolver::s().modules().at(module); + V3ControlModule& mod = V3ControlResolver::s().modules().at(module); if (ftask.empty()) { - mod.vars().at(var).push_back(V3ConfigVarAttr{attr, sensep}); + mod.vars().at(var).push_back(V3ControlVarAttr{attr, sensep}); } else { - mod.ftasks().at(ftask).vars().at(var).push_back(V3ConfigVarAttr{attr, sensep}); + mod.ftasks().at(ftask).vars().at(var).push_back(V3ControlVarAttr{attr, sensep}); } } } } -void V3Config::applyCase(AstCase* nodep) { +void V3Control::applyCase(AstCase* nodep) { const string& filename = nodep->fileline()->filename(); - V3ConfigFile* filep = V3ConfigResolver::s().files().resolve(filename); + V3ControlFile* filep = V3ControlResolver::s().files().resolve(filename); if (filep) filep->applyCase(nodep); } -void V3Config::applyCoverageBlock(AstNodeModule* modulep, AstBegin* nodep) { +void V3Control::applyCoverageBlock(AstNodeModule* modulep, AstBegin* nodep) { const string& filename = nodep->fileline()->filename(); - V3ConfigFile* filep = V3ConfigResolver::s().files().resolve(filename); + V3ControlFile* filep = V3ControlResolver::s().files().resolve(filename); if (filep) filep->applyBlock(nodep); const string& modname = modulep->name(); - V3ConfigModule* modp = V3ConfigResolver::s().modules().resolve(modname); + V3ControlModule* modp = V3ControlResolver::s().modules().resolve(modname); if (modp) modp->applyBlock(nodep); } -void V3Config::applyIgnores(FileLine* filelinep) { +void V3Control::applyIgnores(FileLine* filelinep) { const string& filename = filelinep->filename(); - V3ConfigFile* filep = V3ConfigResolver::s().files().resolve(filename); + V3ControlFile* filep = V3ControlResolver::s().files().resolve(filename); if (filep) filep->applyIgnores(filelinep); } -void V3Config::applyModule(AstNodeModule* modulep) { +void V3Control::applyModule(AstNodeModule* modulep) { const string& modname = modulep->origName(); - V3ConfigModule* modp = V3ConfigResolver::s().modules().resolve(modname); + V3ControlModule* modp = V3ControlResolver::s().modules().resolve(modname); if (modp) modp->apply(modulep); } -void V3Config::applyFTask(AstNodeModule* modulep, AstNodeFTask* ftaskp) { +void V3Control::applyFTask(AstNodeModule* modulep, AstNodeFTask* ftaskp) { const string& modname = modulep->name(); - V3ConfigModule* modp = V3ConfigResolver::s().modules().resolve(modname); + V3ControlModule* modp = V3ControlResolver::s().modules().resolve(modname); if (!modp) return; - const V3ConfigFTask* const ftp = modp->ftasks().resolve(ftaskp->name()); + const V3ControlFTask* const ftp = modp->ftasks().resolve(ftaskp->name()); if (ftp) ftp->apply(ftaskp); } -void V3Config::applyVarAttr(AstNodeModule* modulep, AstNodeFTask* ftaskp, AstVar* varp) { - V3ConfigVar* vp; - V3ConfigModule* modp = V3ConfigResolver::s().modules().resolve(modulep->name()); +void V3Control::applyVarAttr(AstNodeModule* modulep, AstNodeFTask* ftaskp, AstVar* varp) { + V3ControlVar* vp; + V3ControlModule* modp = V3ControlResolver::s().modules().resolve(modulep->name()); if (!modp) return; if (ftaskp) { - V3ConfigFTask* ftp = modp->ftasks().resolve(ftaskp->name()); + V3ControlFTask* ftp = modp->ftasks().resolve(ftaskp->name()); if (!ftp) return; vp = ftp->vars().resolve(varp->name()); } else { @@ -771,33 +771,33 @@ void V3Config::applyVarAttr(AstNodeModule* modulep, AstNodeFTask* ftaskp, AstVar if (vp) vp->apply(varp); } -int V3Config::getHierWorkers(const string& model) { - return V3ConfigResolver::s().getHierWorkers(model); +int V3Control::getHierWorkers(const string& model) { + return V3ControlResolver::s().getHierWorkers(model); } -FileLine* V3Config::getHierWorkersFileLine(const string& model) { - return V3ConfigResolver::s().getHierWorkersFileLine(model); +FileLine* V3Control::getHierWorkersFileLine(const string& model) { + return V3ControlResolver::s().getHierWorkersFileLine(model); } -uint64_t V3Config::getProfileData(const string& hierDpi) { - return V3ConfigResolver::s().getProfileData(hierDpi); +uint64_t V3Control::getProfileData(const string& hierDpi) { + return V3ControlResolver::s().getProfileData(hierDpi); } -uint64_t V3Config::getProfileData(const string& model, const string& key) { - return V3ConfigResolver::s().getProfileData(model, key); +uint64_t V3Control::getProfileData(const string& model, const string& key) { + return V3ControlResolver::s().getProfileData(model, key); } -FileLine* V3Config::getProfileDataFileLine() { - return V3ConfigResolver::s().getProfileDataFileLine(); +FileLine* V3Control::getProfileDataFileLine() { + return V3ControlResolver::s().getProfileDataFileLine(); } -bool V3Config::getScopeTraceOn(const string& scope) { - return V3ConfigResolver::s().scopeTraces().getScopeTraceOn(scope); +bool V3Control::getScopeTraceOn(const string& scope) { + return V3ControlResolver::s().scopeTraces().getScopeTraceOn(scope); } -void V3Config::contentsPushText(const string& text) { return WildcardContents::pushText(text); } +void V3Control::contentsPushText(const string& text) { return WildcardContents::pushText(text); } -bool V3Config::containsMTaskProfileData() { - return V3ConfigResolver::s().containsMTaskProfileData(); +bool V3Control::containsMTaskProfileData() { + return V3ControlResolver::s().containsMTaskProfileData(); } -bool V3Config::waive(FileLine* filelinep, V3ErrorCode code, const string& message) { - V3ConfigFile* filep = V3ConfigResolver::s().files().resolve(filelinep->filename()); +bool V3Control::waive(FileLine* filelinep, V3ErrorCode code, const string& message) { + V3ControlFile* filep = V3ControlResolver::s().files().resolve(filelinep->filename()); if (!filep) return false; return filep->waive(code, message); } diff --git a/src/V3Config.h b/src/V3Control.h similarity index 97% rename from src/V3Config.h rename to src/V3Control.h index 6cae9e04f..ff26e5ab6 100644 --- a/src/V3Config.h +++ b/src/V3Control.h @@ -1,6 +1,6 @@ // -*- mode: C++; c-file-style: "cc-mode" -*- //************************************************************************* -// DESCRIPTION: Verilator: Configuration Files +// DESCRIPTION: Verilator: Verilator Control Files (.vlt) handling // // Code available from: https://verilator.org // @@ -27,7 +27,7 @@ //###################################################################### -class V3Config final { +class V3Control final { public: static void addCaseFull(const string& file, int lineno); static void addCaseParallel(const string& file, int lineno); diff --git a/src/V3ExecGraph.cpp b/src/V3ExecGraph.cpp index 473e42620..b470041d1 100644 --- a/src/V3ExecGraph.cpp +++ b/src/V3ExecGraph.cpp @@ -18,7 +18,7 @@ #include "V3ExecGraph.h" -#include "V3Config.h" +#include "V3Control.h" #include "V3EmitCBase.h" #include "V3File.h" #include "V3GraphStream.h" @@ -799,7 +799,7 @@ void fillinCosts(V3Graph* execMTaskGraphp) { // This estimate is 64 bits, but the final mtask graph algorithm needs 32 bits const uint64_t costEstimate = V3InstrCount::count(mtp->bodyp(), false); const uint64_t costProfiled - = V3Config::getProfileData(v3Global.opt.prefix(), mtp->hashName()); + = V3Control::getProfileData(v3Global.opt.prefix(), mtp->hashName()); if (costProfiled) { UINFO(5, "Profile data for mtask " << mtp->id() << " " << mtp->hashName() << " cost override " << costProfiled); @@ -830,8 +830,8 @@ void fillinCosts(V3Graph* execMTaskGraphp) { } if (missingProfiles) { - if (FileLine* const fl = V3Config::getProfileDataFileLine()) { - if (V3Config::containsMTaskProfileData()) { + if (FileLine* const fl = V3Control::getProfileDataFileLine()) { + if (V3Control::containsMTaskProfileData()) { fl->v3warn(PROFOUTOFDATE, "Profile data for mtasks may be out of date. " << missingProfiles << " of " << totalEstimates << " mtasks had no data"); diff --git a/src/V3FileLine.cpp b/src/V3FileLine.cpp index ffa8fdc45..1631d6e4a 100644 --- a/src/V3FileLine.cpp +++ b/src/V3FileLine.cpp @@ -24,7 +24,7 @@ #include "V3String.h" #ifndef V3ERROR_NO_GLOBAL_ # include "V3Global.h" -# include "V3Config.h" +# include "V3Control.h" # include "V3File.h" #endif #include "V3Waiver.h" @@ -305,7 +305,7 @@ void FileLine::forwardToken(const char* textp, size_t size, bool trackLines) { void FileLine::applyIgnores() { #ifndef V3ERROR_NO_GLOBAL_ - V3Config::applyIgnores(this); // Toggle warnings based on global config file + V3Control::applyIgnores(this); // Toggle warnings based on global config file #endif } @@ -441,7 +441,7 @@ void FileLine::v3errorEnd(std::ostringstream& sstr, const string& extra) nsstr << add; } const string waiverText = V3Error::stripMetaText(wsstr.str(), false); - m_waive = V3Config::waive(this, V3Error::s().errorCode(), waiverText); + m_waive = V3Control::waive(this, V3Error::s().errorCode(), waiverText); if (m_waive) { V3Error::s().suppressThisWarning(); } else { diff --git a/src/V3HierBlock.cpp b/src/V3HierBlock.cpp index 41d542993..b248a6f21 100644 --- a/src/V3HierBlock.cpp +++ b/src/V3HierBlock.cpp @@ -38,7 +38,7 @@ // Here is more detailed internal process. // 1) Parser adds VPragmaType::HIER_BLOCK of AstPragma to modules // that are marked with /*verilator hier_block*/ metacomment in Verilator run a). -// 2) If module type parameters are present, V3Config marks hier param modules +// 2) If module type parameters are present, V3Control marks hier param modules // (marked with hier_params verilator config pragma) as modp->hierParams(true). // This is done in run b), de-parametrized modules are mapped with their params one-to-one. // 3) AstModule with HIER_BLOCK pragma is marked modp->hierBlock(true) @@ -88,7 +88,7 @@ #include "V3HierBlock.h" -#include "V3Config.h" +#include "V3Control.h" #include "V3EmitV.h" #include "V3File.h" #include "V3Os.h" @@ -189,10 +189,10 @@ V3StringList V3HierBlock::commandArgs(bool forCMake) const { if (!params().gTypeParams().empty()) opts.push_back(" --hierarchical-params-file " + typeParametersFilename()); - const int blockThreads = V3Config::getHierWorkers(m_modp->origName()); + const int blockThreads = V3Control::getHierWorkers(m_modp->origName()); if (blockThreads > 1) { if (hasParent()) { - V3Config::getHierWorkersFileLine(m_modp->origName()) + V3Control::getHierWorkersFileLine(m_modp->origName()) ->v3warn(E_UNSUPPORTED, "Specifying workers for nested hierarchical blocks"); } else { if (v3Global.opt.threads() < blockThreads) { diff --git a/src/V3LinkParse.cpp b/src/V3LinkParse.cpp index cd0a309bb..c1128b796 100644 --- a/src/V3LinkParse.cpp +++ b/src/V3LinkParse.cpp @@ -22,7 +22,7 @@ #include "V3LinkParse.h" -#include "V3Config.h" +#include "V3Control.h" #include "V3Stats.h" #include @@ -181,7 +181,7 @@ class LinkParseVisitor final : public VNVisitor { // Mark class methods if (VN_IS(m_modp, Class)) nodep->classMethod(true); - V3Config::applyFTask(m_modp, nodep); + V3Control::applyFTask(m_modp, nodep); cleanFileline(nodep); VL_RESTORER(m_ftaskp); VL_RESTORER(m_lifetime); @@ -340,7 +340,7 @@ class LinkParseVisitor final : public VNVisitor { } // Maybe this variable has a signal attribute - V3Config::applyVarAttr(m_modp, m_ftaskp, nodep); + V3Control::applyVarAttr(m_modp, m_ftaskp, nodep); if (v3Global.opt.anyPublicFlat() && nodep->varType().isVPIAccessible()) { if (v3Global.opt.publicFlatRW()) { @@ -616,7 +616,7 @@ class LinkParseVisitor final : public VNVisitor { iterateChildren(nodep); } void visit(AstNodeModule* nodep) override { - V3Config::applyModule(nodep); + V3Control::applyModule(nodep); ++m_statModules; VL_RESTORER(m_modp); @@ -676,7 +676,7 @@ class LinkParseVisitor final : public VNVisitor { void visit(AstRestrict* nodep) override { visitIterateNoValueMod(nodep); } void visit(AstBegin* nodep) override { - V3Config::applyCoverageBlock(m_modp, nodep); + V3Control::applyCoverageBlock(m_modp, nodep); cleanFileline(nodep); VL_RESTORER(m_beginDepth); m_beginDepth++; @@ -754,7 +754,7 @@ class LinkParseVisitor final : public VNVisitor { } } void visit(AstCase* nodep) override { - V3Config::applyCase(nodep); + V3Control::applyCase(nodep); cleanFileline(nodep); iterateChildren(nodep); } diff --git a/src/V3OrderParallel.cpp b/src/V3OrderParallel.cpp index 8dbe5291c..52057018e 100644 --- a/src/V3OrderParallel.cpp +++ b/src/V3OrderParallel.cpp @@ -20,7 +20,7 @@ #include "V3PchAstNoMT.h" // VL_MT_DISABLED_CODE_UNIT -#include "V3Config.h" +#include "V3Control.h" #include "V3ExecGraph.h" #include "V3File.h" #include "V3Graph.h" @@ -1719,7 +1719,7 @@ class DpiImportCallVisitor final : public VNVisitor { : !v3Global.opt.threadsDpiUnpure()) { // If hierarchical DPI wrapper cost is not found or is of a 0 cost, // we have a normal DPI which induces DPI hazard by default. - m_hasDpiHazard = V3Config::getProfileData(nodep->cname()) == 0; + m_hasDpiHazard = V3Control::getProfileData(nodep->cname()) == 0; UINFO(9, "DPI wrapper '" << nodep->cname() << "' has dpi hazard = " << m_hasDpiHazard); } @@ -1753,7 +1753,7 @@ class DpiThreadsVisitor final : public VNVisitorConst { // METHODS void visit(AstCFunc* nodep) override { - m_threads = std::max(m_threads, V3Config::getHierWorkers(nodep->cname())); + m_threads = std::max(m_threads, V3Control::getHierWorkers(nodep->cname())); iterateChildrenConst(nodep); } void visit(AstNodeCCall* nodep) override { iterateConst(nodep->funcp()); } diff --git a/src/V3PreProc.cpp b/src/V3PreProc.cpp index 0cb788bc4..a29d7c750 100644 --- a/src/V3PreProc.cpp +++ b/src/V3PreProc.cpp @@ -21,7 +21,7 @@ #include "V3PreProc.h" -#include "V3Config.h" +#include "V3Control.h" #include "V3Error.h" #include "V3File.h" #include "V3Global.h" @@ -846,7 +846,7 @@ void V3PreProcImp::openFile(FileLine*, VInFilter* filterp, const string& filenam flsp->newContent(); for (const string& i : wholefile) flsp->contentp()->pushText(i); - // Save contents for V3Config --contents + // Save contents for V3Control --contents if (filename != V3Options::getStdPackagePath()) { bool containsVlt = false; for (const string& i : wholefile) { @@ -857,7 +857,7 @@ void V3PreProcImp::openFile(FileLine*, VInFilter* filterp, const string& filenam } } if (!containsVlt) { - for (const string& i : wholefile) V3Config::contentsPushText(i); + for (const string& i : wholefile) V3Control::contentsPushText(i); } } @@ -906,7 +906,7 @@ void V3PreProcImp::openFile(FileLine*, VInFilter* filterp, const string& filenam FileLine* const fl = new FileLine{flsp}; fl->contentLineno(eof_lineno); fl->column(eof_newline + 1, eof_newline + 1); - V3Config::applyIgnores(fl); // As preprocessor hasn't otherwise applied yet + V3Control::applyIgnores(fl); // As preprocessor hasn't otherwise applied yet fl->v3warn(EOFNEWLINE, "Missing newline at end of file (POSIX 3.206).\n" << fl->warnMore() << "... Suggest add newline."); } diff --git a/src/V3ProtectLib.cpp b/src/V3ProtectLib.cpp index 663c0faaa..f11cdb9a2 100644 --- a/src/V3ProtectLib.cpp +++ b/src/V3ProtectLib.cpp @@ -18,7 +18,7 @@ #include "V3ProtectLib.h" -#include "V3Config.h" +#include "V3Control.h" #include "V3Hasher.h" #include "V3InstrCount.h" #include "V3String.h" @@ -126,10 +126,10 @@ class ProtectVisitor final : public VNVisitor { txtp->addText(fl, "hier_workers -hier-dpi \"" + m_libName + "_protectlib_combo_update\" -workers 16'd" - + std::to_string(V3Config::getHierWorkers(m_libName)) + "\n"); + + std::to_string(V3Control::getHierWorkers(m_libName)) + "\n"); txtp->addText(fl, "hier_workers -hier-dpi \"" + m_libName + "_protectlib_seq_update\" -workers 16'd" - + std::to_string(V3Config::getHierWorkers(m_libName)) + "\n"); + + std::to_string(V3Control::getHierWorkers(m_libName)) + "\n"); // No workers for combo_ignore txtp->addText(fl, "`verilog\n"); txtp->addText(fl, "`endif\n"); diff --git a/src/V3Task.cpp b/src/V3Task.cpp index 23d42ad3e..54a810f2d 100644 --- a/src/V3Task.cpp +++ b/src/V3Task.cpp @@ -27,8 +27,8 @@ #include "V3Task.h" -#include "V3Config.h" #include "V3Const.h" +#include "V3Control.h" #include "V3EmitCBase.h" #include "V3Graph.h" #include "V3Stats.h" @@ -997,7 +997,7 @@ class TaskVisitor final : public VNVisitor { funcp->protect(false); funcp->dpiPure(nodep->dpiPure()); - const int cost = static_cast(V3Config::getProfileData(funcp->name())); + const int cost = static_cast(V3Control::getProfileData(funcp->name())); m_statHierDpisWithCosts += (cost != 0); funcp->cost(cost); diff --git a/src/V3TraceDecl.cpp b/src/V3TraceDecl.cpp index 40359fbaf..bbc2d4e47 100644 --- a/src/V3TraceDecl.cpp +++ b/src/V3TraceDecl.cpp @@ -24,7 +24,7 @@ #include "V3TraceDecl.h" -#include "V3Config.h" +#include "V3Control.h" #include "V3EmitCBase.h" #include "V3Stats.h" @@ -184,7 +184,7 @@ class TraceDeclVisitor final : public VNVisitor { if (!prettyName.empty() && prettyName[0] == '_') return "Leading underscore"; if (prettyName.find("._") != string::npos) return "Inlined leading underscore"; } - if (!V3Config::getScopeTraceOn(prettyName)) return "Vlt scope trace_off"; + if (!V3Control::getScopeTraceOn(prettyName)) return "Vlt scope trace_off"; } return nullptr; } diff --git a/src/verilog.y b/src/verilog.y index fc3dc5224..832af56b7 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -23,7 +23,7 @@ #endif // clang-format on #include "V3Ast.h" -#include "V3Config.h" +#include "V3Control.h" #include "V3Global.h" #include "V3ParseImp.h" // Defines YYTYPE; before including bison header @@ -7713,93 +7713,93 @@ colon: // Generic colon that isn't making a label (e.g. vltItem: // // TODO support arbitrary order of arguments vltOffFront - { V3Config::addIgnore($1, false, "*", 0, 0); } + { V3Control::addIgnore($1, false, "*", 0, 0); } | vltOffFront vltDFile - { V3Config::addIgnore($1, false, *$2, 0, 0); } + { V3Control::addIgnore($1, false, *$2, 0, 0); } | vltOffFront vltDFile yVLT_D_LINES yaINTNUM - { V3Config::addIgnore($1, false, *$2, $4->toUInt(), $4->toUInt() + 1); } + { V3Control::addIgnore($1, false, *$2, $4->toUInt(), $4->toUInt() + 1); } | vltOffFront vltDFile yVLT_D_LINES yaINTNUM '-' yaINTNUM - { V3Config::addIgnore($1, false, *$2, $4->toUInt(), $6->toUInt() + 1); } + { V3Control::addIgnore($1, false, *$2, $4->toUInt(), $6->toUInt() + 1); } | vltOffFront vltDFile vltDMatch { if (($1 == V3ErrorCode::I_COVERAGE) || ($1 == V3ErrorCode::I_TRACING)) { $1->v3error("Argument -match only supported for lint_off"); } else { - V3Config::addIgnoreMatch($1, *$2, "", *$3); + V3Control::addIgnoreMatch($1, *$2, "", *$3); }} | vltOffFront vltDFile vltDContents { if (($1 == V3ErrorCode::I_COVERAGE) || ($1 == V3ErrorCode::I_TRACING)) { $1->v3error("Argument -match only supported for lint_off"); } else { - V3Config::addIgnoreMatch($1, *$2, *$3, "*"); + V3Control::addIgnoreMatch($1, *$2, *$3, "*"); }} | vltOffFront vltDFile vltDContents vltDMatch { if (($1 == V3ErrorCode::I_COVERAGE) || ($1 == V3ErrorCode::I_TRACING)) { $1->v3error("Argument -match only supported for lint_off"); } else { - V3Config::addIgnoreMatch($1, *$2, *$3, *$4); + V3Control::addIgnoreMatch($1, *$2, *$3, *$4); }} | vltOffFront vltDScope { if ($1 != V3ErrorCode::I_TRACING) { $1->v3error("Argument -scope only supported for tracing_on/off"); } else { - V3Config::addScopeTraceOn(false, *$2, 0); + V3Control::addScopeTraceOn(false, *$2, 0); }} | vltOffFront vltDScope vltDLevels { if ($1 != V3ErrorCode::I_TRACING) { $1->v3error("Argument -scope only supported for tracing_on/off_off"); } else { - V3Config::addScopeTraceOn(false, *$2, $3->toUInt()); + V3Control::addScopeTraceOn(false, *$2, $3->toUInt()); }} | vltOnFront - { V3Config::addIgnore($1, true, "*", 0, 0); } + { V3Control::addIgnore($1, true, "*", 0, 0); } | vltOnFront vltDFile - { V3Config::addIgnore($1, true, *$2, 0, 0); } + { V3Control::addIgnore($1, true, *$2, 0, 0); } | vltOnFront vltDFile yVLT_D_LINES yaINTNUM - { V3Config::addIgnore($1, true, *$2, $4->toUInt(), $4->toUInt() + 1); } + { V3Control::addIgnore($1, true, *$2, $4->toUInt(), $4->toUInt() + 1); } | vltOnFront vltDFile yVLT_D_LINES yaINTNUM '-' yaINTNUM - { V3Config::addIgnore($1, true, *$2, $4->toUInt(), $6->toUInt() + 1); } + { V3Control::addIgnore($1, true, *$2, $4->toUInt(), $6->toUInt() + 1); } | vltOnFront vltDScope { if ($1 != V3ErrorCode::I_TRACING) { $1->v3error("Argument -scope only supported for tracing_on/off"); } else { - V3Config::addScopeTraceOn(true, *$2, 0); + V3Control::addScopeTraceOn(true, *$2, 0); }} | vltOnFront vltDScope vltDLevels { if ($1 != V3ErrorCode::I_TRACING) { $1->v3error("Argument -scope only supported for tracing_on/off_off"); } else { - V3Config::addScopeTraceOn(true, *$2, $3->toUInt()); + V3Control::addScopeTraceOn(true, *$2, $3->toUInt()); }} | vltVarAttrFront vltDModuleE vltDFTaskE vltVarAttrVarE attr_event_controlE - { V3Config::addVarAttr($1, *$2, *$3, *$4, $1, $5); } + { V3Control::addVarAttr($1, *$2, *$3, *$4, $1, $5); } | vltInlineFront vltDModuleE vltDFTaskE - { V3Config::addInline($1, *$2, *$3, $1); } + { V3Control::addInline($1, *$2, *$3, $1); } | yVLT_COVERAGE_BLOCK_OFF vltDFile - { V3Config::addCoverageBlockOff(*$2, 0); } + { V3Control::addCoverageBlockOff(*$2, 0); } | yVLT_COVERAGE_BLOCK_OFF vltDFile yVLT_D_LINES yaINTNUM - { V3Config::addCoverageBlockOff(*$2, $4->toUInt()); } + { V3Control::addCoverageBlockOff(*$2, $4->toUInt()); } | yVLT_COVERAGE_BLOCK_OFF vltDModule vltDBlock - { V3Config::addCoverageBlockOff(*$2, *$3); } + { V3Control::addCoverageBlockOff(*$2, *$3); } | yVLT_FULL_CASE vltDFile - { V3Config::addCaseFull(*$2, 0); } + { V3Control::addCaseFull(*$2, 0); } | yVLT_FULL_CASE vltDFile yVLT_D_LINES yaINTNUM - { V3Config::addCaseFull(*$2, $4->toUInt()); } + { V3Control::addCaseFull(*$2, $4->toUInt()); } | yVLT_HIER_BLOCK vltDModuleE - { V3Config::addModulePragma(*$2, VPragmaType::HIER_BLOCK); } + { V3Control::addModulePragma(*$2, VPragmaType::HIER_BLOCK); } | yVLT_HIER_PARAMS vltDModuleE - { V3Config::addModulePragma(*$2, VPragmaType::HIER_PARAMS); } + { V3Control::addModulePragma(*$2, VPragmaType::HIER_PARAMS); } | yVLT_HIER_WORKERS vltDModuleE vltDWorkers - { V3Config::addHierWorkers($1, *$2, $3->toSInt()); } + { V3Control::addHierWorkers($1, *$2, $3->toSInt()); } | yVLT_HIER_WORKERS vltDHierDpi vltDWorkers - { V3Config::addHierWorkers($1, *$2, $3->toSInt()); } + { V3Control::addHierWorkers($1, *$2, $3->toSInt()); } | yVLT_PARALLEL_CASE vltDFile - { V3Config::addCaseParallel(*$2, 0); } + { V3Control::addCaseParallel(*$2, 0); } | yVLT_PARALLEL_CASE vltDFile yVLT_D_LINES yaINTNUM - { V3Config::addCaseParallel(*$2, $4->toUInt()); } + { V3Control::addCaseParallel(*$2, $4->toUInt()); } | yVLT_PROFILE_DATA vltDHierDpi vltDCost - { V3Config::addProfileData($1, *$2, $3->toUQuad()); } + { V3Control::addProfileData($1, *$2, $3->toUQuad()); } | yVLT_PROFILE_DATA vltDModel vltDMtask vltDCost - { V3Config::addProfileData($1, *$2, *$3, $4->toUQuad()); } + { V3Control::addProfileData($1, *$2, *$3, $4->toUQuad()); } ; vltOffFront: