parent
e3558d9e1b
commit
6908e471e7
|
|
@ -2994,8 +2994,8 @@ VerilatedScope::~VerilatedScope() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VerilatedScope::configure(VerilatedSyms* symsp, const char* prefixp, const char* suffixp,
|
void VerilatedScope::configure(VerilatedSyms* symsp, const char* prefixp, const char* suffixp,
|
||||||
const char* identifier, int8_t timeunit, const Type& type,
|
const char* identifier, int8_t timeunit,
|
||||||
const char* defName) VL_MT_UNSAFE {
|
const Type& type) VL_MT_UNSAFE {
|
||||||
// Slowpath - called once/scope at construction
|
// Slowpath - called once/scope at construction
|
||||||
// We don't want the space and reference-count access overhead of strings.
|
// We don't want the space and reference-count access overhead of strings.
|
||||||
m_symsp = symsp;
|
m_symsp = symsp;
|
||||||
|
|
@ -3011,7 +3011,6 @@ void VerilatedScope::configure(VerilatedSyms* symsp, const char* prefixp, const
|
||||||
m_namep = namep;
|
m_namep = namep;
|
||||||
}
|
}
|
||||||
m_identifierp = identifier;
|
m_identifierp = identifier;
|
||||||
m_defNamep = defName;
|
|
||||||
Verilated::threadContextp()->impp()->scopeInsert(this);
|
Verilated::threadContextp()->impp()->scopeInsert(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -607,21 +607,18 @@ private:
|
||||||
const char* m_identifierp = nullptr; // Identifier of scope (with escapes removed)
|
const char* m_identifierp = nullptr; // Identifier of scope (with escapes removed)
|
||||||
int8_t m_timeunit = 0; // Timeunit in negative power-of-10
|
int8_t m_timeunit = 0; // Timeunit in negative power-of-10
|
||||||
Type m_type = SCOPE_OTHER; // Type of the scope
|
Type m_type = SCOPE_OTHER; // Type of the scope
|
||||||
const char* m_defNamep = nullptr; // defName (module name, not instance name)
|
|
||||||
|
|
||||||
public: // But internals only - called from VerilatedModule's
|
public: // But internals only - called from VerilatedModule's
|
||||||
VerilatedScope() = default;
|
VerilatedScope() = default;
|
||||||
~VerilatedScope();
|
~VerilatedScope();
|
||||||
void configure(VerilatedSyms* symsp, const char* prefixp, const char* suffixp,
|
void configure(VerilatedSyms* symsp, const char* prefixp, const char* suffixp,
|
||||||
const char* identifier, int8_t timeunit, const Type& type,
|
const char* identifier, int8_t timeunit, const Type& type) VL_MT_UNSAFE;
|
||||||
const char* defName) VL_MT_UNSAFE;
|
|
||||||
void exportInsert(int finalize, const char* namep, void* cb) 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,
|
void varInsert(int finalize, const char* namep, void* datap, bool isParam,
|
||||||
VerilatedVarType vltype, int vlflags, int dims, ...) VL_MT_UNSAFE;
|
VerilatedVarType vltype, int vlflags, int dims, ...) VL_MT_UNSAFE;
|
||||||
// ACCESSORS
|
// ACCESSORS
|
||||||
const char* name() const VL_MT_SAFE_POSTINIT { return m_namep; }
|
const char* name() const VL_MT_SAFE_POSTINIT { return m_namep; }
|
||||||
const char* identifier() const VL_MT_SAFE_POSTINIT { return m_identifierp; }
|
const char* identifier() const VL_MT_SAFE_POSTINIT { return m_identifierp; }
|
||||||
const char* defname() const VL_MT_SAFE_POSTINIT { return m_defNamep; }
|
|
||||||
int8_t timeunit() const VL_MT_SAFE_POSTINIT { return m_timeunit; }
|
int8_t timeunit() const VL_MT_SAFE_POSTINIT { return m_timeunit; }
|
||||||
VerilatedSyms* symsp() const VL_MT_SAFE_POSTINIT { return m_symsp; }
|
VerilatedSyms* symsp() const VL_MT_SAFE_POSTINIT { return m_symsp; }
|
||||||
VerilatedVar* varFind(const char* namep) const VL_MT_SAFE_POSTINIT;
|
VerilatedVar* varFind(const char* namep) const VL_MT_SAFE_POSTINIT;
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,6 @@ public:
|
||||||
const VerilatedScope* scopep() const { return m_scopep; }
|
const VerilatedScope* scopep() const { return m_scopep; }
|
||||||
const char* name() const override { return m_scopep->name(); }
|
const char* name() const override { return m_scopep->name(); }
|
||||||
const char* fullname() const override { return m_scopep->name(); }
|
const char* fullname() const override { return m_scopep->name(); }
|
||||||
const char* defname() const override { return m_scopep->defname(); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class VerilatedVpioVar VL_NOT_FINAL : public VerilatedVpioVarBase {
|
class VerilatedVpioVar VL_NOT_FINAL : public VerilatedVpioVarBase {
|
||||||
|
|
|
||||||
|
|
@ -44,14 +44,12 @@ class EmitCSyms final : EmitCBaseVisitor {
|
||||||
const string m_prettyName;
|
const string m_prettyName;
|
||||||
const int m_timeunit;
|
const int m_timeunit;
|
||||||
string m_type;
|
string m_type;
|
||||||
string m_defName;
|
|
||||||
ScopeData(const string& symName, const string& prettyName, int timeunit,
|
ScopeData(const string& symName, const string& prettyName, int timeunit,
|
||||||
const string& type, const string& defName = "")
|
const string& type)
|
||||||
: m_symName{symName}
|
: m_symName{symName}
|
||||||
, m_prettyName{prettyName}
|
, m_prettyName{prettyName}
|
||||||
, m_timeunit{timeunit}
|
, m_timeunit{timeunit}
|
||||||
, m_type{type}
|
, m_type{type} {}
|
||||||
, m_defName{defName} {}
|
|
||||||
};
|
};
|
||||||
struct ScopeFuncData {
|
struct ScopeFuncData {
|
||||||
AstScopeName* const m_scopep;
|
AstScopeName* const m_scopep;
|
||||||
|
|
@ -196,7 +194,6 @@ class EmitCSyms final : EmitCBaseVisitor {
|
||||||
m_scopeNames.emplace(scpit->second.m_symName, scpit->second);
|
m_scopeNames.emplace(scpit->second.m_symName, scpit->second);
|
||||||
} else {
|
} else {
|
||||||
scopeNameit->second.m_type = scpit->second.m_type;
|
scopeNameit->second.m_type = scpit->second.m_type;
|
||||||
scopeNameit->second.m_defName = scpit->second.m_defName;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
string::size_type pos = scp.rfind("__DOT__");
|
string::size_type pos = scp.rfind("__DOT__");
|
||||||
|
|
@ -317,9 +314,8 @@ class EmitCSyms final : EmitCBaseVisitor {
|
||||||
const string name = nodep->scopep()->shortName() + "__DOT__" + nodep->name();
|
const string name = nodep->scopep()->shortName() + "__DOT__" + nodep->name();
|
||||||
const string name_pretty = AstNode::vpiName(name);
|
const string name_pretty = AstNode::vpiName(name);
|
||||||
const int timeunit = m_modp->timeunit().powerOfTen();
|
const int timeunit = m_modp->timeunit().powerOfTen();
|
||||||
m_vpiScopeCandidates.insert(
|
m_vpiScopeCandidates.insert(std::make_pair(
|
||||||
std::make_pair(name, ScopeData(scopeSymString(name), name_pretty, timeunit, type,
|
name, ScopeData(scopeSymString(name), name_pretty, timeunit, type)));
|
||||||
nodep->origModName())));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void visit(AstScope* nodep) override {
|
void visit(AstScope* nodep) override {
|
||||||
|
|
@ -332,9 +328,9 @@ class EmitCSyms final : EmitCBaseVisitor {
|
||||||
const string type = VN_IS(nodep->modp(), Package) ? "SCOPE_OTHER" : "SCOPE_MODULE";
|
const string type = VN_IS(nodep->modp(), Package) ? "SCOPE_OTHER" : "SCOPE_MODULE";
|
||||||
const string name_pretty = AstNode::vpiName(nodep->shortName());
|
const string name_pretty = AstNode::vpiName(nodep->shortName());
|
||||||
const int timeunit = m_modp->timeunit().powerOfTen();
|
const int timeunit = m_modp->timeunit().powerOfTen();
|
||||||
m_vpiScopeCandidates.insert(std::make_pair(
|
m_vpiScopeCandidates.insert(
|
||||||
nodep->name(), ScopeData(scopeSymString(nodep->name()), name_pretty, timeunit,
|
std::make_pair(nodep->name(), ScopeData(scopeSymString(nodep->name()), name_pretty,
|
||||||
type, nodep->modp()->origName())));
|
timeunit, type)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void visit(AstScopeName* nodep) override {
|
void visit(AstScopeName* nodep) override {
|
||||||
|
|
@ -342,9 +338,8 @@ class EmitCSyms final : EmitCBaseVisitor {
|
||||||
// UINFO(9,"scnameins sp "<<nodep->name()<<" sp "<<nodep->scopePrettySymName()
|
// UINFO(9,"scnameins sp "<<nodep->name()<<" sp "<<nodep->scopePrettySymName()
|
||||||
// <<" ss"<<name<<endl);
|
// <<" ss"<<name<<endl);
|
||||||
const int timeunit = m_modp ? m_modp->timeunit().powerOfTen() : 0;
|
const int timeunit = m_modp ? m_modp->timeunit().powerOfTen() : 0;
|
||||||
m_scopeNames.emplace(name, ScopeData(name, nodep->scopePrettySymName(), timeunit,
|
m_scopeNames.emplace(
|
||||||
"SCOPE_MODULE", m_modp->origName()));
|
name, ScopeData(name, nodep->scopePrettySymName(), timeunit, "SCOPE_OTHER"));
|
||||||
|
|
||||||
if (nodep->dpiExport()) {
|
if (nodep->dpiExport()) {
|
||||||
UASSERT_OBJ(m_cfuncp, nodep, "ScopeName not under DPI function");
|
UASSERT_OBJ(m_cfuncp, nodep, "ScopeName not under DPI function");
|
||||||
m_scopeFuncs.insert(std::make_pair(name + " " + m_cfuncp->name(),
|
m_scopeFuncs.insert(std::make_pair(name + " " + m_cfuncp->name(),
|
||||||
|
|
@ -872,10 +867,7 @@ void EmitCSyms::emitSymImp() {
|
||||||
putsQuoted(protect(scopeDecodeIdentifier(it->second.m_prettyName)));
|
putsQuoted(protect(scopeDecodeIdentifier(it->second.m_prettyName)));
|
||||||
puts(", ");
|
puts(", ");
|
||||||
puts(cvtToStr(it->second.m_timeunit));
|
puts(cvtToStr(it->second.m_timeunit));
|
||||||
puts(", VerilatedScope::" + it->second.m_type);
|
puts(", VerilatedScope::" + it->second.m_type + ");\n");
|
||||||
puts(", ");
|
|
||||||
putsQuoted(it->second.m_defName);
|
|
||||||
puts(");\n");
|
|
||||||
++m_numStmts;
|
++m_numStmts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -269,8 +269,6 @@ int _mon_check_var() {
|
||||||
CHECK_RESULT_CSTR(p, TestSimulator::top());
|
CHECK_RESULT_CSTR(p, TestSimulator::top());
|
||||||
p = vpi_get_str(vpiType, vh2);
|
p = vpi_get_str(vpiType, vh2);
|
||||||
CHECK_RESULT_CSTR(p, "vpiModule");
|
CHECK_RESULT_CSTR(p, "vpiModule");
|
||||||
p = vpi_get_str(vpiDefName, vh2);
|
|
||||||
CHECK_RESULT_CSTR(p, "t");
|
|
||||||
|
|
||||||
TestVpiHandle vh3 = vpi_handle_by_name((PLI_BYTE8*)"onebit", vh2);
|
TestVpiHandle vh3 = vpi_handle_by_name((PLI_BYTE8*)"onebit", vh2);
|
||||||
CHECK_RESULT_NZ(vh3);
|
CHECK_RESULT_NZ(vh3);
|
||||||
|
|
@ -675,8 +673,6 @@ int _mon_check_putget_str(p_cb_data cb_data) {
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
// setup and install
|
// setup and install
|
||||||
const char* p = nullptr;
|
|
||||||
|
|
||||||
for (int i = 1; i <= 6; i++) {
|
for (int i = 1; i <= 6; i++) {
|
||||||
char buf[32];
|
char buf[32];
|
||||||
snprintf(buf, sizeof(buf), TestSimulator::rooted("arr[%d].arr"), i);
|
snprintf(buf, sizeof(buf), TestSimulator::rooted("arr[%d].arr"), i);
|
||||||
|
|
@ -687,17 +683,12 @@ int _mon_check_putget_str(p_cb_data cb_data) {
|
||||||
= vpi_handle_by_name((PLI_BYTE8*)"check", data[i].scope));
|
= vpi_handle_by_name((PLI_BYTE8*)"check", data[i].scope));
|
||||||
CHECK_RESULT_NZ(data[i].verbose
|
CHECK_RESULT_NZ(data[i].verbose
|
||||||
= vpi_handle_by_name((PLI_BYTE8*)"verbose", data[i].scope));
|
= vpi_handle_by_name((PLI_BYTE8*)"verbose", data[i].scope));
|
||||||
|
|
||||||
p = vpi_get_str(vpiDefName, data[i].scope);
|
|
||||||
CHECK_RESULT_CSTR(p, "arr");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 1; i <= 6; i++) {
|
for (int i = 1; i <= 6; i++) {
|
||||||
char buf[32];
|
char buf[32];
|
||||||
snprintf(buf, sizeof(buf), TestSimulator::rooted("subs[%d].subsub"), i);
|
snprintf(buf, sizeof(buf), TestSimulator::rooted("subs[%d].subsub"), i);
|
||||||
CHECK_RESULT_NZ(data[i].scope = vpi_handle_by_name((PLI_BYTE8*)buf, NULL));
|
CHECK_RESULT_NZ(data[i].scope = vpi_handle_by_name((PLI_BYTE8*)buf, NULL));
|
||||||
|
|
||||||
p = vpi_get_str(vpiDefName, data[i].scope);
|
|
||||||
CHECK_RESULT_CSTR(p, "sub");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static t_cb_data cb_data;
|
static t_cb_data cb_data;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue