From f6fb2362c69f020f2f1072cdf0543f2881b143aa Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Wed, 26 Mar 2008 14:58:30 +0000 Subject: [PATCH] Fix dropping of backslash quoted-quote at end of . git-svn-id: file://localhost/svn/verilator/trunk/verilator@1012 77ca24e4-aefa-0310-84f0-b9a241c72d87 --- Changes | 4 +++- bin/verilator | 2 +- src/V3AstNodes.cpp | 4 ++++ src/V3AstNodes.h | 1 + src/V3EmitC.cpp | 2 -- test_regress/t/t_display.pl | 1 + test_regress/t/t_display.v | 3 +++ test_regress/t/t_display_noopt.pl | 1 + 8 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Changes b/Changes index 956bc9cf3..16d2b4348 100644 --- a/Changes +++ b/Changes @@ -5,9 +5,11 @@ indicates the contributor was also the author of the fix; Thanks! * Verilator 3.66*** +*** Add --top-module option to select between multiple tops. [Stefan Thiede] + **** Fix no-module include files on command line. [Stefan Thiede] -*** Add --top-module option to select between multiple tops. [Stefan Thiede] +**** Fix dropping of backslash quoted-quote at end of $display. * Verilator 3.660 2008/03/23 diff --git a/bin/verilator b/bin/verilator index fbbba3426..5a6d0bec1 100755 --- a/bin/verilator +++ b/bin/verilator @@ -217,7 +217,7 @@ descriptions in the next sections for more information. --sc Create SystemC output --sp Create SystemPerl output --stats Create statistics file - --top-module Name of top level input module + --top-module Name of top level input module --trace Enable waveform creation --trace-depth Depth of tracing -U Undefine preprocessor define diff --git a/src/V3AstNodes.cpp b/src/V3AstNodes.cpp index f41de7b68..fefd1507a 100644 --- a/src/V3AstNodes.cpp +++ b/src/V3AstNodes.cpp @@ -304,6 +304,10 @@ void AstCellInline::dump(ostream& str) { this->AstNode::dump(str); str<<" -> "<AstNode::dump(str); + //str<<" "<AstNode::dump(str); if (modVarp()) { str<<" -> "; modVarp()->dump(str); } diff --git a/src/V3AstNodes.h b/src/V3AstNodes.h index 3cd8a9f5b..e97cd232f 100644 --- a/src/V3AstNodes.h +++ b/src/V3AstNodes.h @@ -1254,6 +1254,7 @@ public: virtual AstType type() const { return AstType::DISPLAY;} virtual AstNode* clone() { return new AstDisplay(*this); } virtual void accept(AstNVisitor& v, AstNUser* vup=NULL) { v.visit(this,vup); } + virtual void dump(ostream& str); virtual string verilogKwd() const { return (filep() ? (string)"$f"+(string)displayType().ascii() : (string)"$"+(string)displayType().ascii()); } virtual bool isGateOptimizable() const { return false; } diff --git a/src/V3EmitC.cpp b/src/V3EmitC.cpp index ae57836e2..9089f5579 100644 --- a/src/V3EmitC.cpp +++ b/src/V3EmitC.cpp @@ -1027,10 +1027,8 @@ void EmitCStmts::visit(AstDisplay* nodep, AstNUser*) { emitDispState.clear(); string fmt = ""; string::iterator pos = vformat.begin(); - if (*pos == '"') pos++; bool inPct = false; for (; pos != vformat.end(); ++pos) { - if (pos[0]=='"' && (pos+1)==vformat.end()) break; if (inPct && pos[0]=='%') { emitDispState.pushFormat("%%"); // We're printf'ing it, so need to quote the % inPct = false; diff --git a/test_regress/t/t_display.pl b/test_regress/t/t_display.pl index 5689cac4f..2c75873ae 100755 --- a/test_regress/t/t_display.pl +++ b/test_regress/t/t_display.pl @@ -18,6 +18,7 @@ execute ( [0] In TOP.v.sub.subblock [0] In TOP.v.sub2 [0] In TOP.v.sub2.subblock2 +[0] Back \ Quote " [0] %X=0c %D=12 %0X=c %0O=14 %B=001100 [0] %x=0c %d=12 %0x=c %0o=14 %b=001100 [0] %x=00abbbbcccc %0x=abbbbcccc %o=00527356746314 %b=00000101010111011101110111100110011001100 diff --git a/test_regress/t/t_display.v b/test_regress/t/t_display.v index 5679b6ebc..44e2520c6 100644 --- a/test_regress/t/t_display.v +++ b/test_regress/t/t_display.v @@ -19,6 +19,9 @@ module t; sub.write_m; sub2.write_m; + // Escapes + $display("[%0t] Back \\ Quote \"", $time); // Old bug when \" last on the line. + // Display formatting $display("[%0t] %%X=%X %%D=%D %%0X=%0X %%0O=%0O %%B=%B", $time, quad[5:0], quad[5:0], quad[5:0], quad[5:0], quad[5:0]); diff --git a/test_regress/t/t_display_noopt.pl b/test_regress/t/t_display_noopt.pl index f72857113..90bd37f2c 100755 --- a/test_regress/t/t_display_noopt.pl +++ b/test_regress/t/t_display_noopt.pl @@ -21,6 +21,7 @@ execute ( [0] In TOP.v.sub.subblock [0] In TOP.v.sub2 [0] In TOP.v.sub2.subblock2 +[0] Back \ Quote " [0] %X=0c %D=12 %0X=c %0O=14 %B=001100 [0] %x=0c %d=12 %0x=c %0o=14 %b=001100 [0] %x=00abbbbcccc %0x=abbbbcccc %o=00527356746314 %b=00000101010111011101110111100110011001100