mirror of
https://github.com/verilator/verilator.git
synced 2025-01-11 17:17:36 +00:00
Internals: Rename to prefixNameProtect. No functional change intended.
This commit is contained in:
parent
f0f370490f
commit
d68ffba8cd
@ -1095,9 +1095,9 @@ class EmitCImp : EmitCStmts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
V3OutCFile* newOutCFile(AstNodeModule* modp, bool slow, bool source, int filenum=0) {
|
V3OutCFile* newOutCFile(AstNodeModule* modp, bool slow, bool source, int filenum=0) {
|
||||||
string filenameNoExt = v3Global.opt.makeDir()+"/"+ modClassName(modp);
|
string filenameNoExt = v3Global.opt.makeDir() + "/" + prefixNameProtect(modp);
|
||||||
if (filenum) filenameNoExt += "__"+cvtToStr(filenum);
|
if (filenum) filenameNoExt += "__" + cvtToStr(filenum);
|
||||||
filenameNoExt += (slow ? "__Slow":"");
|
filenameNoExt += (slow ? "__Slow" : "");
|
||||||
V3OutCFile* ofp = NULL;
|
V3OutCFile* ofp = NULL;
|
||||||
if (v3Global.opt.lintOnly()) {
|
if (v3Global.opt.lintOnly()) {
|
||||||
// Unfortunately we have some lint checks here, so we can't just skip processing.
|
// Unfortunately we have some lint checks here, so we can't just skip processing.
|
||||||
@ -1208,7 +1208,7 @@ class EmitCImp : EmitCStmts {
|
|||||||
ExecMTask* mtp = nodep->execMTaskp();
|
ExecMTask* mtp = nodep->execMTaskp();
|
||||||
puts("\n");
|
puts("\n");
|
||||||
puts("void ");
|
puts("void ");
|
||||||
puts(modClassName(m_modp)+"::"+protect(mtp->cFuncName()));
|
puts(prefixNameProtect(m_modp) + "::" + protect(mtp->cFuncName()));
|
||||||
puts("(bool even_cycle, void* symtab) {\n");
|
puts("(bool even_cycle, void* symtab) {\n");
|
||||||
|
|
||||||
// Declare and set vlSymsp
|
// Declare and set vlSymsp
|
||||||
@ -1237,14 +1237,13 @@ class EmitCImp : EmitCStmts {
|
|||||||
if (nodep->ifdef()!="") puts("#ifdef "+nodep->ifdef()+"\n");
|
if (nodep->ifdef()!="") puts("#ifdef "+nodep->ifdef()+"\n");
|
||||||
if (nodep->isInline()) puts("VL_INLINE_OPT ");
|
if (nodep->isInline()) puts("VL_INLINE_OPT ");
|
||||||
puts(nodep->rtnTypeVoid()); puts(" ");
|
puts(nodep->rtnTypeVoid()); puts(" ");
|
||||||
puts(modClassName(m_modp)+"::"+nodep->nameProtect()
|
puts(prefixNameProtect(m_modp) + "::" + nodep->nameProtect() + "(" + cFuncArgs(nodep)
|
||||||
+"("+cFuncArgs(nodep)+") {\n");
|
+ ") {\n");
|
||||||
|
|
||||||
// "+" in the debug indicates a print from the model
|
// "+" in the debug indicates a print from the model
|
||||||
puts("VL_DEBUG_IF(VL_DBG_MSGF(\"+ ");
|
puts("VL_DEBUG_IF(VL_DBG_MSGF(\"+ ");
|
||||||
for (int i=0; i<m_modp->level(); ++i) { puts(" "); }
|
for (int i=0; i<m_modp->level(); ++i) { puts(" "); }
|
||||||
puts(modClassName(m_modp)+"::"+nodep->nameProtect()
|
puts(prefixNameProtect(m_modp) + "::" + nodep->nameProtect() + "\\n\"); );\n");
|
||||||
+"\\n\"); );\n");
|
|
||||||
|
|
||||||
// Declare and set vlTOPp
|
// Declare and set vlTOPp
|
||||||
if (nodep->symProlog()) puts(EmitCBaseVisitor::symTopAssign()+"\n");
|
if (nodep->symProlog()) puts(EmitCBaseVisitor::symTopAssign()+"\n");
|
||||||
@ -1949,9 +1948,9 @@ void EmitCImp::emitCtorImp(AstNodeModule* modp) {
|
|||||||
puts("\n");
|
puts("\n");
|
||||||
bool first = true;
|
bool first = true;
|
||||||
if (optSystemC() && modp->isTop()) {
|
if (optSystemC() && modp->isTop()) {
|
||||||
puts("VL_SC_CTOR_IMP("+modClassName(modp)+")");
|
puts("VL_SC_CTOR_IMP(" + prefixNameProtect(modp) + ")");
|
||||||
} else {
|
} else {
|
||||||
puts("VL_CTOR_IMP("+modClassName(modp)+")");
|
puts("VL_CTOR_IMP(" + prefixNameProtect(modp) + ")");
|
||||||
first = false; // VL_CTOR_IMP includes the first ':'
|
first = false; // VL_CTOR_IMP includes the first ':'
|
||||||
}
|
}
|
||||||
emitVarCtors(&first);
|
emitVarCtors(&first);
|
||||||
@ -2007,8 +2006,8 @@ void EmitCImp::emitCtorImp(AstNodeModule* modp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EmitCImp::emitConfigureImp(AstNodeModule* modp) {
|
void EmitCImp::emitConfigureImp(AstNodeModule* modp) {
|
||||||
puts("\nvoid "+modClassName(modp)+"::"+protect("__Vconfigure")
|
puts("\nvoid " + prefixNameProtect(modp) + "::" + protect("__Vconfigure") + "("
|
||||||
+"("+symClassName()+"* vlSymsp, bool first) {\n");
|
+ symClassName() + "* vlSymsp, bool first) {\n");
|
||||||
puts( "if (0 && first) {} // Prevent unused\n");
|
puts( "if (0 && first) {} // Prevent unused\n");
|
||||||
puts( "this->__VlSymsp = vlSymsp;\n"); // First, as later stuff needs it.
|
puts( "this->__VlSymsp = vlSymsp;\n"); // First, as later stuff needs it.
|
||||||
if (v3Global.opt.coverage() ) {
|
if (v3Global.opt.coverage() ) {
|
||||||
@ -2023,8 +2022,9 @@ void EmitCImp::emitCoverageImp(AstNodeModule* modp) {
|
|||||||
puts("\n// Coverage\n");
|
puts("\n// Coverage\n");
|
||||||
// Rather than putting out VL_COVER_INSERT calls directly, we do it via this function
|
// Rather than putting out VL_COVER_INSERT calls directly, we do it via this function
|
||||||
// This gets around gcc slowness constructing all of the template arguments.
|
// This gets around gcc slowness constructing all of the template arguments.
|
||||||
puts("void "+modClassName(m_modp)+"::__vlCoverInsert(uint32_t* countp, bool enable,"
|
puts("void " + prefixNameProtect(m_modp)
|
||||||
" const char* filenamep, int lineno, int column,\n");
|
+ "::__vlCoverInsert(uint32_t* countp, bool enable,"
|
||||||
|
+ " const char* filenamep, int lineno, int column,\n");
|
||||||
puts( "const char* hierp, const char* pagep, const char* commentp) {\n");
|
puts( "const char* hierp, const char* pagep, const char* commentp) {\n");
|
||||||
puts( "static uint32_t fake_zero_count = 0;\n"); // static doesn't need save-restore as constant
|
puts( "static uint32_t fake_zero_count = 0;\n"); // static doesn't need save-restore as constant
|
||||||
puts( "if (!enable) countp = &fake_zero_count;\n"); // Used for second++ instantiation of identical bin
|
puts( "if (!enable) countp = &fake_zero_count;\n"); // Used for second++ instantiation of identical bin
|
||||||
@ -2045,7 +2045,7 @@ void EmitCImp::emitCoverageImp(AstNodeModule* modp) {
|
|||||||
|
|
||||||
void EmitCImp::emitDestructorImp(AstNodeModule* modp) {
|
void EmitCImp::emitDestructorImp(AstNodeModule* modp) {
|
||||||
puts("\n");
|
puts("\n");
|
||||||
puts(modClassName(modp)+"::~"+modClassName(modp)+"() {\n");
|
puts(prefixNameProtect(modp) + "::~" + prefixNameProtect(modp) + "() {\n");
|
||||||
if (modp->isTop() && v3Global.opt.mtasks()) {
|
if (modp->isTop() && v3Global.opt.mtasks()) {
|
||||||
puts("delete __Vm_threadPoolp; __Vm_threadPoolp = NULL;\n");
|
puts("delete __Vm_threadPoolp; __Vm_threadPoolp = NULL;\n");
|
||||||
}
|
}
|
||||||
@ -2063,7 +2063,8 @@ void EmitCImp::emitSavableImp(AstNodeModule* modp) {
|
|||||||
string funcname = de ? "__Vdeserialize" : "__Vserialize";
|
string funcname = de ? "__Vdeserialize" : "__Vserialize";
|
||||||
string op = de ? ">>" : "<<";
|
string op = de ? ">>" : "<<";
|
||||||
// NOLINTNEXTLINE(performance-inefficient-string-concatenation)
|
// NOLINTNEXTLINE(performance-inefficient-string-concatenation)
|
||||||
puts("void "+modClassName(modp)+"::"+protect(funcname)+"("+classname+"& os) {\n");
|
puts("void " + prefixNameProtect(modp) + "::" + protect(funcname) + "(" + classname
|
||||||
|
+ "& os) {\n");
|
||||||
// Place a computed checksum to ensure proper structure save/restore formatting
|
// Place a computed checksum to ensure proper structure save/restore formatting
|
||||||
// OK if this hash includes some things we won't dump, since
|
// OK if this hash includes some things we won't dump, since
|
||||||
// just looking for loading the wrong model
|
// just looking for loading the wrong model
|
||||||
@ -2167,7 +2168,8 @@ void EmitCImp::emitCellCtors(AstNodeModule* modp) {
|
|||||||
}
|
}
|
||||||
for (AstNode* nodep = modp->stmtsp(); nodep; nodep = nodep->nextp()) {
|
for (AstNode* nodep = modp->stmtsp(); nodep; nodep = nodep->nextp()) {
|
||||||
if (AstCell* cellp = VN_CAST(nodep, Cell)) {
|
if (AstCell* cellp = VN_CAST(nodep, Cell)) {
|
||||||
puts("VL_CELL("+cellp->nameProtect()+", "+modClassName(cellp->modp())+");\n");
|
puts("VL_CELL(" + cellp->nameProtect() + ", " + prefixNameProtect(cellp->modp())
|
||||||
|
+ ");\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2238,8 +2240,9 @@ void EmitCImp::emitSettleLoop(const std::string& eval_call, bool initial) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EmitCImp::emitWrapEval(AstNodeModule* modp) {
|
void EmitCImp::emitWrapEval(AstNodeModule* modp) {
|
||||||
puts("\nvoid "+modClassName(modp)+"::eval() {\n");
|
puts("\nvoid " + prefixNameProtect(modp) + "::eval() {\n");
|
||||||
puts("VL_DEBUG_IF(VL_DBG_MSGF(\"+++++TOP Evaluate "+modClassName(modp)+"::eval\\n\"); );\n");
|
puts("VL_DEBUG_IF(VL_DBG_MSGF(\"+++++TOP Evaluate " + prefixNameProtect(modp)
|
||||||
|
+ "::eval\\n\"); );\n");
|
||||||
puts(EmitCBaseVisitor::symClassVar()+" = this->__VlSymsp; // Setup global symbol table\n");
|
puts(EmitCBaseVisitor::symClassVar()+" = this->__VlSymsp; // Setup global symbol table\n");
|
||||||
puts(EmitCBaseVisitor::symTopAssign()+"\n");
|
puts(EmitCBaseVisitor::symTopAssign()+"\n");
|
||||||
puts("#ifdef VL_DEBUG\n");
|
puts("#ifdef VL_DEBUG\n");
|
||||||
@ -2311,8 +2314,8 @@ void EmitCImp::emitWrapEval(AstNodeModule* modp) {
|
|||||||
splitSizeInc(10);
|
splitSizeInc(10);
|
||||||
|
|
||||||
//
|
//
|
||||||
puts("\nvoid "+modClassName(modp)+"::"+protect("_eval_initial_loop")
|
puts("\nvoid " + prefixNameProtect(modp) + "::" + protect("_eval_initial_loop") + "("
|
||||||
+"("+EmitCBaseVisitor::symClassVar()+") {\n");
|
+ EmitCBaseVisitor::symClassVar() + ") {\n");
|
||||||
puts("vlSymsp->__Vm_didInit = true;\n");
|
puts("vlSymsp->__Vm_didInit = true;\n");
|
||||||
puts(protect("_eval_initial")+"(vlSymsp);\n");
|
puts(protect("_eval_initial")+"(vlSymsp);\n");
|
||||||
if (v3Global.opt.trace()) {
|
if (v3Global.opt.trace()) {
|
||||||
@ -2571,9 +2574,9 @@ void EmitCImp::emitInt(AstNodeModule* modp) {
|
|||||||
vl_unordered_set<string> didClassName;
|
vl_unordered_set<string> didClassName;
|
||||||
for (AstNode* nodep = modp->stmtsp(); nodep; nodep = nodep->nextp()) {
|
for (AstNode* nodep = modp->stmtsp(); nodep; nodep = nodep->nextp()) {
|
||||||
if (AstCell* cellp = VN_CAST(nodep, Cell)) {
|
if (AstCell* cellp = VN_CAST(nodep, Cell)) {
|
||||||
string className = modClassName(cellp->modp());
|
string className = prefixNameProtect(cellp->modp());
|
||||||
if (didClassName.find(className)==didClassName.end()) {
|
if (didClassName.find(className) == didClassName.end()) {
|
||||||
puts("class "+className+";\n");
|
puts("class " + className + ";\n");
|
||||||
didClassName.insert(className);
|
didClassName.insert(className);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2586,9 +2589,9 @@ void EmitCImp::emitInt(AstNodeModule* modp) {
|
|||||||
emitTextSection(AstType::atScHdr);
|
emitTextSection(AstType::atScHdr);
|
||||||
|
|
||||||
if (optSystemC() && modp->isTop()) {
|
if (optSystemC() && modp->isTop()) {
|
||||||
puts("SC_MODULE("+modClassName(modp)+") {\n");
|
puts("SC_MODULE(" + prefixNameProtect(modp) + ") {\n");
|
||||||
} else {
|
} else {
|
||||||
puts("VL_MODULE("+modClassName(modp)+") {\n");
|
puts("VL_MODULE(" + prefixNameProtect(modp) + ") {\n");
|
||||||
}
|
}
|
||||||
ofp()->resetPrivate();
|
ofp()->resetPrivate();
|
||||||
ofp()->putsPrivate(false); // public:
|
ofp()->putsPrivate(false); // public:
|
||||||
@ -2603,7 +2606,7 @@ void EmitCImp::emitInt(AstNodeModule* modp) {
|
|||||||
if (modp->isTop()) puts("// Public to allow access to /*verilator_public*/ items;\n");
|
if (modp->isTop()) puts("// Public to allow access to /*verilator_public*/ items;\n");
|
||||||
if (modp->isTop()) puts("// otherwise the application code can consider these internals.\n");
|
if (modp->isTop()) puts("// otherwise the application code can consider these internals.\n");
|
||||||
}
|
}
|
||||||
puts(modClassName(cellp->modp())+"* "+cellp->nameProtect()+";\n");
|
puts(prefixNameProtect(cellp->modp()) + "* " + cellp->nameProtect() + ";\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2671,24 +2674,26 @@ void EmitCImp::emitInt(AstNodeModule* modp) {
|
|||||||
ofp()->resetPrivate();
|
ofp()->resetPrivate();
|
||||||
// We don't need a private copy constructor, as VerilatedModule has one for us.
|
// We don't need a private copy constructor, as VerilatedModule has one for us.
|
||||||
ofp()->putsPrivate(true);
|
ofp()->putsPrivate(true);
|
||||||
puts("VL_UNCOPYABLE("+modClassName(modp)+"); ///< Copying not allowed\n");
|
puts("VL_UNCOPYABLE(" + prefixNameProtect(modp) + "); ///< Copying not allowed\n");
|
||||||
|
|
||||||
ofp()->putsPrivate(false); // public:
|
ofp()->putsPrivate(false); // public:
|
||||||
if (optSystemC() && modp->isTop()) {
|
if (optSystemC() && modp->isTop()) {
|
||||||
puts("SC_CTOR("+modClassName(modp)+");\n");
|
puts("SC_CTOR(" + prefixNameProtect(modp) + ");\n");
|
||||||
puts("virtual ~"+modClassName(modp)+"();\n");
|
puts("virtual ~" + prefixNameProtect(modp) + "();\n");
|
||||||
} else if (optSystemC()) {
|
} else if (optSystemC()) {
|
||||||
puts("VL_CTOR("+modClassName(modp)+");\n");
|
puts("VL_CTOR(" + prefixNameProtect(modp) + ");\n");
|
||||||
puts("~"+modClassName(modp)+"();\n");
|
puts("~" + prefixNameProtect(modp) + "();\n");
|
||||||
} else {
|
} else {
|
||||||
if (modp->isTop()) {
|
if (modp->isTop()) {
|
||||||
puts("/// Construct the model; called by application code\n");
|
puts("/// Construct the model; called by application code\n");
|
||||||
puts("/// The special name "" may be used to make a wrapper with a\n");
|
puts("/// The special name "" may be used to make a wrapper with a\n");
|
||||||
puts("/// single model invisible with respect to DPI scope names.\n");
|
puts("/// single model invisible with respect to DPI scope names.\n");
|
||||||
}
|
}
|
||||||
puts(modClassName(modp)+"(const char* name = \"TOP\");\n");
|
puts(prefixNameProtect(modp) + "(const char* name = \"TOP\");\n");
|
||||||
if (modp->isTop()) puts("/// Destroy the model; called (often implicitly) by application code\n");
|
if (modp->isTop()) {
|
||||||
puts("~"+modClassName(modp)+"();\n");
|
puts("/// Destroy the model; called (often implicitly) by application code\n");
|
||||||
|
}
|
||||||
|
puts("~" + prefixNameProtect(modp) + "();\n");
|
||||||
}
|
}
|
||||||
if (v3Global.opt.trace() && modp->isTop()) {
|
if (v3Global.opt.trace() && modp->isTop()) {
|
||||||
puts("/// Trace signals in the model; called by application code\n");
|
puts("/// Trace signals in the model; called by application code\n");
|
||||||
@ -2747,11 +2752,14 @@ void EmitCImp::emitInt(AstNodeModule* modp) {
|
|||||||
if (v3Global.opt.savable() && modp->isTop()) {
|
if (v3Global.opt.savable() && modp->isTop()) {
|
||||||
puts("\n");
|
puts("\n");
|
||||||
puts("inline VerilatedSerialize& operator<<(VerilatedSerialize& os, "
|
puts("inline VerilatedSerialize& operator<<(VerilatedSerialize& os, "
|
||||||
+modClassName(modp)+"& rhs) {\n"
|
+ prefixNameProtect(modp) + "& rhs) {\n"
|
||||||
"Verilated::quiesce(); rhs."+protect("__Vserialize")+"(os); return os; }\n");
|
+ "Verilated::quiesce(); rhs."
|
||||||
|
+ protect("__Vserialize") + "(os); return os; }\n");
|
||||||
puts("inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, "
|
puts("inline VerilatedDeserialize& operator>>(VerilatedDeserialize& os, "
|
||||||
+modClassName(modp)+"& rhs) {\n"
|
+ prefixNameProtect(modp)
|
||||||
"Verilated::quiesce(); rhs."+protect("__Vdeserialize")+"(os); return os; }\n");
|
+ "& rhs) {\n"
|
||||||
|
+ "Verilated::quiesce(); rhs."
|
||||||
|
+ protect("__Vdeserialize") + "(os); return os; }\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// finish up h-file
|
// finish up h-file
|
||||||
@ -2762,8 +2770,8 @@ void EmitCImp::emitInt(AstNodeModule* modp) {
|
|||||||
|
|
||||||
void EmitCImp::emitImp(AstNodeModule* modp) {
|
void EmitCImp::emitImp(AstNodeModule* modp) {
|
||||||
puts("\n");
|
puts("\n");
|
||||||
puts("#include \""+modClassName(modp)+".h\"\n");
|
puts("#include \"" + prefixNameProtect(modp) + ".h\"\n");
|
||||||
puts("#include \""+symClassName()+".h\"\n");
|
puts("#include \"" + symClassName() + ".h\"\n");
|
||||||
|
|
||||||
if (v3Global.dpi()) {
|
if (v3Global.dpi()) {
|
||||||
puts("\n");
|
puts("\n");
|
||||||
@ -2776,7 +2784,7 @@ void EmitCImp::emitImp(AstNodeModule* modp) {
|
|||||||
if (m_slow && splitFilenum()==0) {
|
if (m_slow && splitFilenum()==0) {
|
||||||
puts("\n//--------------------\n");
|
puts("\n//--------------------\n");
|
||||||
puts("// STATIC VARIABLES\n\n");
|
puts("// STATIC VARIABLES\n\n");
|
||||||
emitVarList(modp->stmtsp(), EVL_CLASS_ALL, modClassName(modp));
|
emitVarList(modp->stmtsp(), EVL_CLASS_ALL, prefixNameProtect(modp));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_fast && splitFilenum()==0) {
|
if (m_fast && splitFilenum()==0) {
|
||||||
@ -2824,9 +2832,7 @@ void EmitCImp::main(AstNodeModule* modp, bool slow, bool fast) {
|
|||||||
m_slow = slow;
|
m_slow = slow;
|
||||||
m_fast = fast;
|
m_fast = fast;
|
||||||
|
|
||||||
if (debug()>=5) {
|
UINFO(5, " Emitting " << prefixNameProtect(modp) << endl);
|
||||||
UINFO(0," Emitting "<<modClassName(modp)<<endl);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_fast) {
|
if (m_fast) {
|
||||||
m_ofp = newOutCFile(modp, !m_fast, false/*source*/);
|
m_ofp = newOutCFile(modp, !m_fast, false/*source*/);
|
||||||
|
@ -56,11 +56,12 @@ public:
|
|||||||
static string symClassVar() { return symClassName()+"* __restrict vlSymsp"; }
|
static string symClassVar() { return symClassName()+"* __restrict vlSymsp"; }
|
||||||
static string symTopAssign() {
|
static string symTopAssign() {
|
||||||
return v3Global.opt.prefix()+"* __restrict vlTOPp VL_ATTR_UNUSED = vlSymsp->TOPp;"; }
|
return v3Global.opt.prefix()+"* __restrict vlTOPp VL_ATTR_UNUSED = vlSymsp->TOPp;"; }
|
||||||
static string modClassName(AstNodeModule* modp) { // Return name of current module being processed
|
static string prefixNameProtect(const AstNode* nodep) { // C++ name with prefix
|
||||||
if (modp->isTop()) {
|
const AstNodeModule* modp = VN_CAST_CONST(nodep, NodeModule);
|
||||||
|
if (modp && modp->isTop()) {
|
||||||
return v3Global.opt.prefix();
|
return v3Global.opt.prefix();
|
||||||
} else {
|
} else {
|
||||||
return v3Global.opt.modPrefix()+"_"+protect(modp->name());
|
return v3Global.opt.modPrefix() + "_" + protect(nodep->name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static string topClassName() { // Return name of top wrapper module
|
static string topClassName() { // Return name of top wrapper module
|
||||||
|
@ -391,7 +391,7 @@ void EmitCSyms::emitSymHdr() {
|
|||||||
puts("\n// INCLUDE MODULE CLASSES\n");
|
puts("\n// INCLUDE MODULE CLASSES\n");
|
||||||
for (AstNodeModule* nodep = v3Global.rootp()->modulesp();
|
for (AstNodeModule* nodep = v3Global.rootp()->modulesp();
|
||||||
nodep; nodep=VN_CAST(nodep->nextp(), NodeModule)) {
|
nodep; nodep=VN_CAST(nodep->nextp(), NodeModule)) {
|
||||||
puts("#include \""+modClassName(nodep)+".h\"\n");
|
puts("#include \"" + prefixNameProtect(nodep) + ".h\"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (v3Global.dpi()) {
|
if (v3Global.dpi()) {
|
||||||
@ -425,12 +425,11 @@ void EmitCSyms::emitSymHdr() {
|
|||||||
AstScope* scopep = it->first;
|
AstScope* scopep = it->first;
|
||||||
AstNodeModule* modp = it->second;
|
AstNodeModule* modp = it->second;
|
||||||
if (modp->isTop()) {
|
if (modp->isTop()) {
|
||||||
ofp()->printf("%-30s ", (modClassName(modp)+"*").c_str());
|
ofp()->printf("%-30s ", (prefixNameProtect(modp) + "*").c_str());
|
||||||
puts(protectIf(scopep->nameDotless()+"p", scopep->protect())+";\n");
|
puts(protectIf(scopep->nameDotless() + "p", scopep->protect()) + ";\n");
|
||||||
}
|
} else {
|
||||||
else {
|
ofp()->printf("%-30s ", (prefixNameProtect(modp) + "").c_str());
|
||||||
ofp()->printf("%-30s ", (modClassName(modp)+"").c_str());
|
puts(protectIf(scopep->nameDotless(), scopep->protect()) + ";\n");
|
||||||
puts(protectIf(scopep->nameDotless(), scopep->protect())+";\n");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -528,7 +527,7 @@ void EmitCSyms::emitSymImpPreamble() {
|
|||||||
puts("#include \""+symClassName()+".h\"\n");
|
puts("#include \""+symClassName()+".h\"\n");
|
||||||
for (AstNodeModule* nodep = v3Global.rootp()->modulesp(); nodep;
|
for (AstNodeModule* nodep = v3Global.rootp()->modulesp(); nodep;
|
||||||
nodep = VN_CAST(nodep->nextp(), NodeModule)) {
|
nodep = VN_CAST(nodep->nextp(), NodeModule)) {
|
||||||
puts("#include \"" + modClassName(nodep) + ".h\"\n");
|
puts("#include \"" + prefixNameProtect(nodep) + ".h\"\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -699,7 +698,7 @@ void EmitCSyms::emitSymImp() {
|
|||||||
puts(protect("__Vscope_"+scopep->scopeSymName())+".exportInsert(__Vfinal, ");
|
puts(protect("__Vscope_"+scopep->scopeSymName())+".exportInsert(__Vfinal, ");
|
||||||
putsQuoted(funcp->cname()); // Not protected - user asked for import/export
|
putsQuoted(funcp->cname()); // Not protected - user asked for import/export
|
||||||
puts(", (void*)(&");
|
puts(", (void*)(&");
|
||||||
puts(modClassName(modp));
|
puts(prefixNameProtect(modp));
|
||||||
puts("::");
|
puts("::");
|
||||||
puts(funcp->nameProtect());
|
puts(funcp->nameProtect());
|
||||||
puts("));\n");
|
puts("));\n");
|
||||||
|
@ -61,9 +61,9 @@ class EmitVBaseVisitor : public EmitCBaseVisitor {
|
|||||||
iterateChildren(nodep);
|
iterateChildren(nodep);
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
|
virtual void visit(AstNodeModule* nodep) VL_OVERRIDE {
|
||||||
putfs(nodep, nodep->verilogKwd()+" "+modClassName(nodep)+";\n");
|
putfs(nodep, nodep->verilogKwd() + " " + prefixNameProtect(nodep) + ";\n");
|
||||||
iterateChildren(nodep);
|
iterateChildren(nodep);
|
||||||
putqs(nodep, "end"+nodep->verilogKwd()+"\n");
|
putqs(nodep, "end" + nodep->verilogKwd() + "\n");
|
||||||
}
|
}
|
||||||
virtual void visit(AstNodeFTask* nodep) VL_OVERRIDE {
|
virtual void visit(AstNodeFTask* nodep) VL_OVERRIDE {
|
||||||
putfs(nodep, nodep->isFunction() ? "function":"task");
|
putfs(nodep, nodep->isFunction() ? "function":"task");
|
||||||
@ -757,12 +757,12 @@ void V3EmitV::emitv() {
|
|||||||
EmitVFileVisitor visitor (v3Global.rootp(), &of);
|
EmitVFileVisitor visitor (v3Global.rootp(), &of);
|
||||||
} else {
|
} else {
|
||||||
// Process each module in turn
|
// Process each module in turn
|
||||||
for (AstNodeModule* modp = v3Global.rootp()->modulesp();
|
for (AstNodeModule* modp = v3Global.rootp()->modulesp(); modp;
|
||||||
modp; modp=VN_CAST(modp->nextp(), NodeModule)) {
|
modp = VN_CAST(modp->nextp(), NodeModule)) {
|
||||||
V3OutVFile of (v3Global.opt.makeDir()
|
V3OutVFile of(v3Global.opt.makeDir() + "/" + EmitCBaseVisitor::prefixNameProtect(modp)
|
||||||
+"/"+EmitCBaseVisitor::modClassName(modp)+"__Vout.v");
|
+ "__Vout.v");
|
||||||
of.putsHeader();
|
of.putsHeader();
|
||||||
EmitVFileVisitor visitor (modp, &of);
|
EmitVFileVisitor visitor(modp, &of);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user