mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-13 12:28:44 +00:00
select: Fix -none and -clear
If the selection stack only has one element (which it normally does), then `design->pop_selection()` automatically resets to the default full selection. This is a problem for `select [-none | -clear]` which were trying to replace the current selection, but because the pop added an extra element when the `execute` returned, the extra selection (the one we actually wanted) gets popped too. So instead, reassign `design->selection()` in the same way as if we called `select [selection]`. Also adds selection stack tests, and removes the accidentally-committed `boxes_dummy.ys`.
This commit is contained in:
parent
68adac691d
commit
8405b3b723
|
@ -1509,15 +1509,13 @@ struct SelectPass : public Pass {
|
||||||
log_assert(!design->selection_stack.empty());
|
log_assert(!design->selection_stack.empty());
|
||||||
|
|
||||||
if (clear_mode) {
|
if (clear_mode) {
|
||||||
design->pop_selection();
|
design->selection() = RTLIL::Selection::FullSelection(design);
|
||||||
design->push_full_selection();
|
|
||||||
design->selected_active_module = std::string();
|
design->selected_active_module = std::string();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (none_mode) {
|
if (none_mode) {
|
||||||
design->pop_selection();
|
design->selection() = RTLIL::Selection::EmptySelection(design);
|
||||||
design->push_empty_selection();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
read_verilog -specify boxes.v
|
|
||||||
clean
|
|
||||||
|
|
||||||
echo on
|
|
||||||
select -list
|
|
||||||
select -count
|
|
||||||
select -count *
|
|
||||||
select -count top
|
|
||||||
select -count top/w:*
|
|
||||||
select -list =*
|
|
||||||
select -count =*
|
|
||||||
select -clear
|
|
||||||
select -assert-count 9 =?b
|
|
29
tests/select/boxes_stack.ys
Normal file
29
tests/select/boxes_stack.ys
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
read_verilog -specify boxes.v
|
||||||
|
clean
|
||||||
|
|
||||||
|
# default selection == select *
|
||||||
|
select -assert-count 4 *
|
||||||
|
select -assert-count 4 %
|
||||||
|
|
||||||
|
# -none replaces default selection
|
||||||
|
select -none
|
||||||
|
select -assert-none %
|
||||||
|
select -assert-count 13 =*
|
||||||
|
|
||||||
|
# select replaces current selection
|
||||||
|
select =*
|
||||||
|
select -assert-count 13 %
|
||||||
|
|
||||||
|
# -module changes module
|
||||||
|
select -module wb
|
||||||
|
select -assert-none %
|
||||||
|
select -assert-count 5 =*
|
||||||
|
|
||||||
|
# -none maintains module
|
||||||
|
select -none
|
||||||
|
select -assert-count 5 =*
|
||||||
|
|
||||||
|
# -clear clears current selection and module
|
||||||
|
select -clear
|
||||||
|
select -assert-count 4 %
|
||||||
|
select -assert-count 13 =*
|
Loading…
Reference in a new issue