Skip to content

Commit 5feffd5

Browse files
authored
Merge pull request #174 from antmicro/fail-unsized
Fail when range is unsized
2 parents e42c4a6 + e00acb5 commit 5feffd5

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

uhdm-plugin/UhdmAst.cc

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2686,10 +2686,20 @@ void UhdmAst::process_case_item()
26862686
});
26872687
}
26882688

2689-
void UhdmAst::process_range()
2689+
void UhdmAst::process_range(const UHDM::BaseClass *object)
26902690
{
26912691
current_node = make_ast_node(AST::AST_RANGE);
26922692
visit_one_to_one({vpiLeftRange, vpiRightRange}, obj_h, [&](AST::AstNode *node) { current_node->children.push_back(node); });
2693+
if (current_node->children.size() > 0) {
2694+
if (current_node->children[0]->str == "unsized") {
2695+
log_error("%s:%d: Currently not supported object of type 'unsized range'\n", object->VpiFile().c_str(), object->VpiLineNo());
2696+
}
2697+
}
2698+
if (current_node->children.size() > 1) {
2699+
if (current_node->children[1]->str == "unsized") {
2700+
log_error("%s:%d: Currently not supported object of type 'unsized range'\n", object->VpiFile().c_str(), object->VpiLineNo());
2701+
}
2702+
}
26932703
}
26942704

26952705
void UhdmAst::process_return()
@@ -3570,7 +3580,7 @@ AST::AstNode *UhdmAst::process_object(vpiHandle obj_handle)
35703580
current_node = process_value(obj_h);
35713581
break;
35723582
case vpiRange:
3573-
process_range();
3583+
process_range(object);
35743584
break;
35753585
case vpiReturn:
35763586
process_return();

uhdm-plugin/UhdmAst.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class UhdmAst
114114
void process_gen_scope();
115115
void process_case();
116116
void process_case_item();
117-
void process_range();
117+
void process_range(const UHDM::BaseClass *object);
118118
void process_return();
119119
void process_function();
120120
void process_logic_var();

0 commit comments

Comments
 (0)