From 9c968c590cb2c51d8c309bfb2a3fdf28c978e494 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Wed, 13 Jun 2007 17:34:09 +0000 Subject: [PATCH] Fix Preprocessor dropping some line directives git-svn-id: file://localhost/svn/verilator/trunk/verilator@934 77ca24e4-aefa-0310-84f0-b9a241c72d87 --- Changes | 2 ++ src/V3EmitC.cpp | 2 +- src/V3PreLex.h | 1 + src/V3PreLex.l | 3 ++- src/V3PreProc.cpp | 5 +++++ test_regress/t/t_preproc.out | 2 ++ 6 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index d6b4be980..ecc965ef4 100644 --- a/Changes +++ b/Changes @@ -9,6 +9,8 @@ indicates the contributor was also the author of the fix; Thanks! **** Support V2K portlists with "input a,b,...". [Mark Nodine] +**** Fix Preprocessor dropping some `line directives. [Mark Nodine] + * Verilator 3.651 5/22/2007 *** Added verilator_profcfunc utility. [Gene Weber] diff --git a/src/V3EmitC.cpp b/src/V3EmitC.cpp index 10bde5f3e..b6c7ca06f 100644 --- a/src/V3EmitC.cpp +++ b/src/V3EmitC.cpp @@ -388,7 +388,7 @@ public: } virtual void visit(AstMulS* nodep, AstNUser* vup) { if (nodep->widthWords() > VL_MULS_MAX_WORDS) { - nodep->v3error("Signed multiply of "<width()<<" bits exceeds hardcoded limit VL_MULS_MAX_WORDS in verilatedos.h\n"); + nodep->v3error("Unsupported: Signed multiply of "<width()<<" bits exceeds hardcoded limit VL_MULS_MAX_WORDS in verilatedos.h\n"); } visit(nodep->castNodeBiop(), vup); } diff --git a/src/V3PreLex.h b/src/V3PreLex.h index 147ade848..d8e555a3d 100644 --- a/src/V3PreLex.h +++ b/src/V3PreLex.h @@ -40,6 +40,7 @@ #define VP_DEFINE 261 #define VP_ELSE 262 #define VP_ELSIF 263 +#define VP_LINE 264 #define VP_SYMBOL 300 #define VP_STRING 301 diff --git a/src/V3PreLex.l b/src/V3PreLex.l index a730ac089..63623c080 100644 --- a/src/V3PreLex.l +++ b/src/V3PreLex.l @@ -73,7 +73,8 @@ psl [p]sl /**************************************************************/ %% -^{ws}*"`line"{ws}+.*{crnl} { V3PreLex::s_currentLexp->lineDirective(yytext); } +^{ws}*"`line"{ws}+.*{crnl} { V3PreLex::s_currentLexp->lineDirective(yytext); + return(VP_LINE); } /* Special directives we recognise */ "`include" { return(VP_INCLUDE); } diff --git a/src/V3PreProc.cpp b/src/V3PreProc.cpp index 79a4046c2..f98dca7d8 100644 --- a/src/V3PreProc.cpp +++ b/src/V3PreProc.cpp @@ -328,6 +328,7 @@ const char* V3PreProcImp::tokenName(int tok) { case VP_DEFINE : return("DEFINE"); case VP_ELSE : return("ELSE"); case VP_ELSIF : return("ELSIF"); + case VP_LINE : return("LINE"); case VP_SYMBOL : return("SYMBOL"); case VP_STRING : return("STRING"); case VP_DEFVALUE : return("DEFVALUE"); @@ -583,6 +584,10 @@ int V3PreProcImp::getToken() { for (int len=0; len