Skip to content

Commit

Permalink
liberty ccs support
Browse files Browse the repository at this point in the history
commit 8f90f9e7ba1eb29621faa3efed9154501c600537
Author: James Cherry <[email protected]>
Date:   Fri Feb 3 09:02:22 2023 -0700

    ccs

    Signed-off-by: James Cherry <[email protected]>

commit 0bb6b07fd965dc948a63ed383ac05893af4cbd87
Author: James Cherry <[email protected]>
Date:   Thu Feb 2 08:07:17 2023 -0700

    ccs

    Signed-off-by: James Cherry <[email protected]>

commit 408a19ae7750bdd41641ac6efebec0df565987bc
Author: James Cherry <[email protected]>
Date:   Wed Feb 1 16:55:03 2023 -0700

    ccs

    Signed-off-by: James Cherry <[email protected]>

commit a193adf0efdfa9c2a3b4272609e03f9279fc3479
Author: James Cherry <[email protected]>
Date:   Wed Feb 1 16:37:36 2023 -0700

    ccs

    Signed-off-by: James Cherry <[email protected]>

commit f26f47698ccd3a43d31f031f5cb6a70f0ffe1f91
Author: James Cherry <[email protected]>
Date:   Wed Feb 1 10:34:41 2023 -0700

    cleanup

    Signed-off-by: James Cherry <[email protected]>

commit 54613569fcb9d714b77833d54492b4dc8121a966
Author: James Cherry <[email protected]>
Date:   Wed Feb 1 10:18:20 2023 -0700

    ccs

    Signed-off-by: James Cherry <[email protected]>

commit 4e34c391abc46e9e98d78725e139d739aff7fd44
Author: James Cherry <[email protected]>
Date:   Wed Feb 1 09:05:43 2023 -0700

    ccs

    Signed-off-by: James Cherry <[email protected]>

commit 7b1e5af344948d84f82621d054efa206508a5cb8
Author: James Cherry <[email protected]>
Date:   Tue Jan 31 08:58:23 2023 -0700

    table report

    Signed-off-by: James Cherry <[email protected]>

commit 501a53715f27a1ada6477f29b2efdc96fbaec8be
Author: James Cherry <[email protected]>
Date:   Tue Jan 31 08:33:53 2023 -0700

    ccs

    Signed-off-by: James Cherry <[email protected]>

commit e68cd932db03724e1344259d79bd6397cca777d2
Author: James Cherry <[email protected]>
Date:   Mon Jan 30 11:47:01 2023 -0700

    ccs

    Signed-off-by: James Cherry <[email protected]>

commit 1b279d3ae1e4a8fc156ee92999eab92e6a0a50ff
Author: James Cherry <[email protected]>
Date:   Sun Jan 29 13:56:05 2023 -0700

    ccs

    Signed-off-by: James Cherry <[email protected]>

commit 43e039650373f9a9bb9e7b7cae6b48d7d2db455b
Author: James Cherry <[email protected]>
Date:   Sun Jan 29 11:54:08 2023 -0700

    ccs

    Signed-off-by: James Cherry <[email protected]>

commit 648965c2433f4e7ed87371fced85e80d0198df10
Author: James Cherry <[email protected]>
Date:   Fri Jan 27 19:16:39 2023 -0700

    ccs

    Signed-off-by: James Cherry <[email protected]>

commit 02ac4e3e3f3f97308ff71a2f9984aa3aacb6e7ee
Author: James Cherry <[email protected]>
Date:   Tue Jan 24 09:40:22 2023 -0700

    ccs liberty

    Signed-off-by: James Cherry <[email protected]>

Signed-off-by: James Cherry <[email protected]>
  • Loading branch information
