Skip to content

Commit

Permalink
report_net min/max cap instead of rise/fall/min/max
Browse files Browse the repository at this point in the history
  • Loading branch information
jjcherry56 committed Apr 2, 2021
1 parent 7f0ee1b commit e10258d
Show file tree
Hide file tree
Showing 11 changed files with 181 additions and 137 deletions.
1 change: 1 addition & 0 deletions include/sta/Liberty.hh
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,7 @@ public:
bool &exists) const;
void setFanoutLoad(float fanout_load);
float capacitance() const;
float capacitance(const MinMax *min_max) const;
float capacitance(const RiseFall *rf,
const MinMax *min_max) const;
void capacitance(const RiseFall *rf,
Expand Down
6 changes: 5 additions & 1 deletion include/sta/MinMax.hh
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,19 @@ public:
// Max value1 > value2, Min value1 < value2.
bool compare(float value1,
float value2) const;
// min/max(value1, value2)
float minMax(float value1,
float value2) const;
MinMaxAll *asMinMaxAll() const;
MinMax *opposite() const;
// for range support.
// for (auto min_max : MinMax::range()) {}
static const std::array<MinMax*, 2> &range() { return range_; }
// for (auto mm_index : MinMax::rangeIndex()) {}
static const std::array<int, 2> &rangeIndex() { return range_index_; }
// Find MinMax from name.
static MinMax *find(const char *min_max);
// Find transition from index.
// Find MinMax from index.
static MinMax *find(int index);
static const int index_max = 1;
static const int index_count = 2;
Expand Down
1 change: 1 addition & 0 deletions include/sta/RiseFallMinMax.hh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public:
explicit RiseFallMinMax(float init_value);
float value(const RiseFall *rf,
const MinMax *min_max) const;
float value(const MinMax *min_max) const;
void value(const RiseFall *rf,
const MinMax *min_max,
float &value,
Expand Down
25 changes: 12 additions & 13 deletions include/sta/Sta.hh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class EquivCells;
typedef InstanceSeq::Iterator SlowDrvrIterator;
typedef Vector<const char*> CheckError;
typedef Vector<CheckError*> CheckErrorSeq;
typedef Vector<Corner*> CornerSeq;

enum class CmdNamespace { sta, sdc };

Expand Down Expand Up @@ -155,19 +156,16 @@ public:
const RiseFallBoth *rf,
const MinMaxAll *min_max,
float slew);
// Port external pin load.
float portExtPinCap(Port *port,
const RiseFall *rf,
const MinMax *min_max);
// Set port external pin load (set_load -pin port).
void setPortExtPinCap(Port *port,
const RiseFallBoth *rf,
const MinMaxAll *min_max,
float cap);
// Port external wire load.
float portExtWireCap(Port *port,
const RiseFall *rf,
const MinMax *min_max);
void portExtCaps(Port *port,
const MinMax *min_max,
float &pin_cap,
float &wire_cap,
int &fanout);
// Set port external wire load (set_load -wire port).
void setPortExtWireCap(Port *port,
bool subtract_pin_cap,
Expand All @@ -180,15 +178,16 @@ public:
const Corner *corner,
const MinMaxAll *min_max,
float cap);
// Port external fanout (used by wireload models).
int portExtFanout(Port *port,
const MinMax *min_max);
// Set port external fanout (used by wireload models).
void setPortExtFanout(Port *port,
int fanout,
const MinMaxAll *min_max);
// Remove all "set_load net" annotations.
void removeNetLoadCaps() const;
// Liberty port capacitance.
float capacitance(const LibertyPort *port,
Corner *corner,
const MinMax *min_max);
// pin_cap = net pin capacitances + port external pin capacitance,
// wire_cap = annotated net capacitance + port external wire capacitance.
void connectedCap(Pin *drvr_pin,
Expand All @@ -198,8 +197,7 @@ public:
float &pin_cap,
float &wire_cap) const;
void connectedCap(Net *net,
const RiseFall *rf,
const Corner *corner,
Corner *corner,
const MinMax *min_max,
float &pin_cap,
float &wire_cap) const;
Expand Down Expand Up @@ -1338,6 +1336,7 @@ protected:
LibertyCell *to_lib_cell);
void sdcChangedGraph();
void ensureGraphSdcAnnotated();
CornerSeq makeCornerSeq(Corner *corner) const;

CmdNamespace cmd_namespace_;
Instance *current_instance_;
Expand Down
2 changes: 1 addition & 1 deletion include/sta/Transition.hh
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ private:
};

// Obsolete. Use range iteration instead.
// for (auto tr : RiseFall::range()) {}
// for (RiseFall *rf : RiseFall::range()) {}
class RiseFallIterator : public Iterator<RiseFall*>
{
public:
Expand Down
6 changes: 6 additions & 0 deletions liberty/Liberty.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1948,6 +1948,12 @@ LibertyPort::capacitance() const
return 0.0;
}

float
LibertyPort::capacitance(const MinMax *min_max) const
{
return capacitance_.value(min_max);
}

float
LibertyPort::capacitance(const RiseFall *rf,
const MinMax *min_max) const
Expand Down
16 changes: 14 additions & 2 deletions sdc/RiseFallMinMax.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,18 @@ RiseFallMinMax::value(const RiseFall *rf,
value = values_[rf->index()][min_max->index()];
}

float
RiseFallMinMax::value(const MinMax *min_max) const
{
int mm_index = min_max->index();
float rise = values_[RiseFall::riseIndex()][mm_index];
float fall = values_[RiseFall::fallIndex()][mm_index];
if (min_max->compare(rise, fall))
return rise;
else
return fall;
}

