From: Clifford Wolf Date: Fri, 7 Jun 2019 09:41:54 +0000 (+0200) Subject: Merge branch 'implicit_named_connection' of https://github.com/tux3/yosys into tux3... X-Git-Tag: yosys-0.9~82^2~1 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b637b3109d61ff2d120978975a7b8cdc2ca3f418;p=yosys.git Merge branch 'implicit_named_connection' of https://github.com/tux3/yosys into tux3-implicit_named_connection --- b637b3109d61ff2d120978975a7b8cdc2ca3f418 diff --cc frontends/verilog/verilog_parser.y index ccdab987f,983445011..2fffc7536 --- a/frontends/verilog/verilog_parser.y +++ b/frontends/verilog/verilog_parser.y @@@ -1532,31 -1532,35 +1532,40 @@@ cell_port_list_rules cell_port | cell_port_list_rules ',' cell_port; cell_port: - /* empty */ { + attr { AstNode *node = new AstNode(AST_ARGUMENT); astbuf2->children.push_back(node); + free_attr($1); } | - expr { + attr expr { AstNode *node = new AstNode(AST_ARGUMENT); astbuf2->children.push_back(node); - node->children.push_back($1); + node->children.push_back($2); + free_attr($1); } | - named_port '(' ')' | // not connected - named_port '(' expr ')' { - ($1)->children.push_back($3); + attr '.' TOK_ID '(' expr ')' { + AstNode *node = new AstNode(AST_ARGUMENT); + node->str = *$3; + astbuf2->children.push_back(node); + node->children.push_back($5); + delete $3; + free_attr($1); } | - named_port { - // SV implied port - if (!sv_mode) - frontend_verilog_yyerror("Implicit .name port connection in port list (%s). This is not supported unless read_verilog is called with -sv!", $1->str.c_str()); - auto id_node = new AstNode(AST_IDENTIFIER); - id_node->str = ($1)->str; - ($1)->children.push_back(id_node); - }; - -named_port: - '.' TOK_ID { + attr '.' TOK_ID '(' ')' { AstNode *node = new AstNode(AST_ARGUMENT); - node->str = *$2; - delete $2; + node->str = *$3; + astbuf2->children.push_back(node); + delete $3; + free_attr($1); ++ } | ++ attr '.' TOK_ID { ++ AstNode *node = new AstNode(AST_ARGUMENT); ++ node->str = *$3; + astbuf2->children.push_back(node); - $$ = node; ++ node->children.push_back(new AstNode(AST_IDENTIFIER)); ++ node->children.back()->str = *$3; ++ delete $3; ++ free_attr($1); }; always_stmt: