Collected minor output code cleanups.

This commit is contained in:
Wilson Snyder 2020-04-23 21:22:47 -04:00
parent f93ae707e0
commit df52e481fb
5 changed files with 26 additions and 9 deletions

View File

@ -853,9 +853,13 @@ double vl_time_multiplier(int scale);
/// Evaluate expression if debug enabled
#ifdef VL_DEBUG
# define VL_DEBUG_IF(text) {if (VL_UNLIKELY(Verilated::debug())) {text}}
# define VL_DEBUG_IF(text) \
do { \
if (VL_UNLIKELY(Verilated::debug())) {text} \
} while (false)
#else
# define VL_DEBUG_IF(text)
// We intentionally do not compile the text to improve compile speed
# define VL_DEBUG_IF(text) do {} while (false)
#endif
/// Collect coverage analysis for this line

View File

@ -205,6 +205,7 @@
# define VL_INCLUDE_UNORDERED_SET <unordered_set>
# endif
# define VL_FINAL final
# define VL_MUTABLE mutable
# define VL_OVERRIDE override
#else
# define VL_EQ_DELETE
@ -212,6 +213,7 @@
# define VL_INCLUDE_UNORDERED_MAP "verilated_unordered_set_map.h"
# define VL_INCLUDE_UNORDERED_SET "verilated_unordered_set_map.h"
# define VL_FINAL
# define VL_MUTABLE
# define VL_OVERRIDE
#endif

View File

@ -2334,7 +2334,9 @@ void EmitCImp::emitDestructorImp(AstNodeModule* modp) {
puts("\n");
puts(prefixNameProtect(modp) + "::~" + prefixNameProtect(modp) + "() {\n");
if (modp->isTop()) {
if (v3Global.opt.mtasks()) puts("delete __Vm_threadPoolp; __Vm_threadPoolp = NULL;\n");
if (v3Global.opt.mtasks()) {
puts("VL_DO_CLEAR(delete __Vm_threadPoolp, __Vm_threadPoolp = NULL);\n");
}
// Call via function in __Trace.cpp as this .cpp file does not have trace header
if (v3Global.needTraceDumper()) {
puts("#ifdef VM_TRACE\n");
@ -2343,7 +2345,7 @@ void EmitCImp::emitDestructorImp(AstNodeModule* modp) {
}
}
emitTextSection(AstType::atScDtor);
if (modp->isTop()) puts("delete __VlSymsp; __VlSymsp=NULL;\n");
if (modp->isTop()) puts("VL_DO_CLEAR(delete __VlSymsp, __VlSymsp = NULL);\n");
puts("}\n");
splitSizeInc(10);
}
@ -3326,7 +3328,7 @@ class EmitCTrace : EmitCStmts {
puts("void " + topClassName() + "::_traceDumpClose() {\n");
puts("VerilatedLockGuard lock(__VlSymsp->__Vm_dumperMutex);\n");
puts("__VlSymsp->__Vm_dumping = false;\n");
puts("delete __VlSymsp->__Vm_dumperp; __VlSymsp->__Vm_dumperp = NULL;\n");
puts("VL_DO_CLEAR(delete __VlSymsp->__Vm_dumperp, __VlSymsp->__Vm_dumperp = NULL);\n");
puts("}\n");
splitSizeInc(10);
}

View File

@ -76,10 +76,15 @@ private:
puts("// Simulate until $finish\n");
puts("while (!Verilated::gotFinish()) {\n");
/**/ puts("// Evaluate model\n");
/**/ puts("topp->eval();\n");
/**/ puts("// Advance time\n");
/**/ puts("++main_time;\n");
puts(/**/ "// Evaluate model\n");
puts(/**/ "topp->eval();\n");
puts(/**/ "// Advance time\n");
puts(/**/ "++main_time;\n");
puts("}\n");
puts("\n");
puts("if (!Verilated::gotFinish()) {\n");
puts(/**/ "VL_DEBUG_IF(VL_PRINTF(\"+ Exiting without $finish; no events left\\n\"););\n");
puts("}\n");
puts("\n");

View File

@ -633,6 +633,10 @@ void V3Options::notify() {
&& !v3Global.opt.xmlOnly());
}
if (v3Global.opt.main() && v3Global.opt.systemC()) {
cmdfl->v3error("--main not usable with SystemC. Suggest see examples for sc_main().");
}
// --trace-threads implies --threads 1 unless explicitly specified
if (traceThreads() && !threads()) m_threads = 1;