aboutsummaryrefslogtreecommitdiffstats
path: root/frontends/ast/simplify.cc
diff options
context:
space:
mode:
authorEddie Hung <eddie@fpgeh.com>2019-09-18 12:23:22 -0700
committerEddie Hung <eddie@fpgeh.com>2019-09-18 12:23:22 -0700
commitfd3b033903bf005c4308923ccb34ab269d55dd3e (patch)
treebdb846f228a6517612fab5b7f19a642c91fd093d /frontends/ast/simplify.cc
parent25e0f0c3765060b7ce25a0c58bc926b90dba304d (diff)
parent3ec28ec53a4350d041cd24a4fa9b03e985d20d95 (diff)
downloadyosys-fd3b033903bf005c4308923ccb34ab269d55dd3e.tar.gz
yosys-fd3b033903bf005c4308923ccb34ab269d55dd3e.tar.bz2
yosys-fd3b033903bf005c4308923ccb34ab269d55dd3e.zip
Merge remote-tracking branch 'origin/master' into xc7dsp
Diffstat (limited to 'frontends/ast/simplify.cc')
-rw-r--r--frontends/ast/simplify.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc
index 52fcf3ee7..b1ee22f42 100644
--- a/frontends/ast/simplify.cc
+++ b/frontends/ast/simplify.cc
@@ -2895,8 +2895,15 @@ AstNode *AstNode::readmem(bool is_readmemh, std::string mem_filename, AstNode *m
void AstNode::expand_genblock(std::string index_var, std::string prefix, std::map<std::string, std::string> &name_map)
{
if (!index_var.empty() && type == AST_IDENTIFIER && str == index_var) {
- current_scope[index_var]->children[0]->cloneInto(this);
- return;
+ if (children.empty()) {
+ current_scope[index_var]->children[0]->cloneInto(this);
+ } else {
+ AstNode *p = new AstNode(AST_LOCALPARAM, current_scope[index_var]->children[0]->clone());
+ p->str = stringf("$genval$%d", autoidx++);
+ current_ast_mod->children.push_back(p);
+ str = p->str;
+ id2ast = p;
+ }
}
if ((type == AST_IDENTIFIER || type == AST_FCALL || type == AST_TCALL) && name_map.count(str) > 0)