From a547133efeadc97b80a60170dac3ed627cbe4010 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Mon, 31 Dec 2012 13:47:34 -0500 Subject: [PATCH] Internals: Remove VAR_MEM to match Verilog-Perl, towards bug586. --- src/V3Ast.h | 1 - src/V3LinkDot.cpp | 3 +-- src/V3LinkParse.cpp | 2 -- src/V3Width.cpp | 3 +++ src/verilog.y | 17 ++++++----------- 5 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/V3Ast.h b/src/V3Ast.h index 6e2c6e627..ae0ba869f 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -507,7 +507,6 @@ public: PX_NONE, // Used in V3LinkParse only PX_TEXT, // Unknown ID component PX_PREDOT, // Module name or misc component above var/task/func/member - PX_VAR_MEM, // Variable that must be a memory PX_VAR_ANY, // Variable/structure member PX_FTASK // Task/Function (AstParse::ftaskrefp() will be set) }; diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index f8ea0e95e..46128df53 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -1229,8 +1229,7 @@ private: expectWhat = "scope/variable"; allowScope = true; allowVar = true; - } else if (nodep->expect() == AstParseRefExp::PX_VAR_MEM - || nodep->expect() == AstParseRefExp::PX_VAR_ANY) { + } else if (nodep->expect() == AstParseRefExp::PX_VAR_ANY) { expectWhat = "variable"; onlyVar = true; allowVar = true; diff --git a/src/V3LinkParse.cpp b/src/V3LinkParse.cpp index c5e035580..5a8aa9858 100644 --- a/src/V3LinkParse.cpp +++ b/src/V3LinkParse.cpp @@ -197,8 +197,6 @@ private: nodep->v3error("Syntax Error: Range ':', '+:' etc are not allowed in the cell part of a dotted reference"); } else if (m_exp==AstParseRefExp::PX_FTASK) { nodep->v3error("Syntax Error: Range ':', '+:' etc are not allowed as part of function/task names"); - } else if (m_exp==AstParseRefExp::PX_VAR_MEM) { - nodep->v3error("Syntax Error: Range ':', '+:' etc are not allowed when expecting memory reference"); } else { nodep->lhsp()->iterateAndNext(*this); AstParseRefExp lastExp = m_exp; diff --git a/src/V3Width.cpp b/src/V3Width.cpp index ca39ebbb5..a4e245968 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -1341,6 +1341,9 @@ private: virtual void visit(AstReadMem* nodep, AstNUser*) { nodep->filenamep()->iterateAndNext(*this,WidthVP(ANYSIZE,0,BOTH).p()); nodep->memp()->iterateAndNext(*this,WidthVP(ANYSIZE,0,BOTH).p()); + if (!nodep->memp()->dtypep()->skipRefp()->castArrayDType()) { + nodep->memp()->v3error("Unsupported: $readmem into non-array"); + } nodep->lsbp()->iterateAndNext(*this,WidthVP(ANYSIZE,0,BOTH).p()); nodep->msbp()->iterateAndNext(*this,WidthVP(ANYSIZE,0,BOTH).p()); } diff --git a/src/verilog.y b/src/verilog.y index 1d02316e0..ee81f6cd1 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -2385,12 +2385,12 @@ system_t_call: // IEEE: system_tf_call (as task) | yD_FATAL '(' expr ')' { $$ = new AstDisplay($1,AstDisplayType::DT_FATAL, "", NULL,NULL); $$->addNext(new AstStop($1)); DEL($3); } | yD_FATAL '(' expr ',' str commaEListE ')' { $$ = new AstDisplay($1,AstDisplayType::DT_FATAL, *$5,NULL,$6); $$->addNext(new AstStop($1)); DEL($3); } // - | yD_READMEMB '(' expr ',' varRefMem ')' { $$ = new AstReadMem($1,false,$3,$5,NULL,NULL); } - | yD_READMEMB '(' expr ',' varRefMem ',' expr ')' { $$ = new AstReadMem($1,false,$3,$5,$7,NULL); } - | yD_READMEMB '(' expr ',' varRefMem ',' expr ',' expr ')' { $$ = new AstReadMem($1,false,$3,$5,$7,$9); } - | yD_READMEMH '(' expr ',' varRefMem ')' { $$ = new AstReadMem($1,true, $3,$5,NULL,NULL); } - | yD_READMEMH '(' expr ',' varRefMem ',' expr ')' { $$ = new AstReadMem($1,true, $3,$5,$7,NULL); } - | yD_READMEMH '(' expr ',' varRefMem ',' expr ',' expr ')' { $$ = new AstReadMem($1,true, $3,$5,$7,$9); } + | yD_READMEMB '(' expr ',' idClassSel ')' { $$ = new AstReadMem($1,false,$3,$5,NULL,NULL); } + | yD_READMEMB '(' expr ',' idClassSel ',' expr ')' { $$ = new AstReadMem($1,false,$3,$5,$7,NULL); } + | yD_READMEMB '(' expr ',' idClassSel ',' expr ',' expr ')' { $$ = new AstReadMem($1,false,$3,$5,$7,$9); } + | yD_READMEMH '(' expr ',' idClassSel ')' { $$ = new AstReadMem($1,true, $3,$5,NULL,NULL); } + | yD_READMEMH '(' expr ',' idClassSel ',' expr ')' { $$ = new AstReadMem($1,true, $3,$5,$7,NULL); } + | yD_READMEMH '(' expr ',' idClassSel ',' expr ',' expr ')' { $$ = new AstReadMem($1,true, $3,$5,$7,$9); } ; system_f_call: // IEEE: system_tf_call (as func) @@ -3162,11 +3162,6 @@ variable_lvalueConcList: // IEEE: part of variable_lvalue: '{' variable_l | variable_lvalueConcList ',' variable_lvalue { $$ = new AstConcat($2,$1,$3); } ; -// VarRef to a Memory -varRefMem: - idDotted { $$ = new AstParseRef($1->fileline(), AstParseRefExp::PX_VAR_MEM, "", $1, NULL); $$->start(true); } - ; - // VarRef to dotted, and/or arrayed, and/or bit-ranged variable idClassSel: // Misc Ref to dotted, and/or arrayed, and/or bit-ranged variable idDotted { $$ = new AstParseRef($1->fileline(), AstParseRefExp::PX_VAR_ANY, "", $1, NULL); $$->start(true); }