Internals: Also cleanup gettes/setters in .cpp. No functional change intended.

This commit is contained in:
Wilson Snyder 2024-06-22 19:50:46 -04:00
parent ba0183131c
commit 3315a6e431
12 changed files with 67 additions and 67 deletions

View File

@ -958,8 +958,8 @@ public:
}
static void dumpCbs() VL_MT_UNSAFE_ONE;
static VerilatedVpiError* error_info() VL_MT_UNSAFE_ONE; // getter for vpi error info
static void evalNeeded(bool evalNeeded) { s().m_evalNeeded = evalNeeded; }
static bool evalNeeded() { return s().m_evalNeeded; }
static void evalNeeded(bool evalNeeded) { s().m_evalNeeded = evalNeeded; }
static void inertialDelay(const VerilatedVpioVar* vop, p_vpi_value valuep) {
s().m_inertialPuts.emplace_back(vop, valuep);
}

View File

@ -2076,8 +2076,8 @@ public:
void fileline(FileLine* fl) { m_fileline = fl; }
inline bool width1() const;
inline int widthInstrs() const;
void didWidth(bool flag) { m_flags.didWidth = flag; }
bool didWidth() const { return m_flags.didWidth; }
void didWidth(bool flag) { m_flags.didWidth = flag; }
bool didWidthAndSet() {
if (didWidth()) return true;
didWidth(true);

View File

@ -877,11 +877,11 @@ public:
bool similarDType(const AstNodeDType* samep) const override { return this == samep; }
int widthAlignBytes() const override { return 1; }
int widthTotalBytes() const override { return 1; }
bool isVirtual() const { return m_virtual; }
void isVirtual(bool flag) {
m_virtual = flag;
if (flag) v3Global.setHasVirtIfaces();
}
bool isVirtual() const { return m_virtual; }
FileLine* modportFileline() const { return m_modportFileline; }
string cellName() const { return m_cellName; }
void cellName(const string& name) { m_cellName = name; }
@ -956,8 +956,8 @@ public:
int widthTotalBytes() const override { return subDTypep()->widthTotalBytes(); }
// METHODS
void name(const string& name) override { m_name = name; }
void tag(const string& text) override { m_tag = text; }
string tag() const override { return m_tag; }
void tag(const string& text) override { m_tag = text; }
int lsb() const { return m_lsb; }
void lsb(int lsb) { m_lsb = lsb; }
bool isCompound() const override {

View File

@ -213,8 +213,8 @@ public:
bool isOutputter() override { return !isPure(); }
AstCFunc* funcp() const { return m_funcp; }
void funcp(AstCFunc* funcp) { m_funcp = funcp; }
void argTypes(const string& str) { m_argTypes = str; }
string argTypes() const { return m_argTypes; }
void argTypes(const string& str) { m_argTypes = str; }
string emitVerilog() final override { V3ERROR_NA_RETURN(""); }
string emitC() final override { V3ERROR_NA_RETURN(""); }
@ -1847,11 +1847,11 @@ public:
return (name().find("%m") != string::npos || name().find("%M") != string::npos);
}
bool hidden() const { return m_hidden; }
void hasFormat(bool flag) { m_hasFormat = flag; }
bool hasFormat() const { return m_hasFormat; }
void hasFormat(bool flag) { m_hasFormat = flag; }
char missingArgChar() const { return m_missingArgChar; }
void timeunit(const VTimescale& flag) { m_timeunit = flag; }
VTimescale timeunit() const { return m_timeunit; }
void timeunit(const VTimescale& flag) { m_timeunit = flag; }
string emitVerilog() override { V3ERROR_NA_RETURN(""); }
string emitC() override { V3ERROR_NA_RETURN(""); }
@ -2173,8 +2173,8 @@ public:
bool cleanOut() const override { return true; }
int instrCount() const override { return widthInstrs(); }
bool same(const AstNode* /*samep*/) const override { return true; }
void timeunit(const VTimescale& flag) { m_timeunit = flag; }
VTimescale timeunit() const { return m_timeunit; }
void timeunit(const VTimescale& flag) { m_timeunit = flag; }
};
class AstUCFunc final : public AstNodeExpr {
// User's $c function
@ -4439,8 +4439,8 @@ public:
bool same(const AstNode* /*samep*/) const override { return true; }
void dump(std::ostream& str = std::cout) const override;
void dumpJson(std::ostream& str = std::cout) const override;
void timeunit(const VTimescale& flag) { m_timeunit = flag; }
VTimescale timeunit() const { return m_timeunit; }
void timeunit(const VTimescale& flag) { m_timeunit = flag; }
};
class AstTimeD final : public AstNodeTermop {
VTimescale m_timeunit; // Parent module time unit
@ -4460,8 +4460,8 @@ public:
bool same(const AstNode* /*samep*/) const override { return true; }
void dump(std::ostream& str = std::cout) const override;
void dumpJson(std::ostream& str = std::cout) const override;
void timeunit(const VTimescale& flag) { m_timeunit = flag; }
VTimescale timeunit() const { return m_timeunit; }
void timeunit(const VTimescale& flag) { m_timeunit = flag; }
};
// === AstNodeTriop ===
@ -5355,8 +5355,8 @@ public:
bool sizeMattersLhs() const override { return false; }
void dump(std::ostream& str = std::cout) const override;
void dumpJson(std::ostream& str = std::cout) const override;
void timeunit(const VTimescale& flag) { m_timeunit = flag; }
VTimescale timeunit() const { return m_timeunit; }
void timeunit(const VTimescale& flag) { m_timeunit = flag; }
};
class AstToLowerN final : public AstNodeUniop {
// string.tolower()

View File

@ -138,48 +138,48 @@ public:
void dpiOpenParentInc() { ++m_dpiOpenParent; }
void dpiOpenParentClear() { m_dpiOpenParent = 0; }
uint64_t dpiOpenParent() const { return m_dpiOpenParent; }
void taskPublic(bool flag) { m_taskPublic = flag; }
bool taskPublic() const { return m_taskPublic; }
void attrIsolateAssign(bool flag) { m_attrIsolateAssign = flag; }
void taskPublic(bool flag) { m_taskPublic = flag; }
bool attrIsolateAssign() const { return m_attrIsolateAssign; }
void classMethod(bool flag) { m_classMethod = flag; }
void attrIsolateAssign(bool flag) { m_attrIsolateAssign = flag; }
bool classMethod() const { return m_classMethod; }
void isExternProto(bool flag) { m_externProto = flag; }
void classMethod(bool flag) { m_classMethod = flag; }
bool isExternProto() const { return m_externProto; }
void isExternDef(bool flag) { m_externDef = flag; }
void isExternProto(bool flag) { m_externProto = flag; }
bool isExternDef() const { return m_externDef; }
void prototype(bool flag) { m_prototype = flag; }
void isExternDef(bool flag) { m_externDef = flag; }
bool prototype() const { return m_prototype; }
void dpiExport(bool flag) { m_dpiExport = flag; }
void prototype(bool flag) { m_prototype = flag; }
bool dpiExport() const { return m_dpiExport; }
void dpiImport(bool flag) { m_dpiImport = flag; }
void dpiExport(bool flag) { m_dpiExport = flag; }
bool dpiImport() const { return m_dpiImport; }
void dpiContext(bool flag) { m_dpiContext = flag; }
void dpiImport(bool flag) { m_dpiImport = flag; }
bool dpiContext() const { return m_dpiContext; }
void dpiOpenChild(bool flag) { m_dpiOpenChild = flag; }
void dpiContext(bool flag) { m_dpiContext = flag; }
bool dpiOpenChild() const { return m_dpiOpenChild; }
void dpiTask(bool flag) { m_dpiTask = flag; }
void dpiOpenChild(bool flag) { m_dpiOpenChild = flag; }
bool dpiTask() const { return m_dpiTask; }
void isConstructor(bool flag) { m_isConstructor = flag; }
void dpiTask(bool flag) { m_dpiTask = flag; }
bool isConstructor() const { return m_isConstructor; }
void isConstructor(bool flag) { m_isConstructor = flag; }
bool isHideLocal() const { return m_isHideLocal; }
void isHideLocal(bool flag) { m_isHideLocal = flag; }
bool isHideProtected() const { return m_isHideProtected; }
void isHideProtected(bool flag) { m_isHideProtected = flag; }
void dpiPure(bool flag) { m_dpiPure = flag; }
bool dpiPure() const { return m_dpiPure; }
void pureVirtual(bool flag) { m_pureVirtual = flag; }
void dpiPure(bool flag) { m_dpiPure = flag; }
bool pureVirtual() const { return m_pureVirtual; }
void recursive(bool flag) { m_recursive = flag; }
void pureVirtual(bool flag) { m_pureVirtual = flag; }
bool recursive() const { return m_recursive; }
void isStatic(bool flag) { m_static = flag; }
void recursive(bool flag) { m_recursive = flag; }
bool isStatic() const { return m_static; }
void underGenerate(bool flag) { m_underGenerate = flag; }
void isStatic(bool flag) { m_static = flag; }
bool underGenerate() const { return m_underGenerate; }
void isVirtual(bool flag) { m_virtual = flag; }
void underGenerate(bool flag) { m_underGenerate = flag; }
bool isVirtual() const { return m_virtual; }
void setNeedProcess() { m_needProcess = true; }
void isVirtual(bool flag) { m_virtual = flag; }
bool needProcess() const { return m_needProcess; }
void setNeedProcess() { m_needProcess = true; }
void baseOverride(const VBaseOverride& flag) { m_baseOverride = flag; }
VBaseOverride baseOverride() const { return m_baseOverride; }
void lifetime(const VLifetime& flag) { m_lifetime = flag; }
@ -274,30 +274,30 @@ public:
void level(int level) { m_level = level; }
int level() const VL_MT_SAFE { return m_level; }
bool isTop() const VL_MT_SAFE { return level() == 1; }
void modPublic(bool flag) { m_modPublic = flag; }
bool modPublic() const { return m_modPublic; }
void modTrace(bool flag) { m_modTrace = flag; }
void modPublic(bool flag) { m_modPublic = flag; }
bool modTrace() const { return m_modTrace; }
void dead(bool flag) { m_dead = flag; }
void modTrace(bool flag) { m_modTrace = flag; }
bool dead() const { return m_dead; }
void hasGParam(bool flag) { m_hasGParam = flag; }
void dead(bool flag) { m_dead = flag; }
bool hasGParam() const { return m_hasGParam; }
void hasParameterList(bool flag) { m_hasParameterList = flag; }
void hasGParam(bool flag) { m_hasGParam = flag; }
bool hasParameterList() const { return m_hasParameterList; }
void hierBlock(bool flag) { m_hierBlock = flag; }
void hasParameterList(bool flag) { m_hasParameterList = flag; }
bool hierBlock() const { return m_hierBlock; }
void internal(bool flag) { m_internal = flag; }
void hierBlock(bool flag) { m_hierBlock = flag; }
bool internal() const { return m_internal; }
void recursive(bool flag) { m_recursive = flag; }
void internal(bool flag) { m_internal = flag; }
bool recursive() const { return m_recursive; }
void recursive(bool flag) { m_recursive = flag; }
void recursiveClone(bool flag) { m_recursiveClone = flag; }
bool recursiveClone() const { return m_recursiveClone; }
void lifetime(const VLifetime& flag) { m_lifetime = flag; }
VLifetime lifetime() const { return m_lifetime; }
void timeunit(const VTimescale& flag) { m_timeunit = flag; }
void lifetime(const VLifetime& flag) { m_lifetime = flag; }
VTimescale timeunit() const { return m_timeunit; }
void unconnectedDrive(const VOptionBool flag) { m_unconnectedDrive = flag; }
void timeunit(const VTimescale& flag) { m_timeunit = flag; }
VOptionBool unconnectedDrive() const { return m_unconnectedDrive; }
void unconnectedDrive(const VOptionBool flag) { m_unconnectedDrive = flag; }
};
class AstNodeProcedure VL_NOT_FINAL : public AstNode {
// IEEE procedure: initial, final, always
@ -2191,8 +2191,8 @@ public:
ASTGEN_MEMBERS_AstBegin;
void dump(std::ostream& str) const override;
void dumpJson(std::ostream& str) const override;
void generate(bool flag) { m_generate = flag; }
bool generate() const { return m_generate; }
void generate(bool flag) { m_generate = flag; }
void setNeedProcess() { m_needProcess = true; }
bool needProcess() const { return m_needProcess; }
bool implied() const { return m_implied; }
@ -2688,10 +2688,10 @@ public:
bool isGateOptimizable() const override { return false; }
bool isPredictOptimizable() const override { return false; }
bool same(const AstNode* /*samep*/) const override { return true; }
void isDisableSoft(bool flag) { m_isDisableSoft = flag; }
bool isDisableSoft() const { return m_isDisableSoft; }
void isSoft(bool flag) { m_isSoft = flag; }
void isDisableSoft(bool flag) { m_isDisableSoft = flag; }
bool isSoft() const { return m_isSoft; }
void isSoft(bool flag) { m_isSoft = flag; }
};
class AstConstraintUnique final : public AstNodeStmt {
// Constraint unique statement
@ -2747,8 +2747,8 @@ public:
void dumpJson(std::ostream& str) const override;
int instrCount() const override { return 1 + 2 * INSTR_COUNT_LD; }
bool maybePointedTo() const override { return true; }
void binNum(int flag) { m_binNum = flag; }
int binNum() const { return m_binNum; }
void binNum(int flag) { m_binNum = flag; }
int offset() const { return m_offset; }
const string& comment() const { return m_text; } // text to insert in code
const string& linescov() const { return m_linescov; }
@ -3461,8 +3461,8 @@ public:
// Stop statement searchback here
void addNextStmt(AstNode* newp, AstNode* belowp) override;
bool isFirstInMyListOfStatements(AstNode* n) const override { return n == stmtsp(); }
void unrollFull(const VOptionBool flag) { m_unrollFull = flag; }
VOptionBool unrollFull() const { return m_unrollFull; }
void unrollFull(const VOptionBool flag) { m_unrollFull = flag; }
};
// === AstNodeAssign ===
@ -3792,8 +3792,8 @@ public:
: ASTGEN_SUPER_TextBlock(fl, textp, tracking)
, m_commas(commas) {}
ASTGEN_MEMBERS_AstTextBlock;
void commas(bool flag) { m_commas = flag; }
bool commas() const { return m_commas; }
void commas(bool flag) { m_commas = flag; }
void addText(FileLine* fl, const string& textp, bool tracking = false) {
addNodesp(new AstText{fl, textp, tracking});
}

