diff options
author | Clifford Wolf <clifford@clifford.at> | 2019-06-19 11:37:11 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2019-06-19 11:37:11 +0200 |
commit | 8d0cd529c936b1c0a38d7a71a4457bd84c8b3efe (patch) | |
tree | 2e96384586fd4ede8e1b5d530a39e245cdc44370 /frontends/verilog/verilog_parser.y | |
parent | 6d64e242ba8214f7bceb35f688b544f56d49cea1 (diff) | |
download | yosys-8d0cd529c936b1c0a38d7a71a4457bd84c8b3efe.tar.gz yosys-8d0cd529c936b1c0a38d7a71a4457bd84c8b3efe.tar.bz2 yosys-8d0cd529c936b1c0a38d7a71a4457bd84c8b3efe.zip |
Add defaultvalue attribute
Signed-off-by: Clifford Wolf <clifford@clifford.at>
Diffstat (limited to 'frontends/verilog/verilog_parser.y')
-rw-r--r-- | frontends/verilog/verilog_parser.y | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/frontends/verilog/verilog_parser.y b/frontends/verilog/verilog_parser.y index 5f3d713d3..ebb4369c3 100644 --- a/frontends/verilog/verilog_parser.y +++ b/frontends/verilog/verilog_parser.y @@ -345,6 +345,12 @@ module_arg_opt_assignment: if (ast_stack.back()->children.size() > 0 && ast_stack.back()->children.back()->type == AST_WIRE) { AstNode *wire = new AstNode(AST_IDENTIFIER); wire->str = ast_stack.back()->children.back()->str; + if (ast_stack.back()->children.back()->is_input) { + AstNode *n = ast_stack.back()->children.back(); + if (n->attributes.count("\\defaultvalue")) + delete n->attributes.at("\\defaultvalue"); + n->attributes["\\defaultvalue"] = $2; + } else if (ast_stack.back()->children.back()->is_reg || ast_stack.back()->children.back()->is_logic) ast_stack.back()->children.push_back(new AstNode(AST_INITIAL, new AstNode(AST_BLOCK, new AstNode(AST_ASSIGN_LE, wire, $2)))); else @@ -1360,6 +1366,11 @@ wire_name_and_opt_assign: wire_name '=' expr { AstNode *wire = new AstNode(AST_IDENTIFIER); wire->str = ast_stack.back()->children.back()->str; + if (astbuf1->is_input) { + if (astbuf1->attributes.count("\\defaultvalue")) + delete astbuf1->attributes.at("\\defaultvalue"); + astbuf1->attributes["\\defaultvalue"] = $3; + } else if (astbuf1->is_reg || astbuf1->is_logic) ast_stack.back()->children.push_back(new AstNode(AST_INITIAL, new AstNode(AST_BLOCK, new AstNode(AST_ASSIGN_LE, wire, $3)))); else |