float
RiseFallMinMax::value(const RiseFall *rf,
const MinMax *min_max) const
Expand Down Expand Up @@ -201,9 +213,9 @@ RiseFallMinMax::hasValue(const RiseFall *rf, const MinMax *min_max) const
void
RiseFallMinMax::mergeWith(RiseFallMinMax *rfmm)
{
for (auto min_max : MinMax::range()) {
for (MinMax *min_max : MinMax::range()) {
int mm_index = min_max->index();
for (auto rf_index : RiseFall::rangeIndex()) {
for (int rf_index : RiseFall::rangeIndex()) {
bool exists1 = exists_[rf_index][mm_index];
bool exists2 = rfmm->exists_[rf_index][mm_index];
if (exists1 && exists2) {
Expand Down
122 changes: 77 additions & 45 deletions search/Sta.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3403,24 +3403,6 @@ Sta::simLogicValue(const Pin *pin)
return sim_->logicValue(pin);
}

float
Sta::portExtPinCap(Port *port,
const RiseFall *rf,
const MinMax *min_max)
{
float pin_cap, wire_cap;
int fanout;
bool pin_exists, wire_exists, fanout_exists;
sdc_->portExtCap(port, rf, min_max,
pin_cap, pin_exists,
wire_cap, wire_exists,
fanout, fanout_exists);
if (pin_exists)
return pin_cap;
else
return 0.0;
}

void
Sta::setPortExtPinCap(Port *port,
const RiseFallBoth *rf,
Expand All @@ -3435,22 +3417,43 @@ Sta::setPortExtPinCap(Port *port,
delaysInvalidFromFanin(port);
}

float
Sta::portExtWireCap(Port *port,
const RiseFall *rf,
const MinMax *min_max)
{
float pin_cap, wire_cap;
int fanout;
bool pin_exists, wire_exists, fanout_exists;
sdc_->portExtCap(port, rf, min_max,
pin_cap, pin_exists,
wire_cap, wire_exists,
fanout, fanout_exists);
if (wire_exists)
return wire_cap;
else
return 0.0;
void
Sta::portExtCaps(Port *port,
const MinMax *min_max,
float &pin_cap,
float &wire_cap,
int &fanout)
{
bool pin_exists = false;
bool wire_exists = false;
bool fanout_exists = false;
for (RiseFall *rf : RiseFall::range()) {
float pin_cap1, wire_cap1;
int fanout1;
bool pin_exists1, wire_exists1, fanout_exists1;
sdc_->portExtCap(port, rf, min_max,
pin_cap1, pin_exists1,
wire_cap1, wire_exists1,
fanout1, fanout_exists1);
if (pin_exists1) {
pin_cap = min_max->minMax(pin_cap, pin_cap1);
pin_exists = true;
}
if (wire_exists1) {
wire_cap = min_max->minMax(wire_cap, wire_cap1);
wire_exists = true;
}
if (fanout_exists1) {
fanout = min_max->minMax(fanout, fanout1);
fanout_exists = true;
}
}
if (!pin_exists)
pin_cap = 0.0;
if (!wire_exists)
wire_cap = 0.0;
if (!fanout_exists)
fanout = 0;
}

void
Expand All @@ -3476,13 +3479,6 @@ Sta::removeNetLoadCaps() const
graph_delay_calc_->delaysInvalid();
}

int
Sta::portExtFanout(Port *port,
const MinMax *min_max)
{
return sdc_->portExtFanout(port, min_max);
}

void
Sta::setPortExtFanout(Port *port,
int fanout,
Expand Down Expand Up @@ -3541,21 +3537,57 @@ Sta::connectedCap(Pin *drvr_pin,

void
Sta::connectedCap(Net *net,
const RiseFall *rf,
const Corner *corner,
Corner *corner,
const MinMax *min_max,
float &pin_cap,
float &wire_cap) const
{
Pin *drvr_pin = findNetParasiticDrvrPin(net);
if (drvr_pin)
connectedCap(drvr_pin, rf, corner, min_max, pin_cap, wire_cap);
if (drvr_pin) {
pin_cap = min_max->initValue();
wire_cap = min_max->initValue();
for (const Corner *corner : makeCornerSeq(corner)) {
for (RiseFall *rf : RiseFall::range()) {
float pin_cap1, wire_cap1;
connectedCap(drvr_pin, rf, corner, min_max, pin_cap1, wire_cap1);
pin_cap = min_max->minMax(pin_cap, pin_cap1);
wire_cap = min_max->minMax(wire_cap, wire_cap1);
}
}
}
else {
pin_cap = 0.0;
wire_cap = 0.0;
}
}

CornerSeq
Sta::makeCornerSeq(Corner *corner) const
{
CornerSeq corners;
if (corner)
corners.push_back(corner);
else
corners = corners_->corners();
return corners;
}

float
Sta::capacitance(const LibertyPort *port,
Corner *corner,
const MinMax *min_max)
{
OperatingConditions *op_cond = operatingConditions(min_max);
float cap = min_max->initValue();
for (const Corner *corner : makeCornerSeq(corner)) {
int lib_ap = corner->libertyIndex(min_max);
const LibertyPort *corner_port = port->cornerPort(lib_ap);
for (RiseFall *rf : RiseFall::range())
cap = min_max->minMax(cap, corner_port->capacitance(rf, min_max, op_cond, op_cond));
}
return cap;
}

// Look for a driver to find a parasitic if the net has one.
// Settle for a load pin if there are no drivers.
Pin *
Expand Down
Loading

0 comments on commit e10258d

Please sign in to comment.