View File

@ -125,13 +125,13 @@ class ConstBitOpTreeVisitor final : public VNVisitorConst {
void updateBitRange(const AstShiftR* shiftp) {
m_lsb += VN_AS(shiftp->rhsp(), Const)->toUInt();
}
int wordIdx() const { return m_wordIdx; }
void wordIdx(int i) { m_wordIdx = i; }
bool polarity() const { return m_polarity; }
void polarity(bool p) { m_polarity = p; }
AstVarRef* refp() const { return m_refp; }
const AstConst* constp() const { return m_constp; }
int wordIdx() const { return m_wordIdx; }
bool polarity() const { return m_polarity; }
bool missingWordSel() const {
// When V3Expand is skipped, WordSel is not inserted.
return m_refp->isWide() && m_wordIdx == -1;

View File

@ -351,8 +351,8 @@ public:
void execErrorExitCb() VL_REQUIRES(m_mutex) {
if (m_errorExitCb) m_errorExitCb();
}
void errorExitCb(ErrorExitCb cb) VL_REQUIRES(m_mutex) { m_errorExitCb = cb; }
ErrorExitCb errorExitCb() VL_REQUIRES(m_mutex) { return m_errorExitCb; }
void errorExitCb(ErrorExitCb cb) VL_REQUIRES(m_mutex) { m_errorExitCb = cb; }
bool isError(V3ErrorCode code, bool supp) VL_REQUIRES(m_mutex);
void vlAbortOrExit() VL_REQUIRES(m_mutex);
void errorContexted(bool flag) VL_REQUIRES(m_mutex) { m_errorContexted = flag; }
@ -379,12 +379,12 @@ public:
}
m_pretendError[code] = flag;
}
void debugDefault(int level) VL_MT_UNSAFE { m_debugDefault = level; }
int debugDefault() VL_MT_SAFE { return m_debugDefault; }
void errorLimit(int level) VL_REQUIRES(m_mutex) { m_errorLimit = level; }
void debugDefault(int level) VL_MT_UNSAFE { m_debugDefault = level; }
int errorLimit() VL_REQUIRES(m_mutex) { return m_errorLimit; }
void warnFatal(bool flag) VL_REQUIRES(m_mutex) { m_warnFatal = flag; }
void errorLimit(int level) VL_REQUIRES(m_mutex) { m_errorLimit = level; }
bool warnFatal() VL_REQUIRES(m_mutex) { return m_warnFatal; }
void warnFatal(bool flag) VL_REQUIRES(m_mutex) { m_warnFatal = flag; }
V3ErrorCode errorCode() VL_REQUIRES(m_mutex) { return m_errorCode; }
bool errorContexted() VL_REQUIRES(m_mutex) { return m_errorContexted; }
int warnCount() VL_REQUIRES(m_mutex) { return m_warnCount; }

