Merge 6fb29f12ba into 71dcf30c1f
This commit is contained in:
commit
dda114b271
|
|
@ -3506,13 +3506,12 @@ void VerilatedScope::exportInsert(int finalize, const char* namep, void* cb) VL_
|
|||
}
|
||||
}
|
||||
|
||||
void VerilatedScope::varInsert(int finalize, const char* namep, void* datap, bool isParam,
|
||||
void VerilatedScope::varInsert(const char* namep, void* datap, bool isParam,
|
||||
VerilatedVarType vltype, int vlflags, int udims,
|
||||
int pdims...) VL_MT_UNSAFE {
|
||||
// Grab dimensions
|
||||
// In the future we may just create a large table at emit time and
|
||||
// statically construct from that.
|
||||
if (!finalize) return;
|
||||
|
||||
if (!m_varsp) m_varsp = new VerilatedVarNameMap;
|
||||
VerilatedVar var(namep, datap, vltype, static_cast<VerilatedVarFlags>(vlflags), udims, pdims,
|
||||
|
|
|
|||
|
|
@ -713,8 +713,8 @@ public: // But internals only - called from verilated modules
|
|||
const char* identifier, const char* defnamep, int8_t timeunit,
|
||||
const Type& type) VL_MT_UNSAFE;
|
||||
void exportInsert(int finalize, const char* namep, void* cb) VL_MT_UNSAFE;
|
||||
void varInsert(int finalize, const char* namep, void* datap, bool isParam,
|
||||
VerilatedVarType vltype, int vlflags, int udims, int pdims, ...) VL_MT_UNSAFE;
|
||||
void varInsert(const char* namep, void* datap, bool isParam, VerilatedVarType vltype,
|
||||
int vlflags, int udims, int pdims, ...) VL_MT_UNSAFE;
|
||||
// ACCESSORS
|
||||
const char* name() const VL_MT_SAFE_POSTINIT { return m_namep; }
|
||||
const char* identifier() const VL_MT_SAFE_POSTINIT { return m_identifierp; }
|
||||
|
|
|
|||
|
|
@ -751,31 +751,34 @@ std::vector<std::string> EmitCSyms::getSymCtorStmts() {
|
|||
|
||||
emitScopeHier(stmts, false);
|
||||
|
||||
if (!v3Global.dpi()) return stmts;
|
||||
if (v3Global.dpi()) {
|
||||
for (const std::string vfinal : {"0", "1"}) {
|
||||
add("// Setup export functions - final: " + vfinal);
|
||||
for (const auto& itpair : m_scopeFuncs) {
|
||||
const ScopeFuncData& sfd = itpair.second;
|
||||
const AstScopeName* const scopep = sfd.m_scopep;
|
||||
const AstCFunc* const funcp = sfd.m_cfuncp;
|
||||
const AstNodeModule* const modp = sfd.m_modp;
|
||||
if (!funcp->dpiExportImpl()) continue;
|
||||
|
||||
for (const std::string vfinal : {"0", "1"}) {
|
||||
add("// Setup export functions - final: " + vfinal);
|
||||
for (const auto& itpair : m_scopeFuncs) {
|
||||
const ScopeFuncData& sfd = itpair.second;
|
||||
const AstScopeName* const scopep = sfd.m_scopep;
|
||||
const AstCFunc* const funcp = sfd.m_cfuncp;
|
||||
const AstNodeModule* const modp = sfd.m_modp;
|
||||
if (!funcp->dpiExportImpl()) continue;
|
||||
|
||||
std::string stmt;
|
||||
stmt += protect("__Vscope_" + scopep->scopeSymName()) + ".exportInsert(";
|
||||
stmt += vfinal + ", \"";
|
||||
// Not protected - user asked for import/export
|
||||
stmt += V3OutFormatter::quoteNameControls(funcp->cname());
|
||||
stmt += "\", (void*)(&";
|
||||
stmt += EmitCUtil::prefixNameProtect(modp);
|
||||
stmt += "__";
|
||||
stmt += funcp->nameProtect();
|
||||
stmt += "));";
|
||||
add(stmt);
|
||||
std::string stmt;
|
||||
stmt += protect("__Vscope_" + scopep->scopeSymName()) + ".exportInsert(";
|
||||
stmt += vfinal + ", \"";
|
||||
// Not protected - user asked for import/export
|
||||
stmt += V3OutFormatter::quoteNameControls(funcp->cname());
|
||||
stmt += "\", (void*)(&";
|
||||
stmt += EmitCUtil::prefixNameProtect(modp);
|
||||
stmt += "__";
|
||||
stmt += funcp->nameProtect();
|
||||
stmt += "));";
|
||||
add(stmt);
|
||||
}
|
||||
}
|
||||
// It would be less code if each module inserted its own variables.
|
||||
// Someday. For now public isn't common.
|
||||
}
|
||||
|
||||
// It would be less code if each module inserted its own variables. Someday.
|
||||
if (!m_scopeVars.empty()) {
|
||||
add("// Setup public variables");
|
||||
for (const auto& itpair : m_scopeVars) {
|
||||
const ScopeVarData& svd = itpair.second;
|
||||
const AstScope* const scopep = svd.m_scopep;
|
||||
|
|
@ -812,8 +815,7 @@ std::vector<std::string> EmitCSyms::getSymCtorStmts() {
|
|||
}
|
||||
|
||||
std::string stmt;
|
||||
stmt += protect("__Vscope_" + svd.m_scopeName) + ".varInsert(";
|
||||
stmt += vfinal + ", \"";
|
||||
stmt += protect("__Vscope_" + svd.m_scopeName) + ".varInsert(\"";
|
||||
stmt += V3OutFormatter::quoteNameControls(protect(svd.m_varBasePretty)) + '"';
|
||||
|
||||
const std::string varName
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ test.file_grep_not(test.obj_dir + "/" + test.vm_prefix + "_classes.mk", "vm_clas
|
|||
test.file_grep_not(test.obj_dir + "/" + test.vm_prefix + "_classes.mk", "vm_classes_2")
|
||||
|
||||
# Check combine count
|
||||
test.file_grep(test.stats, r'Node count, CFILE + (\d+)', (270 if test.vltmt else 253))
|
||||
test.file_grep(test.stats, r'Node count, CFILE + (\d+)', (264 if test.vltmt else 247))
|
||||
test.file_grep(test.stats, r'Makefile targets, VM_CLASSES_FAST + (\d+)', 2)
|
||||
test.file_grep(test.stats, r'Makefile targets, VM_CLASSES_SLOW + (\d+)', 2)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
scopesDump:
|
||||
SCOPE 0x#: top.TOP
|
||||
VAR 0x#: clk
|
||||
SCOPE 0x#: top.t
|
||||
VAR 0x#: clk
|
||||
|
||||
*-* All Finished *-*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,15 @@
|
|||
scopesDump:
|
||||
SCOPE 0x#: top.TOP
|
||||
VAR 0x#: clk
|
||||
SCOPE 0x#: top.t
|
||||
VAR 0x#: clk
|
||||
SCOPE 0x#: top.t.s_axis_if
|
||||
VAR 0x#: aclk
|
||||
VAR 0x#: tdata
|
||||
VAR 0x#: tready
|
||||
VAR 0x#: tuser
|
||||
VAR 0x#: tvalid
|
||||
SCOPE 0x#: top.t.u_dut
|
||||
VAR 0x#: clk
|
||||
|
||||
*-* All Finished *-*
|
||||
|
|
|
|||
|
|
@ -1,8 +1,17 @@
|
|||
scopesDump:
|
||||
SCOPE 0x#: top.TOP
|
||||
VAR 0x#: clk
|
||||
SCOPE 0x#: top.t
|
||||
VAR 0x#: clk
|
||||
SCOPE 0x#: top.t.s_axis_if
|
||||
VAR 0x#: aclk
|
||||
VAR 0x#: tdata
|
||||
VAR 0x#: tready
|
||||
VAR 0x#: tuser
|
||||
VAR 0x#: tvalid
|
||||
SCOPE 0x#: top.t.u_dut
|
||||
VAR 0x#: clk
|
||||
SCOPE 0x#: top.t.u_dut.u_sub
|
||||
VAR 0x#: clk
|
||||
|
||||
*-* All Finished *-*
|
||||
|
|
|
|||
Loading…
Reference in New Issue