Skip to content

Commit 6441335

Browse files
committed
Insert nodes from UhdmTopModules before processes
Signed-off-by: Ryszard Różak <[email protected]>
1 parent ecfc0af commit 6441335

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

uhdm-plugin/UhdmAst.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,13 +1466,19 @@ void UhdmAst::process_module()
14661466
if (shared.top_nodes.find(type) != shared.top_nodes.end()) {
14671467
current_node = shared.top_nodes[type];
14681468
shared.current_top_node = current_node;
1469+
auto process_it = std::find_if(current_node->children.begin(), current_node->children.end(),
1470+
[](auto node) { return node->type == AST::AST_INITIAL || node->type == AST::AST_ALWAYS; });
1471+
auto children_after_process = std::vector<AST::AstNode *>(process_it, current_node->children.end());
1472+
current_node->children.erase(process_it, current_node->children.end());
14691473
visit_one_to_many({vpiModule, vpiInterface, vpiParameter, vpiParamAssign, vpiPort, vpiNet, vpiArrayNet, vpiTaskFunc, vpiGenScopeArray,
14701474
vpiContAssign, vpiVariables},
14711475
obj_h, [&](AST::AstNode *node) {
14721476
if (node) {
14731477
add_or_replace_child(current_node, node);
14741478
}
14751479
});
1480+
current_node->children.insert(current_node->children.end(), children_after_process.begin(), children_after_process.end());
1481+
14761482
auto it = current_node->attributes.find(UhdmAst::partial());
14771483
if (it != current_node->attributes.end()) {
14781484
delete it->second;

0 commit comments

Comments
 (0)