Fix Preprocessor dropping some line directives

git-svn-id: file://localhost/svn/verilator/trunk/verilator@934 77ca24e4-aefa-0310-84f0-b9a241c72d87
This commit is contained in:
Wilson Snyder 2007-06-13 17:34:09 +00:00
parent dff5d5c4e4
commit 9c968c590c
6 changed files with 13 additions and 2 deletions

View File

@ -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]

View File

@ -388,7 +388,7 @@ public:
}
virtual void visit(AstMulS* nodep, AstNUser* vup) {
if (nodep->widthWords() > VL_MULS_MAX_WORDS) {
nodep->v3error("Signed multiply of "<<nodep->width()<<" bits exceeds hardcoded limit VL_MULS_MAX_WORDS in verilatedos.h\n");
nodep->v3error("Unsupported: Signed multiply of "<<nodep->width()<<" bits exceeds hardcoded limit VL_MULS_MAX_WORDS in verilatedos.h\n");
}
visit(nodep->castNodeBiop(), vup);
}

View File

@ -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

View File

@ -73,7 +73,8 @@ psl [p]sl
/**************************************************************/
%%
<INITIAL>^{ws}*"`line"{ws}+.*{crnl} { V3PreLex::s_currentLexp->lineDirective(yytext); }
<INITIAL>^{ws}*"`line"{ws}+.*{crnl} { V3PreLex::s_currentLexp->lineDirective(yytext);
return(VP_LINE); }
/* Special directives we recognise */
<INITIAL>"`include" { return(VP_INCLUDE); }

View File

@ -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<yyleng; len++) { if (yytext[len]=='\n') m_lineAdd++; }
goto next_tok;
}
if (tok==VP_LINE) {
addLineComment(0);
goto next_tok;
}
// Deal with some special parser states
switch (m_state) {
case ps_TOP: {

View File

@ -22,6 +22,8 @@ At file t/t_preproc_inc2.v line 4
`line 1 "t/t_preproc_inc3.v" 1
`line 2 "inc3_a_filename_from_line_directive" 0