mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 01:54:01 +02:00
Internals: More const. No functional change intended.
This commit is contained in:
+16
-16
@@ -135,7 +135,7 @@ class EmitCGatherDependencies final : AstNVisitor {
|
||||
|
||||
public:
|
||||
static const std::set<std::string> gather(AstCFunc* cfuncp) {
|
||||
EmitCGatherDependencies visitor{cfuncp};
|
||||
const EmitCGatherDependencies visitor{cfuncp};
|
||||
return std::move(visitor.m_dependencies);
|
||||
}
|
||||
};
|
||||
@@ -348,7 +348,7 @@ class EmitCImp final : EmitCFunc {
|
||||
// just looking for loading the wrong model
|
||||
VHashSha256 hash;
|
||||
for (AstNode* nodep = modp->stmtsp(); nodep; nodep = nodep->nextp()) {
|
||||
if (const AstVar* varp = VN_CAST(nodep, Var)) {
|
||||
if (const AstVar* const varp = VN_CAST(nodep, Var)) {
|
||||
hash.insert(varp->name());
|
||||
hash.insert(varp->dtypep()->width());
|
||||
}
|
||||
@@ -369,7 +369,7 @@ class EmitCImp final : EmitCFunc {
|
||||
|
||||
// Save all members
|
||||
for (AstNode* nodep = modp->stmtsp(); nodep; nodep = nodep->nextp()) {
|
||||
if (const AstVar* varp = VN_CAST(nodep, Var)) {
|
||||
if (const AstVar* const varp = VN_CAST(nodep, Var)) {
|
||||
if (varp->isIO() && modp->isTop() && optSystemC()) {
|
||||
// System C top I/O doesn't need loading, as the
|
||||
// lower level subinst code does it.
|
||||
@@ -576,7 +576,7 @@ class EmitCTrace final : EmitCFunc {
|
||||
if (m_slow) filename += "__Slow";
|
||||
filename += ".cpp";
|
||||
|
||||
AstCFile* cfilep = newCFile(filename, m_slow, true /*source*/);
|
||||
AstCFile* const cfilep = newCFile(filename, m_slow, true /*source*/);
|
||||
cfilep->support(true);
|
||||
|
||||
if (optSystemC()) {
|
||||
@@ -595,23 +595,23 @@ class EmitCTrace final : EmitCFunc {
|
||||
}
|
||||
|
||||
bool emitTraceIsScBv(AstTraceInc* nodep) {
|
||||
const AstVarRef* varrefp = VN_CAST(nodep->declp()->valuep(), VarRef);
|
||||
const AstVarRef* const varrefp = VN_CAST(nodep->declp()->valuep(), VarRef);
|
||||
if (!varrefp) return false;
|
||||
AstVar* varp = varrefp->varp();
|
||||
AstVar* const varp = varrefp->varp();
|
||||
return varp->isSc() && varp->isScBv();
|
||||
}
|
||||
|
||||
bool emitTraceIsScBigUint(AstTraceInc* nodep) {
|
||||
const AstVarRef* varrefp = VN_CAST(nodep->declp()->valuep(), VarRef);
|
||||
const AstVarRef* const varrefp = VN_CAST(nodep->declp()->valuep(), VarRef);
|
||||
if (!varrefp) return false;
|
||||
AstVar* varp = varrefp->varp();
|
||||
AstVar* const varp = varrefp->varp();
|
||||
return varp->isSc() && varp->isScBigUint();
|
||||
}
|
||||
|
||||
bool emitTraceIsScUint(AstTraceInc* nodep) {
|
||||
const AstVarRef* varrefp = VN_CAST(nodep->declp()->valuep(), VarRef);
|
||||
const AstVarRef* const varrefp = VN_CAST(nodep->declp()->valuep(), VarRef);
|
||||
if (!varrefp) return false;
|
||||
AstVar* varp = varrefp->varp();
|
||||
AstVar* const varp = varrefp->varp();
|
||||
return varp->isSc() && varp->isScUint();
|
||||
}
|
||||
|
||||
@@ -714,7 +714,7 @@ class EmitCTrace final : EmitCFunc {
|
||||
if (v3Global.opt.traceFormat().fst()) {
|
||||
// Skip over refs-to-refs, but stop before final ref so can get data type name
|
||||
// Alternatively back in V3Width we could push enum names from upper typedefs
|
||||
if (AstEnumDType* enump = VN_CAST(nodep->skipRefToEnump(), EnumDType)) {
|
||||
if (AstEnumDType* const enump = VN_CAST(nodep->skipRefToEnump(), EnumDType)) {
|
||||
int enumNum = enump->user1();
|
||||
if (!enumNum) {
|
||||
enumNum = ++m_enumNum;
|
||||
@@ -734,7 +734,7 @@ class EmitCTrace final : EmitCFunc {
|
||||
puts("= {");
|
||||
for (AstEnumItem* itemp = enump->itemsp(); itemp;
|
||||
itemp = VN_AS(itemp->nextp(), EnumItem)) {
|
||||
AstConst* constp = VN_AS(itemp->valuep(), Const);
|
||||
AstConst* const constp = VN_AS(itemp->valuep(), Const);
|
||||
if (++nvals > 1) puts(", ");
|
||||
putbs("\"" + constp->num().displayed(nodep, "%0b") + "\"");
|
||||
}
|
||||
@@ -785,7 +785,7 @@ class EmitCTrace final : EmitCFunc {
|
||||
|
||||
void emitTraceValue(AstTraceInc* nodep, int arrayindex) {
|
||||
if (AstVarRef* const varrefp = VN_CAST(nodep->valuep(), VarRef)) {
|
||||
AstVar* varp = varrefp->varp();
|
||||
AstVar* const varp = varrefp->varp();
|
||||
puts("(");
|
||||
if (emitTraceIsScBigUint(nodep)) {
|
||||
puts("(vluint32_t*)");
|
||||
@@ -882,7 +882,7 @@ public:
|
||||
void V3EmitC::emitcImp() {
|
||||
UINFO(2, __FUNCTION__ << ": " << endl);
|
||||
// Make parent module pointers available.
|
||||
EmitCParentModule emitCParentModule;
|
||||
const EmitCParentModule emitCParentModule;
|
||||
|
||||
// Process each module in turn
|
||||
for (const AstNode* nodep = v3Global.rootp()->modulesp(); nodep; nodep = nodep->nextp()) {
|
||||
@@ -903,12 +903,12 @@ void V3EmitC::emitcFiles() {
|
||||
UINFO(2, __FUNCTION__ << ": " << endl);
|
||||
for (AstNodeFile* filep = v3Global.rootp()->filesp(); filep;
|
||||
filep = VN_AS(filep->nextp(), NodeFile)) {
|
||||
AstCFile* cfilep = VN_CAST(filep, CFile);
|
||||
AstCFile* const cfilep = VN_CAST(filep, CFile);
|
||||
if (cfilep && cfilep->tblockp()) {
|
||||
V3OutCFile of(cfilep->name());
|
||||
of.puts("// DESCR"
|
||||
"IPTION: Verilator generated C++\n");
|
||||
EmitCFunc visitor(cfilep->tblockp(), &of, true);
|
||||
const EmitCFunc visitor(cfilep->tblockp(), &of, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user