diff options
author | Clifford Wolf <clifford@clifford.at> | 2016-07-21 14:23:22 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2016-07-21 14:23:22 +0200 |
commit | 5c166e76e52cdaf6ea97952c17d3d79185a59f96 (patch) | |
tree | e0f790a82816d5a148eb913b00176f4a581f5464 /frontends | |
parent | d7763634b68a735443c61aa32918ee0cdd6e9250 (diff) | |
download | yosys-5c166e76e52cdaf6ea97952c17d3d79185a59f96.tar.gz yosys-5c166e76e52cdaf6ea97952c17d3d79185a59f96.tar.bz2 yosys-5c166e76e52cdaf6ea97952c17d3d79185a59f96.zip |
Added $initstate cell type and vlog function
Diffstat (limited to 'frontends')
-rw-r--r-- | frontends/ast/simplify.cc | 24 | ||||
-rw-r--r-- | frontends/verilog/verilog_parser.y | 2 |
2 files changed, 26 insertions, 0 deletions
diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc index 18a752e06..4c64626f7 100644 --- a/frontends/ast/simplify.cc +++ b/frontends/ast/simplify.cc @@ -1626,6 +1626,30 @@ skip_dynamic_range_lvalue_expansion:; { if (type == AST_FCALL) { + if (str == "\\$initstate") + { + int myidx = autoidx++; + + AstNode *wire = new AstNode(AST_WIRE); + wire->str = stringf("$initstate$%d_wire", myidx); + current_ast_mod->children.push_back(wire); + while (wire->simplify(true, false, false, 1, -1, false, false)) { } + + AstNode *cell = new AstNode(AST_CELL, new AstNode(AST_CELLTYPE), new AstNode(AST_ARGUMENT, new AstNode(AST_IDENTIFIER))); + cell->str = stringf("$initstate$%d", myidx); + cell->children[0]->str = "$initstate"; + cell->children[1]->str = "\\Y"; + cell->children[1]->children[0]->str = wire->str; + cell->children[1]->children[0]->id2ast = wire; + current_ast_mod->children.push_back(cell); + while (cell->simplify(true, false, false, 1, -1, false, false)) { } + + newNode = new AstNode(AST_IDENTIFIER); + newNode->str = wire->str; + newNode->id2ast = wire; + goto apply_newNode; + } + if (str == "\\$clog2") { if (children.size() != 1) diff --git a/frontends/verilog/verilog_parser.y b/frontends/verilog/verilog_parser.y index 10de3a19f..86a127428 100644 --- a/frontends/verilog/verilog_parser.y +++ b/frontends/verilog/verilog_parser.y @@ -1189,6 +1189,8 @@ rvalue: $$ = new AstNode(AST_IDENTIFIER, $2); $$->str = *$1; delete $1; + if ($2 == nullptr && $$->str == "\\$initstate") + $$->type = AST_FCALL; } | hierarchical_id non_opt_multirange { $$ = new AstNode(AST_IDENTIFIER, $2); |