aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2019-09-16 13:05:02 +0200
committerGitHub <noreply@github.com>2019-09-16 13:05:02 +0200
commit861f2af5aae74cec2f2cfcddd53cb9c487ae4cec (patch)
treeae6a65e6a4d4db373f2cbfc02a0b3f1e8488cf16
parent2b93b8fc74d98d1d2b1ec9a8cfb5665db1666726 (diff)
parent25b08b1afd87f6c2e6a6c1318bc790b4a929b7f5 (diff)
downloadyosys-861f2af5aae74cec2f2cfcddd53cb9c487ae4cec.tar.gz
yosys-861f2af5aae74cec2f2cfcddd53cb9c487ae4cec.tar.bz2
yosys-861f2af5aae74cec2f2cfcddd53cb9c487ae4cec.zip
Merge pull request #1380 from YosysHQ/clifford/fix1372
Fix handling of range selects on loop variables
-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)