Skip to content

Commit 445fd82

Browse files
authored
Merge pull request #165 from antmicro/fix-int-typespec
Fix missing range in int_typespec
2 parents ff8a4b9 + 1265314 commit 445fd82

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

uhdm-plugin/UhdmAst.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2468,6 +2468,7 @@ void UhdmAst::process_assignment_pattern_op()
24682468
for (auto p : ordered_children) {
24692469
current_node->children.push_back(p.second);
24702470
}
2471+
std::reverse(current_node->children.begin(), current_node->children.end());
24712472
return;
24722473
}
24732474
auto assign_node = find_ancestor({AST::AST_ASSIGN, AST::AST_ASSIGN_EQ, AST::AST_ASSIGN_LE});
@@ -2947,11 +2948,20 @@ void UhdmAst::process_logic_typespec()
29472948

29482949
void UhdmAst::process_int_typespec()
29492950
{
2951+
#ifdef BUILD_UPSTREAM
2952+
std::vector<AST::AstNode *> packed_ranges; // comes before wire name
2953+
std::vector<AST::AstNode *> unpacked_ranges; // comes after wire name
2954+
#endif
29502955
current_node = make_ast_node(AST::AST_WIRE);
29512956
auto left_const = AST::AstNode::mkconst_int(31, true);
29522957
auto right_const = AST::AstNode::mkconst_int(0, true);
29532958
auto range = new AST::AstNode(AST::AST_RANGE, left_const, right_const);
2959+
#ifdef BUILD_UPSTREAM
2960+
packed_ranges.push_back(range);
2961+
add_multirange_wire(current_node, packed_ranges, unpacked_ranges);
2962+
#else
29542963
current_node->children.push_back(range);
2964+
#endif
29552965
current_node->is_signed = true;
29562966
if (!current_node->str.empty()) {
29572967
move_type_to_new_typedef(find_ancestor({AST::AST_MODULE, AST::AST_PACKAGE}), current_node);

0 commit comments

Comments
 (0)