forked from github/verilator
Allow top name to be '' for invisible shells
This commit is contained in:
parent
53fda88d4c
commit
5d5952d354
@ -999,8 +999,12 @@ void VerilatedScope::configure(VerilatedSyms* symsp, const char* prefixp, const
|
||||
// We don't want the space and reference-count access overhead of strings.
|
||||
m_symsp = symsp;
|
||||
char* namep = new char[strlen(prefixp)+strlen(suffixp)+2];
|
||||
strcpy(namep, prefixp);
|
||||
strcat(namep, suffixp);
|
||||
if (!*prefixp && *suffixp && suffixp[0]=='.') { // Special case of top module with empty name - drop the dots
|
||||
strcpy(namep, suffixp+1);
|
||||
} else {
|
||||
strcpy(namep, prefixp);
|
||||
strcat(namep, suffixp);
|
||||
}
|
||||
m_namep = namep;
|
||||
VerilatedImp::scopeInsert(this);
|
||||
}
|
||||
|
@ -1712,7 +1712,11 @@ void EmitCImp::emitInt(AstNodeModule* modp) {
|
||||
puts("VL_CTOR("+modClassName(modp)+");\n");
|
||||
puts("~"+modClassName(modp)+"();\n");
|
||||
} else {
|
||||
if (modp->isTop()) puts("/// Construct the model; called by application code\n");
|
||||
if (modp->isTop()) {
|
||||
puts("/// Construct the model; called by application code\n");
|
||||
puts("/// The special name "" may be used to make a wrapper with a\n");
|
||||
puts("/// single model invisible WRT DPI scope names.\n");
|
||||
}
|
||||
puts(modClassName(modp)+"(const char* name=\"TOP\");\n");
|
||||
if (modp->isTop()) puts("/// Destroy the model; called (often implicitly) by application code\n");
|
||||
puts("~"+modClassName(modp)+"();\n");
|
||||
|
@ -11,7 +11,7 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
|
||||
|
||||
compile (
|
||||
# Amazingly VCS, NC and Verilator all just accept the C file here!
|
||||
v_flags2 => ["t/t_dpi_export_c.cpp"],
|
||||
v_flags2 => ["t/t_dpi_export_c.cpp", "-no-l2name"],
|
||||
);
|
||||
|
||||
execute (
|
||||
|
@ -122,13 +122,8 @@ int dpix_run_tests() {
|
||||
CHECK_RESULT (dpix_f_longint(1), 0xfffffffffffffffeULL);
|
||||
CHECK_RESULT (dpix_f_chandle((void*)(12345)), (void*)(12345));
|
||||
|
||||
#ifdef VERILATOR
|
||||
if (int bad=check_sub("top.v.a",1)) return bad;
|
||||
if (int bad=check_sub("top.v.b",2)) return bad;
|
||||
#else
|
||||
if (int bad=check_sub("top.t.a",1)) return bad;
|
||||
if (int bad=check_sub("top.t.b",2)) return bad;
|
||||
#endif
|
||||
|
||||
return -1; // OK status
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user