diff options
author | Clifford Wolf <clifford@clifford.at> | 2013-02-26 13:18:22 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2013-02-26 13:18:22 +0100 |
commit | 4f0c2862a0d7e1ca247e0a4d54301c7f8cc92fd8 (patch) | |
tree | b1ecbcf2ff95ba1613b5aed85b7883d736c1c9fc /frontends/verilog | |
parent | 26a192b8c7ae959a38d58e971e78064c6f028ad1 (diff) | |
download | yosys-4f0c2862a0d7e1ca247e0a4d54301c7f8cc92fd8.tar.gz yosys-4f0c2862a0d7e1ca247e0a4d54301c7f8cc92fd8.tar.bz2 yosys-4f0c2862a0d7e1ca247e0a4d54301c7f8cc92fd8.zip |
Added support for verilog genblock[index].member syntax
Diffstat (limited to 'frontends/verilog')
-rw-r--r-- | frontends/verilog/parser.y | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/frontends/verilog/parser.y b/frontends/verilog/parser.y index 010af4787..6e0b238e0 100644 --- a/frontends/verilog/parser.y +++ b/frontends/verilog/parser.y @@ -105,7 +105,7 @@ static void free_attr(std::map<std::string, AstNode*> *al) %token TOK_SYNOPSYS_FULL_CASE TOK_SYNOPSYS_PARALLEL_CASE %token TOK_SUPPLY0 TOK_SUPPLY1 TOK_TO_SIGNED TOK_TO_UNSIGNED -%type <ast> wire_type range expr basic_expr concat_list lvalue lvalue_concat_list +%type <ast> wire_type range expr basic_expr concat_list rvalue lvalue lvalue_concat_list %type <string> opt_label tok_prim_wrapper %type <boolean> opt_signed %type <al> attr @@ -802,13 +802,21 @@ case_expr_list: ast_stack.back()->children.push_back($3); }; -lvalue: +rvalue: + TOK_ID '[' expr ']' '.' rvalue { + $$ = new AstNode(AST_PREFIX, $3, $6); + $$->str = *$1; + delete $1; + } | TOK_ID range { - $$ = new AstNode(AST_IDENTIFIER); + $$ = new AstNode(AST_IDENTIFIER, $2); $$->str = *$1; - if ($2) - $$->children.push_back($2); delete $1; + }; + +lvalue: + rvalue { + $$ = $1; } | '{' lvalue_concat_list '}' { $$ = $2; @@ -894,6 +902,9 @@ expr: }; basic_expr: + rvalue { + $$ = $1; + } | TOK_CONST { $$ = const2ast(*$1, case_type_stack.size() == 0 ? 0 : case_type_stack.back()); delete $1; @@ -913,11 +924,6 @@ basic_expr: $$->str = str; delete $1; } | - TOK_ID range { - $$ = new AstNode(AST_IDENTIFIER, $2); - $$->str = *$1; - delete $1; - } | TOK_ID attr { AstNode *node = new AstNode(AST_FCALL); node->str = *$1; |