Skip to content

Commit

Permalink
Merge pull request YosysHQ#3552 from daglem/fix-sv-c-array-dimensions
Browse files Browse the repository at this point in the history
Correct interpretation of SystemVerilog C-style array dimensions
  • Loading branch information
jix authored Nov 23, 2022
2 parents 13e4f34 + a862642 commit fc2f622
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions frontends/verilog/verilog_parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,9 @@ static AstNode *checkRange(AstNode *type_node, AstNode *range_node)
static void rewriteRange(AstNode *rangeNode)
{
if (rangeNode->type == AST_RANGE && rangeNode->children.size() == 1) {
// SV array size [n], rewrite as [n-1:0]
rangeNode->children[0] = new AstNode(AST_SUB, rangeNode->children[0], AstNode::mkconst_int(1, true));
rangeNode->children.push_back(AstNode::mkconst_int(0, false));
// SV array size [n], rewrite as [0:n-1]
rangeNode->children.push_back(new AstNode(AST_SUB, rangeNode->children[0], AstNode::mkconst_int(1, true)));
rangeNode->children[0] = AstNode::mkconst_int(0, false);
}
}

Expand Down

0 comments on commit fc2f622

Please sign in to comment.