jjcherry56 committed Feb 8, 2023
1 parent 72d6349 commit ab698d2
Show file tree
Hide file tree
Showing 11 changed files with 1,104 additions and 496 deletions.
5 changes: 4 additions & 1 deletion include/sta/Liberty.hh
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ enum class DelayModelType { cmos_linear, cmos_pwl, cmos2, table, polynomial, dcm
enum class ScaleFactorPvt { process, volt, temp, unknown };
constexpr int scale_factor_pvt_count = int(ScaleFactorPvt::unknown) + 1;

enum class TableTemplateType { delay, power, output_current, ocv };
enum class TableTemplateType { delay, power, output_current, capacitance, ocv };
constexpr int table_template_type_count = int(TableTemplateType::ocv) + 1;

enum class LevelShifterType { HL, LH, HL_LH };
Expand Down Expand Up @@ -778,6 +778,8 @@ public:
void setRelatedGroundPin(const char *related_ground_pin);
const char *relatedPowerPin() const { return related_power_pin_; }
void setRelatedPowerPin(const char *related_power_pin);
ReceiverModelPtr receiverModel() const { return receiver_model_; }
void setReceiverModel(ReceiverModelPtr receiver_model);

static bool equiv(const LibertyPort *port1,
const LibertyPort *port2);
Expand Down Expand Up @@ -817,6 +819,7 @@ protected:
const char *related_ground_pin_;
const char *related_power_pin_;
Vector<LibertyPort*> corner_ports_;
ReceiverModelPtr receiver_model_;

unsigned int min_pulse_width_exists_:RiseFall::index_count;
bool min_period_exists_:1;
Expand Down
4 changes: 2 additions & 2 deletions include/sta/LibertyClass.hh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class TimingRole;
class Transition;
class RiseFall;
class RiseFallBoth;
class ReceiverModel;

typedef Vector<LibertyLibrary*> LibertyLibrarySeq;
typedef Vector<LibertyCell*> LibertyCellSeq;
Expand All @@ -66,11 +67,10 @@ typedef Vector<LibertyPort*> LibertyPortSeq;
typedef Set<LibertyPort*> LibertyPortSet;
typedef std::pair<const LibertyPort*,const LibertyPort*> LibertyPortPair;
typedef Set<LibertyCell*> LibertyCellSet;
typedef Vector<float> FloatSeq;
typedef Vector<FloatSeq*> FloatTable;
typedef std::shared_ptr<Table> TablePtr;
typedef std::shared_ptr<TimingArcAttrs> TimingArcAttrsPtr;
typedef std::shared_ptr<TableAxis> TableAxisPtr;
typedef std::shared_ptr<ReceiverModel> ReceiverModelPtr;

enum class ScaleFactorType : unsigned {
pin_cap,
Expand Down
104 changes: 101 additions & 3 deletions include/sta/TableModel.hh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ class Unit;
class Units;
class Report;
class Table;
class OutputCurrent;
class OutputCurrentWaveform;

typedef Vector<float> FloatSeq;
typedef Vector<FloatSeq*> FloatTable;
typedef Vector<OutputCurrentWaveform*> OutputCurrentWaveformSeq;

TableAxisVariable
stringTableAxisVariable(const char *variable);
Expand All @@ -48,7 +54,9 @@ public:
GateTableModel(TableModel *delay_model,
TableModel *delay_sigma_models[EarlyLate::index_count],
TableModel *slew_model,
TableModel *slew_sigma_models[EarlyLate::index_count]);
TableModel *slew_sigma_models[EarlyLate::index_count],
ReceiverModelPtr receiver_model,
OutputCurrent *output_current);
virtual ~GateTableModel();
virtual void gateDelay(const LibertyCell *cell,
const Pvt *pvt,
Expand Down Expand Up @@ -118,6 +126,8 @@ protected:
TableModel *delay_sigma_models_[EarlyLate::index_count];
TableModel *slew_model_;
TableModel *slew_sigma_models_[EarlyLate::index_count];
ReceiverModelPtr receiver_model_;
OutputCurrent *output_current_;
};

class CheckTableModel : public CheckTimingModel
Expand Down Expand Up @@ -223,7 +233,8 @@ public:
const char *comment1,
float value2,
float value3,
int digits,
const Unit *table_unit,
int digits,
string *result) const;
void report(const Units *units,
Report *report) const;
Expand All @@ -246,7 +257,7 @@ protected:
bool is_scaled_:1;
};

// Abstract base class for tables.
// Abstract base class for 0, 1, 2, or 3 dimesnion float tables.
class Table
{
public:
Expand Down Expand Up @@ -280,6 +291,7 @@ public:
const char *comment1,
float value2,
float value3,
const Unit *table_unit,
int digits,
string *result) const = 0;
virtual void report(const Units *units,
Expand All @@ -306,6 +318,7 @@ public:
const char *comment1,
float value2,
float value3,
const Unit *table_unit,
int digits,
string *result) const;
virtual void report(const Units *units,
Expand Down Expand Up @@ -340,6 +353,7 @@ public:
const char *comment1,
float value2,
float value3,
const Unit *table_unit,
int digits,
string *result) const;
virtual void report(const Units *units,
Expand Down Expand Up @@ -370,6 +384,7 @@ public:
virtual float findValue(float value1,
float value2,
float value3) const;
FloatTable *values3() { return values_; }
virtual void reportValue(const char *result_name,
const LibertyLibrary *library,
const LibertyCell *cell,
Expand All @@ -378,6 +393,7 @@ public:
const char *comment1,
float value2,
float value3,
const Unit *table_unit,
int digits,
string *result) const;
virtual void report(const Units *units,
Expand Down Expand Up @@ -417,6 +433,7 @@ public:
const char *comment1,
float value2,
float value3,
const Unit *table_unit,
int digits,
string *result) const;
virtual void report(const Units *units,
Expand All @@ -434,15 +451,96 @@ public:
FloatSeq *values);
~TableAxis();
TableAxisVariable variable() const { return variable_; }
const char *variableString() const;
const Unit *unit(const Units *units);
size_t size() const { return values_->size(); }
float axisValue(size_t index) const { return (*values_)[index]; }
// Find the index for value such that axis[index] <= value < axis[index+1].
size_t findAxisIndex(float value) const;
void findAxisIndex(float value,
// Return values.
size_t &index,
bool &exists) const;
FloatSeq *values() const { return values_; }

private:
TableAxisVariable variable_;
FloatSeq *values_;
};

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

