Skip to content

Commit

Permalink
rsz: add user_function_class filter to swappable cells
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Koucher <[email protected]>
  • Loading branch information
AcKoucher committed Oct 25, 2024
1 parent 688a772 commit 7ff30ea
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/rsz/include/rsz/Resizer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,6 @@ class Resizer : public dbStaState

void resizePreamble();
LibertyCellSeq getSwappableCells(LibertyCell* source_cell);
bool footprintsMatch(LibertyCell* source, LibertyCell* target);

// Resize drvr_pin instance to target slew.
// Return 1 if resized.
Expand Down
26 changes: 19 additions & 7 deletions src/rsz/src/Resizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1014,15 +1014,32 @@ void Resizer::resizePreamble()
// Filter equivalent cells based on the following liberty attributes:
// - Footprint (Optional - Honored if enforced by user): Cells with the
// same footprint have the same layout boundary.
// - User Function Class (Optional - Honored if found): Cells with the
// same user_function_class are electrically compatible.
LibertyCellSeq Resizer::getSwappableCells(LibertyCell* source_cell)
{
LibertyCellSeq swappable_cells;
LibertyCellSeq* equiv_cells = sta_->equivCells(source_cell);

if (equiv_cells) {
for (LibertyCell* equiv_cell : *equiv_cells) {
if (match_cell_footprint_ && !footprintsMatch(source_cell, equiv_cell)) {
continue;
if (match_cell_footprint_) {
const bool footprints_match = sta::stringEqIf(source_cell->footprint(),
equiv_cell->footprint());
if (!footprints_match) {
continue;
}
}

if (source_cell->userFunctionClass()) {
// Don't use stringEqIf to avoid a reduntant nullptr check.
// Here, we assume that the equivalent cell will also have
// a user_function_class attribute.
const bool user_function_classes_match = sta::stringEqual(
source_cell->userFunctionClass(), equiv_cell->userFunctionClass());
if (!user_function_classes_match) {
continue;
}
}

swappable_cells.push_back(equiv_cell);
Expand All @@ -1032,11 +1049,6 @@ LibertyCellSeq Resizer::getSwappableCells(LibertyCell* source_cell)
return swappable_cells;
}

bool Resizer::footprintsMatch(LibertyCell* source, LibertyCell* target)
{
return sta::stringEqIf(source->footprint(), target->footprint());
}

void Resizer::checkLibertyForAllCorners()
{
for (Corner* corner : *sta_->corners()) {
Expand Down

0 comments on commit 7ff30ea

Please sign in to comment.