Skip to content

Commit

Permalink
Sta::findWorstClkSkew
Browse files Browse the repository at this point in the history
  • Loading branch information
jjcherry56 committed May 31, 2021
1 parent 8e01d33 commit 6a582fd
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 4 deletions.
1 change: 1 addition & 0 deletions include/sta/Sta.hh
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,7 @@ public:
const Corner *corner,
const SetupHold *setup_hold,
int digits);
float findWorstClkSkew(const SetupHold *setup_hold);
// Header above reportPathEnd results.
void reportPathEndHeader();
// Footer below reportPathEnd results.
Expand Down
24 changes: 20 additions & 4 deletions search/ClkSkew.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,8 @@ ClkSkews::reportClkSkew(ClockSet *clks,

// Sort the clocks to report in a stable order.
ClockSeq sorted_clks;
ClockSet::Iterator clk_iter1(clks);
while (clk_iter1.hasNext()) {
Clock *clk = clk_iter1.next();
for (Clock *clk : *clks)
sorted_clks.push_back(clk);
}
sort(sorted_clks, ClkNameLess());

Unit *time_unit = units_->timeUnit();
Expand Down Expand Up @@ -168,6 +165,25 @@ ClkSkews::reportClkSkew(ClockSet *clks,
skews.deleteContents();
}

float
ClkSkews::findWorstClkSkew(const Corner *corner,
const SetupHold *setup_hold)
{
ClockSet clks;
for (Clock *clk : *sdc_->clocks())
clks.insert(clk);
float worst_skew = INF;
ClkSkewMap skews;
findClkSkew(&clks, corner, setup_hold, skews);
for (auto clk_skew_itr : skews) {
ClkSkew *clk_skew = clk_skew_itr.second;
float skew = clk_skew->skew();
if (skew < worst_skew)
worst_skew = skew;
}
return worst_skew;
}

void
ClkSkews::findClkSkew(ClockSet *clks,
const Corner *corner,
Expand Down
3 changes: 3 additions & 0 deletions search/ClkSkew.hh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public:
const Corner *corner,
const SetupHold *setup_hold,
int digits);
// Find worst clock skew.
float findWorstClkSkew(const Corner *corner,
const SetupHold *setup_hold);

protected:
void findClkSkew(ClockSet *clks,
Expand Down
9 changes: 9 additions & 0 deletions search/Sta.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2582,6 +2582,15 @@ Sta::reportClkSkew(ClockSet *clks,
clk_skews_->reportClkSkew(clks, corner, setup_hold, digits);
}

float
Sta::findWorstClkSkew(const SetupHold *setup_hold)
{
ensureClkArrivals();
if (clk_skews_ == nullptr)
clk_skews_ = new ClkSkews(this);
return clk_skews_->findWorstClkSkew(cmd_corner_, setup_hold);
}

////////////////////////////////////////////////////////////////

void
Expand Down
7 changes: 7 additions & 0 deletions tcl/StaTcl.i
Original file line number Diff line number Diff line change
Expand Up @@ -4453,6 +4453,13 @@ report_clk_skew(ClockSet *clks,
delete clks;
}

float
find_worst_clk_skew(const SetupHold *setup_hold)
{
cmdLinkedNetwork();
return Sta::sta()->findWorstClkSkew(setup_hold);
}

TmpPinSet *
startpoints()
{
Expand Down

0 comments on commit 6a582fd

Please sign in to comment.