class ReceiverModel
{
public:
ReceiverModel();
~ReceiverModel();
void setCapacitanceModel(TableModel *table_model,
int index,
RiseFall *rf);
static bool checkAxes(TablePtr table);

private:
TableModel *capacitance_models_[2][RiseFall::index_count];
};

class OutputCurrentWaveform
{
public:
OutputCurrentWaveform(float axis_value1,
float axis_value2,
TableAxisPtr axis,
Table1 *currents,
float reference_time);
~OutputCurrentWaveform();
float axisValue1() const { return axis_value1_; }
float axisValue2() const { return axis_value2_; }
TableAxisPtr axis() const { return axis_; }
Table1 *currents() const { return currents_; }
float referenceTime() const { return reference_time_; }
void reportWaveform(const Units *units,
int digits,
string *result);
static bool checkAxes(TableTemplate *tbl_template);

private:
float axis_value1_;
float axis_value2_;
TableAxisPtr axis_;
Table1 *currents_;
float reference_time_;
};

// Two dimensional table of one dimensional time/current tables.
class OutputCurrent
{
public:
OutputCurrent(TableAxisPtr axis1,
TableAxisPtr axis2,
Vector<OutputCurrentWaveform*> &waveforms);
~OutputCurrent();
void reportWaveform(const LibertyCell *cell,
const Pvt *pvt,
float in_slew,
float load_cap,
int digits,
string *result) const;

private:
void findAxisValues(float in_slew,
float load_cap,
// Return values.
float &axis_value1,
float &axis_value2) const;
float axisValue(TableAxisPtr axis,
float in_slew,
float load_cap) const;

// Row.
TableAxisPtr axis1_;
// Column.
TableAxisPtr axis2_;
OutputCurrentWaveformSeq waveforms_;
};

} // namespace
4 changes: 2 additions & 2 deletions include/sta/TimingModel.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace sta {

using std::string;

// Abstract base class for timing models.
// Abstract base class for GateTimingModel and CheckTimingModel.
class TimingModel
{
public:
Expand All @@ -36,7 +36,7 @@ protected:
friend class LibertyCell;
};

// Abstract base class for gate timing models.
// Abstract base class for LinearModel and TableModel.
class GateTimingModel : public TimingModel
{
public:
Expand Down
10 changes: 6 additions & 4 deletions liberty/InternalPower.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "FuncExpr.hh"
#include "TableModel.hh"
#include "Liberty.hh"
#include "Units.hh"

namespace sta {

Expand Down Expand Up @@ -152,7 +153,8 @@ InternalPowerModel::reportPower(const LibertyCell *cell,
axis_value1, axis_value2, axis_value3);
const LibertyLibrary *library = cell->libertyLibrary();
model_->reportValue("Power", library, cell, pvt,
axis_value1, nullptr, axis_value2, axis_value3, digits, result);
axis_value1, nullptr, axis_value2, axis_value3,
library->units()->powerUnit(), digits, result);
}
}

Expand Down Expand Up @@ -212,9 +214,9 @@ InternalPowerModel::axisValue(TableAxisPtr axis,
bool
InternalPowerModel::checkAxes(const TableModel *model)
{
TableAxisPtr axis1 = model->axis1();
TableAxisPtr axis2 = model->axis2();
TableAxisPtr axis3 = model->axis3();
const TableAxisPtr axis1 = model->axis1();
const TableAxisPtr axis2 = model->axis2();
const TableAxisPtr axis3 = model->axis3();
bool axis_ok = true;
if (axis1)
axis_ok &= checkAxis(model->axis1());
Expand Down
7 changes: 7 additions & 0 deletions liberty/Liberty.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1919,6 +1919,7 @@ LibertyPort::LibertyPort(LibertyCell *cell,
pulse_clk_sense_(nullptr),
related_ground_pin_(nullptr),
related_power_pin_(nullptr),
receiver_model_(nullptr),
min_pulse_width_exists_(false),
min_period_exists_(false),
is_clk_(false),
Expand Down Expand Up @@ -2492,6 +2493,12 @@ LibertyPort::setRelatedPowerPin(const char *related_power_pin)
related_power_pin_ = stringCopy(related_power_pin);
}

void
LibertyPort::setReceiverModel(ReceiverModelPtr receiver_model)
{
receiver_model_ = receiver_model;
}

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

LibertyPortSeq
Expand Down
Loading

0 comments on commit ab698d2

Please sign in to comment.