diff options
author | Clifford Wolf <clifford@clifford.at> | 2014-02-12 23:29:54 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2014-02-12 23:29:54 +0100 |
commit | 007bdff55d69e6e29091c7beff19c36eeb7ed078 (patch) | |
tree | 896b0bee11fed3a6520dff1b6ec0919cbd162946 /frontends | |
parent | ab71bd0746c39402aefaea85322fe36bdbaabb09 (diff) | |
download | yosys-007bdff55d69e6e29091c7beff19c36eeb7ed078.tar.gz yosys-007bdff55d69e6e29091c7beff19c36eeb7ed078.tar.bz2 yosys-007bdff55d69e6e29091c7beff19c36eeb7ed078.zip |
Added support for functions returning integer
Diffstat (limited to 'frontends')
-rw-r--r-- | frontends/verilog/parser.y | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/frontends/verilog/parser.y b/frontends/verilog/parser.y index 5b6bf58c2..8080729b0 100644 --- a/frontends/verilog/parser.y +++ b/frontends/verilog/parser.y @@ -106,7 +106,7 @@ static void free_attr(std::map<std::string, AstNode*> *al) %token TOK_SUPPLY0 TOK_SUPPLY1 TOK_TO_SIGNED TOK_TO_UNSIGNED %token TOK_POS_INDEXED TOK_NEG_INDEXED TOK_ASSERT -%type <ast> wire_type range non_opt_range expr basic_expr concat_list rvalue lvalue lvalue_concat_list +%type <ast> wire_type range non_opt_range range_or_integer expr basic_expr concat_list rvalue lvalue lvalue_concat_list %type <string> opt_label tok_prim_wrapper hierarchical_id %type <boolean> opt_signed %type <al> attr @@ -360,6 +360,16 @@ range: $$ = NULL; }; +range_or_integer: + range { + $$ = $1; + } | + TOK_INTEGER { + $$ = new AstNode(AST_RANGE); + $$->children.push_back(AstNode::mkconst_int(31, true)); + $$->children.push_back(AstNode::mkconst_int(0, true)); + }; + module_body: module_body module_body_stmt | /* empty */; @@ -380,7 +390,7 @@ task_func_decl: current_function_or_task = NULL; ast_stack.pop_back(); } | - TOK_FUNCTION opt_signed range TOK_ID ';' { + TOK_FUNCTION opt_signed range_or_integer TOK_ID ';' { current_function_or_task = new AstNode(AST_FUNCTION); current_function_or_task->str = *$4; ast_stack.back()->children.push_back(current_function_or_task); |