diff --git a/frontends/verilog/verilog_lexer.l b/frontends/verilog/verilog_lexer.l index e10e6114b..f6a3ac4db 100644 --- a/frontends/verilog/verilog_lexer.l +++ b/frontends/verilog/verilog_lexer.l @@ -518,12 +518,7 @@ import[ \t\r\n]+\"(DPI|DPI-C)\"[ \t\r\n]+function[ \t\r\n]+ { ".*" { return TOK_WILDCARD_CONNECT; } -[+-] { - if (!specify_mode) REJECT; - frontend_verilog_yylval.ch = yytext[0]; - return TOK_SPECIFY_POL; -} -[=*]> { +[-+]?[=*]> { if (!specify_mode) REJECT; yylval->string = new std::string(yytext); return TOK_SPECIFY_OPER; diff --git a/frontends/verilog/verilog_parser.y b/frontends/verilog/verilog_parser.y index daf34fb1e..b4e60b98a 100644 --- a/frontends/verilog/verilog_parser.y +++ b/frontends/verilog/verilog_parser.y @@ -204,7 +204,6 @@ static void addRange(AstNode *parent, int msb = 31, int lsb = 0, bool isSigned = %token TOK_SVA_LABEL TOK_SPECIFY_OPER TOK_MSG_TASKS %token TOK_BASE TOK_BASED_CONSTVAL TOK_UNBASED_UNSIZED_CONSTVAL %token TOK_USER_TYPE TOK_PKG_USER_TYPE -%token TOK_SPECIFY_POL %token TOK_ASSERT TOK_ASSUME TOK_RESTRICT TOK_COVER TOK_FINAL %token ATTR_BEGIN ATTR_END DEFATTR_BEGIN DEFATTR_END %token TOK_MODULE TOK_ENDMODULE TOK_PARAMETER TOK_LOCALPARAM TOK_DEFPARAM @@ -237,7 +236,7 @@ static void addRange(AstNode *parent, int msb = 31, int lsb = 0, bool isSigned = %type specify_triple specify_opt_triple %type specify_rise_fall %type specify_if specify_condition -%type specify_edge specify_polarity +%type specify_edge // operator precedence from low to high %left OP_LOR @@ -869,21 +868,14 @@ specify_item_list: specify_item specify_item_list | /* empty */; -specify_polarity: - TOK_SPECIFY_POL | - /* empty */ { - $$ = 0; - }; - specify_item: - specify_if '(' specify_edge expr specify_polarity TOK_SPECIFY_OPER specify_target ')' '=' specify_rise_fall ';' { + specify_if '(' specify_edge expr TOK_SPECIFY_OPER specify_target ')' '=' specify_rise_fall ';' { AstNode *en_expr = $1; char specify_edge = $3; AstNode *src_expr = $4; - char oper_polarity = $5; - string *oper = $6; - specify_target *target = $7; - specify_rise_fall *timing = $10; + string *oper = $5; + specify_target *target = $6; + specify_rise_fall *timing = $9; if (specify_edge != 0 && target->dat == nullptr) frontend_verilog_yyerror("Found specify edge but no data spec.\n"); @@ -895,8 +887,14 @@ specify_item: cell->children.back()->str = target->dat ? "$specify3" : "$specify2"; SET_AST_NODE_LOC(cell, en_expr ? @1 : @2, @10); + char oper_polarity = 0; char oper_type = oper->at(0); + if (oper->size() == 3) { + oper_polarity = oper->at(0); + oper_type = oper->at(1); + } + cell->children.push_back(new AstNode(AST_PARASET, AstNode::mkconst_int(oper_type == '*', false, 1))); cell->children.back()->str = "\\FULL";