aboutsummaryrefslogtreecommitdiffstats
path: root/frontends/ast
diff options
context:
space:
mode:
authorwhitequark <whitequark@whitequark.org>2020-12-23 23:15:30 +0000
committerGitHub <noreply@github.com>2020-12-23 23:15:30 +0000
commit8ef6b77dc366563410c88ec3687f777e74685377 (patch)
treef6ef03305cfb344a0485f62818486e2a6b844af0 /frontends/ast
parent832f6aa777558ccef3b06798d182372b5783c51f (diff)
parent8206546c45d8fe74ac291a548fa372d1bd98f966 (diff)
downloadyosys-8ef6b77dc366563410c88ec3687f777e74685377.tar.gz
yosys-8ef6b77dc366563410c88ec3687f777e74685377.tar.bz2
yosys-8ef6b77dc366563410c88ec3687f777e74685377.zip
Merge pull request #2476 from zachjs/const-arg-width
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 8e205cb76..5fa4ac83b 100644
--- a/frontends/ast/simplify.cc
+++ b/frontends/ast/simplify.cc
@@ -3342,6 +3342,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);