Add Verilated::scopesDump(), for debugging.

This commit is contained in:
Wilson Snyder 2009-12-08 06:41:16 -05:00
parent 097f3590ae
commit 735871d501
4 changed files with 30 additions and 1 deletions

View File

@ -915,6 +915,10 @@ void Verilated::commandArgs(int argc, const char** argv) {
VerilatedImp::commandArgs(argc,argv);
}
void Verilated::scopesDump() {
VerilatedImp::scopesDump();
}
//===========================================================================
// VerilatedModule:: Methods

View File

@ -186,10 +186,16 @@ public:
/// Enable/disable assertions
static void assertOn(bool flag) { s_assertOn=flag; }
static bool assertOn() { return s_assertOn; }
/// Record command line arguments, for retrieval by $test$plusargs/$value$plusargs
static void commandArgs(int argc, const char** argv);
static void commandArgs(int argc, char** argv) { commandArgs(argc,(const char**)argv); }
/// For debugging, print text list of all scope names with
/// dpiImport/Export context. This function may change in future
/// releases - contact the authors before production use.
static void scopesDump();
// METHODS - INTERNAL USE ONLY
// Internal: Create a new module name by concatenating two strings
static const char* catName(const char* n1, const char* n2); // Returns new'ed data

View File

@ -137,7 +137,15 @@ public: // But only for verilated*.cpp
ScopeNameMap::iterator it=s_s.m_nameMap.find(scopep->name());
if (it != s_s.m_nameMap.end()) s_s.m_nameMap.erase(it);
}
static void scopesDump() {
VL_PRINTF("scopesDump:\n");
for (ScopeNameMap::iterator it=s_s.m_nameMap.begin();
it!=s_s.m_nameMap.end(); ++it) {
const VerilatedScope* scopep = it->second;
VL_PRINTF(" %s\n", scopep->name());
}
VL_PRINTF("\n");
}
};
#endif // Guard

View File

@ -32,6 +32,10 @@
# error "Unknown simulator for DPI test"
#endif
#ifdef VERILATOR
# include "verilated.h"
#endif
#ifdef NEED_EXTERNS
extern "C" {
@ -50,6 +54,13 @@ int dpic_line() {
return 0;
}
#ifdef VERILATOR
static int didDump = 0;
if (didDump++ == 0) {
Verilated::scopesDump();
}
#endif
const char* scopenamep = svGetNameFromScope(scope);
if (!scopenamep) {
printf("%%Warning: svGetNameFromScope failed\n");