mirror of
https://github.com/YosysHQ/yosys
synced 2026-07-13 18:56:27 +00:00
Merge pull request #6012 from YosysHQ/nella/fix-opt-reduce
`opt_reduce`: restore pmux b-slice == a elim
This commit is contained in:
commit
8dc32cbf4e
2 changed files with 52 additions and 0 deletions
|
|
@ -115,6 +115,8 @@ struct OptReduceWorker
|
||||||
int port_width = sig_a.size();
|
int port_width = sig_a.size();
|
||||||
for (int i = 0; i < sig_s.size(); i++) {
|
for (int i = 0; i < sig_s.size(); i++) {
|
||||||
RTLIL::SigSpec this_b = sig_b.extract(i*port_width, port_width);
|
RTLIL::SigSpec this_b = sig_b.extract(i*port_width, port_width);
|
||||||
|
if (this_b == sig_a)
|
||||||
|
continue;
|
||||||
if (grouped_b_to_s.count(this_b)) {
|
if (grouped_b_to_s.count(this_b)) {
|
||||||
grouped_b_to_s[this_b].push_back(sig_s[i]);
|
grouped_b_to_s[this_b].push_back(sig_s[i]);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
50
tests/opt/opt_reduce_pmux.ys
Normal file
50
tests/opt/opt_reduce_pmux.ys
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
read_rtlil << EOT
|
||||||
|
|
||||||
|
module \top
|
||||||
|
wire width 4 input 0 \A
|
||||||
|
wire width 4 input 1 \C
|
||||||
|
wire width 2 input 2 \S
|
||||||
|
wire width 4 output 3 \Y
|
||||||
|
|
||||||
|
cell $pmux $0
|
||||||
|
parameter \WIDTH 4
|
||||||
|
parameter \S_WIDTH 2
|
||||||
|
connect \A \A
|
||||||
|
connect \B { \C \A }
|
||||||
|
connect \S \S
|
||||||
|
connect \Y \Y
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
EOT
|
||||||
|
|
||||||
|
equiv_opt -assert opt_reduce
|
||||||
|
opt_reduce
|
||||||
|
select -assert-count 0 t:$pmux
|
||||||
|
select -assert-count 1 t:$mux
|
||||||
|
|
||||||
|
design -reset
|
||||||
|
|
||||||
|
read_rtlil << EOT
|
||||||
|
|
||||||
|
module \top
|
||||||
|
wire width 4 input 0 \A
|
||||||
|
wire width 2 input 1 \S
|
||||||
|
wire width 4 output 2 \Y
|
||||||
|
|
||||||
|
cell $pmux $0
|
||||||
|
parameter \WIDTH 4
|
||||||
|
parameter \S_WIDTH 2
|
||||||
|
connect \A \A
|
||||||
|
connect \B { \A \A }
|
||||||
|
connect \S \S
|
||||||
|
connect \Y \Y
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
EOT
|
||||||
|
|
||||||
|
equiv_opt -assert opt_reduce
|
||||||
|
opt_reduce
|
||||||
|
select -assert-count 0 t:$pmux
|
||||||
|
select -assert-count 0 t:$mux
|
||||||
Loading…
Add table
Add a link
Reference in a new issue