aboutsummaryrefslogtreecommitdiffstats
path: root/frontends/ast
diff options
context:
space:
mode:
authorZachary Snow <zach@zachjs.com>2020-12-05 18:56:18 -0700
committerZachary Snow <zach@zachjs.com>2020-12-22 17:01:03 -0700
commit8206546c45d8fe74ac291a548fa372d1bd98f966 (patch)
tree7c17d9863c63c27f022c45986624f2fc0e91656f /frontends/ast
parent95c60866813e520da48c628d4f98a2fe2cb4db25 (diff)
downloadyosys-8206546c45d8fe74ac291a548fa372d1bd98f966.tar.gz
yosys-8206546c45d8fe74ac291a548fa372d1bd98f966.tar.bz2
yosys-8206546c45d8fe74ac291a548fa372d1bd98f966.zip
Fix constants bound to single bit arguments (fixes #2383)
Diffstat (limited to 'frontends/ast')
-rw-r--r--frontends/ast/simplify.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc
index fb6623f02..8cd459913 100644
--- a/frontends/ast/simplify.cc
+++ b/frontends/ast/simplify.cc
@@ -3337,6 +3337,14 @@ skip_dynamic_range_lvalue_expansion:;
wire->type = AST_LOCALPARAM;
wire->attributes.erase(ID::nosync);
wire->children.insert(wire->children.begin(), arg->clone());
+ // args without a range implicitly have width 1
+ if (wire->children.back()->type != AST_RANGE) {
+ AstNode* range = new AstNode();
+ range->type = AST_RANGE;
+ wire->children.push_back(range);
+ range->children.push_back(mkconst_int(0, true));
+ range->children.push_back(mkconst_int(0, true));
+ }
continue;
}
AstNode *wire_id = new AstNode(AST_IDENTIFIER);