3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-01-06 11:02:47 +00:00

proc_mux, genrtlil: make use of case_src for better case condition vs block tracking

This commit is contained in:
Emil J. Tywoniak 2025-12-11 00:45:30 +01:00
parent d10c3f75e1
commit 775b8f2f4c
4 changed files with 45 additions and 6 deletions

View file

@ -660,17 +660,23 @@ struct AST_INTERNAL::ProcessGenerator
RTLIL::CaseRule *backup_case = current_case;
// here
current_case = new RTLIL::CaseRule;
set_src_attr(current_case, child.get());
current_case->compare_src = child->loc_string();
last_generated_case = current_case;
addChunkActions(current_case->actions, this_case_eq_ltemp, this_case_eq_rvalue, child.get());
std::optional<AstNode*> block;
for (auto& node : child->children) {
if (node->type == AST_DEFAULT)
if (node->type == AST_DEFAULT) {
default_case = current_case;
else if (node->type == AST_BLOCK)
processAst(node.get());
else
} else if (node->type == AST_BLOCK) {
log_assert(!block.has_value());
block = node.get();
} else {
current_case->compare.push_back(node->genWidthRTLIL(width_hint, sign_hint, &subst_rvalue_map.stdmap()));
}
}
log_assert(block.has_value());
set_src_attr(current_case, *block);
addChunkActions(current_case->actions, this_case_eq_ltemp, this_case_eq_rvalue, *block);
processAst(*block);
if (default_case != current_case)
sw->cases.push_back(current_case);
else