3
0
Fork 0
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:
Robert O'Callahan 2025-08-28 03:53:23 +00:00
parent d4e2fa0c4f
commit bab72e0af7
10 changed files with 71 additions and 56 deletions

View file

@ -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));