Add simulation context (VerilatedContext) (#2660). (#2813)

**   Add simulation context (VerilatedContext) to allow multiple fully independent
      models to be in the same process.  Please see the updated examples.
**   Add context->time() and context->timeInc() API calls, to set simulation time.
      These now are recommended in place of the legacy sc_time_stamp().
This commit is contained in:
Wilson Snyder
2021-03-07 11:01:54 -05:00
committed by GitHub
parent caa9c99837
commit 2cad22a22a
45 changed files with 2216 additions and 1128 deletions
+5 -3
View File
@@ -467,7 +467,8 @@ void EmitCSyms::emitSymHdr() {
}
puts("\n// CREATORS\n");
puts(symClassName() + "(" + topClassName() + "* topp, const char* namep);\n");
puts(symClassName() + "(VerilatedContext* contextp, " + topClassName()
+ "* topp, const char* namep);\n");
puts(string("~") + symClassName() + "();\n");
for (const auto& i : m_usesVfinal) {
@@ -643,10 +644,11 @@ void EmitCSyms::emitSymImp() {
puts("{\n");
emitScopeHier(true);
puts("}\n\n");
puts(symClassName() + "::" + symClassName() + "(" + topClassName()
puts(symClassName() + "::" + symClassName() + "(VerilatedContext* contextp, " + topClassName()
+ "* topp, const char* namep)\n");
puts(" // Setup locals\n");
puts(" : __Vm_namep(namep)\n"); // No leak, as gets destroyed when the top is destroyed
puts(" : VerilatedSyms{contextp}\n");
puts(" , __Vm_namep(namep)\n"); // No leak, as gets destroyed when the top is destroyed
if (v3Global.needTraceDumper()) {
puts(" , __Vm_dumping(false)\n");
puts(" , __Vm_dumperp(nullptr)\n");