Configure time unit/time precision in the Sym constructor.

This used to be done in the constructor of the top module, but there is
no reason to do it there. Internals are cleaner with this in the Sym
constructor. No functional change intended.
This commit is contained in:
Geza Lore 2021-06-19 17:12:56 +01:00
parent 19398efc4c
commit f064a94f1d
2 changed files with 12 additions and 8 deletions

View File

@ -2549,14 +2549,6 @@ void EmitCImp::emitConfigureImp(AstNodeModule* modp) {
if (v3Global.opt.coverage()) {
puts(modName + "__" + protect("_configure_coverage") + "(this, first);\n");
}
if (modp->isTop() && !v3Global.rootp()->timeunit().isNone()) {
puts("vlSymsp->_vm_contextp__->timeunit("
+ cvtToStr(v3Global.rootp()->timeunit().powerOfTen()) + ");\n");
}
if (modp->isTop() && !v3Global.rootp()->timeprecision().isNone()) {
puts("vlSymsp->_vm_contextp__->timeprecision("
+ cvtToStr(v3Global.rootp()->timeprecision().powerOfTen()) + ");\n");
}
puts("}\n");
splitSizeInc(10);
}

View File

@ -704,6 +704,18 @@ void EmitCSyms::emitSymImp() {
}
}
puts("// Configure time unit / time precision\n");
if (!v3Global.rootp()->timeunit().isNone()) {
puts("_vm_contextp__->timeunit(");
puts(cvtToStr(v3Global.rootp()->timeunit().powerOfTen()));
puts(");\n");
}
if (!v3Global.rootp()->timeprecision().isNone()) {
puts("_vm_contextp__->timeprecision(");
puts(cvtToStr(v3Global.rootp()->timeprecision().powerOfTen()));
puts(");\n");
}
puts("// Setup each module's pointer back to symbol table (for public functions)\n");
puts("TOPp->" + protect("__Vconfigure") + "(this, true);\n");
for (const auto& i : m_scopes) {