Inline old VL_CTOR macros.

This commit is contained in:
Wilson Snyder 2021-02-21 12:12:11 -05:00
parent 18f3df438e
commit 3ae75926e4
2 changed files with 6 additions and 15 deletions

View File

@ -272,17 +272,6 @@ public:
#define VL_MODULE(modname) class modname VL_NOT_FINAL : public VerilatedModule
// Not class final in VL_MODULE, as users might be abstracting our models (--hierarchical)
/// Constructor, ala SC_CTOR
#define VL_CTOR(modname) modname(const char* __VCname = "")
/// Constructor declaration for C++, ala SP_CTOR_IMPL
#define VL_CTOR_IMP(modname) \
modname::modname(const char* __VCname) \
: VerilatedModule(__VCname)
/// Constructor declaration for SystemC, ala SP_CTOR_IMPL
#define VL_SC_CTOR_IMP(modname) modname::modname(sc_module_name)
//=========================================================================
// Functions overridable by user defines
// (Internals however must use VL_PRINTF_MT, which calls these.)

View File

@ -2427,10 +2427,12 @@ void EmitCImp::emitCtorImp(AstNodeModule* modp) {
if (VN_IS(modp, Class)) {
modp->v3fatalSrc("constructors should be AstCFuncs instead");
} else if (optSystemC() && modp->isTop()) {
puts("VL_SC_CTOR_IMP(" + prefixNameProtect(modp) + ")");
puts(prefixNameProtect(modp) + "::" + prefixNameProtect(modp) + "(sc_module_name)");
} else {
puts("VL_CTOR_IMP(" + prefixNameProtect(modp) + ")");
first = false; // VL_CTOR_IMP includes the first ':'
puts(prefixNameProtect(modp) + "::" + prefixNameProtect(modp)
+ "(const char* __VCname)\n");
puts(" : VerilatedModule(__VCname)\n");
first = false; // printed the first ':'
}
emitVarCtors(&first);
if (modp->isTop() && v3Global.opt.mtasks()) emitMTaskVertexCtors(&first);
@ -3184,7 +3186,7 @@ void EmitCImp::emitInt(AstNodeModule* modp) {
puts("virtual ~" + prefixNameProtect(modp) + "();\n");
} else if (optSystemC()) {
ofp()->putsPrivate(false); // public:
puts("VL_CTOR(" + prefixNameProtect(modp) + ");\n");
puts(prefixNameProtect(modp) + "(const char* __VCname = \"\");\n");
puts("~" + prefixNameProtect(modp) + "();\n");
} else {
ofp()->putsPrivate(false); // public: