From f61335a194d8d1e8412699da60ae7e1fc91bdb07 Mon Sep 17 00:00:00 2001 From: James Cherry Date: Wed, 13 Apr 2022 19:35:12 -0700 Subject: [PATCH] Sta::findSlewLimit Signed-off-by: James Cherry --- include/sta/Sta.hh | 2 +- search/CheckSlewLimits.cc | 77 ++++++++++++++++++++------------------- search/CheckSlewLimits.hh | 2 +- search/Sta.cc | 4 +- 4 files changed, 43 insertions(+), 42 deletions(-) diff --git a/include/sta/Sta.hh b/include/sta/Sta.hh index c28dec8b..08dd5836 100644 --- a/include/sta/Sta.hh +++ b/include/sta/Sta.hh @@ -631,7 +631,7 @@ public: Slew &slew, float &slack, float &limit); - void findSlewLimit(const Pin *pin, + void findSlewLimit(const LibertyPort *port, const Corner *corner, const MinMax *min_max, // Return values. diff --git a/search/CheckSlewLimits.cc b/search/CheckSlewLimits.cc index e0b92ea8..abb2d842 100644 --- a/search/CheckSlewLimits.cc +++ b/search/CheckSlewLimits.cc @@ -166,24 +166,6 @@ CheckSlewLimits::checkSlews1(Vertex *vertex, } } -void -CheckSlewLimits::findLimit(const Pin *pin, - const Corner *corner, - const MinMax *min_max, - // Return values. - float &limit, - bool &exists) const -{ - limit = INF; - exists = false; - for (auto rf : RiseFall::range()) { - float limit; - bool exists; - findLimit(pin, nullptr, corner, rf, min_max, false, - limit, exists); - } -} - // Return the tightest limit. void CheckSlewLimits::findLimit(const Pin *pin, @@ -196,14 +178,12 @@ CheckSlewLimits::findLimit(const Pin *pin, float &limit, bool &exists) const { - exists = false; const Network *network = sta_->network(); Sdc *sdc = sta_->sdc(); + LibertyPort *port = network->libertyPort(pin); + findLimit(port, corner, min_max, + limit, exists); - // Default to top ("design") limit. - Cell *top_cell = network->cell(network->topInstance()); - sdc->slewLimit(top_cell, min_max, - limit, exists); float limit1; bool exists1; if (check_clks) { @@ -225,6 +205,7 @@ CheckSlewLimits::findLimit(const Pin *pin, } } } + if (network->isTopLevelPort(pin)) { Port *port = network->port(pin); sdc->slewLimit(port, min_max, limit1, exists1); @@ -259,21 +240,41 @@ CheckSlewLimits::findLimit(const Pin *pin, } } } - else { - LibertyPort *port = network->libertyPort(pin); - if (port) { - LibertyPort *corner_port = port->cornerPort(corner->libertyIndex(min_max)); - corner_port->slewLimit(min_max, limit1, exists1); - if (!exists1 - && corner_port->direction()->isAnyOutput() - && min_max == MinMax::max()) - corner_port->libertyLibrary()->defaultMaxSlew(limit1, exists1); - if (exists1 - && (!exists - || min_max->compare(limit, limit1))) { - limit = limit1; - exists = true; - } +} + +void +CheckSlewLimits::findLimit(const LibertyPort *port, + const Corner *corner, + const MinMax *min_max, + // Return values. + float &limit, + bool &exists) const +{ + limit = INF; + exists = false; + + const Network *network = sta_->network(); + Sdc *sdc = sta_->sdc(); + + // Default to top ("design") limit. + Cell *top_cell = network->cell(network->topInstance()); + sdc->slewLimit(top_cell, min_max, + limit, exists); + + if (port) { + const LibertyPort *corner_port = port->cornerPort(corner->libertyIndex(min_max)); + float limit1; + bool exists1; + corner_port->slewLimit(min_max, limit1, exists1); + if (!exists1 + && corner_port->direction()->isAnyOutput() + && min_max == MinMax::max()) + corner_port->libertyLibrary()->defaultMaxSlew(limit1, exists1); + if (exists1 + && (!exists + || min_max->compare(limit, limit1))) { + limit = limit1; + exists = true; } } } diff --git a/search/CheckSlewLimits.hh b/search/CheckSlewLimits.hh index 60d0d7da..35926003 100644 --- a/search/CheckSlewLimits.hh +++ b/search/CheckSlewLimits.hh @@ -52,7 +52,7 @@ public: bool violators, const Corner *corner, const MinMax *min_max); - void findLimit(const Pin *pin, + void findLimit(const LibertyPort *port, const Corner *corner, const MinMax *min_max, // Return values. diff --git a/search/Sta.cc b/search/Sta.cc index 45e11150..a19ac039 100644 --- a/search/Sta.cc +++ b/search/Sta.cc @@ -5212,7 +5212,7 @@ Sta::maxSlewCheck(// Return values. } void -Sta::findSlewLimit(const Pin *pin, +Sta::findSlewLimit(const LibertyPort *port, const Corner *corner, const MinMax *min_max, // Return values. @@ -5220,7 +5220,7 @@ Sta::findSlewLimit(const Pin *pin, bool &exists) { checkSlewLimitPreamble(); - check_slew_limits_->findLimit(pin, corner, min_max, + check_slew_limits_->findLimit(port, corner, min_max, limit, exists); }