Files
OpenSTA/search/CheckSlewLimits.cc
James Cherry 8992827b5b class Path replaces PathVertex etc
commit 08c062d3dd1d0cea846407dda0b5fd75ca64329c
Author: James Cherry <cherry@parallaxsw.com>
Date:   Tue Mar 25 16:17:42 2025 -0700

    ApiChanges.txt

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit ef72112a00419e466e19b5c1442cac6f2835adaa
Author: James Cherry <cherry@parallaxsw.com>
Date:   Sun Mar 23 12:37:10 2025 -0700

    crpr29/30

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 2065acfbfbaa84307fde1c46ff51a1c619c45f50
Author: James Cherry <cherry@parallaxsw.com>
Date:   Sun Mar 23 12:33:55 2025 -0700

    compile error

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit d3133015b90b59f7e8e934c20d1ed8449d543d7b
Author: James Cherry <cherry@parallaxsw.com>
Date:   Mon Mar 17 15:20:55 2025 -0700

    rebase falout

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 8a4b81755765db823e18ffb497f1fb3f0c64ec7b
Author: James Cherry <cherry@parallaxsw.com>
Date:   Mon Mar 17 09:22:01 2025 -0700

    rebase fallout

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 7ef00dcaa4ed0b6db3f4205da47013e4f2ef1049
Author: James Cherry <cherry@parallaxsw.com>
Date:   Sat Mar 15 17:00:51 2025 -0700

    deleteEdge clear to path prev_paths

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 912dacbca8f5c286f623f13659c831be6ed4d93e
Author: James Cherry <cherry@parallaxsw.com>
Date:   Sat Mar 15 12:05:06 2025 -0700

    undo 7f8c7adb

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 9944c2ec907e9f07ab46f71af55ec947f3815de0
Author: James Cherry <cherry@parallaxsw.com>
Date:   Fri Mar 14 21:25:10 2025 -0700

    rm Path::path()

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit a42c28b8447466a445cd8f6fb022eb42e6dcc0f2
Author: James Cherry <cherry@parallaxsw.com>
Date:   Fri Mar 14 17:12:17 2025 -0700

    const

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 3f72adf1b5ad5581adc81afd3e00be7343ae4183
Author: James Cherry <cherry@parallaxsw.com>
Date:   Fri Mar 14 17:03:04 2025 -0700

    PathExpanded rm prev_arcs_

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 25879e66eddf9f12db38705807e1270459661810
Author: James Cherry <cherry@parallaxsw.com>
Date:   Thu Mar 13 12:34:12 2025 -0700

    worst path init path

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 5c7a4fbdf3b8823a1944074a7eb663c6ea8e32df
Author: James Cherry <cherry@parallaxsw.com>
Date:   Thu Mar 13 10:47:02 2025 -0700

    delete edge -> xelete paths of to vertex

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit aa8d3035489de2cd25f27f7531177193be7a40ac
Author: James Cherry <cherry@parallaxsw.com>
Date:   Thu Mar 13 09:17:27 2025 -0700

    debug

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 53741b6c624b1313b0464a31e3900472d0b7c8d2
Author: James Cherry <cherry@parallaxsw.com>
Date:   Thu Mar 13 08:50:01 2025 -0700

    debug

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit cdebd8f3e476e5a2afab1a949449b75dcec9ed97
Author: James Cherry <cherry@parallaxsw.com>
Date:   Thu Mar 13 08:14:58 2025 -0700

    dbg network_edit

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 60cc960439e65cda8cd244723456b81242ced458
Author: James Cherry <cherry@parallaxsw.com>
Date:   Thu Mar 13 07:42:22 2025 -0700

    dbg network edit

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit f4e4264ac1c11dafddbe18971ca35127a0ffc171
Author: James Cherry <cherry@parallaxsw.com>
Date:   Tue Mar 11 19:23:17 2025 -0700

    rm PathVertex.hh

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit aeba9b293f095aecd01d0f5d16de51640f3d2381
Author: James Cherry <cherry@parallaxsw.com>
Date:   Tue Mar 11 13:33:21 2025 -0700

    PathEnum rm divEdge

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit ad97706562da7ceb41b9fbf4c882083de36d578d
Author: James Cherry <cherry@parallaxsw.com>
Date:   Tue Mar 11 13:18:38 2025 -0700

    genclks use path vector

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit a9c2563199d0cee3dee3d420c70f8117cfd69221
Author: James Cherry <cherry@parallaxsw.com>
Date:   Tue Mar 11 12:42:12 2025 -0700

    group_path_count, end_path_count use size_t

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit f16309a8e09e22964b998bf1b7e0922fbb9f02c1
Author: James Cherry <cherry@parallaxsw.com>
Date:   Tue Mar 11 12:30:08 2025 -0700

    Path rm uused

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 51295613c4ab6a6a4170080252397e2846a61bf1
Author: James Cherry <cherry@parallaxsw.com>
Date:   Tue Mar 11 12:22:23 2025 -0700

    network_edit3

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 5de6da2190460183cf07d0d4ffc1d1c6ebbe3e10
Author: James Cherry <cherry@parallaxsw.com>
Date:   Tue Mar 11 10:33:09 2025 -0700

    leak

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit f52dbc18ce08bd2b14d7107b61a57e614b1e3a07
Author: James Cherry <cherry@parallaxsw.com>
Date:   Tue Mar 11 08:06:56 2025 -0700

    valgrind 3 leaks left

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit de1a3727d908c4494f3039ff714ddb939d3390b5
Author: James Cherry <cherry@parallaxsw.com>
Date:   Mon Mar 10 18:21:50 2025 -0700

    Path::prevPath

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit c40aadcac8d2cd6d6dd8ba18f2e9db607358a01f
Author: James Cherry <cherry@parallaxsw.com>
Date:   Mon Mar 10 18:21:31 2025 -0700

    clk_skew init

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 041c97194553e7f7a4746f506be251ee42eb83ee
Author: James Cherry <cherry@parallaxsw.com>
Date:   Mon Mar 10 07:38:49 2025 -0700

    delete path groups before paths

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit fb4aed589f9f67ddb39f4260cb2901764cf49a98
Author: James Cherry <cherry@parallaxsw.com>
Date:   Sun Mar 9 17:23:27 2025 -0700

    leak

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 70b3062872cefdcf1358847025bc7bb1a85f4a5b
Author: James Cherry <cherry@parallaxsw.com>
Date:   Sun Mar 9 17:09:45 2025 -0700

    1 failure

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 92cd7c33c1eb22e4f574a767a645c5db1c9efe4d
Author: James Cherry <cherry@parallaxsw.com>
Date:   Sun Mar 9 11:19:59 2025 -0700

    7 failures

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 537ec153a5f8ab30d800cd36130e7668047b67af
Author: James Cherry <cherry@parallaxsw.com>
Date:   Sun Mar 9 09:05:31 2025 -0700

    11 failures

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit df514124c4daaf90175a89138ed954e20573e02f
Author: James Cherry <cherry@parallaxsw.com>
Date:   Sun Mar 9 08:37:00 2025 -0700

    25 failures

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 0096e8ee5a83194aee84da2cba95f410931f5c0e
Author: James Cherry <cherry@parallaxsw.com>
Date:   Sat Mar 8 16:05:04 2025 -0700

    33 failures

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 02ba7ffdf38b538cd1659df25837d37e8317e741
Author: James Cherry <cherry@parallaxsw.com>
Date:   Fri Mar 7 21:39:53 2025 -0700

    delete path groups before pahts

    Signed-Off-by: James Cherry <cherry@parallaxsw.com>

