3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-27 02:45:52 +00:00

Merge pull request #2476 from zachjs/const-arg-width

Fix constants bound to single bit arguments (fixes #2383)
This commit is contained in:
whitequark 2020-12-23 23:15:30 +00:00 committed by GitHub
commit 8ef6b77dc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View file

@ -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);