Skip to content

Commit d5aa5b9

Browse files
authored
Merge pull request #171 from antmicro/fix-tests
Fix variables in unnamed blocks
2 parents b79ad0d + 8ebab46 commit d5aa5b9

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

uhdm-plugin/UhdmAst.cc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2044,9 +2044,18 @@ void UhdmAst::process_initial()
20442044
});
20452045
}
20462046

2047-
void UhdmAst::process_begin()
2047+
void UhdmAst::process_begin(bool is_named)
20482048
{
20492049
current_node = make_ast_node(AST::AST_BLOCK);
2050+
// TODO: find out how to set VERILOG_FRONTEND::sv_mode to true
2051+
// simplify checks if sv_mode is set to ture when wire is declared inside unnamed block
2052+
if (is_named) {
2053+
visit_one_to_many({vpiVariables}, obj_h, [&](AST::AstNode *node) {
2054+
if (node) {
2055+
current_node->children.push_back(node);
2056+
}
2057+
});
2058+
}
20502059
visit_one_to_many({vpiStmt}, obj_h, [&](AST::AstNode *node) {
20512060
if (node) {
20522061
if ((node->type == AST::AST_ASSIGN_EQ || node->type == AST::AST_ASSIGN_LE) && node->children.size() == 1) {
@@ -2062,15 +2071,6 @@ void UhdmAst::process_begin()
20622071
}
20632072
}
20642073
});
2065-
// TODO: find out how to set VERILOG_FRONTEND::sv_mode to true
2066-
// simplify checks if sv_mode is set to ture when wire is declared inside unnamed block
2067-
if (!current_node->str.empty()) {
2068-
visit_one_to_many({vpiVariables}, obj_h, [&](AST::AstNode *node) {
2069-
if (node) {
2070-
current_node->children.push_back(node);
2071-
}
2072-
});
2073-
}
20742074
}
20752075

20762076
void UhdmAst::process_operation()
@@ -3505,10 +3505,10 @@ AST::AstNode *UhdmAst::process_object(vpiHandle obj_handle)
35053505
process_initial();
35063506
break;
35073507
case vpiNamedBegin:
3508-
process_begin();
3508+
process_begin(true);
35093509
break;
35103510
case vpiBegin:
3511-
process_begin();
3511+
process_begin(false);
35123512
// for unnamed block, reset block name
35133513
current_node->str = "";
35143514
break;

uhdm-plugin/UhdmAst.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class UhdmAst
9696
void process_always();
9797
void process_event_control();
9898
void process_initial();
99-
void process_begin();
99+
void process_begin(bool is_named);
100100
void process_operation();
101101
void process_stream_op();
102102
void process_list_op();

0 commit comments

Comments
 (0)