Fix VCD files showing internal flattened hierarchy, broke in 3.714.

This commit is contained in:
Wilson Snyder
2009-09-26 09:31:50 -04:00
parent 66d000f4ba
commit db5674cb08
10 changed files with 334 additions and 21 deletions
+15
View File
@@ -139,6 +139,21 @@ string AstNode::dedotName(const string& namein) {
return pretty;
}
string AstNode::vcdName(const string& namein) {
// VCD tracing expects space to separate hiearchy
// Dots are reserved for dots the user put in the name
string pretty = namein;
string::size_type pos;
while ((pos=pretty.find("__DOT__")) != string::npos) {
pretty.replace(pos, 7, " ");
}
while ((pos=pretty.find(".")) != string::npos) {
pretty.replace(pos, 1, " ");
}
// Now convert escaped special characters, etc
return prettyName(pretty);
}
string AstNode::prettyName(const string& namein) {
string pretty;
pretty = "";
+1
View File
@@ -676,6 +676,7 @@ public:
static string prettyName(const string& namein); // Name for printing out to the user
static string encodeName(const string& namein); // Encode user name into internal C representation
static string encodeNumber(vlsint64_t numin); // Encode number into internal C representation
static string vcdName(const string& namein); // Name for printing out to vcd files
string prettyName() const { return prettyName(name()); }
string prettyTypeName() const; // "VARREF name" for error messages
FileLine* fileline() const { return m_fileline; }
+4 -2
View File
@@ -125,8 +125,10 @@ private:
AstVar* varp = nodep->varp();
AstScope* scopep = nodep->scopep();
// Compute show name
string showname = scopep->prettyName() + "." + varp->prettyName();
if (showname.substr(0,4) == "TOP.") showname.replace(0,4,"");
// This code assumes SPTRACEVCDC_VERSION >= 1330;
// it uses spaces to separate hierarchy components.
string showname = AstNode::vcdName(scopep->name() + " " + varp->name());
if (showname.substr(0,4) == "TOP ") showname.replace(0,4,"");
if (!m_initSubFuncp) nodep->v3fatalSrc("NULL");
if (varIgnoreTrace(varp)) {
m_statIgnSigs++;