diff --git a/Changes b/Changes index c5fcf412e..c3bc67ba0 100644 --- a/Changes +++ b/Changes @@ -7,7 +7,9 @@ indicates the contributor was also the author of the fix; Thanks! *** Improved warning when "do" used as identifier. -**** Fix tracing escaped dotted identifiers. +**** Fix tracing escaped dotted identifiers, bug107. + +**** Fix $display with uppercase %M. * Verilator 3.713 2009/08/04 diff --git a/src/V3Assert.cpp b/src/V3Assert.cpp index fd4cf138b..55aabc29a 100644 --- a/src/V3Assert.cpp +++ b/src/V3Assert.cpp @@ -65,7 +65,9 @@ private: AstNode* timesp = nodep->exprsp(); if (timesp) timesp->unlinkFrBack(); timesp = timesp->addNext(new AstTime(nodep->fileline())); nodep->exprsp(timesp); - if (!nodep->scopeNamep() && nodep->name().find("%m") != string::npos) { + if (!nodep->scopeNamep() + && (nodep->name().find("%m") != string::npos + || nodep->name().find("%M") != string::npos)) { nodep->scopeNamep(new AstScopeName(nodep->fileline())); } } diff --git a/src/V3LinkResolve.cpp b/src/V3LinkResolve.cpp index b3727f0f3..86547a7a3 100644 --- a/src/V3LinkResolve.cpp +++ b/src/V3LinkResolve.cpp @@ -361,7 +361,7 @@ private: inPct = true; } else if (inPct) { inPct = false; - switch (ch) { + switch (tolower(ch)) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': inPct = true; @@ -441,7 +441,8 @@ private: nodep->v3error(nodep->verilogKwd()+" only allowed under a assertion."); } if (nodep->displayType().needScopeTracking() - || nodep->name().find("%m") != string::npos) { + || nodep->name().find("%m") != string::npos + || nodep->name().find("%M") != string::npos) { nodep->scopeNamep(new AstScopeName(nodep->fileline())); } } diff --git a/src/V3Signed.cpp b/src/V3Signed.cpp index c5764b637..fae3a31ef 100644 --- a/src/V3Signed.cpp +++ b/src/V3Signed.cpp @@ -179,7 +179,7 @@ private: if (!inPct && ch=='%') { inPct = true; } else if (inPct && isdigit(ch)) { - } else if (inPct) { + } else if (tolower(inPct)) { inPct = false; switch (tolower(ch)) { case '%': break; // %% - just output a % diff --git a/test_regress/t/t_display.v b/test_regress/t/t_display.v index 490ecbc35..0acf11196 100644 --- a/test_regress/t/t_display.v +++ b/test_regress/t/t_display.v @@ -52,7 +52,7 @@ module sub; begin $write("[%0t] In %m\n", $time); begin : subblock - $write("[%0t] In %m\n", $time); + $write("[%0t] In %M\n", $time); // Uppercase %M test end end endtask