diff --git a/Makefile.in b/Makefile.in index b49baf8ae..f1b09115a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -425,6 +425,9 @@ CPPCHECK_CPP = $(wildcard \ CPPCHECK_H = $(wildcard \ $(srcdir)/include/*.h \ $(srcdir)/src/*.h ) +CPPCHECK_YL = $(wildcard \ + $(srcdir)/src/*.y \ + $(srcdir)/src/*.l ) CPPCHECK = src/cppcheck_filtered CPPCHECK_FLAGS = --enable=all --inline-suppr \ --suppress=unusedScopedObject --suppress=cstyleCast --suppress=useInitializationList \ @@ -462,7 +465,7 @@ CLANGFORMAT_FLAGS = -i clang-format: @$(CLANGFORMAT) --version | egrep 10.0 > /dev/null \ || echo "*** You are not using clang-format 10.0, indents may differ from master's ***" - $(CLANGFORMAT) $(CLANGFORMAT_FLAGS) $(CPPCHECK_CPP) $(CPPCHECK_H) + $(CLANGFORMAT) $(CLANGFORMAT_FLAGS) $(CPPCHECK_CPP) $(CPPCHECK_H) $(CPPCHECK_YL) ftp: info diff --git a/src/V3ParseImp.cpp b/src/V3ParseImp.cpp index d095e5234..08efef569 100644 --- a/src/V3ParseImp.cpp +++ b/src/V3ParseImp.cpp @@ -34,6 +34,8 @@ #include "V3PreShell.h" #include "V3LanguageWords.h" +#include "V3ParseBison.h" // Generated by bison + #include //====================================================================== @@ -352,6 +354,151 @@ void V3ParseImp::lexFile(const string& modname) { if (bisonParse()) v3fatal("Cannot continue\n"); } +void V3ParseImp::lexToken() { + // called from lexToBison, has a "this" + // Fetch next token from prefetch or real lexer + int token; + if (m_ahead) { + // We prefetched an extra token, give it back + m_ahead = false; + token = m_aheadVal.token; + yylval = m_aheadVal; + } else { + // Parse new token + token = yylexReadTok(); + // yylval // Set by yylexReadTok() + } + // If a paren, read another + if (token == '(' // + || token == yCONST__LEX // + || token == yGLOBAL__LEX // + || token == yLOCAL__LEX // + || token == yNEW__LEX // + || token == yVIRTUAL__LEX + // Never put yID_* here; below symbol table resolution would break + ) { + if (debugFlex() >= 6) { + cout << " lexToken: reading ahead to find possible strength" << endl; + } + V3ParseBisonYYSType curValue = yylval; // Remember value, as about to read ahead + int nexttok = yylexReadTok(); + m_ahead = true; + m_aheadVal = yylval; + m_aheadVal.token = nexttok; + yylval = curValue; + // Now potentially munge the current token + if (token == '(' + && (nexttok == ygenSTRENGTH || nexttok == ySUPPLY0 || nexttok == ySUPPLY1)) { + token = yP_PAR__STRENGTH; + } else if (token == yCONST__LEX) { + if (nexttok == yREF) { + token = yCONST__REF; + } else { + token = yCONST__ETC; + } + } else if (token == yGLOBAL__LEX) { + if (nexttok == yCLOCKING) { + token = yGLOBAL__CLOCKING; + } else if (v3Global.opt.pedantic()) { + token = yGLOBAL__ETC; + } + // Avoid 2009 "global" conflicting with old code when we can + else { + token = yaID__LEX; + yylval.strp = V3ParseImp::parsep()->newString("global"); + } + } else if (token == yLOCAL__LEX) { + if (nexttok == yP_COLONCOLON) { + token = yLOCAL__COLONCOLON; + } else { + token = yLOCAL__ETC; + } + } else if (token == yNEW__LEX) { + if (nexttok == '(') { + token = yNEW__PAREN; + } else { + token = yNEW__ETC; + } + } else if (token == yVIRTUAL__LEX) { + if (nexttok == yCLASS) { + token = yVIRTUAL__CLASS; + } else if (nexttok == yINTERFACE) { + token = yVIRTUAL__INTERFACE; + } else if (nexttok == yaID__ETC // + || nexttok == yaID__LEX) { + // || nexttok == yaID__aINTERFACE // but we may not know interfaces yet. + token = yVIRTUAL__anyID; + } else { + token = yVIRTUAL__ETC; + } + } + // If add to above "else if", also add to "if (token" further above + } + // If an id, change the type based on symbol table + // Note above sometimes converts yGLOBAL to a yaID__LEX + if (token == yaID__LEX) { + VSymEnt* foundp; + if (VSymEnt* look_underp = V3ParseImp::parsep()->symp()->nextId()) { + UINFO(7, " lexToken: next id lookup forced under " << look_underp << endl); + foundp = look_underp->findIdFallback(*(yylval.strp)); + // "consume" it. Must set again if want another token under temp scope + V3ParseImp::parsep()->symp()->nextId(NULL); + } else { + UINFO(7, " lexToken: find upward " << V3ParseImp::parsep()->symp()->symCurrentp() + << " for '" << *(yylval.strp) << "'" << endl); + // if (debug()>=9) V3ParseImp::parsep()->symp()->symCurrentp()->dump(cout," -findtree: + // ", true); + foundp = V3ParseImp::parsep()->symp()->symCurrentp()->findIdFallback(*(yylval.strp)); + } + if (foundp) { + AstNode* scp = foundp->nodep(); + yylval.scp = scp; + UINFO(7, " lexToken: Found " << scp << endl); + if (VN_IS(scp, Typedef)) { + token = yaID__aTYPE; + } else if (VN_IS(scp, TypedefFwd)) { + token = yaID__aTYPE; + } else if (VN_IS(scp, Class)) { + token = yaID__aTYPE; + } + // Packages (and class static references) we could + // alternatively determine by looking for an yaID__LEX followed + // by yP_COLONCOLON (but we can't lookahead after an yaID__LEX + // as described above.) + else if (VN_IS(scp, Package)) { + token = yaID__aPACKAGE; + } else { + token = yaID__ETC; + } + } else { // Not found + yylval.scp = NULL; + token = yaID__ETC; + } + } + yylval.token = token; + // effectively returns yylval +} + +int V3ParseImp::lexToBison() { + // Called as global since bison doesn't have our pointer + lexToken(); // sets yylval + m_prevBisonVal = m_curBisonVal; + m_curBisonVal = yylval; + + // yylval.scp = NULL; // Symbol table not yet needed - no packages + if (debugFlex() >= 6 || debugBison() >= 6) { // --debugi-flex and --debugi-bison + cout << " {" << yylval.fl->filenameLetters() << yylval.fl->asciiLineCol() + << "} lexToBison TOKEN=" << yylval.token << " " << tokenName(yylval.token); + if (yylval.token == yaID__ETC // + || yylval.token == yaID__LEX // + || yylval.token == yaID__aTYPE) { + cout << " strp='" << *(yylval.strp) << "'"; + } + cout << endl; + } + return yylval.token; +} + //====================================================================== // V3Parse functions diff --git a/src/V3PreLex.l b/src/V3PreLex.l index 4647f81e4..42765edb7 100644 --- a/src/V3PreLex.l +++ b/src/V3PreLex.l @@ -1,8 +1,3 @@ -%option noyywrap align interactive -%option stack -%option noc++ -%option prefix="V3PreLex" -%{ /************************************************************************** * DESCRIPTION: Verilator: Flex verilog preprocessor * @@ -20,6 +15,16 @@ * Do not use Flex in C++ mode. It has bugs with yyunput() which result in * lost characters. **************************************************************************/ +/* clang-format off */ + +%option noyywrap align interactive +%option stack +%option noc++ +%option prefix="V3PreLex" +%{ +#ifdef NEVER_JUST_FOR_CLANG_FORMAT + } +#endif #include "V3PreProc.h" #include "V3PreLex.h" @@ -27,17 +32,22 @@ # include // for isatty #endif -V3PreLex* V3PreLex::s_currentLexp = NULL; // Current lexing point +/* clang-format on */ + +V3PreLex* V3PreLex::s_currentLexp = NULL; // Current lexing point #define LEXP V3PreLex::s_currentLexp -#define YY_INPUT(buf,result,max_size) \ +#define YY_INPUT(buf, result, max_size) \ do { result = LEXP->inputToLex(buf, max_size); } while (false) // Accessors, because flex keeps changing the type of yyleng char* yyourtext() { return yytext; } size_t yyourleng() { return yyleng; } -void yyourtext(const char* textp, size_t size) { yytext=(char*)textp; yyleng=size; } +void yyourtext(const char* textp, size_t size) { + yytext = (char*)textp; + yyleng = size; +} // FL_FWD only tracks columns; preproc uses linenoInc() to track lines, so // insertion of a \n does not mess up line count @@ -46,12 +56,13 @@ void yyourtext(const char* textp, size_t size) { yytext=(char*)textp; yyleng=siz #define FL_BRK (LEXP->curFilelinep()->startToken()) // Prevent conflicts from perl version -static void linenoInc() {LEXP->linenoInc();} +static void linenoInc() { LEXP->linenoInc(); } static bool pedantic() { return LEXP->m_pedantic; } static void yyerror(char* msg) { LEXP->curFilelinep()->v3error(msg); } static void yyerrorf(const char* msg) { LEXP->curFilelinep()->v3error(msg); } static void appendDefValue(const char* t, size_t l) { LEXP->appendDefValue(t, l); } +/* clang-format off */ /**********************************************************************/ %} @@ -308,6 +319,7 @@ bom [\357\273\277] [\r] { FL_FWDC; FL_BRK; } . { FL_FWDC; return VP_TEXT; } %% +// clang-format on void V3PreLex::pushStateDefArg(int level) { // Enter define substitution argument state @@ -336,12 +348,15 @@ void V3PreLex::pushStateIncFilename() { yymore(); } -void V3PreLex::debug(int level) { yy_flex_debug = level; } -int V3PreLex::debug() { return yy_flex_debug; } +void V3PreLex::debug(int level) { + yy_flex_debug = level; } +int V3PreLex::debug() { + return yy_flex_debug; } int V3PreLex::lex() { V3PreLex::s_currentLexp = this; // Tell parser where to get/put data - m_tokFilelinep = curFilelinep(); // Remember token start location, may be updated by the lexer later + // Remember token start location, may be updated by the lexer later + m_tokFilelinep = curFilelinep(); return yylex(); } @@ -354,30 +369,32 @@ size_t V3PreLex::inputToLex(char* buf, size_t max_size) { // VPreStream* streamp = curStreamp(); if (debug() >= 10) { - cout<<"- pp:inputToLex ITL s="< max_size) { @@ -388,13 +405,15 @@ size_t V3PreLex::inputToLex(char* buf, size_t max_size) { } } else { if (streamp->m_eof) { - if (yy_flex_debug) cout<<"- EOF\n"; + if (yy_flex_debug) cout << "- EOF\n"; } got = 0; // 0=EOF/EOS - although got was already 0. if (again) goto again; } } - if (debug() >= 10) { cout<<"- pp::inputToLex got="<= 10) { + cout << "- pp::inputToLex got=" << got << " '" << string(buf, got) << "'" << endl; + } return got; } @@ -402,7 +421,7 @@ string V3PreLex::endOfStream(bool& againr) { // Switch to file or next unputString againr = false; if (yy_flex_debug) { - cout<<"-EOS state="<m_termState<<" at "<m_eof) return ""; // Don't delete the final "EOF" stream bool exited_file = curStreamp()->m_file; @@ -424,18 +443,15 @@ string V3PreLex::endOfStream(bool& againr) { // immediately. curStreamp()->m_termState = 1; return "\n"; // Exit old file - } - else if (curStreamp()->m_termState == 1) { + } else if (curStreamp()->m_termState == 1) { // Now the EOF - can't be sent with other characters curStreamp()->m_termState = 2; return ""; // End of file - } - else if (curStreamp()->m_termState == 2) { + } else if (curStreamp()->m_termState == 2) { // Now ending `line curStreamp()->m_termState = 3; return curFilelinep()->lineDirectiveStrg(2); // Exit old file - } - else { + } else { // Final shutdown phase for a stream, we can finally change the // current fileline to the new stream curStreamp()->m_termState = 0; @@ -518,7 +534,7 @@ void V3PreLex::scanBytesBack(const string& str) { string V3PreLex::currentUnreadChars() { // WARNING - Peeking at internals - ssize_t left = (yy_n_chars - (yy_c_buf_p -currentBuffer()->yy_ch_buf)); + ssize_t left = (yy_n_chars - (yy_c_buf_p - currentBuffer()->yy_ch_buf)); if (left > 0) { // left may be -1 at EOS *(yy_c_buf_p) = (yy_hold_char); return string(yy_c_buf_p, left); @@ -536,25 +552,24 @@ int V3PreLex::currentStartState() const { } void V3PreLex::lineDirective(const char* textp) { - curFilelinep()->lineDirective(textp, m_enterExit/*ref*/); + curFilelinep()->lineDirective(textp, m_enterExit /*ref*/); // Make sure we have a dependency on whatever file was specified V3File::addSrcDepend(curFilelinep()->filename()); } void V3PreLex::warnBackslashSpace() { // Make fileline highlight the specific backslash and space - curFilelinep()->v3warn(BSSPACE, "Backslash followed by whitespace, perhaps the whitespace is accidental?"); + curFilelinep()->v3warn( + BSSPACE, "Backslash followed by whitespace, perhaps the whitespace is accidental?"); } void V3PreLex::dumpSummary() { - cout<<"- pp::dumpSummary curBuf="<m_file?" [FILE]":""); - cout<m_file ? " [FILE]" : "") << endl; tmpstack.pop(); } } diff --git a/src/verilog.l b/src/verilog.l index 6635286ac..01d2537a5 100644 --- a/src/verilog.l +++ b/src/verilog.l @@ -13,10 +13,15 @@ * SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 * *************************************************************************/ +/* clang-format off */ %option interactive c++ stack noyywrap %{ /* %option nodefault */ +#ifdef NEVER_JUST_FOR_CLANG_FORMAT + } +#endif +// clang-format on #include "V3Number.h" #include "V3ParseImp.h" // Defines YYTYPE; before including bison header @@ -31,7 +36,7 @@ extern void yyerrorf(const char* format, ...); #define SYMP PARSEP->symp() #define YY_INPUT(buf, result, max_size) \ - do { result = PARSEP->flexPpInputToLex(buf, max_size); } while (false) + do { result = PARSEP->flexPpInputToLex(buf, max_size); } while (false) //====================================================================== @@ -41,12 +46,18 @@ extern void yyerrorf(const char* format, ...); #define CRELINE() (PARSEP->copyOrSameFileLine()) -#define FL do { FL_FWD; yylval.fl = CRELINE(); } while (false) +#define FL \ + do { \ + FL_FWD; \ + yylval.fl = CRELINE(); \ + } while (false) #define ERROR_RSVD_WORD(language) \ - do { FL_FWD; \ - yyerrorf("Unsupported: " language " reserved word not implemented: '%s'", yytext); \ - FL_BRK; } while(0) + do { \ + FL_FWD; \ + yyerrorf("Unsupported: " language " reserved word not implemented: '%s'", yytext); \ + FL_BRK; \ + } while (0) //====================================================================== @@ -80,6 +91,7 @@ void yyerrorf(const char* format, ...) { yyerror(msg); } +// clang-format off /**********************************************************************/ %} @@ -1039,149 +1051,7 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5} /* Catch all - absolutely last */ <*>.|\n { FL_FWD; yyerrorf("Missing verilog.l rule: Default rule invoked in state %d: %s", YY_START, yytext); FL_BRK; } %% +// Avoid code here as cl format misindents +// For implementation functions see V3ParseImp.cpp int V3ParseImp::stateVerilogRecent() { return STATE_VERILOG_RECENT; } - -void V3ParseImp::lexToken() { - // called from lexToBison, has a "this" - // Fetch next token from prefetch or real lexer - int token; - if (m_ahead) { - // We prefetched an extra token, give it back - m_ahead = false; - token = m_aheadVal.token; - yylval = m_aheadVal; - } else { - // Parse new token - token = yylexReadTok(); - // yylval // Set by yylexReadTok() - } - // If a paren, read another - if (token == '(' // - || token == yCONST__LEX // - || token == yGLOBAL__LEX // - || token == yLOCAL__LEX // - || token == yNEW__LEX // - || token == yVIRTUAL__LEX - // Never put yID_* here; below symbol table resolution would break - ) { - if (debugFlex() >= 6) { - cout << " lexToken: reading ahead to find possible strength" << endl; - } - V3ParseBisonYYSType curValue = yylval; // Remember value, as about to read ahead - int nexttok = yylexReadTok(); - m_ahead = true; - m_aheadVal = yylval; - m_aheadVal.token = nexttok; - yylval = curValue; - // Now potentially munge the current token - if (token == '(' - && (nexttok == ygenSTRENGTH || nexttok == ySUPPLY0 || nexttok == ySUPPLY1)) { - token = yP_PAR__STRENGTH; - } else if (token == yCONST__LEX) { - if (nexttok == yREF) { - token = yCONST__REF; - } else { - token = yCONST__ETC; - } - } else if (token == yGLOBAL__LEX) { - if (nexttok == yCLOCKING) { - token = yGLOBAL__CLOCKING; - } else if (v3Global.opt.pedantic()) { - token = yGLOBAL__ETC; - } - // Avoid 2009 "global" conflicting with old code when we can - else { - token = yaID__LEX; - yylval.strp = PARSEP->newString("global"); - } - } else if (token == yLOCAL__LEX) { - if (nexttok == yP_COLONCOLON) { - token = yLOCAL__COLONCOLON; - } else { - token = yLOCAL__ETC; - } - } else if (token == yNEW__LEX) { - if (nexttok == '(') { - token = yNEW__PAREN; - } else { - token = yNEW__ETC; - } - } else if (token == yVIRTUAL__LEX) { - if (nexttok == yCLASS) { - token = yVIRTUAL__CLASS; - } else if (nexttok == yINTERFACE) { - token = yVIRTUAL__INTERFACE; - } else if (nexttok == yaID__ETC // - || nexttok == yaID__LEX) { - // || nexttok == yaID__aINTERFACE // but we may not know interfaces yet. - token = yVIRTUAL__anyID; - } else { - token = yVIRTUAL__ETC; - } - } - // If add to above "else if", also add to "if (token" further above - } - // If an id, change the type based on symbol table - // Note above sometimes converts yGLOBAL to a yaID__LEX - if (token == yaID__LEX) { - VSymEnt* foundp; - if (VSymEnt* look_underp = SYMP->nextId()) { - UINFO(7, " lexToken: next id lookup forced under " << look_underp << endl); - foundp = look_underp->findIdFallback(*(yylval.strp)); - // "consume" it. Must set again if want another token under temp scope - SYMP->nextId(NULL); - } else { - UINFO(7, " lexToken: find upward " << SYMP->symCurrentp() << " for '" - << *(yylval.strp) << "'" << endl); - // if (debug()>=9) SYMP->symCurrentp()->dump(cout," -findtree: ", true); - foundp = SYMP->symCurrentp()->findIdFallback(*(yylval.strp)); - } - if (foundp) { - AstNode* scp = foundp->nodep(); - yylval.scp = scp; - UINFO(7, " lexToken: Found " << scp << endl); - if (VN_IS(scp, Typedef)) { - token = yaID__aTYPE; - } else if (VN_IS(scp, TypedefFwd)) { - token = yaID__aTYPE; - } else if (VN_IS(scp, Class)) { - token = yaID__aTYPE; - } - // Packages (and class static references) we could - // alternatively determine by looking for an yaID__LEX followed - // by yP_COLONCOLON (but we can't lookahead after an yaID__LEX - // as described above.) - else if (VN_IS(scp, Package)) { - token = yaID__aPACKAGE; - } else { - token = yaID__ETC; - } - } else { // Not found - yylval.scp = NULL; - token = yaID__ETC; - } - } - yylval.token = token; - // effectively returns yylval -} - -int V3ParseImp::lexToBison() { - // Called as global since bison doesn't have our pointer - lexToken(); // sets yylval - m_prevBisonVal = m_curBisonVal; - m_curBisonVal = yylval; - - // yylval.scp = NULL; // Symbol table not yet needed - no packages - if (debugFlex() >= 6 || debugBison() >= 6) { // --debugi-flex and --debugi-bison - cout << " {" << yylval.fl->filenameLetters() << yylval.fl->asciiLineCol() - << "} lexToBison TOKEN=" << yylval.token << " " << tokenName(yylval.token); - if (yylval.token == yaID__ETC // - || yylval.token == yaID__LEX // - || yylval.token == yaID__aTYPE) { - cout << " strp='" << *(yylval.strp) << "'"; - } - cout << endl; - } - return yylval.token; -} diff --git a/src/verilog.y b/src/verilog.y index 96ce8a826..c1a2e65dc 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -15,8 +15,13 @@ //************************************************************************* // Original code here by Paul Wasson and Duane Galbi //************************************************************************* +// clang-format off %{ +#ifdef NEVER_JUST_FOR_CLANG_FORMAT + } +#endif +// clang-format on #include "V3Ast.h" #include "V3Global.h" #include "V3Config.h" @@ -26,13 +31,17 @@ #include #define YYERROR_VERBOSE 1 -#define YYINITDEPTH 10000 // Older bisons ignore YYMAXDEPTH +#define YYINITDEPTH 10000 // Older bisons ignore YYMAXDEPTH #define YYMAXDEPTH 10000 // Pick up new lexer #define yylex PARSEP->lexToBison -#define BBUNSUP(fl,msg) { if (!v3Global.opt.bboxUnsup()) { (fl)->v3error(msg); } } -#define GATEUNSUP(fl,tok) { BBUNSUP((fl), "Unsupported: Verilog 1995 gate primitive: "<<(tok)); } +#define BBUNSUP(fl, msg) \ + { \ + if (!v3Global.opt.bboxUnsup()) { (fl)->v3error(msg); } \ + } +#define GATEUNSUP(fl, tok) \ + { BBUNSUP((fl), "Unsupported: Verilog 1995 gate primitive: " << (tok)); } extern void yyerror(const char* errmsg); extern void yyerrorf(const char* format, ...); @@ -46,72 +55,76 @@ extern void yyerrorf(const char* format, ...); class V3ParseGrammar { public: - bool m_impliedDecl; // Allow implied wire declarations - AstVarType m_varDecl; // Type for next signal declaration (reg/wire/etc) - bool m_varDeclTyped; // Var got reg/wire for dedup check - VDirection m_varIO; // Direction for next signal declaration (reg/wire/etc) - VLifetime m_varLifetime; // Static/Automatic for next signal - AstVar* m_varAttrp; // Current variable for attribute adding - AstRange* m_gateRangep; // Current range for gate declarations - AstCase* m_caseAttrp; // Current case statement for attribute adding - AstNodeDType* m_varDTypep; // Pointer to data type for next signal declaration - AstNodeDType* m_memDTypep; // Pointer to data type for next member declaration - AstNodeModule* m_modp; // Last module for timeunits - bool m_pinAnsi; // In ANSI port list - int m_pinNum; // Pin number currently parsing - FileLine* m_instModuleFl; // Fileline of module referenced for instantiations - string m_instModule; // Name of module referenced for instantiations - AstPin* m_instParamp; // Parameters for instantiations - bool m_tracingParse; // Tracing disable for parser + bool m_impliedDecl; // Allow implied wire declarations + AstVarType m_varDecl; // Type for next signal declaration (reg/wire/etc) + bool m_varDeclTyped; // Var got reg/wire for dedup check + VDirection m_varIO; // Direction for next signal declaration (reg/wire/etc) + VLifetime m_varLifetime; // Static/Automatic for next signal + AstVar* m_varAttrp; // Current variable for attribute adding + AstRange* m_gateRangep; // Current range for gate declarations + AstCase* m_caseAttrp; // Current case statement for attribute adding + AstNodeDType* m_varDTypep; // Pointer to data type for next signal declaration + AstNodeDType* m_memDTypep; // Pointer to data type for next member declaration + AstNodeModule* m_modp; // Last module for timeunits + bool m_pinAnsi; // In ANSI port list + int m_pinNum; // Pin number currently parsing + FileLine* m_instModuleFl; // Fileline of module referenced for instantiations + string m_instModule; // Name of module referenced for instantiations + AstPin* m_instParamp; // Parameters for instantiations + bool m_tracingParse; // Tracing disable for parser - static int s_modTypeImpNum; // Implicit type number, incremented each module + static int s_modTypeImpNum; // Implicit type number, incremented each module // CONSTRUCTORS V3ParseGrammar() { - m_impliedDecl = false; - m_varDecl = AstVarType::UNKNOWN; + m_impliedDecl = false; + m_varDecl = AstVarType::UNKNOWN; m_varDeclTyped = false; - m_varIO = VDirection::NONE; - m_varDTypep = NULL; - m_gateRangep = NULL; - m_memDTypep = NULL; - m_modp = NULL; - m_pinAnsi = false; - m_pinNum = -1; - m_instModuleFl = NULL; - m_instModule = ""; - m_instParamp = NULL; - m_varAttrp = NULL; - m_caseAttrp = NULL; - m_tracingParse = true; + m_varIO = VDirection::NONE; + m_varDTypep = NULL; + m_gateRangep = NULL; + m_memDTypep = NULL; + m_modp = NULL; + m_pinAnsi = false; + m_pinNum = -1; + m_instModuleFl = NULL; + m_instModule = ""; + m_instParamp = NULL; + m_varAttrp = NULL; + m_caseAttrp = NULL; + m_tracingParse = true; } static V3ParseGrammar* singletonp() { - static V3ParseGrammar singleton; - return &singleton; + static V3ParseGrammar singleton; + return &singleton; } // METHODS AstNode* argWrapList(AstNode* nodep); bool allTracingOn(FileLine* fl) { - return v3Global.opt.trace() && m_tracingParse && fl->tracingOn(); + return v3Global.opt.trace() && m_tracingParse && fl->tracingOn(); } AstRange* scrubRange(AstNodeRange* rangep); AstNodeDType* createArray(AstNodeDType* basep, AstNodeRange* rangep, bool isPacked); - AstVar* createVariable(FileLine* fileline, const string& name, AstNodeRange* arrayp, AstNode* attrsp); + AstVar* createVariable(FileLine* fileline, const string& name, AstNodeRange* arrayp, + AstNode* attrsp); AstNode* createSupplyExpr(FileLine* fileline, const string& name, int value); AstText* createTextQuoted(FileLine* fileline, const string& text) { - string newtext = deQuote(fileline, text); - return new AstText(fileline, newtext); + string newtext = deQuote(fileline, text); + return new AstText(fileline, newtext); } AstDisplay* createDisplayError(FileLine* fileline) { - AstDisplay* nodep = new AstDisplay(fileline, AstDisplayType::DT_ERROR, "", NULL, NULL); - nodep->addNext(new AstStop(fileline, true)); - return nodep; + AstDisplay* nodep = new AstDisplay(fileline, AstDisplayType::DT_ERROR, "", NULL, NULL); + nodep->addNext(new AstStop(fileline, true)); + return nodep; } AstNode* createGatePin(AstNode* exprp) { - AstRange* rangep = m_gateRangep; - if (!rangep) return exprp; - else return new AstGatePin(rangep->fileline(), exprp, rangep->cloneTree(true)); + AstRange* rangep = m_gateRangep; + if (!rangep) { + return exprp; + } else { + return new AstGatePin(rangep->fileline(), exprp, rangep->cloneTree(true)); + } } void endLabel(FileLine* fl, AstNode* nodep, string* endnamep) { endLabel(fl, nodep->prettyName(), endnamep); @@ -119,34 +132,35 @@ public: void endLabel(FileLine* fl, const string& name, string* endnamep) { if (fl && endnamep && *endnamep != "" && name != *endnamep && name != AstNode::prettyName(*endnamep)) { - fl->v3warn(ENDLABEL,"End label '"<<*endnamep<<"' does not match begin label '"<v3warn(ENDLABEL, "End label '" << *endnamep << "' does not match begin label '" + << name << "'"); } } void setVarDecl(AstVarType type) { m_varDecl = type; } void setDType(AstNodeDType* dtypep) { - if (m_varDTypep) VL_DO_CLEAR(m_varDTypep->deleteTree(), m_varDTypep=NULL); // It was cloned, so this is safe. - m_varDTypep = dtypep; + if (m_varDTypep) VL_DO_CLEAR(m_varDTypep->deleteTree(), m_varDTypep = NULL); + m_varDTypep = dtypep; } AstPackage* unitPackage(FileLine* fl) { - // Find one made earlier? - VSymEnt* symp = SYMP->symRootp()->findIdFlat(AstPackage::dollarUnitName()); - AstPackage* pkgp; - if (!symp) { - pkgp = PARSEP->rootp()->dollarUnitPkgAddp(); - SYMP->reinsert(pkgp, SYMP->symRootp()); // Don't push/pop scope as they're global - } else { - pkgp = VN_CAST(symp->nodep(), Package); - } - return pkgp; + // Find one made earlier? + VSymEnt* symp = SYMP->symRootp()->findIdFlat(AstPackage::dollarUnitName()); + AstPackage* pkgp; + if (!symp) { + pkgp = PARSEP->rootp()->dollarUnitPkgAddp(); + SYMP->reinsert(pkgp, SYMP->symRootp()); // Don't push/pop scope as they're global + } else { + pkgp = VN_CAST(symp->nodep(), Package); + } + return pkgp; } AstNodeDType* addRange(AstBasicDType* dtypep, AstNodeRange* rangesp, bool isPacked) { - // If dtypep isn't basic, don't use this, call createArray() instead - if (!rangesp) { - return dtypep; - } else { - // If rangesp is "wire [3:3][2:2][1:1] foo [5:5][4:4]" - // then [1:1] becomes the basicdtype range; everything else is arraying - // the final [5:5][4:4] will be passed in another call to createArray + // If dtypep isn't basic, don't use this, call createArray() instead + if (!rangesp) { + return dtypep; + } else { + // If rangesp is "wire [3:3][2:2][1:1] foo [5:5][4:4]" + // then [1:1] becomes the basicdtype range; everything else is arraying + // the final [5:5][4:4] will be passed in another call to createArray AstNodeRange* rangearraysp = NULL; if (dtypep->isRanged()) { rangearraysp = rangesp; // Already a range; everything is an array @@ -160,26 +174,27 @@ public: if (AstRange* finalRangep = VN_CAST(finalp, Range)) { // not an UnsizedRange if (dtypep->implicit()) { // It's no longer implicit but a wire logic type - AstBasicDType* newp = new AstBasicDType(dtypep->fileline(), AstBasicDTypeKwd::LOGIC, - dtypep->numeric(), dtypep->width(), dtypep->widthMin()); + AstBasicDType* newp = new AstBasicDType( + dtypep->fileline(), AstBasicDTypeKwd::LOGIC, dtypep->numeric(), + dtypep->width(), dtypep->widthMin()); VL_DO_DANGLING(dtypep->deleteTree(), dtypep); dtypep = newp; } dtypep->rangep(finalRangep); } - } - return createArray(dtypep, rangearraysp, isPacked); - } + } + return createArray(dtypep, rangearraysp, isPacked); + } } - string deQuote(FileLine* fileline, string text); + string deQuote(FileLine* fileline, string text); void checkDpiVer(FileLine* fileline, const string& str) { - if (str != "DPI-C" && !v3Global.opt.bboxSys()) { - fileline->v3error("Unsupported DPI type '"<v3error("Unsupported DPI type '" << str << "': Use 'DPI-C'"); + } } }; -const AstBasicDTypeKwd LOGIC = AstBasicDTypeKwd::LOGIC; // Shorthand "LOGIC" +const AstBasicDTypeKwd LOGIC = AstBasicDTypeKwd::LOGIC; // Shorthand "LOGIC" const AstBasicDTypeKwd LOGIC_IMPLICIT = AstBasicDTypeKwd::LOGIC_IMPLICIT; int V3ParseGrammar::s_modTypeImpNum = 0; @@ -187,53 +202,87 @@ int V3ParseGrammar::s_modTypeImpNum = 0; //====================================================================== // Macro functions -#define CRELINE() (PARSEP->copyOrSameFileLine()) // Only use in empty rules, so lines point at beginnings +#define CRELINE() \ + (PARSEP->copyOrSameFileLine()) // Only use in empty rules, so lines point at beginnings #define FILELINE_OR_CRE(nodep) ((nodep) ? (nodep)->fileline() : CRELINE()) -#define VARRESET_LIST(decl) { GRAMMARP->m_pinNum=1; GRAMMARP->m_pinAnsi=false; \ - VARRESET(); VARDECL(decl); } // Start of pinlist -#define VARRESET_NONLIST(decl) { GRAMMARP->m_pinNum=0; GRAMMARP->m_pinAnsi=false; \ - VARRESET(); VARDECL(decl); } // Not in a pinlist -#define VARRESET() { VARDECL(UNKNOWN); VARIO(NONE); VARDTYPE_NDECL(NULL); \ - GRAMMARP->m_varLifetime = VLifetime::NONE; \ - GRAMMARP->m_varDeclTyped = false; } -#define VARDECL(type) { GRAMMARP->setVarDecl(AstVarType::type); } -#define VARIO(type) { GRAMMARP->m_varIO = VDirection::type; } -#define VARLIFE(flag) { GRAMMARP->m_varLifetime = flag; } -#define VARDTYPE(dtypep) { GRAMMARP->setDType(dtypep); GRAMMARP->m_varDeclTyped = true; } -#define VARDTYPE_NDECL(dtypep) { GRAMMARP->setDType(dtypep); } // Port that is range or signed only (not a decl) +#define VARRESET_LIST(decl) \ + { \ + GRAMMARP->m_pinNum = 1; \ + GRAMMARP->m_pinAnsi = false; \ + VARRESET(); \ + VARDECL(decl); \ + } // Start of pinlist +#define VARRESET_NONLIST(decl) \ + { \ + GRAMMARP->m_pinNum = 0; \ + GRAMMARP->m_pinAnsi = false; \ + VARRESET(); \ + VARDECL(decl); \ + } // Not in a pinlist +#define VARRESET() \ + { \ + VARDECL(UNKNOWN); \ + VARIO(NONE); \ + VARDTYPE_NDECL(NULL); \ + GRAMMARP->m_varLifetime = VLifetime::NONE; \ + GRAMMARP->m_varDeclTyped = false; \ + } +#define VARDECL(type) \ + { GRAMMARP->setVarDecl(AstVarType::type); } +#define VARIO(type) \ + { GRAMMARP->m_varIO = VDirection::type; } +#define VARLIFE(flag) \ + { GRAMMARP->m_varLifetime = flag; } +#define VARDTYPE(dtypep) \ + { \ + GRAMMARP->setDType(dtypep); \ + GRAMMARP->m_varDeclTyped = true; \ + } +#define VARDTYPE_NDECL(dtypep) \ + { GRAMMARP->setDType(dtypep); } // Port that is range or signed only (not a decl) -#define VARDONEA(fl,name,array,attrs) GRAMMARP->createVariable((fl),(name),(array),(attrs)) -#define VARDONEP(portp,array,attrs) GRAMMARP->createVariable((portp)->fileline(),(portp)->name(),(array),(attrs)) +#define VARDONEA(fl, name, array, attrs) GRAMMARP->createVariable((fl), (name), (array), (attrs)) +#define VARDONEP(portp, array, attrs) \ + GRAMMARP->createVariable((portp)->fileline(), (portp)->name(), (array), (attrs)) #define PINNUMINC() (GRAMMARP->m_pinNum++) -#define GATERANGE(rangep) { GRAMMARP->m_gateRangep = rangep; } +#define GATERANGE(rangep) \ + { GRAMMARP->m_gateRangep = rangep; } -#define INSTPREP(modfl,modname,paramsp) { \ - GRAMMARP->m_impliedDecl = true; \ - GRAMMARP->m_instModuleFl = modfl; GRAMMARP->m_instModule = modname; \ - GRAMMARP->m_instParamp = paramsp; } +#define INSTPREP(modfl, modname, paramsp) \ + { \ + GRAMMARP->m_impliedDecl = true; \ + GRAMMARP->m_instModuleFl = modfl; \ + GRAMMARP->m_instModule = modname; \ + GRAMMARP->m_instParamp = paramsp; \ + } -#define DEL(nodep) { if (nodep) nodep->deleteTree(); } +#define DEL(nodep) \ + { \ + if (nodep) nodep->deleteTree(); \ + } static void ERRSVKWD(FileLine* fileline, const string& tokname) { static int toldonce = 0; - fileline->v3error(string("Unexpected '")+tokname+"': '"+tokname - +"' is a SystemVerilog keyword misused as an identifier." - +(!toldonce++ - ? "\n"+V3Error::warnMore() - +"... Suggest modify the Verilog-2001 code to avoid SV keywords," - +" or use `begin_keywords or --language." - : "")); + fileline->v3error( + string("Unexpected '") + tokname + "': '" + tokname + + "' is a SystemVerilog keyword misused as an identifier." + + (!toldonce++ ? "\n" + V3Error::warnMore() + + "... Suggest modify the Verilog-2001 code to avoid SV keywords," + + " or use `begin_keywords or --language." + : "")); } static void UNSUPREAL(FileLine* fileline) { - fileline->v3warn(SHORTREAL, "Unsupported: shortreal being promoted to real (suggest use real instead)"); + fileline->v3warn(SHORTREAL, + "Unsupported: shortreal being promoted to real (suggest use real instead)"); } //====================================================================== class AstSenTree; +// clang-format off %} // When writing Bison patterns we use yTOKEN instead of "token", @@ -241,107 +290,107 @@ class AstSenTree; // Generic lexer tokens, for example a number // IEEE: real_number -%token yaFLOATNUM "FLOATING-POINT NUMBER" +%token yaFLOATNUM "FLOATING-POINT NUMBER" // IEEE: identifier, class_identifier, class_variable_identifier, // covergroup_variable_identifier, dynamic_array_variable_identifier, // enum_identifier, interface_identifier, interface_instance_identifier, // package_identifier, type_identifier, variable_identifier, -%token yaID__ETC "IDENTIFIER" -%token yaID__LEX "IDENTIFIER-in-lex" -%token yaID__aPACKAGE "PACKAGE-IDENTIFIER" -%token yaID__aTYPE "TYPE-IDENTIFIER" -// Can't predecode aFUNCTION, can declare after use -// Can't predecode aINTERFACE, can declare after use -// Can't predecode aTASK, can declare after use +%token yaID__ETC "IDENTIFIER" +%token yaID__LEX "IDENTIFIER-in-lex" +%token yaID__aPACKAGE "PACKAGE-IDENTIFIER" +%token yaID__aTYPE "TYPE-IDENTIFIER" +// Can't predecode aFUNCTION, can declare after use +// Can't predecode aINTERFACE, can declare after use +// Can't predecode aTASK, can declare after use // IEEE: integral_number -%token yaINTNUM "INTEGER NUMBER" +%token yaINTNUM "INTEGER NUMBER" // IEEE: time_literal + time_unit -%token yaTIMENUM "TIME NUMBER" +%token yaTIMENUM "TIME NUMBER" // IEEE: string_literal -%token yaSTRING "STRING" -%token yaSTRING__IGNORE "STRING-ignored" // Used when expr:string not allowed +%token yaSTRING "STRING" +%token yaSTRING__IGNORE "STRING-ignored" // Used when expr:string not allowed -%token yaTIMINGSPEC "TIMING SPEC ELEMENT" +%token yaTIMINGSPEC "TIMING SPEC ELEMENT" -%token ygenSTRENGTH "STRENGTH keyword (strong1/etc)" +%token ygenSTRENGTH "STRENGTH keyword (strong1/etc)" -%token yaTABLELINE "TABLE LINE" +%token yaTABLELINE "TABLE LINE" -%token yaSCHDR "`systemc_header BLOCK" -%token yaSCINT "`systemc_ctor BLOCK" -%token yaSCIMP "`systemc_dtor BLOCK" -%token yaSCIMPH "`systemc_interface BLOCK" -%token yaSCCTOR "`systemc_implementation BLOCK" -%token yaSCDTOR "`systemc_imp_header BLOCK" +%token yaSCHDR "`systemc_header BLOCK" +%token yaSCINT "`systemc_ctor BLOCK" +%token yaSCIMP "`systemc_dtor BLOCK" +%token yaSCIMPH "`systemc_interface BLOCK" +%token yaSCCTOR "`systemc_implementation BLOCK" +%token yaSCDTOR "`systemc_imp_header BLOCK" -%token yVLT_CLOCKER "clocker" -%token yVLT_CLOCK_ENABLE "clock_enable" -%token yVLT_COVERAGE_BLOCK_OFF "coverage_block_off" -%token yVLT_COVERAGE_OFF "coverage_off" -%token yVLT_COVERAGE_ON "coverage_on" -%token yVLT_FULL_CASE "full_case" -%token yVLT_INLINE "inline" -%token yVLT_ISOLATE_ASSIGNMENTS "isolate_assignments" -%token yVLT_LINT_OFF "lint_off" -%token yVLT_LINT_ON "lint_on" -%token yVLT_NO_CLOCKER "no_clocker" -%token yVLT_NO_INLINE "no_inline" -%token yVLT_PARALLEL_CASE "parallel_case" -%token yVLT_PUBLIC "public" -%token yVLT_PUBLIC_FLAT "public_flat" -%token yVLT_PUBLIC_FLAT_RD "public_flat_rd" -%token yVLT_PUBLIC_FLAT_RW "public_flat_rw" -%token yVLT_PUBLIC_MODULE "public_module" -%token yVLT_SC_BV "sc_bv" -%token yVLT_SFORMAT "sformat" -%token yVLT_SPLIT_VAR "split_var" -%token yVLT_TRACING_OFF "tracing_off" -%token yVLT_TRACING_ON "tracing_on" +%token yVLT_CLOCKER "clocker" +%token yVLT_CLOCK_ENABLE "clock_enable" +%token yVLT_COVERAGE_BLOCK_OFF "coverage_block_off" +%token yVLT_COVERAGE_OFF "coverage_off" +%token yVLT_COVERAGE_ON "coverage_on" +%token yVLT_FULL_CASE "full_case" +%token yVLT_INLINE "inline" +%token yVLT_ISOLATE_ASSIGNMENTS "isolate_assignments" +%token yVLT_LINT_OFF "lint_off" +%token yVLT_LINT_ON "lint_on" +%token yVLT_NO_CLOCKER "no_clocker" +%token yVLT_NO_INLINE "no_inline" +%token yVLT_PARALLEL_CASE "parallel_case" +%token yVLT_PUBLIC "public" +%token yVLT_PUBLIC_FLAT "public_flat" +%token yVLT_PUBLIC_FLAT_RD "public_flat_rd" +%token yVLT_PUBLIC_FLAT_RW "public_flat_rw" +%token yVLT_PUBLIC_MODULE "public_module" +%token yVLT_SC_BV "sc_bv" +%token yVLT_SFORMAT "sformat" +%token yVLT_SPLIT_VAR "split_var" +%token yVLT_TRACING_OFF "tracing_off" +%token yVLT_TRACING_ON "tracing_on" -%token yVLT_D_BLOCK "--block" -%token yVLT_D_FILE "--file" -%token yVLT_D_FUNCTION "--function" -%token yVLT_D_LINES "--lines" -%token yVLT_D_MODULE "--module" -%token yVLT_D_MATCH "--match" -%token yVLT_D_MSG "--msg" -%token yVLT_D_RULE "--rule" -%token yVLT_D_TASK "--task" -%token yVLT_D_VAR "--var" +%token yVLT_D_BLOCK "--block" +%token yVLT_D_FILE "--file" +%token yVLT_D_FUNCTION "--function" +%token yVLT_D_LINES "--lines" +%token yVLT_D_MODULE "--module" +%token yVLT_D_MATCH "--match" +%token yVLT_D_MSG "--msg" +%token yVLT_D_RULE "--rule" +%token yVLT_D_TASK "--task" +%token yVLT_D_VAR "--var" -%token yaD_PLI "${pli-system}" +%token yaD_PLI "${pli-system}" -%token yaT_RESETALL "`resetall" +%token yaT_RESETALL "`resetall" // is the fileline, abbreviated to shorten "$1" references -%token '!' -%token '#' -%token '%' -%token '&' -%token '(' -%token ')' -%token '*' -%token '+' -%token ',' -%token '-' -%token '.' -%token '/' -%token ':' -%token ';' -%token '<' -%token '=' -%token '>' -%token '?' -%token '@' -%token '[' -%token ']' -%token '^' -%token '{' -%token '|' -%token '}' -%token '~' +%token '!' +%token '#' +%token '%' +%token '&' +%token '(' +%token ')' +%token '*' +%token '+' +%token ',' +%token '-' +%token '.' +%token '/' +%token ':' +%token ';' +%token '<' +%token '=' +%token '>' +%token '?' +%token '@' +%token '[' +%token ']' +%token '^' +%token '{' +%token '|' +%token '}' +%token '~' // Specific keywords // yKEYWORD means match "keyword" @@ -349,385 +398,385 @@ class AstSenTree; // for example yP_ for punctuation based operators. // Double underscores "yX__Y" means token X followed by Y, // and "yX__ETC" means X folled by everything but Y(s). -%token yALIAS "alias" -%token yALWAYS "always" -%token yALWAYS_COMB "always_comb" -%token yALWAYS_FF "always_ff" -%token yALWAYS_LATCH "always_latch" -%token yAND "and" -%token yASSERT "assert" -%token yASSIGN "assign" -%token yASSUME "assume" -%token yAUTOMATIC "automatic" -%token yBEGIN "begin" -%token yBIND "bind" -%token yBIT "bit" -%token yBREAK "break" -%token yBUF "buf" -%token yBUFIF0 "bufif0" -%token yBUFIF1 "bufif1" -%token yBYTE "byte" -%token yCASE "case" -%token yCASEX "casex" -%token yCASEZ "casez" -%token yCHANDLE "chandle" -%token yCLASS "class" -%token yCLOCKING "clocking" -%token yCMOS "cmos" -%token yCONST__ETC "const" -%token yCONST__LEX "const-in-lex" -%token yCONST__REF "const-then-ref" -%token yCONTEXT "context" -%token yCONTINUE "continue" -%token yCOVER "cover" -%token yDEASSIGN "deassign" -%token yDEFAULT "default" -%token yDEFPARAM "defparam" -%token yDISABLE "disable" -%token yDO "do" -%token yEDGE "edge" -%token yELSE "else" -%token yEND "end" -%token yENDCASE "endcase" -%token yENDCLASS "endclass" -%token yENDCLOCKING "endclocking" -%token yENDFUNCTION "endfunction" -%token yENDGENERATE "endgenerate" -%token yENDINTERFACE "endinterface" -%token yENDMODULE "endmodule" -%token yENDPACKAGE "endpackage" -%token yENDPRIMITIVE "endprimitive" -%token yENDPROGRAM "endprogram" -%token yENDPROPERTY "endproperty" -%token yENDSPECIFY "endspecify" -%token yENDTABLE "endtable" -%token yENDTASK "endtask" -%token yENUM "enum" -%token yEVENT "event" -%token yEXPORT "export" -%token yEXTENDS "extends" -%token yEXTERN "extern" -%token yFINAL "final" -%token yFOR "for" -%token yFORCE "force" -%token yFOREACH "foreach" -%token yFOREVER "forever" -%token yFORK "fork" -%token yFORKJOIN "forkjoin" -%token yFUNCTION "function" -%token yGENERATE "generate" -%token yGENVAR "genvar" -%token yGLOBAL__CLOCKING "global-then-clocking" -%token yGLOBAL__ETC "global" -%token yGLOBAL__LEX "global-in-lex" -%token yIF "if" -%token yIFF "iff" -%token yIMPLEMENTS "implements" -%token yIMPORT "import" -%token yINITIAL "initial" -%token yINOUT "inout" -%token yINPUT "input" -%token yINSIDE "inside" -%token yINT "int" -%token yINTEGER "integer" -%token yINTERFACE "interface" -%token yJOIN "join" -%token yJOIN_ANY "join_any" -%token yJOIN_NONE "join_none" -%token yLOCALPARAM "localparam" -%token yLOCAL__COLONCOLON "local-then-::" -%token yLOCAL__ETC "local" -%token yLOCAL__LEX "local-in-lex" -%token yLOGIC "logic" -%token yLONGINT "longint" -%token yMODPORT "modport" -%token yMODULE "module" -%token yNAND "nand" -%token yNEGEDGE "negedge" -%token yNEW__ETC "new" -%token yNEW__LEX "new-in-lex" -%token yNEW__PAREN "new-then-paren" -%token yNMOS "nmos" -%token yNOR "nor" -%token yNOT "not" -%token yNOTIF0 "notif0" -%token yNOTIF1 "notif1" -%token yNULL "null" -%token yOR "or" -%token yOUTPUT "output" -%token yPACKAGE "package" -%token yPACKED "packed" -%token yPARAMETER "parameter" -%token yPMOS "pmos" -%token yPOSEDGE "posedge" -%token yPRIMITIVE "primitive" -%token yPRIORITY "priority" -%token yPROGRAM "program" -%token yPROPERTY "property" -%token yPROTECTED "protected" -%token yPULLDOWN "pulldown" -%token yPULLUP "pullup" -%token yPURE "pure" -%token yRAND "rand" -%token yRANDC "randc" -%token yRANDCASE "randcase" -%token yRCMOS "rcmos" -%token yREAL "real" -%token yREALTIME "realtime" -%token yREF "ref" -%token yREG "reg" -%token yRELEASE "release" -%token yREPEAT "repeat" -%token yRESTRICT "restrict" -%token yRETURN "return" -%token yRNMOS "rnmos" -%token yRPMOS "rpmos" -%token yRTRAN "rtran" -%token yRTRANIF0 "rtranif0" -%token yRTRANIF1 "rtranif1" -%token ySCALARED "scalared" -%token ySHORTINT "shortint" -%token ySHORTREAL "shortreal" -%token ySIGNED "signed" -%token ySPECIFY "specify" -%token ySPECPARAM "specparam" -%token ySTATIC__ETC "static" -%token ySTRING "string" -%token ySTRUCT "struct" -%token ySUPER "super" -%token ySUPPLY0 "supply0" -%token ySUPPLY1 "supply1" -%token yTABLE "table" -%token yTASK "task" -%token yTHIS "this" -%token yTIME "time" -%token yTIMEPRECISION "timeprecision" -%token yTIMEUNIT "timeunit" -%token yTRAN "tran" -%token yTRANIF0 "tranif0" -%token yTRANIF1 "tranif1" -%token yTRI "tri" -%token yTRI0 "tri0" -%token yTRI1 "tri1" -%token yTRIAND "triand" -%token yTRIOR "trior" -%token yTRIREG "trireg" -%token yTRUE "true" -%token yTYPE "type" -%token yTYPEDEF "typedef" -%token yUNION "union" -%token yUNIQUE "unique" -%token yUNIQUE0 "unique0" -%token yUNSIGNED "unsigned" -%token yVAR "var" -%token yVECTORED "vectored" -%token yVIRTUAL__CLASS "virtual-then-class" -%token yVIRTUAL__ETC "virtual" -%token yVIRTUAL__INTERFACE "virtual-then-interface" -%token yVIRTUAL__LEX "virtual-in-lex" -%token yVIRTUAL__anyID "virtual-then-identifier" -%token yVOID "void" -%token yWAIT "wait" -%token yWAND "wand" -%token yWHILE "while" -%token yWIRE "wire" -%token yWOR "wor" -%token yWREAL "wreal" -%token yXNOR "xnor" -%token yXOR "xor" +%token yALIAS "alias" +%token yALWAYS "always" +%token yALWAYS_COMB "always_comb" +%token yALWAYS_FF "always_ff" +%token yALWAYS_LATCH "always_latch" +%token yAND "and" +%token yASSERT "assert" +%token yASSIGN "assign" +%token yASSUME "assume" +%token yAUTOMATIC "automatic" +%token yBEGIN "begin" +%token yBIND "bind" +%token yBIT "bit" +%token yBREAK "break" +%token yBUF "buf" +%token yBUFIF0 "bufif0" +%token yBUFIF1 "bufif1" +%token yBYTE "byte" +%token yCASE "case" +%token yCASEX "casex" +%token yCASEZ "casez" +%token yCHANDLE "chandle" +%token yCLASS "class" +%token yCLOCKING "clocking" +%token yCMOS "cmos" +%token yCONST__ETC "const" +%token yCONST__LEX "const-in-lex" +%token yCONST__REF "const-then-ref" +%token yCONTEXT "context" +%token yCONTINUE "continue" +%token yCOVER "cover" +%token yDEASSIGN "deassign" +%token yDEFAULT "default" +%token yDEFPARAM "defparam" +%token yDISABLE "disable" +%token yDO "do" +%token yEDGE "edge" +%token yELSE "else" +%token yEND "end" +%token yENDCASE "endcase" +%token yENDCLASS "endclass" +%token yENDCLOCKING "endclocking" +%token yENDFUNCTION "endfunction" +%token yENDGENERATE "endgenerate" +%token yENDINTERFACE "endinterface" +%token yENDMODULE "endmodule" +%token yENDPACKAGE "endpackage" +%token yENDPRIMITIVE "endprimitive" +%token yENDPROGRAM "endprogram" +%token yENDPROPERTY "endproperty" +%token yENDSPECIFY "endspecify" +%token yENDTABLE "endtable" +%token yENDTASK "endtask" +%token yENUM "enum" +%token yEVENT "event" +%token yEXPORT "export" +%token yEXTENDS "extends" +%token yEXTERN "extern" +%token yFINAL "final" +%token yFOR "for" +%token yFORCE "force" +%token yFOREACH "foreach" +%token yFOREVER "forever" +%token yFORK "fork" +%token yFORKJOIN "forkjoin" +%token yFUNCTION "function" +%token yGENERATE "generate" +%token yGENVAR "genvar" +%token yGLOBAL__CLOCKING "global-then-clocking" +%token yGLOBAL__ETC "global" +%token yGLOBAL__LEX "global-in-lex" +%token yIF "if" +%token yIFF "iff" +%token yIMPLEMENTS "implements" +%token yIMPORT "import" +%token yINITIAL "initial" +%token yINOUT "inout" +%token yINPUT "input" +%token yINSIDE "inside" +%token yINT "int" +%token yINTEGER "integer" +%token yINTERFACE "interface" +%token yJOIN "join" +%token yJOIN_ANY "join_any" +%token yJOIN_NONE "join_none" +%token yLOCALPARAM "localparam" +%token yLOCAL__COLONCOLON "local-then-::" +%token yLOCAL__ETC "local" +%token yLOCAL__LEX "local-in-lex" +%token yLOGIC "logic" +%token yLONGINT "longint" +%token yMODPORT "modport" +%token yMODULE "module" +%token yNAND "nand" +%token yNEGEDGE "negedge" +%token yNEW__ETC "new" +%token yNEW__LEX "new-in-lex" +%token yNEW__PAREN "new-then-paren" +%token yNMOS "nmos" +%token yNOR "nor" +%token yNOT "not" +%token yNOTIF0 "notif0" +%token yNOTIF1 "notif1" +%token yNULL "null" +%token yOR "or" +%token yOUTPUT "output" +%token yPACKAGE "package" +%token yPACKED "packed" +%token yPARAMETER "parameter" +%token yPMOS "pmos" +%token yPOSEDGE "posedge" +%token yPRIMITIVE "primitive" +%token yPRIORITY "priority" +%token yPROGRAM "program" +%token yPROPERTY "property" +%token yPROTECTED "protected" +%token yPULLDOWN "pulldown" +%token yPULLUP "pullup" +%token yPURE "pure" +%token yRAND "rand" +%token yRANDC "randc" +%token yRANDCASE "randcase" +%token yRCMOS "rcmos" +%token yREAL "real" +%token yREALTIME "realtime" +%token yREF "ref" +%token yREG "reg" +%token yRELEASE "release" +%token yREPEAT "repeat" +%token yRESTRICT "restrict" +%token yRETURN "return" +%token yRNMOS "rnmos" +%token yRPMOS "rpmos" +%token yRTRAN "rtran" +%token yRTRANIF0 "rtranif0" +%token yRTRANIF1 "rtranif1" +%token ySCALARED "scalared" +%token ySHORTINT "shortint" +%token ySHORTREAL "shortreal" +%token ySIGNED "signed" +%token ySPECIFY "specify" +%token ySPECPARAM "specparam" +%token ySTATIC__ETC "static" +%token ySTRING "string" +%token ySTRUCT "struct" +%token ySUPER "super" +%token ySUPPLY0 "supply0" +%token ySUPPLY1 "supply1" +%token yTABLE "table" +%token yTASK "task" +%token yTHIS "this" +%token yTIME "time" +%token yTIMEPRECISION "timeprecision" +%token yTIMEUNIT "timeunit" +%token yTRAN "tran" +%token yTRANIF0 "tranif0" +%token yTRANIF1 "tranif1" +%token yTRI "tri" +%token yTRI0 "tri0" +%token yTRI1 "tri1" +%token yTRIAND "triand" +%token yTRIOR "trior" +%token yTRIREG "trireg" +%token yTRUE "true" +%token yTYPE "type" +%token yTYPEDEF "typedef" +%token yUNION "union" +%token yUNIQUE "unique" +%token yUNIQUE0 "unique0" +%token yUNSIGNED "unsigned" +%token yVAR "var" +%token yVECTORED "vectored" +%token yVIRTUAL__CLASS "virtual-then-class" +%token yVIRTUAL__ETC "virtual" +%token yVIRTUAL__INTERFACE "virtual-then-interface" +%token yVIRTUAL__LEX "virtual-in-lex" +%token yVIRTUAL__anyID "virtual-then-identifier" +%token yVOID "void" +%token yWAIT "wait" +%token yWAND "wand" +%token yWHILE "while" +%token yWIRE "wire" +%token yWOR "wor" +%token yWREAL "wreal" +%token yXNOR "xnor" +%token yXOR "xor" -%token yD_ACOS "$acos" -%token yD_ACOSH "$acosh" -%token yD_ASIN "$asin" -%token yD_ASINH "$asinh" -%token yD_ATAN "$atan" -%token yD_ATAN2 "$atan2" -%token yD_ATANH "$atanh" -%token yD_BITS "$bits" -%token yD_BITSTOREAL "$bitstoreal" -%token yD_BITSTOSHORTREAL "$bitstoshortreal" -%token yD_C "$c" -%token yD_CEIL "$ceil" -%token yD_CLOG2 "$clog2" -%token yD_COS "$cos" -%token yD_COSH "$cosh" -%token yD_COUNTBITS "$countbits" -%token yD_COUNTONES "$countones" -%token yD_DIMENSIONS "$dimensions" -%token yD_DISPLAY "$display" -%token yD_DISPLAYB "$displayb" -%token yD_DISPLAYH "$displayh" -%token yD_DISPLAYO "$displayo" -%token yD_DUMPALL "$dumpall" -%token yD_DUMPFILE "$dumpfile" -%token yD_DUMPFLUSH "$dumpflush" -%token yD_DUMPLIMIT "$dumplimit" -%token yD_DUMPOFF "$dumpoff" -%token yD_DUMPON "$dumpon" -%token yD_DUMPPORTS "$dumpports" -%token yD_DUMPVARS "$dumpvars" -%token yD_ERROR "$error" -%token yD_EXP "$exp" -%token yD_FATAL "$fatal" -%token yD_FCLOSE "$fclose" -%token yD_FDISPLAY "$fdisplay" -%token yD_FDISPLAYB "$fdisplayb" -%token yD_FDISPLAYH "$fdisplayh" -%token yD_FDISPLAYO "$fdisplayo" -%token yD_FEOF "$feof" -%token yD_FERROR "$ferror" -%token yD_FFLUSH "$fflush" -%token yD_FGETC "$fgetc" -%token yD_FGETS "$fgets" -%token yD_FINISH "$finish" -%token yD_FLOOR "$floor" -%token yD_FOPEN "$fopen" -%token yD_FREAD "$fread" -%token yD_FREWIND "$frewind" -%token yD_FSCANF "$fscanf" -%token yD_FSEEK "$fseek" -%token yD_FTELL "$ftell" -%token yD_FWRITE "$fwrite" -%token yD_FWRITEB "$fwriteb" -%token yD_FWRITEH "$fwriteh" -%token yD_FWRITEO "$fwriteo" -%token yD_HIGH "$high" -%token yD_HYPOT "$hypot" -%token yD_INCREMENT "$increment" -%token yD_INFO "$info" -%token yD_ISUNBOUNDED "$isunbounded" -%token yD_ISUNKNOWN "$isunknown" -%token yD_ITOR "$itor" -%token yD_LEFT "$left" -%token yD_LN "$ln" -%token yD_LOG10 "$log10" -%token yD_LOW "$low" -%token yD_ONEHOT "$onehot" -%token yD_ONEHOT0 "$onehot0" -%token yD_PAST "$past" -%token yD_POW "$pow" -%token yD_PRINTTIMESCALE "$printtimescale" -%token yD_RANDOM "$random" -%token yD_READMEMB "$readmemb" -%token yD_READMEMH "$readmemh" -%token yD_REALTIME "$realtime" -%token yD_REALTOBITS "$realtobits" -%token yD_REWIND "$rewind" -%token yD_RIGHT "$right" -%token yD_ROOT "$root" -%token yD_RTOI "$rtoi" -%token yD_SAMPLED "$sampled" -%token yD_SFORMAT "$sformat" -%token yD_SFORMATF "$sformatf" -%token yD_SHORTREALTOBITS "$shortrealtobits" -%token yD_SIGNED "$signed" -%token yD_SIN "$sin" -%token yD_SINH "$sinh" -%token yD_SIZE "$size" -%token yD_SQRT "$sqrt" -%token yD_SSCANF "$sscanf" -%token yD_STIME "$stime" -%token yD_STOP "$stop" -%token yD_SWRITE "$swrite" -%token yD_SWRITEB "$swriteb" -%token yD_SWRITEH "$swriteh" -%token yD_SWRITEO "$swriteo" -%token yD_SYSTEM "$system" -%token yD_TAN "$tan" -%token yD_TANH "$tanh" -%token yD_TESTPLUSARGS "$test$plusargs" -%token yD_TIME "$time" -%token yD_TIMEFORMAT "$timeformat" -%token yD_TYPENAME "$typename" -%token yD_UNGETC "$ungetc" -%token yD_UNIT "$unit" -%token yD_UNPACKED_DIMENSIONS "$unpacked_dimensions" -%token yD_UNSIGNED "$unsigned" -%token yD_VALUEPLUSARGS "$value$plusargs" -%token yD_WARNING "$warning" -%token yD_WRITE "$write" -%token yD_WRITEB "$writeb" -%token yD_WRITEH "$writeh" -%token yD_WRITEMEMH "$writememh" -%token yD_WRITEO "$writeo" +%token yD_ACOS "$acos" +%token yD_ACOSH "$acosh" +%token yD_ASIN "$asin" +%token yD_ASINH "$asinh" +%token yD_ATAN "$atan" +%token yD_ATAN2 "$atan2" +%token yD_ATANH "$atanh" +%token yD_BITS "$bits" +%token yD_BITSTOREAL "$bitstoreal" +%token yD_BITSTOSHORTREAL "$bitstoshortreal" +%token yD_C "$c" +%token yD_CEIL "$ceil" +%token yD_CLOG2 "$clog2" +%token yD_COS "$cos" +%token yD_COSH "$cosh" +%token yD_COUNTBITS "$countbits" +%token yD_COUNTONES "$countones" +%token yD_DIMENSIONS "$dimensions" +%token yD_DISPLAY "$display" +%token yD_DISPLAYB "$displayb" +%token yD_DISPLAYH "$displayh" +%token yD_DISPLAYO "$displayo" +%token yD_DUMPALL "$dumpall" +%token yD_DUMPFILE "$dumpfile" +%token yD_DUMPFLUSH "$dumpflush" +%token yD_DUMPLIMIT "$dumplimit" +%token yD_DUMPOFF "$dumpoff" +%token yD_DUMPON "$dumpon" +%token yD_DUMPPORTS "$dumpports" +%token yD_DUMPVARS "$dumpvars" +%token yD_ERROR "$error" +%token yD_EXP "$exp" +%token yD_FATAL "$fatal" +%token yD_FCLOSE "$fclose" +%token yD_FDISPLAY "$fdisplay" +%token yD_FDISPLAYB "$fdisplayb" +%token yD_FDISPLAYH "$fdisplayh" +%token yD_FDISPLAYO "$fdisplayo" +%token yD_FEOF "$feof" +%token yD_FERROR "$ferror" +%token yD_FFLUSH "$fflush" +%token yD_FGETC "$fgetc" +%token yD_FGETS "$fgets" +%token yD_FINISH "$finish" +%token yD_FLOOR "$floor" +%token yD_FOPEN "$fopen" +%token yD_FREAD "$fread" +%token yD_FREWIND "$frewind" +%token yD_FSCANF "$fscanf" +%token yD_FSEEK "$fseek" +%token yD_FTELL "$ftell" +%token yD_FWRITE "$fwrite" +%token yD_FWRITEB "$fwriteb" +%token yD_FWRITEH "$fwriteh" +%token yD_FWRITEO "$fwriteo" +%token yD_HIGH "$high" +%token yD_HYPOT "$hypot" +%token yD_INCREMENT "$increment" +%token yD_INFO "$info" +%token yD_ISUNBOUNDED "$isunbounded" +%token yD_ISUNKNOWN "$isunknown" +%token yD_ITOR "$itor" +%token yD_LEFT "$left" +%token yD_LN "$ln" +%token yD_LOG10 "$log10" +%token yD_LOW "$low" +%token yD_ONEHOT "$onehot" +%token yD_ONEHOT0 "$onehot0" +%token yD_PAST "$past" +%token yD_POW "$pow" +%token yD_PRINTTIMESCALE "$printtimescale" +%token yD_RANDOM "$random" +%token yD_READMEMB "$readmemb" +%token yD_READMEMH "$readmemh" +%token yD_REALTIME "$realtime" +%token yD_REALTOBITS "$realtobits" +%token yD_REWIND "$rewind" +%token yD_RIGHT "$right" +%token yD_ROOT "$root" +%token yD_RTOI "$rtoi" +%token yD_SAMPLED "$sampled" +%token yD_SFORMAT "$sformat" +%token yD_SFORMATF "$sformatf" +%token yD_SHORTREALTOBITS "$shortrealtobits" +%token yD_SIGNED "$signed" +%token yD_SIN "$sin" +%token yD_SINH "$sinh" +%token yD_SIZE "$size" +%token yD_SQRT "$sqrt" +%token yD_SSCANF "$sscanf" +%token yD_STIME "$stime" +%token yD_STOP "$stop" +%token yD_SWRITE "$swrite" +%token yD_SWRITEB "$swriteb" +%token yD_SWRITEH "$swriteh" +%token yD_SWRITEO "$swriteo" +%token yD_SYSTEM "$system" +%token yD_TAN "$tan" +%token yD_TANH "$tanh" +%token yD_TESTPLUSARGS "$test$plusargs" +%token yD_TIME "$time" +%token yD_TIMEFORMAT "$timeformat" +%token yD_TYPENAME "$typename" +%token yD_UNGETC "$ungetc" +%token yD_UNIT "$unit" +%token yD_UNPACKED_DIMENSIONS "$unpacked_dimensions" +%token yD_UNSIGNED "$unsigned" +%token yD_VALUEPLUSARGS "$value$plusargs" +%token yD_WARNING "$warning" +%token yD_WRITE "$write" +%token yD_WRITEB "$writeb" +%token yD_WRITEH "$writeh" +%token yD_WRITEMEMH "$writememh" +%token yD_WRITEO "$writeo" -%token yVL_CLOCK "/*verilator sc_clock*/" -%token yVL_CLOCKER "/*verilator clocker*/" -%token yVL_NO_CLOCKER "/*verilator no_clocker*/" -%token yVL_CLOCK_ENABLE "/*verilator clock_enable*/" -%token yVL_COVERAGE_BLOCK_OFF "/*verilator coverage_block_off*/" -%token yVL_FULL_CASE "/*verilator full_case*/" -%token yVL_INLINE_MODULE "/*verilator inline_module*/" -%token yVL_ISOLATE_ASSIGNMENTS "/*verilator isolate_assignments*/" -%token yVL_NO_INLINE_MODULE "/*verilator no_inline_module*/" -%token yVL_NO_INLINE_TASK "/*verilator no_inline_task*/" -%token yVL_SC_BV "/*verilator sc_bv*/" -%token yVL_SFORMAT "/*verilator sformat*/" -%token yVL_PARALLEL_CASE "/*verilator parallel_case*/" -%token yVL_PUBLIC "/*verilator public*/" -%token yVL_PUBLIC_FLAT "/*verilator public_flat*/" -%token yVL_PUBLIC_FLAT_RD "/*verilator public_flat_rd*/" -%token yVL_PUBLIC_FLAT_RW "/*verilator public_flat_rw*/" -%token yVL_PUBLIC_MODULE "/*verilator public_module*/" -%token yVL_SPLIT_VAR "/*verilator split_var*/" +%token yVL_CLOCK "/*verilator sc_clock*/" +%token yVL_CLOCKER "/*verilator clocker*/" +%token yVL_NO_CLOCKER "/*verilator no_clocker*/" +%token yVL_CLOCK_ENABLE "/*verilator clock_enable*/" +%token yVL_COVERAGE_BLOCK_OFF "/*verilator coverage_block_off*/" +%token yVL_FULL_CASE "/*verilator full_case*/" +%token yVL_INLINE_MODULE "/*verilator inline_module*/" +%token yVL_ISOLATE_ASSIGNMENTS "/*verilator isolate_assignments*/" +%token yVL_NO_INLINE_MODULE "/*verilator no_inline_module*/" +%token yVL_NO_INLINE_TASK "/*verilator no_inline_task*/" +%token yVL_SC_BV "/*verilator sc_bv*/" +%token yVL_SFORMAT "/*verilator sformat*/" +%token yVL_PARALLEL_CASE "/*verilator parallel_case*/" +%token yVL_PUBLIC "/*verilator public*/" +%token yVL_PUBLIC_FLAT "/*verilator public_flat*/" +%token yVL_PUBLIC_FLAT_RD "/*verilator public_flat_rd*/" +%token yVL_PUBLIC_FLAT_RW "/*verilator public_flat_rw*/" +%token yVL_PUBLIC_MODULE "/*verilator public_module*/" +%token yVL_SPLIT_VAR "/*verilator split_var*/" -%token yP_TICK "'" -%token yP_TICKBRA "'{" -%token yP_OROR "||" -%token yP_ANDAND "&&" -%token yP_NOR "~|" -%token yP_XNOR "^~" -%token yP_NAND "~&" -%token yP_EQUAL "==" -%token yP_NOTEQUAL "!=" -%token yP_CASEEQUAL "===" -%token yP_CASENOTEQUAL "!==" -%token yP_WILDEQUAL "==?" -%token yP_WILDNOTEQUAL "!=?" -%token yP_GTE ">=" -%token yP_LTE "<=" -%token yP_LTE__IGNORE "<=-ignored" // Used when expr:<= means assignment -%token yP_SLEFT "<<" -%token yP_SRIGHT ">>" -%token yP_SSRIGHT ">>>" -%token yP_POW "**" +%token yP_TICK "'" +%token yP_TICKBRA "'{" +%token yP_OROR "||" +%token yP_ANDAND "&&" +%token yP_NOR "~|" +%token yP_XNOR "^~" +%token yP_NAND "~&" +%token yP_EQUAL "==" +%token yP_NOTEQUAL "!=" +%token yP_CASEEQUAL "===" +%token yP_CASENOTEQUAL "!==" +%token yP_WILDEQUAL "==?" +%token yP_WILDNOTEQUAL "!=?" +%token yP_GTE ">=" +%token yP_LTE "<=" +%token yP_LTE__IGNORE "<=-ignored" // Used when expr:<= means assignment +%token yP_SLEFT "<<" +%token yP_SRIGHT ">>" +%token yP_SSRIGHT ">>>" +%token yP_POW "**" -%token yP_PAR__STRENGTH "(-for-strength" +%token yP_PAR__STRENGTH "(-for-strength" -%token yP_LTMINUSGT "<->" -%token yP_PLUSCOLON "+:" -%token yP_MINUSCOLON "-:" -%token yP_MINUSGT "->" -%token yP_MINUSGTGT "->>" -%token yP_EQGT "=>" -%token yP_ASTGT "*>" -%token yP_ANDANDAND "&&&" -%token yP_POUNDPOUND "##" -%token yP_DOTSTAR ".*" +%token yP_LTMINUSGT "<->" +%token yP_PLUSCOLON "+:" +%token yP_MINUSCOLON "-:" +%token yP_MINUSGT "->" +%token yP_MINUSGTGT "->>" +%token yP_EQGT "=>" +%token yP_ASTGT "*>" +%token yP_ANDANDAND "&&&" +%token yP_POUNDPOUND "##" +%token yP_DOTSTAR ".*" -%token yP_ATAT "@@" -%token yP_COLONCOLON "::" -%token yP_COLONEQ ":=" -%token yP_COLONDIV ":/" -%token yP_ORMINUSGT "|->" -%token yP_OREQGT "|=>" -%token yP_BRASTAR "[*" -%token yP_BRAEQ "[=" -%token yP_BRAMINUSGT "[->" +%token yP_ATAT "@@" +%token yP_COLONCOLON "::" +%token yP_COLONEQ ":=" +%token yP_COLONDIV ":/" +%token yP_ORMINUSGT "|->" +%token yP_OREQGT "|=>" +%token yP_BRASTAR "[*" +%token yP_BRAEQ "[=" +%token yP_BRAMINUSGT "[->" -%token yP_PLUSPLUS "++" -%token yP_MINUSMINUS "--" -%token yP_PLUSEQ "+=" -%token yP_MINUSEQ "-=" -%token yP_TIMESEQ "*=" -%token yP_DIVEQ "/=" -%token yP_MODEQ "%=" -%token yP_ANDEQ "&=" -%token yP_OREQ "|=" -%token yP_XOREQ "^=" -%token yP_SLEFTEQ "<<=" -%token yP_SRIGHTEQ ">>=" -%token yP_SSRIGHTEQ ">>>=" +%token yP_PLUSPLUS "++" +%token yP_MINUSMINUS "--" +%token yP_PLUSEQ "+=" +%token yP_MINUSEQ "-=" +%token yP_TIMESEQ "*=" +%token yP_DIVEQ "/=" +%token yP_MODEQ "%=" +%token yP_ANDEQ "&=" +%token yP_OREQ "|=" +%token yP_XOREQ "^=" +%token yP_SLEFTEQ "<<=" +%token yP_SRIGHTEQ ">>=" +%token yP_SSRIGHTEQ ">>>=" // [* is not a operator, as "[ * ]" is legal // [= and [-> could be repitition operators, but to match [* we don't add them. @@ -735,30 +784,30 @@ class AstSenTree; //******************** // These prevent other conflicts -%left yP_ANDANDAND +%left yP_ANDANDAND // PSL op precedence -%right yP_ORMINUSGT yP_OREQGT +%right yP_ORMINUSGT yP_OREQGT // Verilog op precedence -%right yP_MINUSGT yP_LTMINUSGT -%right '?' ':' -%left yP_OROR -%left yP_ANDAND -%left '|' yP_NOR -%left '^' yP_XNOR -%left '&' yP_NAND -%left yP_EQUAL yP_NOTEQUAL yP_CASEEQUAL yP_CASENOTEQUAL yP_WILDEQUAL yP_WILDNOTEQUAL -%left '>' '<' yP_GTE yP_LTE yP_LTE__IGNORE yINSIDE -%left yP_SLEFT yP_SRIGHT yP_SSRIGHT -%left '+' '-' -%left '*' '/' '%' -%left yP_POW -%left prUNARYARITH yP_MINUSMINUS yP_PLUSPLUS prREDUCTION prNEGATION -%left '.' +%right yP_MINUSGT yP_LTMINUSGT +%right '?' ':' +%left yP_OROR +%left yP_ANDAND +%left '|' yP_NOR +%left '^' yP_XNOR +%left '&' yP_NAND +%left yP_EQUAL yP_NOTEQUAL yP_CASEEQUAL yP_CASENOTEQUAL yP_WILDEQUAL yP_WILDNOTEQUAL +%left '>' '<' yP_GTE yP_LTE yP_LTE__IGNORE yINSIDE +%left yP_SLEFT yP_SRIGHT yP_SSRIGHT +%left '+' '-' +%left '*' '/' '%' +%left yP_POW +%left prUNARYARITH yP_MINUSMINUS yP_PLUSPLUS prREDUCTION prNEGATION +%left '.' // Not in IEEE, but need to avoid conflicts; TICK should bind tightly just lower than COLONCOLON -%left yP_TICK -//%left '(' ')' '[' ']' yP_COLONCOLON '.' +%left yP_TICK +//%left '(' ')' '[' ']' yP_COLONCOLON '.' %nonassoc prLOWER_THAN_ELSE %nonassoc yELSE