3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-08-22 19:17:55 +00:00

check: Limit detailed cell edge checking for $pmux and $bmux

While these cells can't have a quadratic number of edges between A, B
and Y, they do have a quadratic number of edges between S and Y.
This commit is contained in:
Jannis Harder 2025-08-12 14:38:20 +02:00
parent fb024c4d55
commit 256aa3e389

View file

@ -195,16 +195,23 @@ struct CheckPass : public Pass {
// in port widths are those for us to check. // in port widths are those for us to check.
if (!cell->type.in( if (!cell->type.in(
ID($add), ID($sub), ID($add), ID($sub),
ID($shl), ID($shr), ID($sshl), ID($sshr), ID($shift), ID($shiftx))) ID($shl), ID($shr), ID($sshl), ID($sshr), ID($shift), ID($shiftx),
ID($pmux), ID($bmux)))
return false; return false;
int in_widths = 0, out_widths = 0; int in_widths = 0, out_widths = 0;
for (auto &conn : cell->connections()) { if (cell->type.in(ID($pmux), ID($bmux))) {
if (cell->input(conn.first)) // We're skipping inputs A and B, since each of their bits contributes only one edge
in_widths += conn.second.size(); in_widths = GetSize(cell->getPort(ID::S));
if (cell->output(conn.first)) out_widths = GetSize(cell->getPort(ID::Y));
out_widths += conn.second.size(); } else {
for (auto &conn : cell->connections()) {
if (cell->input(conn.first))
in_widths += conn.second.size();
if (cell->output(conn.first))
out_widths += conn.second.size();
}
} }
const int threshold = 1024; const int threshold = 1024;