From 256aa3e389e325b925e554d1d3b52abaac2c7a11 Mon Sep 17 00:00:00 2001 From: Jannis Harder Date: Tue, 12 Aug 2025 14:38:20 +0200 Subject: [PATCH] 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. --- passes/cmds/check.cc | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/passes/cmds/check.cc b/passes/cmds/check.cc index 8bbcb8da0..3017630a6 100644 --- a/passes/cmds/check.cc +++ b/passes/cmds/check.cc @@ -195,16 +195,23 @@ struct CheckPass : public Pass { // in port widths are those for us to check. if (!cell->type.in( 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; int in_widths = 0, out_widths = 0; - 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(); + if (cell->type.in(ID($pmux), ID($bmux))) { + // We're skipping inputs A and B, since each of their bits contributes only one edge + in_widths = GetSize(cell->getPort(ID::S)); + out_widths = GetSize(cell->getPort(ID::Y)); + } 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;