View File

@ -52,8 +52,8 @@ public:
void priority(uint32_t pri) { m_priority = pri; }
uint32_t cost() const { return m_cost; }
void cost(uint32_t cost) { m_cost = cost; }
void predictStart(uint64_t time) { m_predictStart = time; }
uint64_t predictStart() const { return m_predictStart; }
void predictStart(uint64_t time) { m_predictStart = time; }
string name() const override VL_MT_STABLE { return "mt"s + std::to_string(id()); }
string hashName() const { return m_hashName; }
void dump(std::ostream& str) const;

View File

@ -185,10 +185,10 @@ public:
UASSERT(!m_hierPlanp, "call once");
m_hierPlanp = plan;
}
void useParallelBuild(bool flag) { m_useParallelBuild = flag; }
bool useParallelBuild() const { return m_useParallelBuild; }
void useRandomizeMethods(bool flag) { m_useRandomizeMethods = flag; }
void useParallelBuild(bool flag) { m_useParallelBuild = flag; }
bool useRandomizeMethods() const { return m_useRandomizeMethods; }
void useRandomizeMethods(bool flag) { m_useRandomizeMethods = flag; }
void saveJsonPtrFieldName(const std::string& fieldName);
void ptrNamesDumpJson(std::ostream& os);
void idPtrMapDumpJson(std::ostream& os);

