From f8fc314a03ab14643ae36fe655309b2c82c64d0a Mon Sep 17 00:00:00 2001 From: James Cherry Date: Wed, 4 Oct 2023 15:39:42 -0700 Subject: [PATCH] LibertyPort::clockTreePathDelays() Signed-off-by: James Cherry --- include/sta/Liberty.hh | 1 + liberty/Liberty.cc | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/include/sta/Liberty.hh b/include/sta/Liberty.hh index d1ede379..0924ebd9 100644 --- a/include/sta/Liberty.hh +++ b/include/sta/Liberty.hh @@ -794,6 +794,7 @@ public: DriverWaveform *driverWaveform(const RiseFall *rf) const; void setDriverWaveform(DriverWaveform *driver_waveform, const RiseFall *rf); + RiseFallMinMax clockTreePathDelays(); static bool equiv(const LibertyPort *port1, const LibertyPort *port2); diff --git a/liberty/Liberty.cc b/liberty/Liberty.cc index bf90baa1..aedcb5b6 100644 --- a/liberty/Liberty.cc +++ b/liberty/Liberty.cc @@ -2566,6 +2566,33 @@ LibertyPort::setDriverWaveform(DriverWaveform *driver_waveform, driver_waveform_[rf->index()] = driver_waveform; } +RiseFallMinMax +LibertyPort::clockTreePathDelays() +{ + RiseFallMinMax delays; + const TimingArcSetSeq &arc_sets = liberty_cell_->timingArcSets(nullptr, this); + for (TimingArcSet *arc_set : arc_sets) { + TimingRole *role = arc_set->role(); + if (role == TimingRole::clockTreePathMin() + || role == TimingRole::clockTreePathMax()) { + for (TimingArc *arc : arc_set->arcs()) { + TimingModel *model = arc->model(); + GateTimingModel *gate_model = dynamic_cast(model); + ArcDelay delay; + Slew slew; + gate_model->gateDelay(liberty_cell_, nullptr, 0.0, 0.0, 0.0, false, + delay, slew); + const RiseFall *rf = arc->toEdge()->asRiseFall(); + const MinMax *min_max = (role == TimingRole::clockTreePathMin()) + ? MinMax::min() + : MinMax::max(); + delays.setValue(rf, min_max, delay); + } + } + } + return delays; +} + //////////////////////////////////////////////////////////////// LibertyPortSeq