diff options
author | Clifford Wolf <clifford@clifford.at> | 2013-03-26 09:44:54 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2013-03-26 09:44:54 +0100 |
commit | 6a382f2abab4d6c24d329204ed1ea18e44f3f3b8 (patch) | |
tree | f7ea1abb7e9cd7d4fbb16dda4a59d78b14a11df8 /frontends | |
parent | 227520f94d5fe0eb983889b61ed9b72640f1b4f4 (diff) | |
download | yosys-6a382f2abab4d6c24d329204ed1ea18e44f3f3b8.tar.gz yosys-6a382f2abab4d6c24d329204ed1ea18e44f3f3b8.tar.bz2 yosys-6a382f2abab4d6c24d329204ed1ea18e44f3f3b8.zip |
Fixed handling of unconditional generate blocks
Diffstat (limited to 'frontends')
-rw-r--r-- | frontends/ast/genrtlil.cc | 1 | ||||
-rw-r--r-- | frontends/ast/simplify.cc | 19 |
2 files changed, 19 insertions, 1 deletions
diff --git a/frontends/ast/genrtlil.cc b/frontends/ast/genrtlil.cc index 0654db2df..47ca37bd0 100644 --- a/frontends/ast/genrtlil.cc +++ b/frontends/ast/genrtlil.cc @@ -528,6 +528,7 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint) case AST_LOCALPARAM: case AST_GENVAR: case AST_GENFOR: + case AST_GENBLOCK: case AST_GENIF: break; diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc index ef06c5b03..981897db5 100644 --- a/frontends/ast/simplify.cc +++ b/frontends/ast/simplify.cc @@ -182,6 +182,8 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage) break; if (type == AST_GENIF && i >= 1) break; + if (type == AST_GENBLOCK) + break; if (type == AST_PREFIX && i >= 1) break; while (did_something_here && i < children.size()) { @@ -409,6 +411,21 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage) did_something = true; } + // simplify unconditional generate block + if (type == AST_GENBLOCK && children.size() != 0) + { + if (!str.empty()) { + std::map<std::string, std::string> name_map; + expand_genblock(std::string(), str + ".", name_map); + } + + for (size_t i = 0; i < children.size(); i++) + current_ast_mod->children.push_back(children[i]); + + children.clear(); + did_something = true; + } + // simplify generate-if blocks if (type == AST_GENIF && children.size() != 0) { @@ -434,7 +451,7 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage) if (!buf->str.empty()) { std::map<std::string, std::string> name_map; - buf->expand_genblock(std::string(), buf->str, name_map); + buf->expand_genblock(std::string(), buf->str + ".", name_map); } for (size_t i = 0; i < buf->children.size(); i++) |