Skip to content

Commit

Permalink
resizer support
Browse files Browse the repository at this point in the history
  • Loading branch information
jjcherry56 committed May 28, 2019
1 parent 8242035 commit 53df947
Show file tree
Hide file tree
Showing 15 changed files with 178 additions and 62 deletions.
33 changes: 25 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ message(STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}")

set(STA_SOURCE
app/StaMain.cc
app/StaApp_wrap.cc
app/TclInitVar.cc
app/StaApp_wrap.cc

dcalc/ArcDelayCalc.cc
dcalc/ArnoldiDelayCalc.cc
Expand Down Expand Up @@ -213,6 +210,11 @@ set(STA_SOURCE
verilog/VerilogParse.cc
)

set(STA_CMD_SOURCE
app/TclInitVar.cc
app/StaApp_wrap.cc
)

set(STA_HEADERS
app/StaMain.hh

Expand Down Expand Up @@ -648,7 +650,6 @@ add_custom_command(OUTPUT ${STA_HOME}/app/TclInitVar.cc
set(STA_INCLUDE_DIRS
app
dcalc
dcalc/verilog
graph
liberty
network
Expand All @@ -663,20 +664,38 @@ set(STA_INCLUDE_DIRS
)

###########################################################
# Library
# Library without TCL commands.
# This is used to build applications that define
# their own SWIG and TCL commands.
###########################################################

# compatibility with configure
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${STA_HOME}/app)

add_library(OpenSTA ${STA_SOURCE})
add_library(OpenSTAnoCmds ${STA_SOURCE})

target_include_directories(OpenSTAnoCmds PUBLIC ${STA_INCLUDE_DIRS})

target_compile_features(OpenSTAnoCmds
PUBLIC cxx_auto_type
)

target_compile_options(OpenSTAnoCmds PUBLIC ${STA_COMPILE_OPTIONS})

###########################################################
# Library
###########################################################

add_library(OpenSTA ${STA_SOURCE} ${STA_CMD_SOURCE})

target_include_directories(OpenSTA PUBLIC ${STA_INCLUDE_DIRS})

target_compile_features(OpenSTA
PUBLIC cxx_auto_type
)

target_compile_options(OpenSTA PUBLIC ${STA_COMPILE_OPTIONS})

###########################################################
# Executable
###########################################################
Expand Down Expand Up @@ -704,9 +723,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_link_libraries(sta -pthread)
endif()

target_compile_options(OpenSTA PUBLIC ${STA_COMPILE_OPTIONS})
target_compile_options(sta PUBLIC ${STA_COMPILE_OPTIONS})
message(STATUS "Compiler options: ${STA_COMPILE_OPTIONS}")

################################################################
# Install
Expand Down
7 changes: 7 additions & 0 deletions dcalc/GraphDelayCalc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ GraphDelayCalc::loadCap(const Pin *,
return 0.0F;
}

float
GraphDelayCalc::loadCap(const Pin *,
const DcalcAnalysisPt *) const
{
return 0.0F;
}

void
GraphDelayCalc::netCaps(const Pin *,
const TransRiseFall *,
Expand Down
5 changes: 4 additions & 1 deletion dcalc/GraphDelayCalc.hh
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,13 @@ public:
// Return values.
float &pin_cap,
float &wire_cap) const;
// Load pin_cap + wire_cap.
// Load pin_cap + wire_cap including parasitic.
virtual float loadCap(const Pin *drvr_pin,
const TransRiseFall *to_tr,
const DcalcAnalysisPt *dcalc_ap) const;
// Load pin_cap + wire_cap including parasitic min/max for rise/fall.
virtual float loadCap(const Pin *drvr_pin,
const DcalcAnalysisPt *dcalc_ap) const;
// Load pin_cap + wire_cap.
virtual float loadCap(const Pin *drvr_pin,
Parasitic *drvr_parasitic,
Expand Down
18 changes: 18 additions & 0 deletions dcalc/GraphDelayCalc1.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,24 @@ GraphDelayCalc1::findDriverEdgeDelays(LibertyCell *drvr_cell,
return delay_changed;
}

float
GraphDelayCalc1::loadCap(const Pin *drvr_pin,
const DcalcAnalysisPt *dcalc_ap) const
{
const MinMax *min_max = dcalc_ap->constraintMinMax();
float load_cap = 0.0;
TransRiseFallIterator drvr_tr_iter;
while (drvr_tr_iter.hasNext()) {
TransRiseFall *drvr_tr = drvr_tr_iter.next();
Parasitic *drvr_parasitic = arc_delay_calc_->findParasitic(drvr_pin, drvr_tr,
dcalc_ap);
float cap = loadCap(drvr_pin, nullptr, drvr_parasitic, drvr_tr, dcalc_ap);
if (min_max->compare(cap, load_cap))
load_cap = cap;
}
return load_cap;
}

float
GraphDelayCalc1::loadCap(const Pin *drvr_pin,
const TransRiseFall *drvr_tr,
Expand Down
2 changes: 2 additions & 0 deletions dcalc/GraphDelayCalc1.hh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public:
virtual float loadCap(const Pin *drvr_pin,
const TransRiseFall *drvr_tr,
const DcalcAnalysisPt *dcalc_ap) const;
virtual float loadCap(const Pin *drvr_pin,
const DcalcAnalysisPt *dcalc_ap) const;
virtual void loadCap(const Pin *drvr_pin,
Parasitic *drvr_parasitic,
const TransRiseFall *tr,
Expand Down
15 changes: 4 additions & 11 deletions liberty/EquivCells.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ typedef Set<LibertyCellSeq*> LibertyCellSeqSet;
static LibertyCellEquivMap *
findEquivCells1(const LibertyLibrary *library);
static void
deleteEquivCellMap(LibertyCellEquivMap *equiv_map);
static void
sortCellEquivs(LibertyCellEquivMap *cell_equivs);
static float
cellDriveResistance(const LibertyCell *cell);
Expand All @@ -58,19 +56,19 @@ static bool
equivCellSequentials(const LibertyCell *cell1,
const LibertyCell *cell2);

void
LibertyCellEquivMap *
findEquivCells(const LibertyLibrary *library)
{
// Build a map from each cell in the library to a group (CellSeq) of
// cells with equivalent functionality.
LibertyCellEquivMap *cell_equivs = findEquivCells1(library);
// Sort by drive strength.
sortCellEquivs(cell_equivs);
deleteEquivCellMap(cell_equivs);
return cell_equivs;
}

// Delete the LibertyCellEquivMap returned by makeEquivCellMap.
static void
void
deleteEquivCellMap(LibertyCellEquivMap *equiv_map)
{
// Multiple cells can point to the same cell sequence, so collect
Expand Down Expand Up @@ -129,12 +127,7 @@ findEquivCells1(const LibertyLibrary *library)
}
}

LibertyCellHashMap::Iterator hash_iter(cell_hash);
while (hash_iter.hasNext()) {
LibertyCellSeq *cells = hash_iter.next();
delete cells;
}

cell_hash.deleteContents();
return cell_equivs;
}

Expand Down
5 changes: 4 additions & 1 deletion liberty/EquivCells.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ namespace sta {

// Find equivalent cells, sort by drive strength and
// and set cell->higherDrive/lowerDrive.
void
LibertyCellEquivMap *
findEquivCells(const LibertyLibrary *library);
// Delete findEquivCells return value.
void
deleteEquivCellMap(LibertyCellEquivMap *equiv_map);

// Predicate that is true when the ports, functions, sequentials and
// timing arcs match.
Expand Down
98 changes: 71 additions & 27 deletions liberty/Liberty.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,15 @@ LibertyLibrary::LibertyLibrary(const char *name,
default_wire_load_selection_(nullptr),
default_operating_conditions_(nullptr),
ocv_arc_depth_(0.0),
default_ocv_derate_(nullptr)
default_ocv_derate_(nullptr),
equiv_cell_map_(nullptr),
buffers_(nullptr)
{
// Scalar templates are builtin.
for (int i = 0; i != int(TableTemplateType::count); i++) {
TableTemplateType type = static_cast<TableTemplateType>(i);
TableTemplate *scalar_template = new TableTemplate("scalar", nullptr, nullptr, nullptr);
TableTemplate *scalar_template = new TableTemplate("scalar", nullptr,
nullptr, nullptr);
addTableTemplate(scalar_template, type);
}

Expand Down Expand Up @@ -129,6 +132,8 @@ LibertyLibrary::~LibertyLibrary()
const char *supply_name = name_volt.first;
stringDelete(supply_name);
}
deleteEquivCellMap(equiv_cell_map_);
delete buffers_;
}

LibertyCell *
Expand All @@ -149,6 +154,22 @@ LibertyLibrary::findLibertyCellsMatching(PatternMatch *pattern,
}
}

LibertyCellSeq *
LibertyLibrary::buffers()
{
if (buffers_ == nullptr) {
buffers_ = new LibertyCellSeq;
LibertyCellIterator cell_iter(this);
while (cell_iter.hasNext()) {
LibertyCell *cell = cell_iter.next();
if (!cell->dontUse()
&& cell->isBuffer())
buffers_->push_back(cell);
}
}
return buffers_;
}

void
LibertyLibrary::setDelayModelType(DelayModelType type)
{
Expand Down Expand Up @@ -737,9 +758,17 @@ LibertyLibrary::makeCornerMap(LibertyCell *cell1,
}

void
LibertyLibrary::finish()
LibertyLibrary::ensureEquivCells()
{
findEquivCells(this);
if (equiv_cell_map_ == nullptr)
equiv_cell_map_ = sta::findEquivCells(this);
}

LibertyCellSeq *
LibertyLibrary::findEquivCells(LibertyCell *cell)
{
ensureEquivCells();
return equiv_cell_map_->findKey(cell);
}

////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -1022,33 +1051,16 @@ LibertyCell::setClockGateType(ClockGateType type)

bool
LibertyCell::isBuffer() const
{
LibertyPort *input, *output;
return isBuffer(input, output);
}

bool
LibertyCell::isBuffer(// Return values.
LibertyPort *&input,
LibertyPort *&output) const
{
if (ports_.size() == 2) {
LibertyPort *port1 = static_cast<LibertyPort*>(ports_[0]);
LibertyPort *port2 = static_cast<LibertyPort*>(ports_[1]);
if (port1->direction()->isInput()
&& port2->direction()->isOutput()
&& hasBufferFunc(port1, port2)) {
input = port1;
output = port2;
return true;
}
else if (port2->direction()->isInput()
&& port1->direction()->isOutput()
&& hasBufferFunc(port2, port1)) {
input = port2;
output = port1;
return true;
}
return (port1->direction()->isInput()
&& port2->direction()->isOutput()
&& hasBufferFunc(port1, port2))
|| (port2->direction()->isInput()
&& port1->direction()->isOutput()
&& hasBufferFunc(port2, port1));
}
return false;
}
Expand All @@ -1063,6 +1075,24 @@ LibertyCell::hasBufferFunc(const LibertyPort *input,
&& func->port() == input;
}

void
LibertyCell::bufferPorts(// Return values.
LibertyPort *&input,
LibertyPort *&output)
{
LibertyPort *port1 = static_cast<LibertyPort*>(ports_[0]);
LibertyPort *port2 = static_cast<LibertyPort*>(ports_[1]);
if (port1->direction()->isInput()
&& port2->direction()->isOutput()) {
input = port1;
output = port2;
}
else {
input = port2;
output = port1;
}
}

unsigned
LibertyCell::addTimingArcSet(TimingArcSet *arc_set)
{
Expand Down Expand Up @@ -1427,6 +1457,20 @@ LibertyCell::setCornerCell(LibertyCell *corner_cell,

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

LibertyCell *
LibertyCell::higherDrive() const
{
liberty_library_->ensureEquivCells();
return higher_drive_;
}

LibertyCell *
LibertyCell::lowerDrive() const
{
liberty_library_->ensureEquivCells();
return lower_drive_;
}

void
LibertyCell::setHigherDrive(LibertyCell *cell)
{
Expand Down
Loading

0 comments on commit 53df947

Please sign in to comment.