commit 270dbad6bc9303f9255256b5b85cac84deb27a94
Author: James Cherry <cherry@parallaxsw.com>
Date:   Fri Mar 7 18:27:52 2025 -0700

    no seg faults, 42 failures

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 3ceca5981fd6032294523cd23dc1334b9619f6a0
Author: James Cherry <cherry@parallaxsw.com>
Date:   Thu Mar 6 15:43:28 2025 -0700

    multiclk1,2 seg fault

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 0441c00dc172817cc1a39bbb740d6369cf163869
Author: James Cherry <cherry@parallaxsw.com>
Date:   Thu Mar 6 15:29:47 2025 -0700

    gated_clocks15

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 7a1f87737e9c8247acd2c78138ee482d46123952
Author: James Cherry <cherry@parallaxsw.com>
Date:   Thu Mar 6 09:05:09 2025 -0700

    nworst, crpr

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 74b52e5ac0ed9dac5b7c31835393c4e2dd30ca95
Author: James Cherry <cherry@parallaxsw.com>
Date:   Wed Mar 5 17:18:47 2025 -0700

    check_timiing6

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 93bddf0d940e9b833d5bc47d5af8b3bdefac67a5
Author: James Cherry <cherry@parallaxsw.com>
Date:   Wed Mar 5 17:13:24 2025 -0700

    nworst10

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit f1edddbffb2e0d23bc3f4a10733203b9756f2e2e
Author: James Cherry <cherry@parallaxsw.com>
Date:   Wed Mar 5 16:22:25 2025 -0700

    path enum

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit c57d241b668d305f0492e55e273b3411320692b4
Author: James Cherry <cherry@parallaxsw.com>
Date:   Wed Mar 5 16:09:11 2025 -0700

    most nwost pass

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit c6fca38e28571e5f2d63236aa67233d572c3a1d6
Author: James Cherry <cherry@parallaxsw.com>
Date:   Wed Mar 5 09:15:47 2025 -0700

    most genclks

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 82f5e6e9252987433f9699919c5716b3a4321a5d
Author: James Cherry <cherry@parallaxsw.com>
Date:   Tue Mar 4 17:51:29 2025 -0700

    genclks

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 19f4035496e004c543110b063482928e55bddbc9
Author: James Cherry <cherry@parallaxsw.com>
Date:   Tue Mar 4 17:33:28 2025 -0700

    nworst1

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit edafefa4e4f98291a3edebe5c7b3e2630988723f
Author: James Cherry <cherry@parallaxsw.com>
Date:   Tue Mar 4 15:02:38 2025 -0700

    path enum

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 3e4684fd67eacdb474574eee9e51741e75bba907
Author: James Cherry <cherry@parallaxsw.com>
Date:   Mon Mar 3 21:07:18 2025 -0700

    rm unused Path* files

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 3f04819c01002f8b5eec0f4b8f0caf6798f3a20f
Author: James Cherry <cherry@parallaxsw.com>
Date:   Mon Mar 3 19:43:35 2025 -0700

    more regressions pass

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 276d70283cda14dfd6c48d1e2e4f45d326bf286c
Author: James Cherry <cherry@parallaxsw.com>
Date:   Mon Mar 3 10:43:30 2025 -0700

    arrival1

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 383a480450833741144b57383bb40a33310fad44
Author: James Cherry <cherry@parallaxsw.com>
Date:   Sun Mar 2 19:23:40 2025 -0700

    arrival1 no segfault

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 36e3a6b8d8b19f185a5a71fb4547e17586ea2c44
Author: James Cherry <cherry@parallaxsw.com>
Date:   Sun Mar 2 18:40:23 2025 -0700

    VertexPathIterator

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 083c76201e1a5482726e5856f124b15a523453d6
Author: James Cherry <cherry@parallaxsw.com>
Date:   Sun Mar 2 18:18:15 2025 -0700

    report_checks3 passes

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 834c076b7e2cb733655d917881463c76ce6196f6
Author: James Cherry <cherry@parallaxsw.com>
Date:   Sun Mar 2 14:10:34 2025 -0800

    links

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 371792b1e6dd44ad0c72399b999d86cd2557cbe1
Author: James Cherry <cherry@parallaxsw.com>
Date:   Sun Mar 2 13:37:33 2025 -0800

    link errors

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 158e9dafa6d11e0a4fd4e7ef253b0b6cb7595bf6
Author: James Cherry <cherry@parallaxsw.com>
Date:   Sun Mar 2 12:30:29 2025 -0800

    compiles

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 8df515dab15c0744abe04eae7e4a7d7688455f03
Author: James Cherry <cherry@parallaxsw.com>
Date:   Sun Mar 2 09:41:51 2025 -0800

    PathEnd compiles

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit d94f241d0803376b1526f32e4f5111d081c604af
Author: James Cherry <cherry@parallaxsw.com>
Date:   Sun Mar 2 07:42:51 2025 -0800

    compile progress

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