View File

@ -165,12 +165,12 @@ public:
: "lightgreen"));
}
FileLine* fileline() const override { return nodep()->fileline(); }
void isTristate(bool flag) { m_isTristate = flag; }
bool isTristate() const VL_MT_SAFE { return m_isTristate; }
void feedsTri(bool flag) { m_feedsTri = flag; }
void isTristate(bool flag) { m_isTristate = flag; }
bool feedsTri() const VL_MT_SAFE { return m_feedsTri; }
void processed(bool flag) { m_processed = flag; }
void feedsTri(bool flag) { m_feedsTri = flag; }
bool processed() const { return m_processed; }
void processed(bool flag) { m_processed = flag; }
};
//######################################################################

View File

@ -87,8 +87,8 @@ public:
// ACCESSORS
const string& name() const { return m_name; }
void needed(bool flag) { m_needed = flag; }
bool needed() const { return m_needed; }
void needed(bool flag) { m_needed = flag; }
LinenoMap& lines() { return m_lines; }
// METHODS

View File

@ -19,7 +19,7 @@ my %files = %{get_source_files($root)};
foreach my $file (sort keys %files) {
my $filename = "$root/$file";
next if !-f $filename; # git file might be deleted but not yet staged
next unless $file =~ /include.*verilated.*\.(h)(\.in)?$/;
next unless $file =~ /include.*verilated.*\.[ch].*$/;
next if $file =~ /gtkwave/;
my $contents = file_contents($filename);
@ -27,17 +27,17 @@ foreach my $file (sort keys %files) {
my %seen_getters;
foreach my $line (split(/\n/, $contents . "\n\n")) {
next if $line =~ /^\s*\/\//; # skip commented lines
if($line =~ /\s*void\s+([a-zA-Z0-9]+)\([a-zA-Z0-9]+.*/) {
if ($line =~ /\s*void\s+([a-zA-Z0-9_]+)\([a-zA-Z0-9_]+.*/) {
my $setter_name = $1;
$seen_setters{$setter_name} = 1;
} else {
next unless $line =~ /\s*[a-zA-Z0-9]+\s+([a-zA-Z0-9]+)\(\s*\)/;
next unless $line =~ /\s*[a-zA-Z0-9_]+\s+([a-zA-Z0-9_]+)\(\s*\)/;
my $getter_name = $1;
if($file =~ /verilated_sc_trace/ and $getter_name == "cycle") {
next; # hardcoded check for cycle() which looks like a setter but isn't
if ($file =~ /verilated_sc_trace/ and $getter_name == "cycle") {
next; # hardcoded check for cycle() which looks like a setter but isn't
}
if(exists $seen_setters{$getter_name} and not (exists $seen_getters{$getter_name})) {
error("$getter_name came after its setter in $file");
if (exists $seen_setters{$getter_name} and not (exists $seen_getters{$getter_name})) {
error("$file: '$getter_name()' came after its setter; suggest swap order");
}
$seen_getters{$getter_name} = 1;
}