mirror of
https://github.com/YosysHQ/yosys
synced 2025-09-26 11:21:31 +00:00
Update passes/opt to avoid bits()
This commit is contained in:
parent
d4e2fa0c4f
commit
bab72e0af7
10 changed files with 71 additions and 56 deletions
|
@ -96,10 +96,10 @@ struct OptFfInvWorker
|
|||
}
|
||||
}
|
||||
Const mask = lut->getParam(ID::LUT);
|
||||
Const new_mask;
|
||||
for (int j = 0; j < (1 << GetSize(sig_a)); j++) {
|
||||
new_mask.bits().push_back(mask[j ^ flip_mask]);
|
||||
}
|
||||
Const::Builder new_mask_builder(1 << GetSize(sig_a));
|
||||
for (int j = 0; j < (1 << GetSize(sig_a)); j++)
|
||||
new_mask_builder.push_back(mask[j ^ flip_mask]);
|
||||
Const new_mask = new_mask_builder.build();
|
||||
if (GetSize(sig_a) == 1 && new_mask.as_int() == 2) {
|
||||
module->connect(lut->getPort(ID::Y), ff.sig_q);
|
||||
module->remove(lut);
|
||||
|
@ -178,13 +178,14 @@ struct OptFfInvWorker
|
|||
|
||||
if (d_lut->type == ID($lut)) {
|
||||
Const mask = d_lut->getParam(ID::LUT);
|
||||
Const new_mask;
|
||||
Const::Builder new_mask_builder(GetSize(mask));
|
||||
for (int i = 0; i < GetSize(mask); i++) {
|
||||
if (mask[i] == State::S0)
|
||||
new_mask.bits().push_back(State::S1);
|
||||
new_mask_builder.push_back(State::S1);
|
||||
else
|
||||
new_mask.bits().push_back(State::S0);
|
||||
new_mask_builder.push_back(State::S0);
|
||||
}
|
||||
Const new_mask = new_mask_builder.build();
|
||||
d_lut->setParam(ID::LUT, new_mask);
|
||||
if (d_lut->getParam(ID::WIDTH) == 1 && new_mask.as_int() == 2) {
|
||||
module->connect(ff.sig_d, d_lut->getPort(ID::A));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue