Skip to content

Commit

Permalink
Merge branch 'parallaxsw:master' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
akashlevy authored Dec 9, 2024
2 parents f62d2d1 + c312d5b commit ed53dbd
Show file tree
Hide file tree
Showing 11 changed files with 231 additions and 175 deletions.
1 change: 1 addition & 0 deletions include/sta/Clock.hh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public:
int index() const { return index_; }
bool isPropagated() const { return is_propagated_; }
void setIsPropagated(bool propagated);
bool isIdeal() const { return !is_propagated_; }
// Ideal clock slew.
void slew(const RiseFall *rf,
const MinMax *min_max,
Expand Down
3 changes: 3 additions & 0 deletions include/sta/PathEnd.hh
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public:
// Required time with source clock offset.
virtual Required requiredTimeOffset(const StaState *sta) const;
virtual ArcDelay margin(const StaState *sta) const = 0;
virtual float macroClkTreeDelay(const StaState *) const { return 0.0; }
virtual Slack slack(const StaState *sta) const = 0;
virtual Slack slackNoCrpr(const StaState *sta) const = 0;
virtual Arrival borrow(const StaState *sta) const;
Expand Down Expand Up @@ -324,6 +325,7 @@ public:
virtual void reportFull(ReportPath *report) const;
virtual bool isCheck() const { return true; }
virtual ArcDelay margin(const StaState *sta) const;
virtual float macroClkTreeDelay(const StaState *sta) const;
virtual TimingRole *checkRole(const StaState *sta) const;
virtual TimingArc *checkArc() const { return check_arc_; }
virtual int exceptPathCmp(const PathEnd *path_end,
Expand All @@ -339,6 +341,7 @@ protected:
Crpr crpr,
bool crpr_valid);
Delay sourceClkDelay(const StaState *sta) const;
virtual Required requiredTimeNoCrpr(const StaState *sta) const;

TimingArc *check_arc_;
Edge *check_edge_;
Expand Down
1 change: 1 addition & 0 deletions liberty/LibertyWriter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ LibertyWriter::writeHeader()
if (exists)
fprintf(stream_, " default_fanout_load : %.2f;\n", fanout_load);
fprintf(stream_, "\n");

fprintf(stream_, " nom_process : %.1f;\n",
library_->nominalProcess());
fprintf(stream_, " nom_temperature : %.1f;\n",
Expand Down
250 changes: 125 additions & 125 deletions search/CheckSlewLimits.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,93 +87,156 @@ CheckSlewLimits::CheckSlewLimits(const StaState *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 *&rf,
Slew &slew,
float &limit,
float &slack) const
const RiseFall *&rf1,
Slew &slew1,
float &limit1,
float &slack1) const
{
corner1 = nullptr;
rf = nullptr;
slew = 0.0;
limit = 0.0;
slack = MinMax::min()->initValue();
if (corner)
checkSlews1(pin, corner, min_max, check_clks,
corner1, rf, slew, limit, slack);
else {
for (auto corner : *sta_->corners()) {
checkSlews1(pin, corner, min_max, check_clks,
corner1, rf, slew, limit, slack);
}
}
}
rf1 = nullptr;
slew1 = 0.0;
limit1 = 0.0;
slack1 = MinMax::min()->initValue();

void
CheckSlewLimits::checkSlews1(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
{
Vertex *vertex, *bidirect_drvr_vertex;
sta_->graph()->pinVertices(pin, vertex, bidirect_drvr_vertex);
if (vertex)
checkSlews1(vertex, corner, min_max, check_clks,
corner1, rf1, slew1, limit1, slack1);
checkSlew1(pin, vertex, corner, min_max, check_clks,
corner1, rf1, slew1, limit1, slack1);
if (bidirect_drvr_vertex)
checkSlews1(bidirect_drvr_vertex, corner, min_max, check_clks,
corner1, rf1, slew1, limit1, slack1);
checkSlew1(pin, bidirect_drvr_vertex, corner, min_max, check_clks,
corner1, rf1, slew1, limit1, slack1);
}

void
CheckSlewLimits::checkSlews1(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
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
{
const Pin *pin = vertex->pin();
if (!vertex->isDisabledConstraint()
&& !vertex->isConstant()
&& !sta_->clkNetwork()->isIdealClock(pin)) {
for (auto rf : RiseFall::range()) {
float limit;
bool exists;
findLimit(pin, vertex, corner, rf, min_max, check_clks,
limit, exists);
if (exists) {
checkSlew(vertex, corner, rf, min_max, limit,
corner1, rf1, slew1, slack1, limit1);
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 Vertex *vertex,
const Corner *corner,
const RiseFall *rf,
const MinMax *min_max,
bool check_clks,
const ClockSet &clks,
// Return values.
float &limit,
bool &exists) const
Expand All @@ -186,14 +249,10 @@ CheckSlewLimits::findLimit(const Pin *pin,

float limit1;
bool exists1;
if (check_clks) {
if (!clks.empty()) {
// Look for clock slew limits.
bool is_clk = sta_->clkNetwork()->isIdealClock(pin);
ClockSet clks;
clockDomains(vertex, clks);
ClockSet::Iterator clk_iter(clks);
while (clk_iter.hasNext()) {
Clock *clk = clk_iter.next();
for (Clock *clk : clks) {
PathClkOrData clk_data = is_clk ? PathClkOrData::clk : PathClkOrData::data;
sdc->slewLimit(clk, rf, clk_data, min_max,
limit1, exists1);
Expand Down Expand Up @@ -284,49 +343,18 @@ CheckSlewLimits::findLimit(const LibertyPort *port,
}
}

void
CheckSlewLimits::clockDomains(const Vertex *vertex,
// Return value.
ClockSet &clks) const
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));
}
}

void
CheckSlewLimits::checkSlew(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 clks;
}

////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -383,32 +411,4 @@ CheckSlewLimits::checkSlewLimits(const Instance *inst,
delete pin_iter;
}

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;
}
}
}
}

} // namespace
Loading

0 comments on commit ed53dbd

Please sign in to comment.