commit 591997e3bb496c4cc2fd6963c3798a8e17b8f587
Author: James Cherry <cherry@parallaxsw.com>
Date:   Sat Mar 1 10:42:11 2025 -0800

    path unification

    Signed-off-by: James Cherry <cherry@parallaxsw.com>

Signed-off-by: James Cherry <cherry@parallaxsw.com>
2025-03-26 18:21:03 -07:00

423 lines
12 KiB
C++

// OpenSTA, Static Timing Analyzer
// Copyright (c) 2025, Parallax Software, Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
// The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software.
//
// Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
//
// This notice may not be removed or altered from any source distribution.
#include "CheckSlewLimits.hh"
#include "Fuzzy.hh"
#include "Liberty.hh"
#include "Network.hh"
#include "Sdc.hh"
#include "InputDrive.hh"
#include "Graph.hh"
#include "DcalcAnalysisPt.hh"
#include "GraphDelayCalc.hh"
#include "StaState.hh"
#include "Corner.hh"
#include "Path.hh"
#include "PortDirection.hh"
#include "Search.hh"
#include "ClkNetwork.hh"
namespace sta {
class PinSlewLimitSlackLess
{
public:
PinSlewLimitSlackLess(const Corner *corner,
const MinMax *min_max,
CheckSlewLimits *check_slew_limit,
const StaState *sta);
bool operator()(const Pin *pin1,
const Pin *pin2) const;
private:
const Corner *corner_;
const MinMax *min_max_;
CheckSlewLimits *check_slew_limit_;
const StaState *sta_;
};
PinSlewLimitSlackLess::PinSlewLimitSlackLess(const Corner *corner,
const MinMax *min_max,
CheckSlewLimits *check_slew_limit,
const StaState *sta) :
corner_(corner),
min_max_(min_max),
check_slew_limit_(check_slew_limit),
sta_(sta)
{
}
bool
PinSlewLimitSlackLess::operator()(const Pin *pin1,
const Pin *pin2) const
{
const Corner *corner1, *corner2;
const RiseFall *rf1, *rf2;
Slew slew1, slew2;
float limit1, limit2, slack1, slack2;
check_slew_limit_->checkSlew(pin1, corner_, min_max_, true,
corner1, rf1, slew1, limit1, slack1);
check_slew_limit_->checkSlew(pin2, corner_, min_max_, true,
corner2, rf2, slew2, limit2, slack2);
return fuzzyLess(slack1, slack2)
|| (fuzzyEqual(slack1, slack2)
// Break ties for the sake of regression stability.
&& sta_->network()->pinLess(pin1, pin2));
}
////////////////////////////////////////////////////////////////
CheckSlewLimits::CheckSlewLimits(const StaState *sta) :
sta_(sta)
{
}
void
CheckSlewLimits::checkSlewLimits(const Pin *pin,
bool violators,
const Corner *corner,
const MinMax *min_max,
PinSeq &slew_pins,
float &min_slack)
{
const Corner *corner1;
const RiseFall *rf;
Slew slew;
float limit, slack;
checkSlew(pin, corner, min_max, true, corner1, rf, slew, limit, slack);
if (!fuzzyInf(slack)) {
if (violators) {
if (slack < 0.0)
slew_pins.push_back(pin);
}
else {
if (slew_pins.empty()
|| slack < min_slack) {
slew_pins.push_back(pin);
min_slack = slack;
}
}
}
}
void
CheckSlewLimits::checkSlew(const Pin *pin,
const Corner *corner,
const MinMax *min_max,
bool check_clks,
// Return values.
const Corner *&corner1,
const RiseFall *&rf1,
Slew &slew1,
float &limit1,
float &slack1) const
{
corner1 = nullptr;
rf1 = nullptr;
slew1 = 0.0;
limit1 = 0.0;
slack1 = MinMax::min()->initValue();
Vertex *vertex, *bidirect_drvr_vertex;
sta_->graph()->pinVertices(pin, vertex, bidirect_drvr_vertex);
if (vertex)
checkSlew1(pin, vertex, corner, min_max, check_clks,
corner1, rf1, slew1, limit1, slack1);
if (bidirect_drvr_vertex)
checkSlew1(pin, bidirect_drvr_vertex, corner, min_max, check_clks,
corner1, rf1, slew1, limit1, slack1);
}
void
CheckSlewLimits::checkSlew1(const Pin *pin,
const Vertex *vertex,
const Corner *corner,
const MinMax *min_max,
bool check_clks,
// Return values.
const Corner *&corner1,
const RiseFall *&rf1,
Slew &slew1,
float &limit1,
float &slack1) const
{
if (!vertex->isDisabledConstraint()
&& !vertex->isConstant()
&& !sta_->clkNetwork()->isIdealClock(pin)) {
ClockSet clks;
if (check_clks)
clks = clockDomains(vertex);
if (corner)
checkSlew2(pin, vertex, corner, min_max, clks,
corner1, rf1, slew1, limit1, slack1);
else {
for (auto corner : *sta_->corners()) {
checkSlew2(pin, vertex, corner, min_max, clks,
corner1, rf1, slew1, limit1, slack1);
}
}
}
}
void
CheckSlewLimits::checkSlew2(const Pin *pin,
const Vertex *vertex,
const Corner *corner,
const MinMax *min_max,
const ClockSet &clks,
// Return values.
const Corner *&corner1,
const RiseFall *&rf1,
Slew &slew1,
float &limit1,
float &slack1) const
{
for (const RiseFall *rf : RiseFall::range()) {
float limit;
bool exists;
findLimit(pin, corner, rf, min_max, clks,
limit, exists);
if (exists) {
checkSlew3(vertex, corner, rf, min_max, limit,
corner1, rf1, slew1, slack1, limit1);
}
}
}
void
CheckSlewLimits::checkSlew3(const Vertex *vertex,
const Corner *corner,
const RiseFall *rf,
const MinMax *min_max,
float limit,
// Return values.
const Corner *&corner1,
const RiseFall *&rf1,
Slew &slew1,
float &slack1,
float &limit1) const
{
const DcalcAnalysisPt *dcalc_ap = corner->findDcalcAnalysisPt(min_max);
Slew slew = sta_->graph()->slew(vertex, rf, dcalc_ap->index());
float slew2 = delayAsFloat(slew);
float slack = (min_max == MinMax::max())
? limit - slew2 : slew2 - limit;
if (corner1 == nullptr
|| (slack < slack1
// Break ties for the sake of regression stability.
|| (fuzzyEqual(slack, slack1)
&& rf->index() < rf1->index()))) {
corner1 = corner;
rf1 = rf;
slew1 = slew;
slack1 = slack;
limit1 = limit;
}
}
// Return the tightest limit.
void
CheckSlewLimits::findLimit(const Pin *pin,
const Corner *corner,
const RiseFall *rf,
const MinMax *min_max,
const ClockSet &clks,
// Return values.
float &limit,
bool &exists) const
{
const Network *network = sta_->network();
Sdc *sdc = sta_->sdc();
LibertyPort *port = network->libertyPort(pin);
findLimit(port, corner, min_max,
limit, exists);
float limit1;
bool exists1;
if (!clks.empty()) {
// Look for clock slew limits.
bool is_clk = sta_->clkNetwork()->isIdealClock(pin);
for (Clock *clk : clks) {
PathClkOrData clk_data = is_clk ? PathClkOrData::clk : PathClkOrData::data;
sdc->slewLimit(clk, rf, clk_data, min_max,
limit1, exists1);
if (exists1
&& (!exists
|| min_max->compare(limit, limit1))) {
limit = limit1;
exists = true;
}
}
}
if (network->isTopLevelPort(pin)) {
Port *port = network->port(pin);
sdc->slewLimit(port, min_max, limit1, exists1);
if (exists1
&& (!exists
|| min_max->compare(limit, limit1))) {
limit = limit1;
exists = true;
}
InputDrive *drive = sdc->findInputDrive(port);
if (drive) {
for (auto rf : RiseFall::range()) {
const LibertyCell *cell;
const LibertyPort *from_port;
float *from_slews;
const LibertyPort *to_port;
drive->driveCell(rf, min_max, cell, from_port, from_slews, to_port);
if (to_port) {
const LibertyPort *corner_port = to_port->cornerPort(corner, 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();
float limit1;
bool exists1;
// Default to top ("design") limit.
Cell *top_cell = network->cell(network->topInstance());
sdc->slewLimit(top_cell, min_max,
limit1, exists1);
if (exists1) {
limit = limit1;
exists = true;
}
if (port) {
const LibertyPort *corner_port = port->cornerPort(corner, min_max);
corner_port->slewLimit(min_max, limit1, exists1);
if (!exists1
// default_max_transition only applies to outputs.
&& 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;
}
}
}
ClockSet
CheckSlewLimits::clockDomains(const Vertex *vertex) const
{
ClockSet clks;
VertexPathIterator path_iter(const_cast<Vertex*>(vertex), sta_);
while (path_iter.hasNext()) {
Path *path = path_iter.next();
const Clock *clk = path->clock(sta_);
if (clk)
clks.insert(const_cast<Clock*>(clk));
}
return clks;
}
////////////////////////////////////////////////////////////////
PinSeq
CheckSlewLimits::checkSlewLimits(const Net *net,
bool violators,
const Corner *corner,
const MinMax *min_max)
{
const Network *network = sta_->network();
PinSeq slew_pins;
float min_slack = MinMax::min()->initValue();
if (net) {
NetPinIterator *pin_iter = network->pinIterator(net);
while (pin_iter->hasNext()) {
const Pin *pin = pin_iter->next();
checkSlewLimits(pin, violators, corner, min_max, slew_pins, min_slack);
}
delete pin_iter;
}
else {
LeafInstanceIterator *inst_iter = network->leafInstanceIterator();
while (inst_iter->hasNext()) {
const Instance *inst = inst_iter->next();
checkSlewLimits(inst, violators,corner, min_max, slew_pins, min_slack);
}
delete inst_iter;
// Check top level ports.
checkSlewLimits(network->topInstance(), violators, corner, min_max,
slew_pins, min_slack);
}
sort(slew_pins, PinSlewLimitSlackLess(corner, min_max, this, sta_));
// Keep the min slack pin unless all violators or net pins.
if (!slew_pins.empty() && !violators && net == nullptr)
slew_pins.resize(1);
return slew_pins;
}
void
CheckSlewLimits::checkSlewLimits(const Instance *inst,
bool violators,
const Corner *corner,
const MinMax *min_max,
PinSeq &slew_pins,
float &min_slack)
{
const Network *network = sta_->network();
InstancePinIterator *pin_iter = network->pinIterator(inst);
while (pin_iter->hasNext()) {
Pin *pin = pin_iter->next();
checkSlewLimits(pin, violators, corner, min_max, slew_pins, min_slack);
}
delete pin_iter;
}
} // namespace