Skip to content

Commit

Permalink
Fix setting up scope for parameter simplification (#2674)
Browse files Browse the repository at this point in the history
Fixes: #2661
  • Loading branch information
tgorochowik authored Nov 25, 2024
2 parents 8e4e643 + 2d497e2 commit 84ab47c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/frontends/systemverilog/uhdm_ast.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2380,6 +2380,19 @@ void UhdmAst::simplify_parameter(AST::AstNode *parameter, const std::vector<::Yo
}
});
}
auto ancestor_node = this;
while (ancestor_node) {
if (ancestor_node->current_node) {
visitEachDescendant(ancestor_node->current_node, [&](AST::AstNode *current_scope_node) {
if (current_scope_node->type == AST::AST_TYPEDEF || current_scope_node->type == AST::AST_PARAMETER ||
current_scope_node->type == AST::AST_LOCALPARAM || current_scope_node->type == AST::AST_FUNCTION) {
AST_INTERNAL::current_scope[current_scope_node->str] = current_scope_node;
}
});
}
ancestor_node = ancestor_node->parent;
}

// first apply custom simplification step if needed
simplify_sv(parameter, nullptr);
// workaround for yosys sometimes not simplifying parameters children
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ lowrisc:ip:rom_ctrl:0.1
lowrisc:ip:rom_ctrl_pkg:0.1
lowrisc:ip:rstmgr_cnsty_chk:0
lowrisc:ip:rstmgr_reg:0.1
lowrisc:ip:rv_core_ibex:0.1
lowrisc:ip:rv_core_ibex_pkg:0.1
lowrisc:ip:rv_dm:0.1
lowrisc:ip:rv_plic_component:0.1
Expand Down

0 comments on commit 84ab47c

Please sign in to comment.