3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-24 01:25:33 +00:00
This commit is contained in:
Akash Levy 2024-11-04 12:03:53 -08:00
parent 2d929f2e99
commit 1eb577120e

View file

@ -36,10 +36,14 @@ struct BmuxmapPass : public Pass {
log(" -pmux\n");
log(" transform to $pmux instead of $mux cells.\n");
log("\n");
log(" -fewunq\n");
log(" only transform $bmux cells that have few unique A bits.\n");
log("\n");
}
void execute(std::vector<std::string> args, RTLIL::Design *design) override
{
bool pmux_mode = false;
bool fewunq_mode = false;
log_header(design, "Executing BMUXMAP pass.\n");
@ -49,6 +53,10 @@ struct BmuxmapPass : public Pass {
pmux_mode = true;
continue;
}
if (args[argidx] == "-fewunq") {
fewunq_mode = true;
continue;
}
break;
}
extra_args(args, argidx, design);
@ -58,6 +66,17 @@ struct BmuxmapPass : public Pass {
{
if (cell->type != ID($bmux))
continue;
if (fewunq_mode) {
SigSpec data = cell->getPort(ID::A);
SigMap sigmap(module);
pool<SigBit> unqbits;
for (auto bit : data)
if (bit.wire != nullptr)
unqbits.insert(sigmap(bit));
if (GetSize(unqbits) > GetSize(data)/2)
continue;
}
SigSpec sel = cell->getPort(ID::S);
SigSpec data = cell->getPort(ID::A);