This commit is contained in:
James Cherry 2019-03-12 17:25:53 -07:00
parent dae85f08e0
commit e5c9bc43fd
177 changed files with 4678 additions and 4655 deletions

View File

@ -16,7 +16,7 @@
cmake_minimum_required (VERSION 3.9)
project(STA VERSION 2.0.8)
project(STA VERSION 2.0.10)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_CXX_STANDARD 11)
@ -186,16 +186,12 @@ set(STA_SOURCE
search/WorstSlack.cc
search/WritePathSpice.cc
util/Condition.cc
util/Debug.cc
util/Error.cc
util/Fuzzy.cc
util/Machine.cc
util/MinMax.cc
util/Mutex.cc
util/PatternMatch.cc
util/Pthread.cc
util/ReadWriteLock.cc
util/Report.cc
util/ReportStd.cc
util/ReportTcl.cc
@ -203,10 +199,6 @@ set(STA_SOURCE
util/StringSeq.cc
util/StringSet.cc
util/StringUtil.cc
util/Thread.cc
util/ThreadException.cc
util/ThreadPool.cc
util/ThreadWorker.cc
util/TokenParser.cc
verilog/VerilogReader.cc
@ -353,14 +345,13 @@ set(STA_HEADERS
search/WorstSlack.hh
search/WritePathSpice.hh
util/Condition.hh
util/Debug.hh
util/DisallowCopyAssign.hh
util/EnumNameMap.hh
util/Error.hh
util/Fuzzy.hh
util/Hash.hh
util/HashSet.hh
util/HashMap.hh
util/Iterator.hh
util/Machine.hh
util/Map.hh
@ -368,9 +359,7 @@ set(STA_HEADERS
util/Mutex.hh
util/ObjectIndex.hh
util/PatternMatch.hh
util/Pthread.hh
util/Pool.hh
util/ReadWriteLock.hh
util/Report.hh
util/ReportStd.hh
util/ReportTcl.hh
@ -379,13 +368,10 @@ set(STA_HEADERS
util/StringSeq.hh
util/StringSet.hh
util/StringUtil.hh
util/Thread.hh
util/ThreadException.hh
util/ThreadForEach.hh
util/ThreadPool.hh
util/ThreadWorker.hh
util/TokenParser.hh
util/UnorderedMap.hh
util/UnorderedSet.hh
util/Vector.hh
util/Zlib.hh
@ -431,15 +417,6 @@ set(STA_SWIG_FILES
#
################################################################
# Pthreads
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads)
set(PTHREADS ${CMAKE_USE_PTHREADS_INIT})
if (PTHREADS)
message(STATUS "Found pthreads")
endif()
# Zlib
include(FindZLIB)
# translate cmake bool to ifdef bool
@ -458,11 +435,12 @@ if("${CUDD}" STREQUAL "")
set(CUDD $ENV{CUDD})
endif()
if("${CUDD}" STREQUAL "")
if("${CUDD}" STREQUAL "" OR "${CUDD}" STREQUAL "0")
set(CUDD_INCLUDE "")
set(CUDD_LIB "")
set(CUDD_FOUND FALSE)
set(CUDD 0)
message(STATUS "CUDD library: not found")
else()
set(CUDD_INCLUDE ${CUDD}/include)
find_library(CUDD_LIB NAMES cudd PATHS ${CUDD}/lib)
@ -476,7 +454,7 @@ endif()
if("${SSTA}" STREQUAL "")
set(SSTA 0)
endif()
message(STATUS "Enable SSTA: ${SSTA}")
message(STATUS "SSTA: ${SSTA}")
# configure a header file to pass some of the CMake settins
configure_file(${STA_HOME}/util/StaConfig.hh.cmake
@ -689,7 +667,6 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${STA_HOME}/app)
add_executable(sta app/Main.cc)
target_link_libraries(sta
OpenSTA
Threads::Threads
${TCL_LIB}
${CUDD_LIB}
)
@ -701,12 +678,18 @@ message(STATUS "STA executable: ${STA_HOME}/app/sta")
set(STA_COMPILE_OPTIONS -Wall -Wcast-qual -Wunused-parameter -Wno-deprecated-register -Wredundant-decls)
# Compiler specific options.
if (CMAKE_CXX_COMPILER_ID MATCHES AppleClang|Clang|GNU)
target_compile_options(OpenSTA PUBLIC ${STA_COMPILE_OPTIONS})
target_compile_options(sta PUBLIC ${STA_COMPILE_OPTIONS})
message(STATUS "Compiler options: ${STA_COMPILE_OPTIONS}")
endif()
# g++ still needs -pthreads when using std::thread
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_link_libraries(sta -pthread)
endif()
################################################################
# Install
# cmake .. -DCMAKE_INSTALL_PREFIX=<prefix_path>

View File

@ -108,9 +108,8 @@ make
make install
```
The Zlib library is an optional. If CMake or the configure script
finds libz, OpenSTA can read Verilog, SDF, SPF, and SPEF files
compressed with gzip.
The Zlib library is an optional. If CMake finds libz, OpenSTA can
read Verilog, SDF, SPF, and SPEF files compressed with gzip.
### Installing with CMake
@ -163,11 +162,6 @@ files in the build directory.
### Installing on Windoz
The Win32 API does not natively support the pthreads API. The
pthreads-win32 package is one way to get support for pthreads for 32
bit builds. It is available from [pthreads](www.sourceware.org/pthreads-win32).
If Cmake does not find `pthreads.h` the build proceeds without thread support.
Use a .bat file to start a cygwin shell that has its path set to
support the Microcruft cl compiler by calling the vsvars32.bat script
from the Visual C++ installation.

View File

@ -37,7 +37,7 @@ class Pin;
class arnoldi1
{
public:
arnoldi1() { order=0; n=0; d=NULL; e=NULL; U=NULL; ctot=0.0; sqc=0.0; }
arnoldi1() { order=0; n=0; d=nullptr; e=nullptr; U=nullptr; ctot=0.0; sqc=0.0; }
~arnoldi1();
double elmore(int term_index);

View File

@ -269,7 +269,7 @@ ArnoldiDelayCalc::findParasitic(const Pin *drvr_pin,
Parasitic *&parasitic,
bool &delete_at_finish)
{
parasitic = NULL;
parasitic = nullptr;
delete_at_finish = false;
// set_load has precidence over parasitics.
if (!sdc_->drvrPinHasWireCap(drvr_pin)) {
@ -280,7 +280,7 @@ ArnoldiDelayCalc::findParasitic(const Pin *drvr_pin,
Parasitic *parasitic_network =
parasitics_->findParasiticNetwork(drvr_pin, parasitic_ap);
bool delete_parasitic_network = false;
if (parasitic_network == NULL) {
if (parasitic_network == nullptr) {
Wireload *wireload = sdc_->wireloadDefaulted(cnst_min_max);
if (wireload) {
float pin_cap, wire_cap, fanout;
@ -318,7 +318,7 @@ ArnoldiDelayCalc::inputPortDelay(const Pin *drvr_pin,
const DcalcAnalysisPt *dcalc_ap)
{
RCDelayCalc::inputPortDelay(drvr_pin, in_slew, tr, parasitic, dcalc_ap);
rcmodel_ = NULL;
rcmodel_ = nullptr;
_delayV[0] = 0.0;
_slewV[0] = in_slew;

View File

@ -35,7 +35,7 @@
namespace sta {
rcmodel::rcmodel() :
pinV(NULL)
pinV(nullptr)
{
}
@ -188,7 +188,7 @@ ArnoldiReduce::loadWork()
ts_edge *e;
int tindex;
for (p = p0; p!=pend; p++) {
p->node_ = NULL;
p->node_ = nullptr;
p->eN = 0;
p->is_term = false;
}
@ -323,7 +323,7 @@ ArnoldiReduce::makeRcmodelDrv()
makeRcmodelDfs(pdrv);
getRC();
if (ctot_ < 1e-22) // 1e-10ps
return NULL;
return nullptr;
setTerms(pdrv);
makeRcmodelFromTs();
rcmodel *mod = makeRcmodelFromW();
@ -350,7 +350,7 @@ ArnoldiReduce::makeRcmodelDfs(ts_point *pdrv)
stackV[0] = e = pdrv->eV[0];
ts_orient(pdrv,e);
pdrv->visited = 1;
pdrv->in_edge = NULL;
pdrv->in_edge = nullptr;
pdrv->ts = 0;
ts_ordV[0] = pdrv-p0;
ts_pordV[0] = pdrv;
@ -620,7 +620,7 @@ ArnoldiReduce::makeRcmodelFromW()
int totd = order + order - 1 + order*n;
mod->d = (double *)malloc(totd*sizeof(double));
if (order>1) mod->e = mod->d + order;
else mod->e = NULL;
else mod->e = nullptr;
mod->U = (double **)malloc(order*sizeof(double*));
mod->U[0] = mod->d + order + order - 1;
for (h=1;h<order;h++) mod->U[h]=mod->U[0] + h*n;

View File

@ -28,7 +28,7 @@ namespace sta {
typedef Map<const char*, MakeArcDelayCalc, CharPtrLess> DelayCalcMap;
static DelayCalcMap *delay_calcs = NULL;
static DelayCalcMap *delay_calcs = nullptr;
void
registerDelayCalcs()
@ -45,7 +45,7 @@ void
registerDelayCalc(const char *name,
MakeArcDelayCalc maker)
{
if (delay_calcs == NULL)
if (delay_calcs == nullptr)
delay_calcs = new DelayCalcMap;
(*delay_calcs)[name] = maker;
}
@ -54,7 +54,7 @@ void
deleteDelayCalcs()
{
delete delay_calcs;
delay_calcs = NULL;
delay_calcs = nullptr;
}
ArcDelayCalc *
@ -65,7 +65,7 @@ makeDelayCalc(const char *name,
if (maker)
return maker(sta);
else
return NULL;
return nullptr;
}
bool

View File

@ -53,20 +53,12 @@ static const double tiny_double = 1.0e-20;
static const int find_root_max_iter = 20;
// Indices of Newton-Raphson parameter vector.
enum {
dmp_param_t0,
dmp_param_dt,
dmp_param_ceff
};
enum DmpParam { t0, dt, ceff };
static const char *dmp_param_index_strings[] = {"t0", "dt", "Ceff"};
// Indices of Newton-Raphson function value vector.
enum {
dmp_func_y20,
dmp_func_y50,
dmp_func_ipi
};
enum DmpFunc { y20, y50, ipi };
static const char *dmp_func_index_strings[] = {"y20", "y50", "Ipi"};
@ -330,7 +322,7 @@ DmpAlg::init(const LibertyLibrary *drvr_library,
}
// Find Ceff, delta_t and t0 for the driver.
// Caller must initialize/retrieve x_[dmp_param_ceff] because
// Caller must initialize/retrieve x_[DmpParam::ceff] because
// order 2 eqns don't have a ceff eqn.
// Return true if successful.
bool
@ -340,17 +332,17 @@ DmpAlg::findDriverParams(double &ceff)
gateDelays(ceff, t_vth, t_vl, slew);
double dt = slew / (vh_ - vl_);
double t0 = t_vth + log(1.0 - vth_) * rd_ * ceff - vth_ * dt;
x_[dmp_param_dt] = dt;
x_[dmp_param_t0] = t0;
x_[DmpParam::dt] = dt;
x_[DmpParam::t0] = t0;
const char *nr_error;
if (newtonRaphson(100, x_, nr_order_, driver_param_tol, evalDmpEqnsState,
this, fvec_, fjac_, index_, p_, scale_, nr_error)) {
t0_ = x_[dmp_param_t0];
dt_ = x_[dmp_param_dt];
t0_ = x_[DmpParam::t0];
dt_ = x_[DmpParam::dt];
debugPrint3(debug_, "delay_calc", 3, " t0 = %s dt = %s ceff = %s\n",
units_->timeUnit()->asString(t0_),
units_->timeUnit()->asString(dt_),
units_->capacitanceUnit()->asString(x_[dmp_param_ceff]));
units_->capacitanceUnit()->asString(x_[DmpParam::ceff]));
if (debug_->check("delay_calc", 4))
showVo();
return true;
@ -929,7 +921,7 @@ DmpPi::gateDelaySlew(double &delay,
double &slew)
{
if (findDriverParamsPi()) {
ceff_ = x_[dmp_param_ceff];
ceff_ = x_[DmpParam::ceff];
driver_valid_ = true;
double table_slew;
// Table gate delays are more accurate than using Vo waveform delay
@ -955,8 +947,8 @@ bool
DmpPi::findDriverParamsPi()
{
double ceff = c1_ + c2_;
x_[dmp_param_ceff] = ceff;
return findDriverParams(x_[dmp_param_ceff]);
x_[DmpParam::ceff] = ceff;
return findDriverParams(x_[DmpParam::ceff]);
}
// Given x_ as a vector of input parameters, fill fvec_ with the
@ -964,9 +956,9 @@ DmpPi::findDriverParamsPi()
bool
DmpPi::evalDmpEqns()
{
double t0 = x_[dmp_param_t0];
double dt = x_[dmp_param_dt];
double ceff = x_[dmp_param_ceff];
double t0 = x_[DmpParam::t0];
double dt = x_[DmpParam::dt];
double ceff = x_[DmpParam::ceff];
if (ceff > (c1_ + c2_) || ceff < 0.0)
return false;
@ -988,29 +980,29 @@ DmpPi::evalDmpEqns()
double y_t_vth = y(t_vth, t0, dt, ceff);
// y20 in the paper. Match Vl.
double y_t_vl = y(t_vl, t0, dt, ceff);
fvec_[dmp_func_ipi] = ipiIceff(t0, dt, ceff_time, ceff);
fvec_[dmp_func_y50] = y_t_vth - vth_;
fvec_[dmp_func_y20] = y_t_vl - vl_;
fjac_[dmp_func_ipi][dmp_param_t0] = 0.0;
fjac_[dmp_func_ipi][dmp_param_dt] =
fvec_[DmpFunc::ipi] = ipiIceff(t0, dt, ceff_time, ceff);
fvec_[DmpFunc::y50] = y_t_vth - vth_;
fvec_[DmpFunc::y20] = y_t_vl - vl_;
fjac_[DmpFunc::ipi][DmpParam::t0] = 0.0;
fjac_[DmpFunc::ipi][DmpParam::dt] =
(-A_ * dt + B_ * dt * exp_p1_dt - (2 * B_ / p1_) * (1.0 - exp_p1_dt)
+ D_ * dt * exp_p2_dt - (2 * D_ / p2_) * (1.0 - exp_p2_dt)
+ rd_ * ceff * (dt + dt * exp_dt_rd_ceff
- 2 * rd_ * ceff * (1.0 - exp_dt_rd_ceff)))
/ (rd_ * dt * dt * dt);
fjac_[dmp_func_ipi][dmp_param_ceff] =
fjac_[DmpFunc::ipi][DmpParam::ceff] =
(2 * rd_ * ceff - dt - (2 * rd_ * ceff + dt) * exp(-dt / (rd_ * ceff)))
/ (dt * dt);
dy(t_vl, t0, dt, ceff,
fjac_[dmp_func_y20][dmp_param_t0],
fjac_[dmp_func_y20][dmp_param_dt],
fjac_[dmp_func_y20][dmp_param_ceff]);
fjac_[DmpFunc::y20][DmpParam::t0],
fjac_[DmpFunc::y20][DmpParam::dt],
fjac_[DmpFunc::y20][DmpParam::ceff]);
dy(t_vth, t0, dt, ceff,
fjac_[dmp_func_y50][dmp_param_t0],
fjac_[dmp_func_y50][dmp_param_dt],
fjac_[dmp_func_y50][dmp_param_ceff]);
fjac_[DmpFunc::y50][DmpParam::t0],
fjac_[DmpFunc::y50][DmpParam::dt],
fjac_[DmpFunc::y50][DmpParam::ceff]);
if (debug_->check("delay_calc", 4)) {
showX();
@ -1099,17 +1091,17 @@ DmpOnePole::DmpOnePole(StaState *sta) :
bool
DmpOnePole::evalDmpEqns()
{
double t0 = x_[dmp_param_t0];
double dt = x_[dmp_param_dt];
double t0 = x_[DmpParam::t0];
double dt = x_[DmpParam::dt];
double t_vth, t_vl, ignore, dummy;
gateDelays(ceff_, t_vth, t_vl, ignore);
if (dt <= 0.0)
dt = x_[dmp_param_dt] = (t_vl - t_vth) / 100;
dt = x_[DmpParam::dt] = (t_vl - t_vth) / 100;
fvec_[dmp_func_y50] = y(t_vth, t0, dt, ceff_) - vth_;
fvec_[dmp_func_y20] = y(t_vl, t0, dt, ceff_) - vl_;
fvec_[DmpFunc::y50] = y(t_vth, t0, dt, ceff_) - vth_;
fvec_[DmpFunc::y20] = y(t_vl, t0, dt, ceff_) - vl_;
if (debug_->check("delay_calc", 4)) {
showX();
@ -1117,13 +1109,13 @@ DmpOnePole::evalDmpEqns()
}
dy(t_vl, t0, dt, ceff_,
fjac_[dmp_func_y20][dmp_param_t0],
fjac_[dmp_func_y20][dmp_param_dt],
fjac_[DmpFunc::y20][DmpParam::t0],
fjac_[DmpFunc::y20][DmpParam::dt],
dummy);
dy(t_vth, t0, dt, ceff_,
fjac_[dmp_func_y50][dmp_param_t0],
fjac_[dmp_func_y50][dmp_param_dt],
fjac_[DmpFunc::y50][DmpParam::t0],
fjac_[DmpFunc::y50][DmpParam::dt],
dummy);
if (debug_->check("delay_calc", 4)) {
@ -1560,7 +1552,7 @@ DmpCeffDelayCalc::DmpCeffDelayCalc(StaState *sta) :
dmp_cap_(new DmpCap(sta)),
dmp_pi_(new DmpPi(sta)),
dmp_zero_c2_(new DmpZeroC2(sta)),
dmp_alg_(NULL)
dmp_alg_(nullptr)
{
}
@ -1578,7 +1570,7 @@ DmpCeffDelayCalc::inputPortDelay(const Pin *port_pin,
Parasitic *parasitic,
const DcalcAnalysisPt *dcalc_ap)
{
dmp_alg_ = NULL;
dmp_alg_ = nullptr;
input_port_ = true;
RCDelayCalc::inputPortDelay(port_pin, in_slew, tr, parasitic, dcalc_ap);
}

View File

@ -206,7 +206,7 @@ DmpCeffTwoPoleDelayCalc::findParasitic(const Pin *drvr_pin,
Parasitic *&parasitic,
bool &delete_at_finish)
{
parasitic = NULL;
parasitic = nullptr;
delete_at_finish = false;
// set_load has precidence over parasitics.
if (!sdc_->drvrPinHasWireCap(drvr_pin)) {
@ -216,7 +216,7 @@ DmpCeffTwoPoleDelayCalc::findParasitic(const Pin *drvr_pin,
const MinMax *cnst_min_max = dcalc_ap->constraintMinMax();
// Prefer PiPoleResidue.
parasitic = parasitics_->findPiPoleResidue(drvr_pin, tr, parasitic_ap);
if (parasitic == NULL) {
if (parasitic == nullptr) {
Parasitic *parasitic_network =
parasitics_->findParasiticNetwork(drvr_pin, parasitic_ap);
if (parasitic_network)
@ -227,11 +227,11 @@ DmpCeffTwoPoleDelayCalc::findParasitic(const Pin *drvr_pin,
parasitic_ap);
delete_at_finish = true;
}
if (parasitic == NULL)
if (parasitic == nullptr)
parasitic = parasitics_->findPiElmore(drvr_pin, tr, parasitic_ap);
if (parasitic == NULL)
if (parasitic == nullptr)
parasitic = parasitics_->findLumpedElmore(drvr_pin, tr, parasitic_ap);
if (parasitic == NULL) {
if (parasitic == nullptr) {
Wireload *wireload = sdc_->wireloadDefaulted(cnst_min_max);
if (wireload) {
float pin_cap, wire_cap, fanout;
@ -343,7 +343,7 @@ DmpCeffTwoPoleDelayCalc::loadDelay(Parasitic *pole_residue,
{
ComplexFloat pole2, residue2;
parasitics_->poleResidue(pole_residue, 1, pole2, residue2);
if (!delayFuzzyZero(drvr_slew_)
if (!fuzzyZero(drvr_slew_)
&& pole2.imag() == 0.0
&& residue2.imag() == 0.0) {
double p2 = pole2.real();

View File

@ -126,7 +126,7 @@ GraphDelayCalc::minPulseWidth(const Pin *pin,
LibertyPort *port = network_->libertyPort(pin);
if (port) {
Instance *inst = network_->instance(pin);
Pvt *pvt = inst ? sdc_->pvt(inst, min_max) : NULL;
Pvt *pvt = inst ? sdc_->pvt(inst, min_max) : nullptr;
OperatingConditions *op_cond=sdc_->operatingConditions(min_max);
port->minPulseWidth(hi_low, op_cond, pvt, min_width, exists);
}
@ -161,7 +161,7 @@ GraphDelayCalc::minPeriod(const Pin *pin,
// Liberty library.
Instance *inst = network_->instance(pin);
OperatingConditions *op_cond = sdc_->operatingConditions(min_max);
Pvt *pvt = inst ? sdc_->pvt(inst, min_max) : NULL;
Pvt *pvt = inst ? sdc_->pvt(inst, min_max) : nullptr;
port->minPeriod(op_cond, pvt, min_period, exists);
}
}

View File

@ -17,6 +17,7 @@
#include "Machine.hh"
#include "Debug.hh"
#include "Stats.hh"
#include "Mutex.hh"
#include "MinMax.hh"
#include "PortDirection.hh"
#include "TimingRole.hh"
@ -92,11 +93,11 @@ private:
};
MultiDrvrNet::MultiDrvrNet(VertexSet *drvrs) :
dcalc_drvr_(NULL),
dcalc_drvr_(nullptr),
drvrs_(drvrs),
parallel_delays_(NULL),
parallel_slews_(NULL),
net_caps_(NULL),
parallel_delays_(nullptr),
parallel_slews_(nullptr),
net_caps_(nullptr),
delays_valid_(false)
{
}
@ -217,13 +218,13 @@ MultiDrvrNet::setDcalcDrvr(Vertex *drvr)
GraphDelayCalc1::GraphDelayCalc1(StaState *sta) :
GraphDelayCalc(sta),
observer_(NULL),
observer_(nullptr),
delays_seeded_(false),
incremental_(false),
search_pred_(new SearchPred1(sta)),
search_non_latch_pred_(new SearchPredNonLatch2(sta)),
clk_pred_(new ClkTreeSearchPred(sta)),
iter_(new BfsFwdIterator(bfs_dcalc, search_non_latch_pred_, sta)),
iter_(new BfsFwdIterator(BfsIndex::dcalc, search_non_latch_pred_, sta)),
multi_drvr_nets_found_(false),
incremental_delay_tolerance_(0.0)
{
@ -525,7 +526,7 @@ GraphDelayCalc1::makeMultiDrvrNet(PinSet &drvr_pins)
VertexSet *drvr_vertices = new VertexSet;
MultiDrvrNet *multi_drvr = new MultiDrvrNet(drvr_vertices);
Level max_drvr_level = 0;
Vertex *max_drvr = NULL;
Vertex *max_drvr = nullptr;
PinSet::Iterator pin_iter(drvr_pins);
while (pin_iter.hasNext()) {
Pin *pin = pin_iter.next();
@ -535,7 +536,7 @@ GraphDelayCalc1::makeMultiDrvrNet(PinSet &drvr_pins)
multi_drvr_net_map_[drvr_vertex] = multi_drvr;
drvr_vertices->insert(drvr_vertex);
Level drvr_level = drvr_vertex->level();
if (max_drvr == NULL
if (max_drvr == nullptr
|| drvr_level > max_drvr_level)
max_drvr = drvr_vertex;
}
@ -606,7 +607,7 @@ GraphDelayCalc1::seedDrvrSlew(Vertex *drvr_vertex,
drive->driveCell(tr, cnst_min_max, drvr_cell, from_port,
from_slews, to_port);
if (drvr_cell) {
if (from_port == NULL)
if (from_port == nullptr)
from_port = driveCellDefaultFromPort(drvr_cell, to_port);
findInputDriverDelay(drvr_cell, drvr_pin, drvr_vertex, tr,
from_port, from_slews, to_port, dcalc_ap);
@ -747,7 +748,7 @@ GraphDelayCalc1::driveCellDefaultFromPort(LibertyCell *cell,
if (arc_set->to() == to_port) {
LibertyPort *set_from_port = arc_set->from();
int set_from_port_index = findPortIndex(cell, set_from_port);
if (from_port == NULL
if (from_port == nullptr
|| set_from_port_index < from_port_index) {
from_port = set_from_port;
from_port_index = set_from_port_index;
@ -904,9 +905,8 @@ GraphDelayCalc1::enqueueTimingChecksEdges(Vertex *vertex)
{
if (vertex->hasChecks()
|| vertex->isCheckClk()) {
check_vertices_lock_.lock();
UniqueLock lock(check_vertices_lock_);
invalid_checks_.insert(vertex);
check_vertices_lock_.unlock();
}
}
@ -951,7 +951,7 @@ GraphDelayCalc1::findDriverDelays(Vertex *drvr_vertex,
return delay_changed;
}
else
return findDriverDelays1(drvr_vertex, true, NULL, arc_delay_calc);
return findDriverDelays1(drvr_vertex, true, nullptr, arc_delay_calc);
}
bool
@ -1021,7 +1021,7 @@ GraphDelayCalc1::findDriverEdgeDelays(LibertyCell *drvr_cell,
while (ap_iter.hasNext()) {
DcalcAnalysisPt *dcalc_ap = ap_iter.next();
const Pvt *pvt = sdc_->pvt(drvr_inst, dcalc_ap->constraintMinMax());
if (pvt == NULL)
if (pvt == nullptr)
pvt = dcalc_ap->operatingConditions();
TimingArcSetArcIterator arc_iter(arc_set);
while (arc_iter.hasNext()) {
@ -1069,7 +1069,7 @@ GraphDelayCalc1::loadCap(const Pin *drvr_pin,
bool delete_parasitic;
arc_delay_calc_->findParasitic(drvr_pin, drvr_tr, dcalc_ap,
drvr_parasitic, delete_parasitic);
float load_cap = loadCap(drvr_pin, NULL, drvr_parasitic, drvr_tr, dcalc_ap);
float load_cap = loadCap(drvr_pin, nullptr, drvr_parasitic, drvr_tr, dcalc_ap);
arc_delay_calc_->finish(drvr_pin, drvr_tr, dcalc_ap,
drvr_parasitic, delete_parasitic);
return load_cap;
@ -1081,7 +1081,7 @@ GraphDelayCalc1::loadCap(const Pin *drvr_pin,
const TransRiseFall *tr,
const DcalcAnalysisPt *dcalc_ap) const
{
return loadCap(drvr_pin, NULL, drvr_parasitic, tr, dcalc_ap);
return loadCap(drvr_pin, nullptr, drvr_parasitic, tr, dcalc_ap);
}
float
@ -1283,7 +1283,7 @@ GraphDelayCalc1::findArcDelay(LibertyCell *drvr_cell,
// Merge slews.
const Slew &drvr_slew = graph_->slew(drvr_vertex, drvr_tr, ap_index);
const MinMax *slew_min_max = dcalc_ap->slewMinMax();
if (delayFuzzyGreater(gate_slew, drvr_slew, dcalc_ap->slewMinMax())
if (fuzzyGreater(gate_slew, drvr_slew, dcalc_ap->slewMinMax())
&& !drvr_vertex->slewAnnotated(drvr_tr, slew_min_max))
graph_->setSlew(drvr_vertex, drvr_tr, ap_index, gate_slew);
if (!graph_->arcDelayAnnotated(edge, arc, ap_index)) {
@ -1493,7 +1493,7 @@ GraphDelayCalc1::annotateLoadDelays(Vertex *drvr_vertex,
else {
const Slew &slew = graph_->slew(load_vertex, drvr_tr, ap_index);
if (!merge
|| delayFuzzyGreater(load_slew, slew, slew_min_max))
|| fuzzyGreater(load_slew, slew, slew_min_max))
graph_->setSlew(load_vertex, drvr_tr, ap_index, load_slew);
}
}
@ -1506,7 +1506,7 @@ GraphDelayCalc1::annotateLoadDelays(Vertex *drvr_vertex,
Delay wire_delay_extra = extra_delay + wire_delay;
const MinMax *delay_min_max = dcalc_ap->delayMinMax();
if (!merge
|| delayFuzzyGreater(wire_delay_extra, delay, delay_min_max)) {
|| fuzzyGreater(wire_delay_extra, delay, delay_min_max)) {
graph_->setWireArcDelay(wire_edge, drvr_tr, ap_index,
wire_delay_extra);
if (observer_)
@ -1583,7 +1583,7 @@ GraphDelayCalc1::findCheckEdgeDelays(Edge *edge,
DcalcAPIndex ap_index = dcalc_ap->index();
if (!graph_->arcDelayAnnotated(edge, arc, ap_index)) {
const Pvt *pvt = sdc_->pvt(inst,dcalc_ap->constraintMinMax());
if (pvt == NULL)
if (pvt == nullptr)
pvt = dcalc_ap->operatingConditions();
const Slew &from_slew = checkEdgeClkSlew(from_vertex, from_tr,
dcalc_ap);
@ -1650,7 +1650,7 @@ bool
GraphDelayCalc1::findIdealClks(Vertex *vertex)
{
const Pin *pin = vertex->pin();
ClockSet *ideal_clks = NULL;
ClockSet *ideal_clks = nullptr;
if (sdc_->isVertexPinClock(pin)) {
// Seed ideal clocks pins.
if (!sdc_->isPropagatedClock(pin)) {
@ -1659,7 +1659,7 @@ GraphDelayCalc1::findIdealClks(Vertex *vertex)
while (clk_iter.hasNext()) {
Clock *clk = clk_iter.next();
if (!clk->isPropagated()) {
if (ideal_clks == NULL) {
if (ideal_clks == nullptr) {
ideal_clks = new ClockSet;
debugPrint1(debug_, "ideal_clks", 1, " %s\n",
vertex->name(sdc_network_));
@ -1682,7 +1682,7 @@ GraphDelayCalc1::findIdealClks(Vertex *vertex)
ClockSet::ConstIterator from_clk_iter(from_clks);
while (from_clk_iter.hasNext()) {
Clock *from_clk = from_clk_iter.next();
if (ideal_clks == NULL) {
if (ideal_clks == nullptr) {
ideal_clks = new ClockSet;
debugPrint1(debug_, "ideal_clks", 1, " %s\n",
vertex->name(sdc_network_));
@ -1709,7 +1709,7 @@ GraphDelayCalc1::setIdealClks(const Vertex *vertex,
ClockSet *clks)
{
bool changed = false;
ideal_clks_map_lock_.lock();
UniqueLock lock(ideal_clks_map_lock_);
ClockSet *clks1 = ideal_clks_map_.findKey(vertex);
if (ClockSet::equal(clks, clks1))
delete clks;
@ -1718,16 +1718,14 @@ GraphDelayCalc1::setIdealClks(const Vertex *vertex,
ideal_clks_map_[vertex] = clks;
changed = true;
}
ideal_clks_map_lock_.unlock();
return changed;
}
ClockSet *
GraphDelayCalc1::idealClks(const Vertex *vertex)
{
ideal_clks_map_lock_.lock();
UniqueLock lock(ideal_clks_map_lock_);
ClockSet *clks = ideal_clks_map_.findKey(vertex);
ideal_clks_map_lock_.unlock();
return clks;
}
@ -1752,7 +1750,7 @@ GraphDelayCalc1::ceff(Edge *edge,
TimingArcSet *arc_set = edge->timingArcSet();
float ceff = 0.0;
const Pvt *pvt = sdc_->pvt(inst, dcalc_ap->constraintMinMax());
if (pvt == NULL)
if (pvt == nullptr)
pvt = dcalc_ap->operatingConditions();
TransRiseFall *from_tr = arc->fromTrans()->asRiseFall();
TransRiseFall *to_tr = arc->toTrans()->asRiseFall();
@ -1806,7 +1804,7 @@ GraphDelayCalc1::reportDelayCalc(Edge *edge,
string *result = new string;
DcalcAnalysisPt *dcalc_ap = corner->findDcalcAnalysisPt(min_max);
const Pvt *pvt = sdc_->pvt(inst, dcalc_ap->constraintMinMax());
if (pvt == NULL)
if (pvt == nullptr)
pvt = dcalc_ap->operatingConditions();
TransRiseFall *from_tr = arc->fromTrans()->asRiseFall();
TransRiseFall *to_tr = arc->toTrans()->asRiseFall();
@ -1831,7 +1829,7 @@ GraphDelayCalc1::reportDelayCalc(Edge *edge,
int slew_index = dcalc_ap->checkDataSlewIndex();
const Slew &to_slew = graph_->slew(to_vertex, to_tr, slew_index);
bool from_ideal_clk = isIdealClk(from_vertex);
const char *from_slew_annotation = from_ideal_clk ? " (ideal clock)" : NULL;
const char *from_slew_annotation = from_ideal_clk ? " (ideal clock)" : nullptr;
arc_delay_calc_->reportCheckDelay(cell, arc, from_slew, from_slew_annotation,
to_slew, related_out_cap, pvt, dcalc_ap,
digits, result);

View File

@ -17,7 +17,7 @@
#ifndef STA_GRAPH_DELAY_CALC1_H
#define STA_GRAPH_DELAY_CALC1_H
#include "Mutex.hh"
#include <mutex>
#include "GraphDelayCalc.hh"
namespace sta {
@ -222,7 +222,7 @@ protected:
VertexSet invalid_delays_;
// Vertices with invalid -from/-to timing checks.
VertexSet invalid_checks_;
Mutex check_vertices_lock_;
std::mutex check_vertices_lock_;
SearchPred *search_pred_;
SearchPred *search_non_latch_pred_;
SearchPred *clk_pred_;
@ -233,7 +233,7 @@ protected:
// delays to be recomputed during incremental delay calculation.
float incremental_delay_tolerance_;
VertexIdealClksMap ideal_clks_map_;
Mutex ideal_clks_map_lock_;
std::mutex ideal_clks_map_lock_;
friend class FindVertexDelays;
friend class MultiDrvrNet;

View File

@ -54,16 +54,16 @@ LumpedCapDelayCalc::findParasitic(const Pin *drvr_pin,
Parasitic *&parasitic,
bool &delete_at_finish)
{
parasitic = NULL;
parasitic = nullptr;
delete_at_finish = false;
// set_load has precidence over parasitics.
if (!sdc_->drvrPinHasWireCap(drvr_pin)) {
const ParasiticAnalysisPt *parasitic_ap = dcalc_ap->parasiticAnalysisPt();
// Prefer capacitive load.
parasitic = parasitics_->findLumpedElmore(drvr_pin, tr, parasitic_ap);
if (parasitic == NULL)
if (parasitic == nullptr)
parasitic = parasitics_->findPiElmore(drvr_pin, tr, parasitic_ap);
if (parasitic == NULL) {
if (parasitic == nullptr) {
parasitic = parasitics_->findParasiticNetwork(drvr_pin, parasitic_ap);
if (parasitic) {
parasitic = parasitics_->reduceToPiElmore(parasitic, drvr_pin, tr,
@ -74,7 +74,7 @@ LumpedCapDelayCalc::findParasitic(const Pin *drvr_pin,
delete_at_finish = true;
}
}
if (parasitic == NULL) {
if (parasitic == nullptr) {
const MinMax *cnst_min_max = dcalc_ap->constraintMinMax();
Wireload *wireload = sdc_->wireloadDefaulted(cnst_min_max);
if (wireload) {

View File

@ -43,7 +43,7 @@ RCDelayCalc::findParasitic(const Pin *drvr_pin,
Parasitic *&parasitic,
bool &delete_at_finish)
{
parasitic = NULL;
parasitic = nullptr;
delete_at_finish = false;
// set_load has precidence over parasitics.
if (!sdc_->drvrPinHasWireCap(drvr_pin)) {
@ -53,7 +53,7 @@ RCDelayCalc::findParasitic(const Pin *drvr_pin,
const ParasiticAnalysisPt *parasitic_ap = dcalc_ap->parasiticAnalysisPt();
// Prefer PiElmore.
parasitic = parasitics_->findPiElmore(drvr_pin, tr, parasitic_ap);
if (parasitic == NULL) {
if (parasitic == nullptr) {
Parasitic *parasitic_network =
parasitics_->findParasiticNetwork(drvr_pin, parasitic_ap);
if (parasitic_network) {
@ -63,9 +63,9 @@ RCDelayCalc::findParasitic(const Pin *drvr_pin,
delete_at_finish = true;
}
}
if (parasitic == NULL)
if (parasitic == nullptr)
parasitic = parasitics_->findLumpedElmore(drvr_pin, tr, parasitic_ap);
if (parasitic == NULL) {
if (parasitic == nullptr) {
Wireload *wireload = sdc_->wireloadDefaulted(cnst_min_max);
if (wireload) {
float pin_cap, wire_cap, fanout;
@ -92,7 +92,7 @@ RCDelayCalc::inputPortDelay(const Pin *,
drvr_parasitic_ = parasitic;
drvr_slew_ = in_slew;
drvr_tr_ = tr;
drvr_cell_ = NULL;
drvr_cell_ = nullptr;
drvr_library_ = network_->defaultLibertyLibrary();
multi_drvr_slew_factor_ = 1.0F;
}

View File

@ -46,7 +46,7 @@ UnitDelayCalc::findParasitic(const Pin *,
bool &delete_at_finish)
{
// No parasitics are required for this delay calculator.
parasitic = NULL;
parasitic = nullptr;
delete_at_finish = false;
}

Binary file not shown.

Binary file not shown.

View File

@ -27,7 +27,6 @@
#include "DelayFloat.hh"
#endif
// API common to DelayFloat and DelayNormal2.
namespace sta {
typedef Delay ArcDelay;

View File

@ -49,72 +49,20 @@ delayIsInitValue(const Delay &delay,
}
bool
delayFuzzyZero(const Delay &delay)
{
return fuzzyZero(delay);
}
bool
delayFuzzyEqual(const Delay &delay1,
const Delay &delay2)
{
return fuzzyEqual(delay1, delay2);
}
bool
delayFuzzyLess(const Delay &delay1,
const Delay &delay2)
{
return fuzzyLess(delay1, delay2);
}
bool
delayFuzzyLessEqual(const Delay &delay1,
const Delay &delay2)
{
return fuzzyLessEqual(delay1, delay2);
}
bool
delayFuzzyLessEqual(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max)
fuzzyGreater(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max)
{
if (min_max == MinMax::max())
return fuzzyLessEqual(delay1, delay2);
return fuzzyGreater(delay1, delay2);
else
return fuzzyGreaterEqual(delay1, delay2);
return fuzzyLess(delay1, delay2);
}
bool
delayFuzzyGreater(const Delay &delay1,
const Delay &delay2)
{
return fuzzyGreater(delay1, delay2);
}
bool
delayFuzzyGreaterEqual(const Delay &delay1,
const Delay &delay2)
{
return fuzzyGreaterEqual(delay1, delay2);
}
bool
delayFuzzyGreater(const Delay &delay1,
fuzzyGreaterEqual(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max)
{
if (min_max == MinMax::max())
return fuzzyGreater(delay1, delay2);
else
return fuzzyLess(delay1, delay2);
}
bool
delayFuzzyGreaterEqual(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max)
{
if (min_max == MinMax::max())
return fuzzyGreaterEqual(delay1, delay2);
@ -123,9 +71,9 @@ delayFuzzyGreaterEqual(const Delay &delay1,
}
bool
delayFuzzyLess(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max)
fuzzyLess(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max)
{
if (min_max == MinMax::max())
return fuzzyLess(delay1, delay2);
@ -133,6 +81,17 @@ delayFuzzyLess(const Delay &delay1,
return fuzzyGreater(delay1, delay2);
}
bool
fuzzyLessEqual(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max)
{
if (min_max == MinMax::max())
return fuzzyLessEqual(delay1, delay2);
else
return fuzzyGreaterEqual(delay1, delay2);
}
float
delayRatio(const Delay &delay1,
const Delay &delay2)
@ -167,18 +126,12 @@ delayAsString(const Delay &delay,
float
delayAsFloat(const Delay &delay,
const EarlyLate *)
const EarlyLate *,
float )
{
return delay;
}
float
delaySigma(const Delay &,
const EarlyLate *)
{
return 0.0;
}
float
delaySigma2(const Delay &,
const EarlyLate *)

View File

@ -18,6 +18,7 @@
#define STA_DELAY_FLOAT_H
#include "MinMax.hh"
#include "Fuzzy.hh"
// Delay values defined as floats.
@ -57,10 +58,8 @@ delayAsFloat(const Delay &delay)
// mean late+/early- sigma
float
delayAsFloat(const Delay &delay,
const EarlyLate *early_late);
float
delaySigma(const Delay &delay,
const EarlyLate *early_late);
const EarlyLate *early_late,
float sigma_factor);
float
delaySigma2(const Delay &delay,
const EarlyLate *early_late);
@ -82,38 +81,21 @@ bool
delayIsInitValue(const Delay &delay,
const MinMax *min_max);
bool
delayFuzzyZero(const Delay &delay);
fuzzyGreater(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max);
bool
delayFuzzyEqual(const Delay &delay1,
const Delay &delay2);
bool
delayFuzzyLess(const Delay &delay1,
const Delay &delay2);
bool
delayFuzzyLess(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max);
bool
delayFuzzyLessEqual(const Delay &delay1,
const Delay &delay2);
bool
delayFuzzyLessEqual(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max);
bool
delayFuzzyGreater(const Delay &delay1,
const Delay &delay2);
bool
delayFuzzyGreaterEqual(const Delay &delay1,
const Delay &delay2);
bool
delayFuzzyGreaterEqual(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max);
bool
delayFuzzyGreater(const Delay &delay1,
fuzzyGreaterEqual(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max);
bool
fuzzyLess(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max);
bool
fuzzyLessEqual(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max);
float
delayRatio(const Delay &delay1,
const Delay &delay2);

View File

@ -238,17 +238,16 @@ delayIsInitValue(const Delay &delay,
}
bool
delayFuzzyZero(const Delay &delay)
fuzzyZero(const Delay &delay)
{
return fuzzyZero(delay.mean())
// && fuzzyZero(delay.sigma2(EarlyLate::early()))
&& fuzzyZero(delay.sigma2Early())
&& fuzzyZero(delay.sigma2Late());
}
bool
delayFuzzyEqual(const Delay &delay1,
const Delay &delay2)
fuzzyEqual(const Delay &delay1,
const Delay &delay2)
{
return fuzzyEqual(delay1.mean(), delay2.mean())
&& fuzzyEqual(delay1.sigma2Early(), delay2.sigma2Early())
@ -256,37 +255,37 @@ delayFuzzyEqual(const Delay &delay1,
}
bool
delayFuzzyLess(const Delay &delay1,
const Delay &delay2)
fuzzyLess(const Delay &delay1,
const Delay &delay2)
{
return fuzzyLess(delay1.mean(), delay2.mean());
}
bool
delayFuzzyLess(const Delay &delay1,
float delay2)
fuzzyLess(const Delay &delay1,
float delay2)
{
return fuzzyLess(delay1.mean(), delay2);
}
bool
delayFuzzyLessEqual(const Delay &delay1,
const Delay &delay2)
fuzzyLessEqual(const Delay &delay1,
const Delay &delay2)
{
return fuzzyLessEqual(delay1.mean(), delay2.mean());
}
bool
delayFuzzyLessEqual(const Delay &delay1,
fuzzyLessEqual(const Delay &delay1,
float delay2)
{
return fuzzyLessEqual(delay1.mean(), delay2);
}
bool
delayFuzzyLessEqual(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max)
fuzzyLessEqual(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max)
{
if (min_max == MinMax::max())
return fuzzyLessEqual(delay1.mean(), delay2.mean());
@ -295,37 +294,37 @@ delayFuzzyLessEqual(const Delay &delay1,
}
bool
delayFuzzyGreater(const Delay &delay1,
const Delay &delay2)
fuzzyGreater(const Delay &delay1,
const Delay &delay2)
{
return fuzzyGreater(delay1.mean(), delay2.mean());
}
bool
delayFuzzyGreater(const Delay &delay1,
float delay2)
fuzzyGreater(const Delay &delay1,
float delay2)
{
return fuzzyGreater(delay1.mean(), delay2);
}
bool
delayFuzzyGreaterEqual(const Delay &delay1,
const Delay &delay2)
fuzzyGreaterEqual(const Delay &delay1,
const Delay &delay2)
{
return fuzzyGreaterEqual(delay1.mean(), delay2.mean());
}
bool
delayFuzzyGreaterEqual(const Delay &delay1,
float delay2)
fuzzyGreaterEqual(const Delay &delay1,
float delay2)
{
return fuzzyGreaterEqual(delay1.mean(), delay2);
}
bool
delayFuzzyGreater(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max)
fuzzyGreater(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max)
{
if (min_max == MinMax::max())
return fuzzyGreater(delay1.mean(), delay2.mean());
@ -334,9 +333,9 @@ delayFuzzyGreater(const Delay &delay1,
}
bool
delayFuzzyGreaterEqual(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max)
fuzzyGreaterEqual(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max)
{
if (min_max == MinMax::max())
return fuzzyGreaterEqual(delay1.mean(), delay2.mean());
@ -345,9 +344,9 @@ delayFuzzyGreaterEqual(const Delay &delay1,
}
bool
delayFuzzyLess(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max)
fuzzyLess(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max)
{
if (min_max == MinMax::max())
return fuzzyLess(delay1.mean(), delay2.mean());
@ -392,23 +391,17 @@ delayRatio(const Delay &delay1,
float
delayAsFloat(const Delay &delay,
const EarlyLate *early_late)
const EarlyLate *early_late,
float sigma_factor)
{
if (early_late == EarlyLate::early())
return delay.mean() - delay.sigma(early_late);
return delay.mean() - delay.sigma(early_late) * sigma_factor;
else if (early_late == EarlyLate::late())
return delay.mean() + delay.sigma(early_late);
return delay.mean() + delay.sigma(early_late) * sigma_factor;
else
internalError("unknown early/late value.");
}
float
delaySigma(const Delay &delay,
const EarlyLate *early_late)
{
return delay.sigma(early_late);
}
float
delaySigma2(const Delay &delay,
const EarlyLate *early_late)
@ -452,7 +445,7 @@ delayAsString(const Delay &delay,
const StaState *sta,
int digits)
{
float mean_sigma = delayAsFloat(delay, early_late);
float mean_sigma = delayAsFloat(delay, early_late, sta->sigmaFactor());
return sta->units()->timeUnit()->asString(mean_sigma, digits);
}

View File

@ -21,8 +21,6 @@
namespace sta {
// Delay values defined as objects that hold a float value.
class Delay;
class StaState;
@ -103,10 +101,8 @@ Delay operator*(const Delay &delay1,
// mean late+/early- sigma
float
delayAsFloat(const Delay &delay,
const EarlyLate *early_late);
float
delaySigma(const Delay &delay,
const EarlyLate *early_late);
const EarlyLate *early_late,
float sigma_factor);
float
delaySigma2(const Delay &delay,
const EarlyLate *early_late);
@ -128,38 +124,38 @@ bool
delayIsInitValue(const Delay &delay,
const MinMax *min_max);
bool
delayFuzzyZero(const Delay &delay);
fuzzyZero(const Delay &delay);
bool
delayFuzzyEqual(const Delay &delay1,
const Delay &delay2);
fuzzyEqual(const Delay &delay1,
const Delay &delay2);
bool
delayFuzzyLess(const Delay &delay1,
fuzzyLess(const Delay &delay1,
const Delay &delay2);
bool
fuzzyLess(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max);
bool
fuzzyLessEqual(const Delay &delay1,
const Delay &delay2);
bool
delayFuzzyLess(const Delay &delay1,
fuzzyLessEqual(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max);
bool
delayFuzzyLessEqual(const Delay &delay1,
const Delay &delay2);
fuzzyGreater(const Delay &delay1,
const Delay &delay2);
bool
delayFuzzyLessEqual(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max);
bool
delayFuzzyGreater(const Delay &delay1,
fuzzyGreaterEqual(const Delay &delay1,
const Delay &delay2);
bool
delayFuzzyGreaterEqual(const Delay &delay1,
const Delay &delay2);
bool
delayFuzzyGreaterEqual(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max);
bool
delayFuzzyGreater(const Delay &delay1,
fuzzyGreaterEqual(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max);
bool
fuzzyGreater(const Delay &delay1,
const Delay &delay2,
const MinMax *min_max);
float
delayRatio(const Delay &delay1,
const Delay &delay2);

View File

@ -32,8 +32,6 @@
namespace sta {
const char *bfs_index_names[] = {"dcalc", "arrival", "required", "other"};
////////////////////////////////////////////////////////////////
//
// Graph
@ -45,17 +43,17 @@ Graph::Graph(StaState *sta,
bool have_arc_delays,
DcalcAPIndex ap_count) :
StaState(sta),
vertices_(NULL),
edges_(NULL),
vertices_(nullptr),
edges_(nullptr),
vertex_count_(0),
edge_count_(0),
arc_count_(0),
slew_tr_count_(slew_tr_count),
have_arc_delays_(have_arc_delays),
ap_count_(ap_count),
float_pool_(NULL),
width_check_annotations_(NULL),
period_check_annotations_(NULL)
float_pool_(nullptr),
width_check_annotations_(nullptr),
period_check_annotations_(nullptr)
{
}
@ -144,7 +142,7 @@ Graph::vertexAndEdgeCounts(const Instance *inst,
vertex_count++;
if (cell) {
LibertyPort *port = network_->libertyPort(pin);
LibertyCellTimingArcSetIterator set_iter(cell, port, NULL);
LibertyCellTimingArcSetIterator set_iter(cell, port, nullptr);
while (set_iter.hasNext()) {
TimingArcSet *arc_set = set_iter.next();
LibertyPort *to_port = arc_set->to();
@ -261,7 +259,7 @@ Graph::makeInstanceEdges(const Instance *inst)
{
LibertyCell *cell = network_->libertyCell(inst);
if (cell)
makePortInstanceEdges(inst, cell, NULL);
makePortInstanceEdges(inst, cell, nullptr);
}
void
@ -287,7 +285,7 @@ Graph::makePortInstanceEdges(const Instance *inst,
TimingArcSet *arc_set = timing_iter.next();
LibertyPort *from_port = arc_set->from();
LibertyPort *to_port = arc_set->to();
if (from_to_port == NULL
if (from_to_port == nullptr
|| from_port == from_to_port
|| to_port == from_to_port) {
Pin *from_pin = network_->findPin(inst, from_port);
@ -362,9 +360,7 @@ Graph::makeWireEdgesFromPin(Pin *drvr_pin)
FindNetDrvrLoads visitor(drvr_pin, visited_drvrs, loads, drvrs, network_);
network_->visitConnectedPins(drvr_pin, visitor);
PinSeq::Iterator load_iter(loads);
while (load_iter.hasNext()) {
Pin *load_pin = load_iter.next();
for (auto load_pin : loads) {
if (drvr_pin != load_pin)
makeWireEdge(drvr_pin, load_pin);
}
@ -380,12 +376,8 @@ Graph::makeWireEdgesFromPin(Pin *drvr_pin,
FindNetDrvrLoads visitor(drvr_pin, visited_drvrs, loads, drvrs, network_);
network_->visitConnectedPins(drvr_pin, visitor);
PinSeq::Iterator drvr_iter(drvrs);
while (drvr_iter.hasNext()) {
Pin *drvr_pin = drvr_iter.next();
PinSeq::Iterator load_iter(loads);
while (load_iter.hasNext()) {
Pin *load_pin = load_iter.next();
for (auto drvr_pin : drvrs) {
for (auto load_pin : loads) {
if (drvr_pin != load_pin)
makeWireEdge(drvr_pin, load_pin);
}
@ -397,9 +389,7 @@ Graph::makeWireEdgesToPin(Pin *to_pin)
{
PinSet *drvrs = network_->drivers(to_pin);
if (drvrs) {
PinSet::Iterator drvr_iter(drvrs);
while (drvr_iter.hasNext()) {
Pin *drvr = drvr_iter.next();
for (auto drvr : *drvrs) {
if (drvr != to_pin)
makeWireEdge(drvr, to_pin);
}
@ -409,8 +399,7 @@ Graph::makeWireEdgesToPin(Pin *to_pin)
class MakeEdgesThruHierPin : public HierPinThruVisitor
{
public:
MakeEdgesThruHierPin(Graph *graph,
Network *network);
MakeEdgesThruHierPin(Graph *graph);
private:
DISALLOW_COPY_AND_ASSIGN(MakeEdgesThruHierPin);
@ -418,14 +407,11 @@ private:
Pin *load);
Graph *graph_;
Network *network_;
};
MakeEdgesThruHierPin::MakeEdgesThruHierPin(Graph *graph,
Network *network) :
MakeEdgesThruHierPin::MakeEdgesThruHierPin(Graph *graph) :
HierPinThruVisitor(),
graph_(graph),
network_(network)
graph_(graph)
{
}
@ -439,7 +425,7 @@ MakeEdgesThruHierPin::visit(Pin *drvr,
void
Graph::makeWireEdgesThruPin(Pin *hpin)
{
MakeEdgesThruHierPin visitor(this, network_);
MakeEdgesThruHierPin visitor(this);
visitDrvrLoadsThruHierPin(hpin, network_, &visitor);
}
@ -494,7 +480,7 @@ Graph::makePinVertices(Pin *pin,
pin_bidirect_drvr_vertex_map_[pin] = bidir_drvr_vertex;
}
else
bidir_drvr_vertex = NULL;
bidir_drvr_vertex = nullptr;
}
}
@ -522,7 +508,7 @@ Graph::pinVertices(const Pin *pin,
if (network_->direction(pin)->isBidirect())
bidirect_drvr_vertex = pin_bidirect_drvr_vertex_map_.findKey(pin);
else
bidirect_drvr_vertex = NULL;
bidirect_drvr_vertex = nullptr;
}
Vertex *
@ -1017,10 +1003,10 @@ Graph::setWidthCheckAnnotation(const Pin *pin,
DcalcAPIndex ap_index,
float width)
{
if (width_check_annotations_ == NULL)
if (width_check_annotations_ == nullptr)
width_check_annotations_ = new WidthCheckAnnotations;
float *widths = width_check_annotations_->findKey(pin);
if (widths == NULL) {
if (widths == nullptr) {
int width_count = TransRiseFall::index_count * ap_count_;
widths = makeFloats(width_count);
// Use negative (illegal) width values to indicate unannotated checks.
@ -1043,7 +1029,7 @@ Graph::removeWidthCheckAnnotations()
deleteFloats(widths, width_count);
}
delete width_check_annotations_;
width_check_annotations_ = NULL;
width_check_annotations_ = nullptr;
}
}
@ -1072,10 +1058,10 @@ Graph::setPeriodCheckAnnotation(const Pin *pin,
DcalcAPIndex ap_index,
float period)
{
if (period_check_annotations_ == NULL)
if (period_check_annotations_ == nullptr)
period_check_annotations_ = new PeriodCheckAnnotations;
float *periods = period_check_annotations_->findKey(pin);
if (periods == NULL) {
if (periods == nullptr) {
periods = makeFloats(ap_count_);
// Use negative (illegal) period values to indicate unannotated checks.
for (DcalcAPIndex i = 0; i < ap_count_; i++)
@ -1089,13 +1075,12 @@ void
Graph::removePeriodCheckAnnotations()
{
if (period_check_annotations_) {
PeriodCheckAnnotations::Iterator check_iter(period_check_annotations_);
while (check_iter.hasNext()) {
float *periods = check_iter.next();
for (auto pin_floats : *period_check_annotations_) {
float *periods = pin_floats.second;
deleteFloats(periods, ap_count_);
}
delete period_check_annotations_;
period_check_annotations_ = NULL;
period_check_annotations_ = nullptr;
}
}
@ -1119,7 +1104,7 @@ Graph::removeDelaySlewAnnotations()
float *
Graph::makeFloats(ObjectIndex count)
{
if (float_pool_ == NULL)
if (float_pool_ == nullptr)
float_pool_ = new Pool<float>(100);
return float_pool_->makeObjects(count);
}
@ -1138,7 +1123,7 @@ Graph::deleteFloats(float *floats, ObjectIndex count)
Vertex::Vertex()
{
init(NULL, false, false);
init(nullptr, false, false);
}
void
@ -1151,19 +1136,19 @@ Vertex::init(Pin *pin,
is_bidirect_drvr_ = is_bidirect_drvr;
in_edges_ = 0;
out_edges_ = 0;
arrivals_ = NULL;
prev_paths_ = NULL;
arrivals_ = nullptr;
prev_paths_ = nullptr;
has_requireds_ = false;
tag_group_index_ = tag_group_index_max;
slew_annotated_ = false;
sim_value_ = logic_unknown;
sim_value_ = unsigned(LogicValue::unknown);
is_disabled_constraint_ = false;
is_gated_clk_enable_ = false;
has_checks_ = false;
is_check_clk_ = false;
is_constrained_ = false;
has_downstream_clk_pin_ = false;
color_ = vertex_color_white;
color_ = unsigned(LevelColor::white);
level_ = 0;
bfs_in_queue_ = 0;
crpr_path_pruning_disabled_ = false;
@ -1190,9 +1175,9 @@ Vertex::setLevel(Level level)
}
void
Vertex::setColor(VertexColor color)
Vertex::setColor(LevelColor color)
{
color_ = color;
color_ = unsigned(color);
}
bool
@ -1282,14 +1267,15 @@ Vertex::simValue() const
void
Vertex::setSimValue(LogicValue value)
{
sim_value_ = value;
sim_value_ = unsigned(value);
}
bool
Vertex::isConstant() const
{
return sim_value_ == logic_zero
|| sim_value_ == logic_one;
LogicValue value = static_cast<LogicValue>(sim_value_);
return value == LogicValue::zero
|| value == LogicValue::one;
}
void
@ -1331,7 +1317,7 @@ Vertex::setHasDownstreamClkPin(bool has_clk_pin)
bool
Vertex::bfsInQueue(BfsIndex index) const
{
return (bfs_in_queue_ >> index) & 1;
return (bfs_in_queue_ >> unsigned(index)) & 1;
}
void
@ -1339,9 +1325,9 @@ Vertex::setBfsInQueue(BfsIndex index,
bool value)
{
if (value)
bfs_in_queue_ |= 1 << index;
bfs_in_queue_ |= 1 << int(index);
else
bfs_in_queue_ &= ~(1 << index);
bfs_in_queue_ &= ~(1 << int(index));
}
////////////////////////////////////////////////////////////////
@ -1352,7 +1338,7 @@ Vertex::setBfsInQueue(BfsIndex index,
Edge::Edge()
{
init(0, 0, NULL);
init(0, 0, nullptr);
}
void
@ -1371,7 +1357,7 @@ Edge::init(VertexIndex from,
is_bidirect_inst_path_ = false;
is_bidirect_net_path_ = false;
delay_annotation_is_incremental_ = false;
sim_timing_sense_ = timing_sense_unknown;
sim_timing_sense_ = unsigned(TimingSense::unknown);
is_disabled_constraint_ = false;
is_disabled_cond_ = false;
is_disabled_loop_ = false;
@ -1423,13 +1409,13 @@ Edge::sense() const
TimingSense
Edge::simTimingSense() const
{
return static_cast<TimingSense>(sim_timing_sense_);
return static_cast<TimingSense>(sim_timing_sense_);
}
void
Edge::setSimTimingSense(TimingSense sense)
{
sim_timing_sense_ = sense;
sim_timing_sense_ = unsigned(sense);
}
bool
@ -1486,9 +1472,9 @@ VertexIterator::VertexIterator(Graph *graph) :
network_(graph->network()),
top_inst_(network_->topInstance()),
inst_iter_(network_->leafInstanceIterator()),
pin_iter_(NULL),
vertex_(NULL),
bidir_vertex_(NULL)
pin_iter_(nullptr),
vertex_(nullptr),
bidir_vertex_(nullptr)
{
if (inst_iter_)
findNext();
@ -1497,16 +1483,16 @@ VertexIterator::VertexIterator(Graph *graph) :
Vertex *
VertexIterator::next()
{
Vertex *next = NULL;
Vertex *next = nullptr;
if (vertex_) {
next = vertex_;
vertex_ = NULL;
vertex_ = nullptr;
}
else if (bidir_vertex_) {
next = bidir_vertex_;
bidir_vertex_ = NULL;
bidir_vertex_ = nullptr;
}
if (bidir_vertex_ == NULL)
if (bidir_vertex_ == nullptr)
findNext();
return next;
}
@ -1519,12 +1505,12 @@ VertexIterator::findNextPin()
vertex_ = graph_->vertex(network_->vertexIndex(pin));
bidir_vertex_ = network_->direction(pin)->isBidirect()
? graph_->pin_bidirect_drvr_vertex_map_.findKey(pin)
: NULL;
: nullptr;
if (vertex_ || bidir_vertex_)
return true;
}
delete pin_iter_;
pin_iter_ = NULL;
pin_iter_ = nullptr;
return false;
}
@ -1541,10 +1527,10 @@ VertexIterator::findNext()
pin_iter_ = network_->pinIterator(inst);
} else {
delete inst_iter_;
inst_iter_ = NULL;
inst_iter_ = nullptr;
if (top_inst_) {
pin_iter_ = network_->pinIterator(top_inst_);
top_inst_ = NULL;
top_inst_ = nullptr;
}
}
}

View File

@ -34,11 +34,7 @@ class MinMax;
class Sdc;
class PathVertexRep;
enum VertexColor {
vertex_color_white,
vertex_color_gray,
vertex_color_black
};
enum class LevelColor { white, gray, black };
typedef Pool<Delay> DelayPool;
typedef Pool<Vertex> VertexPool;
@ -271,8 +267,8 @@ public:
Level level() const { return level_; }
void setLevel(Level level);
bool isRoot() const{ return level_ == 0; }
VertexColor color() const { return (VertexColor) color_; }
void setColor(VertexColor color);
LevelColor color() const { return static_cast<LevelColor>(color_); }
void setColor(LevelColor color);
Arrival *arrivals() const { return arrivals_; }
void setArrivals(Arrival *arrivals);
PathVertexRep *prevPaths() const { return prev_paths_; }
@ -337,14 +333,16 @@ protected:
// 4 bytes
unsigned int tag_group_index_:tag_group_index_bits; // 24
// Each bit corresponds to a different BFS queue.
unsigned int bfs_in_queue_:bfs_index_bits; // 4
unsigned int bfs_in_queue_:int(BfsIndex::bits); // 4
unsigned int slew_annotated_:slew_annotated_bits;
// 4 bytes (32 bits)
unsigned int level_:16;
// Levelization search state.
unsigned int color_:2;
unsigned int sim_value_:3; // LogicValue
// LevelColor gcc barfs if this is dcl'd.
unsigned color_:2;
// LogicValue gcc barfs if this is dcl'd.
unsigned sim_value_:3;
bool has_requireds_:1;
// Bidirect pins have two vertices.
// This flag distinguishes the driver and load vertices.
@ -418,14 +416,14 @@ protected:
VertexIndex vertex_out_next_; // Vertex out edges doubly linked list.
VertexIndex vertex_out_prev_;
ArcIndex arc_delays_;
unsigned int delay_annotation_is_incremental_:1;
unsigned int is_bidirect_inst_path_:1;
unsigned int is_bidirect_net_path_:1;
bool delay_annotation_is_incremental_:1;
bool is_bidirect_inst_path_:1;
bool is_bidirect_net_path_:1;
// Timing sense from function and constants on edge instance.
unsigned int sim_timing_sense_:timing_sense_bit_count;
unsigned int is_disabled_constraint_:1;
unsigned int is_disabled_cond_:1;
unsigned int is_disabled_loop_:1;
unsigned sim_timing_sense_:timing_sense_bit_count;
bool is_disabled_constraint_:1;
bool is_disabled_cond_:1;
bool is_disabled_loop_:1;
private:
DISALLOW_COPY_AND_ASSIGN(Edge);
@ -468,7 +466,7 @@ public:
const Graph *graph);
VertexInEdgeIterator(VertexIndex vertex_index,
const Graph *graph);
bool hasNext() { return (next_ != NULL); }
bool hasNext() { return (next_ != nullptr); }
Edge *next();
private:
@ -483,7 +481,7 @@ class VertexOutEdgeIterator : public VertexEdgeIterator
public:
VertexOutEdgeIterator(Vertex *vertex,
const Graph *graph);
bool hasNext() { return (next_ != NULL); }
bool hasNext() { return (next_ != nullptr); }
Edge *next();
private:

View File

@ -51,15 +51,8 @@ static const int tag_group_index_bits = 24;
static const TagGroupIndex tag_group_index_max = (1<<tag_group_index_bits)-1;
static const int slew_annotated_bits = MinMax::index_count * TransRiseFall::index_count;
enum BfsIndex {
bfs_dcalc,
bfs_arrival,
bfs_required,
bfs_other
};
static const int bfs_index_bits = bfs_other + 1;
extern const char *bfs_index_names[];
// Bit shifts used to mark vertices in a Bfs queue.
enum class BfsIndex { dcalc, arrival, required, other, bits };
} // namespace
#endif

View File

@ -167,7 +167,7 @@ cellDriveResistance(const LibertyCell *cell)
TimingArc *arc = arc_iter.next();
GateTimingModel *model = dynamic_cast<GateTimingModel*>(arc->model());
if (model) {
float drive = model->driveResistance(cell, NULL);
float drive = model->driveResistance(cell, nullptr);
if (drive > max_drive)
max_drive = drive;
}
@ -217,8 +217,8 @@ hashCellSequentials(const LibertyCell *cell)
hash += hashPort(seq->outputInv()) * 9;
hash += hashFuncExpr(seq->clear()) * 11;
hash += hashFuncExpr(seq->preset()) * 13;
hash += seq->clearPresetOutput() * 17;
hash += seq->clearPresetOutputInv() * 19;
hash += int(seq->clearPresetOutput()) * 17;
hash += int(seq->clearPresetOutputInv()) * 19;
}
return hash;
}
@ -226,7 +226,7 @@ hashCellSequentials(const LibertyCell *cell)
static unsigned
hashFuncExpr(const FuncExpr *expr)
{
if (expr == NULL)
if (expr == nullptr)
return 0;
else {
switch (expr->op()) {

View File

@ -25,13 +25,13 @@ namespace sta {
FuncExpr *
FuncExpr::makePort(LibertyPort *port)
{
return new FuncExpr(op_port, NULL, NULL, port);
return new FuncExpr(op_port, nullptr, nullptr, port);
}
FuncExpr *
FuncExpr::makeNot(FuncExpr *expr)
{
return new FuncExpr(op_not, expr, NULL, NULL);
return new FuncExpr(op_not, expr, nullptr, nullptr);
}
@ -39,33 +39,33 @@ FuncExpr *
FuncExpr::makeAnd(FuncExpr *left,
FuncExpr *right)
{
return new FuncExpr(op_and, left, right, NULL);
return new FuncExpr(op_and, left, right, nullptr);
}
FuncExpr *
FuncExpr::makeOr(FuncExpr *left,
FuncExpr *right)
{
return new FuncExpr(op_or, left, right, NULL);
return new FuncExpr(op_or, left, right, nullptr);
}
FuncExpr *
FuncExpr::makeXor(FuncExpr *left,
FuncExpr *right)
{
return new FuncExpr(op_xor, left, right, NULL);
return new FuncExpr(op_xor, left, right, nullptr);
}
FuncExpr *
FuncExpr::makeZero()
{
return new FuncExpr(op_zero, NULL, NULL, NULL);
return new FuncExpr(op_zero, nullptr, nullptr, nullptr);
}
FuncExpr *
FuncExpr::makeOne()
{
return new FuncExpr(op_one, NULL, NULL, NULL);
return new FuncExpr(op_one, nullptr, nullptr, nullptr);
}
FuncExpr::FuncExpr(Operator op,
@ -95,7 +95,7 @@ FuncExpr::port() const
if (op_ == op_port)
return port_;
else
return NULL;
return nullptr;
}
// Protect against null sub-expressions caused by unknown port refs.
@ -107,29 +107,29 @@ FuncExpr::portTimingSense(const LibertyPort *port) const
switch (op_) {
case op_port:
if (port == port_)
return timing_sense_positive_unate;
return TimingSense::positive_unate;
else
return timing_sense_none;
return TimingSense::none;
case op_not:
if (left_) {
switch (left_->portTimingSense(port)) {
case timing_sense_positive_unate:
return timing_sense_negative_unate;
case timing_sense_negative_unate:
return timing_sense_positive_unate;
case timing_sense_non_unate:
return timing_sense_non_unate;
case timing_sense_none:
return timing_sense_none;
case timing_sense_unknown:
return timing_sense_unknown;
case TimingSense::positive_unate:
return TimingSense::negative_unate;
case TimingSense::negative_unate:
return TimingSense::positive_unate;
case TimingSense::non_unate:
return TimingSense::non_unate;
case TimingSense::none:
return TimingSense::none;
case TimingSense::unknown:
return TimingSense::unknown;
}
}
return timing_sense_unknown;
return TimingSense::unknown;
case op_or:
case op_and:
left_sense = timing_sense_unknown;
right_sense = timing_sense_unknown;
left_sense = TimingSense::unknown;
right_sense = TimingSense::unknown;
if (left_)
left_sense = left_->portTimingSense(port);
if (right_)
@ -137,44 +137,44 @@ FuncExpr::portTimingSense(const LibertyPort *port) const
if (left_sense == right_sense)
return left_sense;
else if (left_sense == timing_sense_non_unate
|| right_sense == timing_sense_non_unate
|| (left_sense == timing_sense_positive_unate
&& right_sense == timing_sense_negative_unate)
|| (left_sense == timing_sense_negative_unate
&& right_sense == timing_sense_positive_unate))
return timing_sense_non_unate;
else if (left_sense == timing_sense_none
|| left_sense == timing_sense_unknown)
else if (left_sense == TimingSense::non_unate
|| right_sense == TimingSense::non_unate
|| (left_sense == TimingSense::positive_unate
&& right_sense == TimingSense::negative_unate)
|| (left_sense == TimingSense::negative_unate
&& right_sense == TimingSense::positive_unate))
return TimingSense::non_unate;
else if (left_sense == TimingSense::none
|| left_sense == TimingSense::unknown)
return right_sense;
else if (right_sense == timing_sense_none
|| right_sense == timing_sense_unknown)
else if (right_sense == TimingSense::none
|| right_sense == TimingSense::unknown)
return left_sense;
else
return timing_sense_unknown;
return TimingSense::unknown;
case op_xor:
left_sense = timing_sense_unknown;
right_sense = timing_sense_unknown;
left_sense = TimingSense::unknown;
right_sense = TimingSense::unknown;
if (left_)
left_sense = left_->portTimingSense(port);
if (right_)
right_sense = right_->portTimingSense(port);
if (left_sense == timing_sense_positive_unate
|| left_sense == timing_sense_negative_unate
|| left_sense == timing_sense_non_unate
|| right_sense == timing_sense_positive_unate
|| right_sense == timing_sense_negative_unate
|| right_sense == timing_sense_non_unate)
return timing_sense_non_unate;
if (left_sense == TimingSense::positive_unate
|| left_sense == TimingSense::negative_unate
|| left_sense == TimingSense::non_unate
|| right_sense == TimingSense::positive_unate
|| right_sense == TimingSense::negative_unate
|| right_sense == TimingSense::non_unate)
return TimingSense::non_unate;
else
return timing_sense_unknown;
return TimingSense::unknown;
case op_one:
return timing_sense_none;
return TimingSense::none;
case op_zero:
return timing_sense_none;
return TimingSense::none;
}
// Prevent warnings from lame compilers.
return timing_sense_unknown;
return TimingSense::unknown;
}
const char *
@ -270,7 +270,7 @@ FuncExpr::bitSubExpr(int bit_offset)
return this;
}
// Prevent warnings from lame compilers.
return NULL;
return nullptr;
}
bool
@ -360,9 +360,9 @@ bool
FuncExpr::equiv(const FuncExpr *expr1,
const FuncExpr *expr2)
{
if (expr1 == NULL && expr2 == NULL)
if (expr1 == nullptr && expr2 == nullptr)
return true;
else if (expr1 != NULL && expr2 != NULL
else if (expr1 != nullptr && expr2 != nullptr
&& expr1->op() == expr2->op()) {
switch (expr1->op()) {
case FuncExpr::op_port:
@ -382,7 +382,7 @@ bool
FuncExpr::less(const FuncExpr *expr1,
const FuncExpr *expr2)
{
if (expr1 != NULL && expr2 != NULL) {
if (expr1 != nullptr && expr2 != nullptr) {
Operator op1 = expr1->op();
Operator op2 = expr2->op();
if (op1 == op2) {
@ -401,10 +401,10 @@ FuncExpr::less(const FuncExpr *expr1,
else
return op1 < op2;
}
else if (expr1 == NULL && expr2 == NULL)
else if (expr1 == nullptr && expr2 == nullptr)
return false;
else
return (expr1 == NULL && expr2 != NULL);
return (expr1 == nullptr && expr2 != nullptr);
}
} // namespace

View File

@ -58,7 +58,7 @@ public:
Operator op() const { return op_; }
// When operator is NOT left is the only operand.
FuncExpr *left() const { return left_; }
// NULL when op == op_not
// nullptr when op == op_not
FuncExpr *right() const { return right_; }
TimingSense portTimingSense(const LibertyPort *port) const;
// Return true if expression has port as an input.

View File

@ -23,9 +23,9 @@
namespace sta {
InternalPowerAttrs::InternalPowerAttrs() :
when_(NULL),
models_{NULL, NULL},
related_pg_pin_(NULL)
when_(nullptr),
models_{nullptr, nullptr},
related_pg_pin_(nullptr)
{
}
@ -157,7 +157,7 @@ InternalPowerModel::reportPower(const LibertyCell *cell,
axis_value1, axis_value2, axis_value3);
const LibertyLibrary *library = cell->libertyLibrary();
model_->reportValue("Power", library, cell, pvt,
axis_value1, NULL, axis_value2, axis_value3, digits, result);
axis_value1, nullptr, axis_value2, axis_value3, digits, result);
}
}
@ -201,9 +201,9 @@ InternalPowerModel::axisValue(TableAxis *axis,
float load_cap) const
{
TableAxisVariable var = axis->variable();
if (var == table_axis_input_transition_time)
if (var == TableAxisVariable::input_transition_time)
return in_slew;
else if (var == table_axis_total_output_net_capacitance)
else if (var == TableAxisVariable::total_output_net_capacitance)
return load_cap;
else {
internalError("unsupported table axes");
@ -222,7 +222,7 @@ InternalPowerModel::checkAxes(const TableModel *model)
axis_ok &= checkAxis(model->axis1());
if (axis2)
axis_ok &= checkAxis(model->axis2());
axis_ok &= (axis3 == NULL);
axis_ok &= (axis3 == nullptr);
return axis_ok;
}
@ -230,9 +230,9 @@ bool
InternalPowerModel::checkAxis(TableAxis *axis)
{
TableAxisVariable var = axis->variable();
return var == table_axis_constrained_pin_transition
|| var == table_axis_related_pin_transition
|| var == table_axis_related_out_total_output_net_capacitance;
return var == TableAxisVariable::constrained_pin_transition
|| var == TableAxisVariable::related_pin_transition
|| var == TableAxisVariable::related_out_total_output_net_capacitance;
}
} // namespace

View File

@ -23,7 +23,7 @@
namespace sta {
LeakagePowerAttrs::LeakagePowerAttrs() :
when_(NULL),
when_(nullptr),
power_(0.0)
{
}

View File

@ -16,6 +16,7 @@
#include "Machine.hh"
#include "DisallowCopyAssign.hh"
#include "EnumNameMap.hh"
#include "Report.hh"
#include "Debug.hh"
#include "Error.hh"
@ -44,29 +45,16 @@ typedef Set<FuncExpr*> FuncExprSet;
typedef Set<LatchEnable*> LatchEnableSet;
bool LibertyLibrary::found_rise_fall_caps_ = false;
const float LibertyLibrary::input_threshold_default_ = .5F;
const float LibertyLibrary::output_threshold_default_ = .5F;
const float LibertyLibrary::slew_lower_threshold_default_ = .2F;
const float LibertyLibrary::slew_upper_threshold_default_ = .8F;
void
makeScaleFactorTypeMap();
void
deleteScaleFactorTypeMap();
void
initLiberty()
{
makeTimingTypeMap();
makeScaleFactorTypeMap();
TimingArcSet::init();
}
void
deleteLiberty()
{
deleteTimingTypeMap();
deleteScaleFactorTypeMap();
TimingArcSet::destroy();
}
@ -74,11 +62,11 @@ LibertyLibrary::LibertyLibrary(const char *name,
const char *filename) :
ConcreteLibrary(name, filename),
units_(new Units()),
delay_model_type_(delay_model_cmos_linear), // default
delay_model_type_(DelayModelType::cmos_linear), // default
nominal_process_(0.0),
nominal_voltage_(0.0),
nominal_temperature_(0.0),
scale_factors_(NULL),
scale_factors_(nullptr),
default_input_pin_cap_(0.0),
default_output_pin_cap_(0.0),
default_bidirect_pin_cap_(0.0),
@ -90,18 +78,18 @@ LibertyLibrary::LibertyLibrary(const char *name,
default_max_slew_(0.0),
default_max_slew_exists_(false),
slew_derate_from_library_(1.0),
default_wire_load_(NULL),
default_wire_load_mode_(wire_load_mode_unknown),
default_wire_load_selection_(NULL),
default_operating_conditions_(NULL),
equiv_cell_map_(NULL),
default_wire_load_(nullptr),
default_wire_load_mode_(WireloadMode::unknown),
default_wire_load_selection_(nullptr),
default_operating_conditions_(nullptr),
equiv_cell_map_(nullptr),
ocv_arc_depth_(0.0),
default_ocv_derate_(NULL)
default_ocv_derate_(nullptr)
{
// Scalar templates are builtin.
for (int i = 0; i != table_template_count; i++) {
for (int i = 0; i != int(TableTemplateType::count); i++) {
TableTemplateType type = static_cast<TableTemplateType>(i);
TableTemplate *scalar_template = new TableTemplate("scalar", NULL, NULL, NULL);
TableTemplate *scalar_template = new TableTemplate("scalar", nullptr, nullptr, nullptr);
addTableTemplate(scalar_template, type);
}
@ -109,7 +97,7 @@ LibertyLibrary::LibertyLibrary(const char *name,
while (tr_iter.hasNext()) {
TransRiseFall *tr = tr_iter.next();
int tr_index = tr->index();
wire_slew_degradation_tbls_[tr_index] = NULL;
wire_slew_degradation_tbls_[tr_index] = nullptr;
input_threshold_[tr_index] = input_threshold_default_;
output_threshold_[tr_index] = output_threshold_default_;
slew_lower_threshold_[tr_index] = slew_lower_threshold_default_;
@ -120,7 +108,7 @@ LibertyLibrary::LibertyLibrary(const char *name,
LibertyLibrary::~LibertyLibrary()
{
bus_dcls_.deleteContents();
for (int i = 0; i < table_template_count; i++)
for (int i = 0; i < int(TableTemplateType::count); i++)
template_maps_[i].deleteContents();
scale_factors_map_.deleteContents();
delete scale_factors_;
@ -189,14 +177,14 @@ void
LibertyLibrary::addTableTemplate(TableTemplate *tbl_template,
TableTemplateType type)
{
template_maps_[type][tbl_template->name()] = tbl_template;
template_maps_[int(type)][tbl_template->name()] = tbl_template;
}
TableTemplate *
LibertyLibrary::findTableTemplate(const char *name,
TableTemplateType type)
{
return template_maps_[type][name];
return template_maps_[int(type)][name];
}
void
@ -239,7 +227,7 @@ float
LibertyLibrary::scaleFactor(ScaleFactorType type,
const Pvt *pvt) const
{
return scaleFactor(type, 0, NULL, pvt);
return scaleFactor(type, 0, nullptr, pvt);
}
float
@ -256,24 +244,24 @@ LibertyLibrary::scaleFactor(ScaleFactorType type,
const LibertyCell *cell,
const Pvt *pvt) const
{
if (pvt == NULL)
if (pvt == nullptr)
pvt = default_operating_conditions_;
// If there is no operating condition, nominal pvt values are used.
// All scale factors are unity for nominal pvt.
if (pvt) {
ScaleFactors *scale_factors = NULL;
ScaleFactors *scale_factors = nullptr;
// Cell level scale factors have precidence over library scale factors.
if (cell)
scale_factors = cell->scaleFactors();
if (scale_factors == NULL)
if (scale_factors == nullptr)
scale_factors = scale_factors_;
if (scale_factors) {
float process_scale = 1.0F + (pvt->process() - nominal_process_)
* scale_factors->scale(type, scale_factor_process, tr_index);
* scale_factors->scale(type, ScaleFactorPvt::process, tr_index);
float temp_scale = 1.0F + (pvt->temperature() - nominal_temperature_)
* scale_factors->scale(type, scale_factor_temp, tr_index);
* scale_factors->scale(type, ScaleFactorPvt::temp, tr_index);
float volt_scale = 1.0F + (pvt->voltage() - nominal_voltage_)
* scale_factors->scale(type, scale_factor_volt, tr_index);
* scale_factors->scale(type, ScaleFactorPvt::volt, tr_index);
float scale = process_scale * temp_scale * volt_scale;
return scale;
}
@ -324,9 +312,9 @@ LibertyLibrary::degradeWireSlew(const LibertyCell *cell,
case 1: {
TableAxis *axis1 = model->axis1();
TableAxisVariable var1 = axis1->variable();
if (var1 == table_axis_output_pin_transition)
if (var1 == TableAxisVariable::output_pin_transition)
return model->findValue(this, cell, pvt, in_slew, 0.0, 0.0);
else if (var1 == table_axis_connect_delay)
else if (var1 == TableAxisVariable::connect_delay)
return model->findValue(this, cell, pvt, wire_delay, 0.0, 0.0);
else {
internalError("unsupported slew degradation table axes");
@ -338,11 +326,11 @@ LibertyLibrary::degradeWireSlew(const LibertyCell *cell,
TableAxis *axis2 = model->axis2();
TableAxisVariable var1 = axis1->variable();
TableAxisVariable var2 = axis2->variable();
if (var1 == table_axis_output_pin_transition
&& var2 == table_axis_connect_delay)
if (var1 == TableAxisVariable::output_pin_transition
&& var2 == TableAxisVariable::connect_delay)
return model->findValue(this, cell, pvt, in_slew, wire_delay, 0.0);
else if (var1 == table_axis_connect_delay
&& var2 == table_axis_output_pin_transition)
else if (var1 == TableAxisVariable::connect_delay
&& var2 == TableAxisVariable::output_pin_transition)
return model->findValue(this, cell, pvt, wire_delay, in_slew, 0.0);
else {
internalError("unsupported slew degradation table axes");
@ -366,18 +354,18 @@ LibertyLibrary::checkSlewDegradationAxes(Table *table)
case 1: {
TableAxis *axis1 = table->axis1();
TableAxisVariable var1 = axis1->variable();
return var1 == table_axis_output_pin_transition
|| var1 == table_axis_connect_delay;
return var1 == TableAxisVariable::output_pin_transition
|| var1 == TableAxisVariable::connect_delay;
}
case 2: {
TableAxis *axis1 = table->axis1();
TableAxis *axis2 = table->axis2();
TableAxisVariable var1 = axis1->variable();
TableAxisVariable var2 = axis2->variable();
return (var1 == table_axis_output_pin_transition
&& var2 == table_axis_connect_delay)
|| (var1 == table_axis_connect_delay
&& var2 == table_axis_output_pin_transition);
return (var1 == TableAxisVariable::output_pin_transition
&& var2 == TableAxisVariable::connect_delay)
|| (var1 == TableAxisVariable::connect_delay
&& var2 == TableAxisVariable::output_pin_transition);
}
default:
internalError("unsupported slew degradation table axes");
@ -518,7 +506,7 @@ LibertyLibrary::setDefaultOutputPinRes(const TransRiseFall *tr,
LibertyCellSeq *
LibertyLibrary::findEquivCells(LibertyCell *cell)
{
if (equiv_cell_map_ == NULL)
if (equiv_cell_map_ == nullptr)
equiv_cell_map_ = makeEquivCellMap(this);
LibertyCellSeq *equivs = equiv_cell_map_->findKey(cell);
return equivs;
@ -777,13 +765,13 @@ LibertyLibrary::addSupplyVoltage(const char *supply_name,
supply_voltage_map_[stringCopy(supply_name)] = voltage;
}
float
LibertyLibrary::supplyVoltage(const char *supply_name) const
void
LibertyLibrary::supplyVoltage(const char *supply_name,
// Return value.
float &voltage,
bool &exists) const
{
float voltage;
bool exists;
supply_voltage_map_.findKey(supply_name, voltage, exists);
return voltage;
}
bool
@ -825,22 +813,22 @@ LibertyCell::LibertyCell(LibertyLibrary *library,
is_pad_(false),
has_internal_ports_(false),
interface_timing_(false),
clock_gate_type_(clock_gate_none),
timing_arc_sets_(NULL),
port_timing_arc_set_map_(NULL),
timing_arc_set_from_map_(NULL),
timing_arc_set_to_map_(NULL),
clock_gate_type_(ClockGateType::none),
timing_arc_sets_(nullptr),
port_timing_arc_set_map_(nullptr),
timing_arc_set_from_map_(nullptr),
timing_arc_set_to_map_(nullptr),
has_infered_reg_timing_arcs_(false),
internal_powers_(NULL),
leakage_powers_(NULL),
sequentials_(NULL),
port_to_seq_map_(NULL),
mode_defs_(NULL),
scale_factors_(NULL),
scaled_cells_(NULL),
test_cell_(NULL),
internal_powers_(nullptr),
leakage_powers_(nullptr),
sequentials_(nullptr),
port_to_seq_map_(nullptr),
mode_defs_(nullptr),
scale_factors_(nullptr),
scaled_cells_(nullptr),
test_cell_(nullptr),
ocv_arc_depth_(0.0),
ocv_derate_(NULL),
ocv_derate_(nullptr),
is_disabled_constraint_(false),
leakage_power_(0.0)
{
@ -971,7 +959,7 @@ ModeDef *
LibertyCell::makeModeDef(const char *name)
{
ModeDef *mode = new ModeDef(name);
if (mode_defs_ == NULL)
if (mode_defs_ == nullptr)
mode_defs_ = new ModeDefMap;
(*mode_defs_)[mode->name()] = mode;
return mode;
@ -1034,37 +1022,37 @@ LibertyCell::setInterfaceTiming(bool value)
bool
LibertyCell::isClockGateLatchPosedge() const
{
return clock_gate_type_ == clock_gate_latch_posedge;
return clock_gate_type_ == ClockGateType::latch_posedge;
}
bool
LibertyCell::isClockGateLatchNegedge() const
{
return clock_gate_type_ == clock_gate_latch_posedge;
return clock_gate_type_ == ClockGateType::latch_posedge;
}
bool
LibertyCell::isClockGateOther() const
{
return clock_gate_type_ == clock_gate_other;
return clock_gate_type_ == ClockGateType::other;
}
bool
LibertyCell::isClockGate() const
{
return clock_gate_type_ != clock_gate_none;
return clock_gate_type_ != ClockGateType::none;
}
void
LibertyCell::setClockGateType(ClockGateType clock_gate_type)
LibertyCell::setClockGateType(ClockGateType type)
{
clock_gate_type_ = clock_gate_type;
clock_gate_type_ = type;
}
unsigned
LibertyCell::addTimingArcSet(TimingArcSet *arc_set)
{
if (timing_arc_sets_ == NULL) {
if (timing_arc_sets_ == nullptr) {
timing_arc_sets_ = new TimingArcSetSeq;
timing_arc_set_map_ = new TimingArcSetMap;
port_timing_arc_set_map_ = new LibertyPortPairTimingArcMap;
@ -1088,7 +1076,7 @@ LibertyCell::addTimingArcSet(TimingArcSet *arc_set)
LibertyPortPair port_pair(from, to);
TimingArcSetSeq *sets = port_timing_arc_set_map_->findKey(&port_pair);
if (sets == NULL) {
if (sets == nullptr) {
// First arc set for from/to ports.
sets = new TimingArcSetSeq;
LibertyPortPair *port_pair1 = new LibertyPortPair(from, to);
@ -1097,14 +1085,14 @@ LibertyCell::addTimingArcSet(TimingArcSet *arc_set)
sets->push_back(arc_set);
sets = timing_arc_set_from_map_->findKey(from);
if (sets == NULL) {
if (sets == nullptr) {
sets = new TimingArcSetSeq;
(*timing_arc_set_from_map_)[from] = sets;
}
sets->push_back(arc_set);
sets = timing_arc_set_to_map_->findKey(to);
if (sets == NULL) {
if (sets == nullptr) {
sets = new TimingArcSetSeq;
(*timing_arc_set_to_map_)[to] = sets;
}
@ -1121,7 +1109,7 @@ LibertyCell::addTimingArcAttrs(TimingArcAttrs *attrs)
void
LibertyCell::addInternalPower(InternalPower *power)
{
if (internal_powers_ == NULL)
if (internal_powers_ == nullptr)
internal_powers_ = new InternalPowerSeq;
internal_powers_->push_back(power);
}
@ -1147,7 +1135,7 @@ LibertyCell::deleteInternalPowerAttrs()
void
LibertyCell::addLeakagePower(LeakagePower *power)
{
if (leakage_powers_ == NULL)
if (leakage_powers_ == nullptr)
leakage_powers_ = new LeakagePowerSeq;
leakage_powers_->push_back(power);
}
@ -1241,7 +1229,7 @@ LibertyCell::timingArcSets(const LibertyPort *from,
else if (to)
return timing_arc_set_to_map_->findKey(to);
}
return NULL;
return nullptr;
}
TimingArcSet *
@ -1250,7 +1238,7 @@ LibertyCell::findTimingArcSet(TimingArcSet *key) const
if (timing_arc_sets_)
return timing_arc_set_map_->findKey(key);
else
return NULL;
return nullptr;
}
TimingArcSet *
@ -1289,16 +1277,16 @@ LibertyCell::makeSequential(int size,
LibertyPort *output_inv)
{
for (int bit = 0; bit < size; bit++) {
FuncExpr *clk_bit = NULL;
FuncExpr *clk_bit = nullptr;
if (clk)
clk_bit = clk->bitSubExpr(bit);
FuncExpr *data_bit = NULL;
FuncExpr *data_bit = nullptr;
if (data)
data_bit = data->bitSubExpr(bit);
FuncExpr *clear_bit = NULL;
FuncExpr *clear_bit = nullptr;
if (clear)
clear_bit = clear->bitSubExpr(bit);
FuncExpr *preset_bit = NULL;
FuncExpr *preset_bit = nullptr;
if (preset)
preset_bit = preset->bitSubExpr(bit);
LibertyPort *out_bit = output;
@ -1311,7 +1299,7 @@ LibertyCell::makeSequential(int size,
clear_bit,preset_bit,
clr_preset_out, clr_preset_out_inv,
out_bit, out_inv_bit);
if (sequentials_ == NULL) {
if (sequentials_ == nullptr) {
sequentials_ = new SequentialSeq;
port_to_seq_map_ = new PortToSequentialMap;
}
@ -1327,7 +1315,7 @@ LibertyCell::outputPortSequential(LibertyPort *port)
if (port_to_seq_map_)
return port_to_seq_map_->findKey(port);
else
return NULL;
return nullptr;
}
bool
@ -1340,7 +1328,7 @@ void
LibertyCell::addScaledCell(OperatingConditions *op_cond,
LibertyCell *scaled_cell)
{
if (scaled_cells_ == NULL)
if (scaled_cells_ == nullptr)
scaled_cells_ = new ScaledCellMap;
(*scaled_cells_)[op_cond] = scaled_cell;
@ -1402,7 +1390,7 @@ LibertyCell::cornerCell(int ap_index)
if (ap_index < static_cast<int>(corner_cells_.size()))
return corner_cells_[ap_index];
else
return NULL;
return nullptr;
}
void
@ -1539,7 +1527,7 @@ LibertyCell::makeLatchEnables(Report *report,
if (en_to_q->role() == TimingRole::latchEnToQ()) {
LibertyPort *en = en_to_q->from();
LibertyPort *q = en_to_q->to();
LibertyCellTimingArcSetIterator to_iter(this, NULL, q);
LibertyCellTimingArcSetIterator to_iter(this, nullptr, q);
while (to_iter.hasNext()) {
TimingArcSet *d_to_q = to_iter.next();
if (d_to_q->role() == TimingRole::latchDtoQ()) {
@ -1571,7 +1559,7 @@ LibertyCell::makeLatchEnables(Report *report,
FuncExpr *en_func = latch_enable->enableFunc();
if (en_func) {
TimingSense en_sense = en_func->portTimingSense(en);
if (en_sense == timing_sense_positive_unate
if (en_sense == TimingSense::positive_unate
&& en_tr != TransRiseFall::rise())
report->warn("%s, cell %s latch enable %s -> %s %s_edge is inconsistent with latch group enable function positive sense.\n",
filename_,
@ -1579,7 +1567,7 @@ LibertyCell::makeLatchEnables(Report *report,
en->name(),
q->name(),
en_tr == TransRiseFall::rise()?"rising":"falling");
else if (en_sense == timing_sense_negative_unate
else if (en_sense == TimingSense::negative_unate
&& en_tr != TransRiseFall::fall())
report->warn("%s, cell %s latch enable %s -> %s %s_edge is inconsistent with latch group enable function negative sense.\n",
filename_,
@ -1613,7 +1601,7 @@ LibertyCell::findLatchEnableFunc(LibertyPort *data,
&& seq->clock()->hasPort(enable))
return seq->clock();
}
return NULL;
return nullptr;
}
LatchEnable *
@ -1653,15 +1641,15 @@ LibertyCell::inferLatchRoles(Debug *debug)
if (en_to_q->role() == TimingRole::regClkToQ()) {
LibertyPort *en = en_to_q->from();
LibertyPort *q = en_to_q->to();
LibertyCellTimingArcSetIterator to_iter(this, NULL, q);
LibertyCellTimingArcSetIterator to_iter(this, nullptr, q);
while (to_iter.hasNext()) {
TimingArcSet *d_to_q = to_iter.next();
// Look for combinational d->q arcs.
TimingRole *d_to_q_role = d_to_q->role();
if ((d_to_q_role == TimingRole::combinational()
&& ((d_to_q->arcCount() == 2
&& (d_to_q->sense() == timing_sense_positive_unate
|| d_to_q->sense() == timing_sense_negative_unate))
&& (d_to_q->sense() == TimingSense::positive_unate
|| d_to_q->sense() == TimingSense::negative_unate))
|| (d_to_q->arcCount() == 4)))
// Previously identified as D->Q arc.
|| d_to_q_role == TimingRole::latchDtoQ()) {
@ -1696,7 +1684,7 @@ LibertyCell::latchEnable(TimingArcSet *d_to_q_set,
FuncExpr *&enable_func,
TransRiseFall *&enable_tr) const
{
enable_port = NULL;
enable_port = nullptr;
LatchEnable *latch_enable = latch_d_to_q_map_.findKey(d_to_q_set);
if (latch_enable) {
enable_port = latch_enable->enable();
@ -1712,7 +1700,7 @@ LibertyCell::latchCheckEnableTrans(TimingArcSet *check_set)
if (latch_enable)
return latch_enable->enableTransition();
else
return NULL;
return nullptr;
}
////////////////////////////////////////////////////////////////
@ -1769,14 +1757,14 @@ LibertyPort::LibertyPort(LibertyCell *cell,
ConcretePortSeq *members) :
ConcretePort(cell, name, is_bus, from_index, to_index, is_bundle, members),
liberty_cell_(cell),
function_(NULL),
tristate_enable_(NULL),
scaled_ports_(NULL),
function_(nullptr),
tristate_enable_(nullptr),
scaled_ports_(nullptr),
min_period_(0.0),
pulse_clk_trigger_(NULL),
pulse_clk_sense_(NULL),
related_ground_pin_(NULL),
related_power_pin_(NULL),
pulse_clk_trigger_(nullptr),
pulse_clk_sense_(nullptr),
related_ground_pin_(nullptr),
related_power_pin_(nullptr),
min_pulse_width_exists_(false),
min_period_exists_(false),
is_clk_(false),
@ -1885,7 +1873,7 @@ LibertyPort::capacitance(const TransRiseFall *tr,
}
LibertyLibrary *lib = liberty_cell_->libertyLibrary();
float cap = capacitance(tr, min_max);
return cap * lib->scaleFactor(scale_factor_pin_cap, liberty_cell_, pvt);
return cap * lib->scaleFactor(ScaleFactorType::pin_cap, liberty_cell_, pvt);
}
void
@ -1897,7 +1885,7 @@ LibertyPort::setFunction(FuncExpr *func)
int bit_offset = 0;
while (member_iter.hasNext()) {
LibertyPort *port_bit = member_iter.next();
FuncExpr *sub_expr = (func) ? func->bitSubExpr(bit_offset) : NULL;
FuncExpr *sub_expr = (func) ? func->bitSubExpr(bit_offset) : nullptr;
port_bit->setFunction(sub_expr);
bit_offset++;
}
@ -1913,7 +1901,7 @@ LibertyPort::setTristateEnable(FuncExpr *enable)
while (member_iter.hasNext()) {
LibertyPort *port_bit = member_iter.next();
FuncExpr *sub_expr =
(enable) ? enable->bitSubExpr(port_bit->busBitIndex()) : NULL;
(enable) ? enable->bitSubExpr(port_bit->busBitIndex()) : nullptr;
port_bit->setTristateEnable(sub_expr);
}
}
@ -1980,7 +1968,7 @@ LibertyPort::minPeriod(const OperatingConditions *op_cond,
}
}
LibertyLibrary *lib = liberty_cell_->libertyLibrary();
min_period = min_period_ * lib->scaleFactor(scale_factor_min_period,
min_period = min_period_ * lib->scaleFactor(ScaleFactorType::min_period,
liberty_cell_, pvt);
exists = min_period_exists_;
}
@ -2017,7 +2005,7 @@ LibertyPort::minPulseWidth(const TransRiseFall *hi_low,
int hi_low_index = hi_low->index();
LibertyLibrary *lib = liberty_cell_->libertyLibrary();
min_width = min_pulse_width_[hi_low_index]
* lib->scaleFactor(scale_factor_min_pulse_width, hi_low_index,
* lib->scaleFactor(ScaleFactorType::min_pulse_width, hi_low_index,
liberty_cell_, pvt);
exists = min_pulse_width_exists_ & (1 << hi_low_index);
}
@ -2045,8 +2033,8 @@ bool
LibertyPort::equiv(const LibertyPort *port1,
const LibertyPort *port2)
{
return (port1 == NULL && port2 == NULL)
|| (port1 != NULL && port2 != NULL
return (port1 == nullptr && port2 == nullptr)
|| (port1 != nullptr && port2 != nullptr
&& stringEq(port1->name(), port2->name())
&& port1->direction() == port2->direction());
}
@ -2072,7 +2060,7 @@ void
LibertyPort::addScaledPort(OperatingConditions *op_cond,
LibertyPort *scaled_port)
{
if (scaled_ports_ == NULL)
if (scaled_ports_ == nullptr)
scaled_ports_ = new ScaledPortMap;
(*scaled_ports_)[op_cond] = scaled_port;
}
@ -2298,9 +2286,9 @@ ModeValueDef::setSdfCond(const char *sdf_cond)
TableTemplate::TableTemplate(const char *name) :
name_(stringCopy(name)),
axis1_(NULL),
axis2_(NULL),
axis3_(NULL)
axis1_(nullptr),
axis2_(nullptr),
axis3_(nullptr)
{
}
@ -2381,7 +2369,7 @@ OperatingConditions::OperatingConditions(const char *name) :
Pvt(0.0, 0.0, 0.0),
name_(stringCopy(name)),
// Default wireload tree.
wire_load_tree_(wire_load_balanced_tree)
wire_load_tree_(WireloadTree::balanced)
{
}
@ -2409,115 +2397,87 @@ OperatingConditions::setWireloadTree(WireloadTree tree)
////////////////////////////////////////////////////////////////
typedef Map<const char*,ScaleFactorType,CharPtrLess> ScaleFactorTypeMap;
static const char *scale_factor_type_names[] = {"pin_cap",
"wire_cap",
"wire_res",
"min_period",
"cell",
"hold",
"setup",
"recovery",
"removal",
"nochange",
"skew",
"leakage_power",
"internal_power",
"transition",
"min_pulse_width",
"count",
"unknown"};
static ScaleFactorTypeMap *scale_factor_type_name_map = NULL;
void
makeScaleFactorTypeMap()
{
scale_factor_type_name_map = new ScaleFactorTypeMap;
for (int i = 0; i < scale_factor_count; i++) {
ScaleFactorType type = (ScaleFactorType) i;
(*scale_factor_type_name_map)[scale_factor_type_names[type]] = type;
}
}
void
deleteScaleFactorTypeMap()
{
delete scale_factor_type_name_map;
scale_factor_type_name_map = NULL;
}
static EnumNameMap<ScaleFactorType> scale_factor_type_map =
{{ScaleFactorType::pin_cap, "pin_cap"},
{ScaleFactorType::wire_cap, "wire_res"},
{ScaleFactorType::min_period, "min_period"},
{ScaleFactorType::cell, "cell"},
{ScaleFactorType::hold, "hold"},
{ScaleFactorType::setup, "setup"},
{ScaleFactorType::recovery, "recovery"},
{ScaleFactorType::removal, "removal"},
{ScaleFactorType::nochange, "nochange"},
{ScaleFactorType::skew, "skew"},
{ScaleFactorType::leakage_power, "leakage_power"},
{ScaleFactorType::internal_power, "internal_power"},
{ScaleFactorType::transition, "transition"},
{ScaleFactorType::min_pulse_width, "min_pulse_width"},
{ScaleFactorType::unknown, "unknown"}
};
const char *
scaleFactorTypeName(ScaleFactorType type)
{
return scale_factor_type_names[type];
return scale_factor_type_map.find(type);
}
ScaleFactorType
findScaleFactorType(const char *name)
{
ScaleFactorType type;
bool exists;
scale_factor_type_name_map->findKey(name, type, exists);
if (exists)
return type;
else
return scale_factor_unknown;
return scale_factor_type_map.find(name, ScaleFactorType::unknown);
}
bool
scaleFactorTypeRiseFallSuffix(ScaleFactorType type)
{
return type == scale_factor_cell
|| type == scale_factor_hold
|| type == scale_factor_setup
|| type == scale_factor_recovery
|| type == scale_factor_removal
|| type == scale_factor_nochange
|| type == scale_factor_skew;
return type == ScaleFactorType::cell
|| type == ScaleFactorType::hold
|| type == ScaleFactorType::setup
|| type == ScaleFactorType::recovery
|| type == ScaleFactorType::removal
|| type == ScaleFactorType::nochange
|| type == ScaleFactorType::skew;
}
bool
scaleFactorTypeRiseFallPrefix(ScaleFactorType type)
{
return type == scale_factor_transition;
return type == ScaleFactorType::transition;
}
bool
scaleFactorTypeLowHighSuffix(ScaleFactorType type)
{
return type == scale_factor_min_pulse_width;
return type == ScaleFactorType::min_pulse_width;
}
static const char *scale_factor_pvt_names[] = {"process",
"volt",
"temp"};
////////////////////////////////////////////////////////////////
EnumNameMap<ScaleFactorPvt> scale_factor_pvt_names =
{{ScaleFactorPvt::process, "process"},
{ScaleFactorPvt::volt, "volt"},
{ScaleFactorPvt::temp, "temp"}
};
ScaleFactorPvt
findScaleFactorPvt(const char *name)
{
if (stringEq(name, scale_factor_pvt_names[scale_factor_process]))
return scale_factor_process;
else if (stringEq(name, scale_factor_pvt_names[scale_factor_temp]))
return scale_factor_temp;
else if (stringEq(name, scale_factor_pvt_names[scale_factor_volt]))
return scale_factor_volt;
else
return scale_factor_pvt_unknown;
return scale_factor_pvt_names.find(name, ScaleFactorPvt::unknown);
}
const char *
scaleFactorPvtName(ScaleFactorPvt pvt)
{
return scale_factor_pvt_names[pvt];
return scale_factor_pvt_names.find(pvt);
}
////////////////////////////////////////////////////////////////
ScaleFactors::ScaleFactors(const char *name) :
name_(stringCopy(name))
{
for (int type = 0; type < scale_factor_count; type++) {
for (int pvt = 0; pvt < scale_factor_pvt_count; pvt++) {
for (int type = 0; type < scale_factor_type_count; type++) {
for (int pvt = 0; pvt < int(ScaleFactorPvt::count); pvt++) {
TransRiseFallIterator tr_iter;
while (tr_iter.hasNext()) {
TransRiseFall *tr = tr_iter.next();
@ -2539,7 +2499,7 @@ ScaleFactors::setScale(ScaleFactorType type,
TransRiseFall *tr,
float scale)
{
scales_[type][pvt][tr->index()] = scale;
scales_[int(type)][int(pvt)][tr->index()] = scale;
}
void
@ -2547,7 +2507,7 @@ ScaleFactors::setScale(ScaleFactorType type,
ScaleFactorPvt pvt,
float scale)
{
scales_[type][pvt][0] = scale;
scales_[int(type)][int(pvt)][0] = scale;
}
float
@ -2555,7 +2515,7 @@ ScaleFactors::scale(ScaleFactorType type,
ScaleFactorPvt pvt,
TransRiseFall *tr)
{
return scales_[type][pvt][tr->index()];
return scales_[int(type)][int(pvt)][tr->index()];
}
float
@ -2563,29 +2523,29 @@ ScaleFactors::scale(ScaleFactorType type,
ScaleFactorPvt pvt,
int tr_index)
{
return scales_[type][pvt][tr_index];
return scales_[int(type)][int(pvt)][tr_index];
}
float
ScaleFactors::scale(ScaleFactorType type,
ScaleFactorPvt pvt)
{
return scales_[type][pvt][0];
return scales_[int(type)][int(pvt)][0];
}
void
ScaleFactors::print()
{
printf("%10s", " ");
for (int pvt_index = 0; pvt_index < scale_factor_pvt_count; pvt_index++) {
for (int pvt_index = 0; pvt_index < int(ScaleFactorPvt::count); pvt_index++) {
ScaleFactorPvt pvt = (ScaleFactorPvt) pvt_index;
printf("%10s", scaleFactorPvtName(pvt));
}
printf("\n");
for (int type_index = 0; type_index < scale_factor_count; type_index++) {
for (int type_index = 0; type_index < scale_factor_type_count; type_index++) {
ScaleFactorType type = (ScaleFactorType) type_index;
printf("%10s ", scaleFactorTypeName(type));
for (int pvt_index = 0; pvt_index < scale_factor_pvt_count; pvt_index++) {
for (int pvt_index = 0; pvt_index < int(ScaleFactorPvt::count); pvt_index++) {
TransRiseFallIterator tr_iter;
if (scaleFactorTypeRiseFallSuffix(type)
|| scaleFactorTypeRiseFallPrefix(type)
@ -2617,11 +2577,11 @@ TestCell::TestCell(LibertyPort *data_in,
}
TestCell::TestCell() :
data_in_(NULL),
scan_in_(NULL),
scan_enable_(NULL),
scan_out_(NULL),
scan_out_inv_(NULL)
data_in_(nullptr),
scan_in_(nullptr),
scan_enable_(nullptr),
scan_out_(nullptr),
scan_out_inv_(nullptr)
{
}
@ -2668,8 +2628,8 @@ OcvDerate::OcvDerate(const char *name) :
while (tr_iter.hasNext()) {
TransRiseFall *tr = tr_iter.next();
int tr_index = tr->index();
derate_[tr_index][el_index][path_type_clk] = NULL;
derate_[tr_index][el_index][path_type_data] = NULL;
derate_[tr_index][el_index][int(PathType::clk)] = nullptr;
derate_[tr_index][el_index][int(PathType::data)] = nullptr;
}
}
}
@ -2689,10 +2649,10 @@ OcvDerate::~OcvDerate()
TransRiseFall *tr = tr_iter.next();
int tr_index = tr->index();
Table *derate;
derate = derate_[tr_index][el_index][path_type_clk];
derate = derate_[tr_index][el_index][int(PathType::clk)];
if (derate)
models.insert(derate);
derate = derate_[tr_index][el_index][path_type_data];
derate = derate_[tr_index][el_index][int(PathType::data)];
if (derate)
models.insert(derate);
}
@ -2709,7 +2669,7 @@ OcvDerate::derateTable(const TransRiseFall *tr,
const EarlyLate *early_late,
PathType path_type)
{
return derate_[tr->index()][early_late->index()][path_type];
return derate_[tr->index()][early_late->index()][int(path_type)];
}
void
@ -2718,7 +2678,7 @@ OcvDerate::setDerateTable(const TransRiseFall *tr,
const PathType path_type,
Table *derate)
{
derate_[tr->index()][early_late->index()][path_type] = derate;
derate_[tr->index()][early_late->index()][int(path_type)] = derate;
}
////////////////////////////////////////////////////////////////
@ -2727,7 +2687,7 @@ LibertyPgPort::LibertyPgPort(const char *name,
LibertyCell *cell) :
name_(stringCopy(name)),
pg_type_(unknown),
voltage_name_(NULL),
voltage_name_(nullptr),
cell_(cell)
{
}

View File

@ -72,37 +72,13 @@ typedef Vector<InternalPowerAttrs*> InternalPowerAttrsSeq;
typedef Map<const char *, float, CharPtrLess> SupplyVoltageMap;
typedef Map<const char *, LibertyPgPort*, CharPtrLess> LibertyPgPortMap;
typedef enum {
clock_gate_none,
clock_gate_latch_posedge,
clock_gate_latch_negedge,
clock_gate_other
} ClockGateType;
enum class ClockGateType { none, latch_posedge, latch_negedge, other };
typedef enum {
delay_model_cmos_linear,
delay_model_cmos_pwl,
delay_model_cmos2,
delay_model_table,
delay_model_polynomial,
delay_model_dcm
} DelayModelType;
enum class DelayModelType { cmos_linear, cmos_pwl, cmos2, table, polynomial, dcm };
typedef enum {
scale_factor_process,
scale_factor_volt,
scale_factor_temp,
scale_factor_pvt_count,
scale_factor_pvt_unknown
} ScaleFactorPvt;
enum class ScaleFactorPvt { process, volt, temp, count, unknown };
typedef enum {
table_template_delay,
table_template_power,
table_template_output_current,
table_template_ocv,
table_template_count
} TableTemplateType;
enum class TableTemplateType { delay, power, output_current, ocv, count };
void
initLiberty();
@ -279,7 +255,10 @@ public:
void addSupplyVoltage(const char *suppy_name,
float voltage);
bool supplyExists(const char *suppy_name) const;
float supplyVoltage(const char *suppy_name) const;
void supplyVoltage(const char *supply_name,
// Return value.
float &voltage,
bool &exists) const;
// Make scaled cell. Call LibertyCell::addScaledCell after it is complete.
LibertyCell *makeScaledCell(const char *name,
@ -303,7 +282,7 @@ protected:
Units *units_;
DelayModelType delay_model_type_;
BusDclMap bus_dcls_;
TableTemplateMap template_maps_[table_template_count];
TableTemplateMap template_maps_[int(TableTemplateType::count)];
float nominal_process_;
float nominal_voltage_;
float nominal_temperature_;
@ -343,12 +322,10 @@ protected:
// Set if any library has rise/fall capacitances.
static bool found_rise_fall_caps_;
static const float input_threshold_default_;
static const float output_threshold_default_;
static const float slew_lower_threshold_default_;
static const float slew_upper_threshold_default_;
static const float slew_lower_measure_threshold_default_;
static const float slew_upper_measure_threshold_default_;
static constexpr float input_threshold_default_ = .5;
static constexpr float output_threshold_default_ = .5;
static constexpr float slew_lower_threshold_default_ = .2;
static constexpr float slew_upper_threshold_default_ = .8;
private:
DISALLOW_COPY_AND_ASSIGN(LibertyLibrary);
@ -376,7 +353,7 @@ class TableTemplateIterator : public TableTemplateMap::ConstIterator
public:
TableTemplateIterator(const LibertyLibrary *library,
TableTemplateType type) :
TableTemplateMap::ConstIterator(library->template_maps_[type]) {}
TableTemplateMap::ConstIterator(library->template_maps_[int(type)]) {}
};
class OperatingConditionsIterator : public OperatingConditionsMap::ConstIterator
@ -424,7 +401,7 @@ public:
bool isClockGateLatchNegedge() const;
bool isClockGateOther() const;
bool isClockGate() const;
void setClockGateType(ClockGateType clock_gate_type);
void setClockGateType(ClockGateType type);
virtual unsigned addTimingArcSet(TimingArcSet *set);
void addTimingArcAttrs(TimingArcAttrs *attrs);
virtual void addInternalPower(InternalPower *power);
@ -865,7 +842,7 @@ public:
protected:
const char *name_;
float scales_[scale_factor_count][scale_factor_pvt_count][TransRiseFall::index_count];
float scales_[scale_factor_type_count][int(ScaleFactorPvt::count)][TransRiseFall::index_count];
private:
DISALLOW_COPY_AND_ASSIGN(ScaleFactors);

View File

@ -41,7 +41,7 @@ LibertyPort *
LibertyBuilder::makePort(LibertyCell *cell,
const char *name)
{
LibertyPort *port = new LibertyPort(cell, name, false, -1, -1, false, NULL);
LibertyPort *port = new LibertyPort(cell, name, false, -1, -1, false, nullptr);
cell->addPort(port);
return port;
}
@ -100,7 +100,7 @@ LibertyBuilder::makePort(LibertyCell *cell,
int bit_index)
{
ConcretePort *port = new LibertyPort(cell, bit_name, false,
bit_index, bit_index, false, NULL);
bit_index, bit_index, false, nullptr);
return port;
}
@ -124,9 +124,9 @@ LibertyBuilder::makeTimingArcs(LibertyCell *cell,
TimingArcAttrs *attrs)
{
FuncExpr *to_func;
Sequential *seq = NULL;
Sequential *seq = nullptr;
switch (attrs->timingType()) {
case timing_type_combinational:
case TimingType::combinational:
to_func = to_port->function();
if (to_func && to_func->op() == FuncExpr::op_port)
seq = cell->outputPortSequential(to_func->port());
@ -135,114 +135,114 @@ LibertyBuilder::makeTimingArcs(LibertyCell *cell,
else
return makeCombinationalArcs(cell, from_port, to_port, related_out,
true, true, attrs);
case timing_type_combinational_fall:
case TimingType::combinational_fall:
return makeCombinationalArcs(cell, from_port, to_port, related_out,
false, true, attrs);
case timing_type_combinational_rise:
case TimingType::combinational_rise:
return makeCombinationalArcs(cell, from_port, to_port, related_out,
true, false, attrs);
case timing_type_setup_rising:
case TimingType::setup_rising:
return makeFromTransitionArcs(cell, from_port, to_port, related_out,
TransRiseFall::rise(), TimingRole::setup(),
attrs);
case timing_type_setup_falling:
case TimingType::setup_falling:
return makeFromTransitionArcs(cell, from_port, to_port, related_out,
TransRiseFall::fall(), TimingRole::setup(),
attrs);
case timing_type_hold_rising:
case TimingType::hold_rising:
return makeFromTransitionArcs(cell, from_port, to_port, related_out,
TransRiseFall::rise(), TimingRole::hold(),
attrs);
case timing_type_hold_falling:
case TimingType::hold_falling:
return makeFromTransitionArcs(cell, from_port, to_port, related_out,
TransRiseFall::fall(), TimingRole::hold(),
attrs);
case timing_type_rising_edge:
case TimingType::rising_edge:
return makeRegLatchArcs(cell, from_port, to_port, related_out,
TransRiseFall::rise(), attrs);
case timing_type_falling_edge:
case TimingType::falling_edge:
return makeRegLatchArcs(cell, from_port, to_port, related_out,
TransRiseFall::fall(), attrs);
case timing_type_preset:
case TimingType::preset:
return makePresetClrArcs(cell, from_port, to_port, related_out,
TransRiseFall::rise(), attrs);
case timing_type_clear:
case TimingType::clear:
return makePresetClrArcs(cell, from_port, to_port, related_out,
TransRiseFall::fall(), attrs);
case timing_type_recovery_rising:
case TimingType::recovery_rising:
return makeFromTransitionArcs(cell, from_port, to_port, related_out,
TransRiseFall::rise(),TimingRole::recovery(),
attrs);
case timing_type_recovery_falling:
case TimingType::recovery_falling:
return makeFromTransitionArcs(cell, from_port, to_port, related_out,
TransRiseFall::fall(),TimingRole::recovery(),
attrs);
case timing_type_removal_rising:
case TimingType::removal_rising:
return makeFromTransitionArcs(cell, from_port, to_port, related_out,
TransRiseFall::rise(), TimingRole::removal(),
attrs);
case timing_type_removal_falling:
case TimingType::removal_falling:
return makeFromTransitionArcs(cell, from_port, to_port, related_out,
TransRiseFall::fall(), TimingRole::removal(),
attrs);
case timing_type_three_state_disable:
case TimingType::three_state_disable:
return makeTristateDisableArcs(cell, from_port, to_port, related_out,
true, true, attrs);
case timing_type_three_state_disable_fall:
case TimingType::three_state_disable_fall:
return makeTristateDisableArcs(cell, from_port, to_port, related_out,
false, true, attrs);
case timing_type_three_state_disable_rise:
case TimingType::three_state_disable_rise:
return makeTristateDisableArcs(cell, from_port, to_port, related_out,
true, false, attrs);
case timing_type_three_state_enable:
case TimingType::three_state_enable:
return makeTristateEnableArcs(cell, from_port, to_port, related_out,
true, true, attrs);
case timing_type_three_state_enable_fall:
case TimingType::three_state_enable_fall:
return makeTristateEnableArcs(cell, from_port, to_port, related_out,
false, true, attrs);
case timing_type_three_state_enable_rise:
case TimingType::three_state_enable_rise:
return makeTristateEnableArcs(cell, from_port, to_port, related_out,
true, false, attrs);
case timing_type_skew_falling:
case TimingType::skew_falling:
return makeFromTransitionArcs(cell, from_port, to_port, related_out,
TransRiseFall::fall(), TimingRole::skew(),
attrs);
case timing_type_skew_rising:
case TimingType::skew_rising:
return makeFromTransitionArcs(cell, from_port, to_port, related_out,
TransRiseFall::rise(), TimingRole::skew(),
attrs);
case timing_type_non_seq_setup_rising:
case TimingType::non_seq_setup_rising:
return makeFromTransitionArcs(cell, from_port, to_port, related_out,
TransRiseFall::rise(),
TimingRole::nonSeqSetup(), attrs);
case timing_type_non_seq_setup_falling:
case TimingType::non_seq_setup_falling:
return makeFromTransitionArcs(cell, from_port, to_port, related_out,
TransRiseFall::fall(),
TimingRole::nonSeqSetup(), attrs);
case timing_type_non_seq_hold_rising:
case TimingType::non_seq_hold_rising:
return makeFromTransitionArcs(cell, from_port, to_port, related_out,
TransRiseFall::rise(),
TimingRole::nonSeqHold(),
attrs);
case timing_type_non_seq_hold_falling:
case TimingType::non_seq_hold_falling:
return makeFromTransitionArcs(cell, from_port, to_port, related_out,
TransRiseFall::fall(),
TimingRole::nonSeqHold(),
attrs);
case timing_type_min_pulse_width:
case timing_type_minimum_period:
case timing_type_nochange_high_high:
case timing_type_nochange_high_low:
case timing_type_nochange_low_high:
case timing_type_nochange_low_low:
case timing_type_retaining_time:
case timing_type_unknown:
case timing_type_min_clock_tree_path:
case timing_type_max_clock_tree_path:
return NULL;
case TimingType::min_pulse_width:
case TimingType::minimum_period:
case TimingType::nochange_high_high:
case TimingType::nochange_high_low:
case TimingType::nochange_low_high:
case TimingType::nochange_low_low:
case TimingType::retaining_time:
case TimingType::unknown:
case TimingType::min_clock_tree_path:
case TimingType::max_clock_tree_path:
return nullptr;
}
// Prevent warnings from lame compilers.
return NULL;
return nullptr;
}
TimingArcSet *
@ -258,21 +258,21 @@ LibertyBuilder::makeCombinationalArcs(LibertyCell *cell,
TimingArcSet *arc_set = makeTimingArcSet(cell, from_port, to_port, related_out,
TimingRole::combinational(), attrs);
TimingSense sense = attrs->timingSense();
if (sense == timing_sense_unknown && func) {
if (sense == TimingSense::unknown && func) {
// Timing sense not specified - find it from function.
sense = func->portTimingSense(from_port);
if (sense == timing_sense_none
if (sense == TimingSense::none
&& to_port->direction()->isAnyTristate()) {
// from_port is not an input to function, check tristate enable.
FuncExpr *enable = to_port->tristateEnable();
if (enable && enable->hasPort(from_port))
sense = timing_sense_non_unate;
sense = TimingSense::non_unate;
}
}
TimingModel *model;
TransRiseFall *to_tr;
switch (sense) {
case timing_sense_positive_unate:
case TimingSense::positive_unate:
if (to_rise) {
to_tr = TransRiseFall::rise();
model = attrs->model(to_tr);
@ -286,7 +286,7 @@ LibertyBuilder::makeCombinationalArcs(LibertyCell *cell,
makeTimingArc(arc_set, TransRiseFall::fall(), to_tr, model);
}
break;
case timing_sense_negative_unate:
case TimingSense::negative_unate:
if (to_fall) {
to_tr = TransRiseFall::fall();
model = attrs->model(to_tr);
@ -300,12 +300,12 @@ LibertyBuilder::makeCombinationalArcs(LibertyCell *cell,
makeTimingArc(arc_set, TransRiseFall::fall(), to_tr, model);
}
break;
case timing_sense_non_unate:
case timing_sense_unknown:
case TimingSense::non_unate:
case TimingSense::unknown:
// Timing sense none means function does not mention from_port.
// This can happen if the function references an internal port,
// as in fpga lut cells.
case timing_sense_none:
case TimingSense::none:
if (to_fall) {
to_tr = TransRiseFall::fall();
model = attrs->model(to_tr);
@ -342,14 +342,14 @@ LibertyBuilder::makeLatchDtoQArcs(LibertyCell *cell,
model = attrs->model(to_tr);
TimingSense sense = attrs->timingSense();
if (model) {
TransRiseFall *from_tr = (sense == timing_sense_negative_unate) ?
TransRiseFall *from_tr = (sense == TimingSense::negative_unate) ?
to_tr->opposite() : to_tr;
makeTimingArc(arc_set, from_tr, to_tr, model);
}
to_tr = TransRiseFall::fall();
model = attrs->model(to_tr);
if (model) {
TransRiseFall *from_tr = (sense == timing_sense_negative_unate) ?
TransRiseFall *from_tr = (sense == TimingSense::negative_unate) ?
to_tr->opposite() : to_tr;
makeTimingArc(arc_set, from_tr, to_tr, model);
}
@ -425,25 +425,25 @@ LibertyBuilder::makePresetClrArcs(LibertyCell *cell,
TransRiseFall *to_tr,
TimingArcAttrs *attrs)
{
TimingArcSet *arc_set = NULL;
TimingArcSet *arc_set = nullptr;
TimingModel *model = attrs->model(to_tr);
if (model) {
arc_set = makeTimingArcSet(cell, from_port, to_port, related_out,
TimingRole::regSetClr(), attrs);
TransRiseFall *opp_tr = to_tr->opposite();
switch (attrs->timingSense()) {
case timing_sense_positive_unate:
case TimingSense::positive_unate:
makeTimingArc(arc_set, to_tr, to_tr, model);
break;
case timing_sense_negative_unate:
case TimingSense::negative_unate:
makeTimingArc(arc_set, opp_tr, to_tr, model);
break;
case timing_sense_non_unate:
case timing_sense_unknown:
case TimingSense::non_unate:
case TimingSense::unknown:
makeTimingArc(arc_set, to_tr, to_tr, model);
makeTimingArc(arc_set, opp_tr, to_tr, model);
break;
case timing_sense_none:
case TimingSense::none:
break;
}
}
@ -466,12 +466,12 @@ LibertyBuilder::makeTristateEnableArcs(LibertyCell *cell,
TimingRole::tristateEnable(),attrs);
FuncExpr *tristate_enable = to_port->tristateEnable();
TimingSense sense = attrs->timingSense();
if (sense == timing_sense_unknown && tristate_enable)
if (sense == TimingSense::unknown && tristate_enable)
sense = tristate_enable->portTimingSense(from_port);
TimingModel *model;
TransRiseFall *to_tr;
switch (sense) {
case timing_sense_positive_unate:
case TimingSense::positive_unate:
if (to_rise) {
to_tr = TransRiseFall::rise();
model = attrs->model(to_tr);
@ -485,7 +485,7 @@ LibertyBuilder::makeTristateEnableArcs(LibertyCell *cell,
makeTimingArc(arc_set, Transition::rise(), Transition::trZ0(), model);
}
break;
case timing_sense_negative_unate:
case TimingSense::negative_unate:
if (to_rise) {
to_tr = TransRiseFall::rise();
model = attrs->model(to_tr);
@ -499,8 +499,8 @@ LibertyBuilder::makeTristateEnableArcs(LibertyCell *cell,
makeTimingArc(arc_set, Transition::fall(), Transition::trZ0(), model);
}
break;
case timing_sense_non_unate:
case timing_sense_unknown:
case TimingSense::non_unate:
case TimingSense::unknown:
if (to_rise) {
to_tr = TransRiseFall::rise();
model = attrs->model(to_tr);
@ -518,7 +518,7 @@ LibertyBuilder::makeTristateEnableArcs(LibertyCell *cell,
}
}
break;
case timing_sense_none:
case TimingSense::none:
break;
}
return arc_set;
@ -539,12 +539,12 @@ LibertyBuilder::makeTristateDisableArcs(LibertyCell *cell,
attrs);
TimingSense sense = attrs->timingSense();
FuncExpr *tristate_enable = to_port->tristateEnable();
if (sense == timing_sense_unknown && tristate_enable)
if (sense == TimingSense::unknown && tristate_enable)
sense = timingSenseOpposite(tristate_enable->portTimingSense(from_port));
TimingModel *model;
TransRiseFall *to_tr;
switch (sense) {
case timing_sense_positive_unate:
case TimingSense::positive_unate:
if (to_rise) {
to_tr = TransRiseFall::rise();
model = attrs->model(to_tr);
@ -558,7 +558,7 @@ LibertyBuilder::makeTristateDisableArcs(LibertyCell *cell,
makeTimingArc(arc_set, Transition::rise(), Transition::tr1Z(), model);
}
break;
case timing_sense_negative_unate:
case TimingSense::negative_unate:
if (to_rise) {
to_tr = TransRiseFall::rise();
model = attrs->model(to_tr);
@ -572,8 +572,8 @@ LibertyBuilder::makeTristateDisableArcs(LibertyCell *cell,
makeTimingArc(arc_set, Transition::fall(), Transition::tr1Z(), model);
}
break;
case timing_sense_non_unate:
case timing_sense_unknown:
case TimingSense::non_unate:
case TimingSense::unknown:
if (to_rise) {
to_tr = TransRiseFall::rise();
model = attrs->model(to_tr);
@ -591,7 +591,7 @@ LibertyBuilder::makeTristateDisableArcs(LibertyCell *cell,
}
}
break;
case timing_sense_none:
case TimingSense::none:
break;
}
return arc_set;

View File

@ -67,86 +67,70 @@ typedef Set<LibertyCell*> LibertyCellSet;
typedef Vector<float> FloatSeq;
typedef Vector<FloatSeq*> FloatTable;
typedef enum {
scale_factor_pin_cap,
scale_factor_wire_cap,
scale_factor_wire_res,
scale_factor_min_period,
enum class ScaleFactorType : unsigned {
pin_cap,
wire_cap,
wire_res,
min_period,
// Liberty attributes have rise/fall suffix.
scale_factor_cell,
scale_factor_hold,
scale_factor_setup,
scale_factor_recovery,
scale_factor_removal,
scale_factor_nochange,
scale_factor_skew,
scale_factor_leakage_power,
scale_factor_internal_power,
cell,
hold,
setup,
recovery,
removal,
nochange,
skew,
leakage_power,
internal_power,
// Liberty attributes have rise/fall prefix.
scale_factor_transition,
transition,
// Liberty attributes have low/high suffix (indexed as rise/fall).
scale_factor_min_pulse_width,
scale_factor_unknown,
scale_factor_count
} ScaleFactorType;
min_pulse_width,
unknown,
};
const int scale_factor_type_count = int(ScaleFactorType::unknown) + 1;
// Enough bits to hold a ScaleFactorType enum.
const int scale_factor_bits = 4;
typedef enum {
wire_load_worst_case_tree,
wire_load_best_case_tree,
wire_load_balanced_tree,
wire_load_unknown_tree
} WireloadTree;
enum class WireloadTree { worst_case, best_case, balanced, unknown };
typedef enum {
wire_load_mode_top,
wire_load_mode_enclosed,
wire_load_mode_segmented,
wire_load_mode_unknown
} WireloadMode;
enum class WireloadMode { top, enclosed, segmented, unknown };
typedef enum {
timing_sense_positive_unate,
timing_sense_negative_unate,
timing_sense_non_unate,
timing_sense_none,
timing_sense_unknown
} TimingSense;
enum class TimingSense {
positive_unate,
negative_unate,
non_unate,
none,
unknown
};
const int timing_sense_count = int(TimingSense::unknown) + 1;
const int timing_sense_bit_count = 3;
typedef enum {
table_axis_total_output_net_capacitance,
table_axis_equal_or_opposite_output_net_capacitance,
table_axis_input_net_transition,
table_axis_input_transition_time,
table_axis_related_pin_transition,
table_axis_constrained_pin_transition,
table_axis_output_pin_transition,
table_axis_connect_delay,
table_axis_related_out_total_output_net_capacitance,
table_axis_time,
table_axis_iv_output_voltage,
table_axis_input_noise_width,
table_axis_input_noise_height,
table_axis_input_voltage,
table_axis_output_voltage,
table_axis_path_depth,
table_axis_path_distance,
table_axis_normalized_voltage,
table_axis_unknown
} TableAxisVariable;
typedef enum {
path_type_clk,
path_type_data,
path_type_clk_and_data
} PathType;
enum class TableAxisVariable {
total_output_net_capacitance,
equal_or_opposite_output_net_capacitance,
input_net_transition,
input_transition_time,
related_pin_transition,
constrained_pin_transition,
output_pin_transition,
connect_delay,
related_out_total_output_net_capacitance,
time,
iv_output_voltage,
input_noise_width,
input_noise_height,
input_voltage,
output_voltage,
path_depth,
path_distance,
normalized_voltage,
unknown
};
enum class PathType { clk, data, clk_and_data };
const int path_type_count = 2;
const int timing_sense_count = timing_sense_unknown + 1;
const int timing_sense_bit_count = 3;
// Rise/fall to rise/fall.
const int timing_arc_index_bit_count = 2;
const int timing_arc_index_max = (1<<timing_arc_index_bit_count)-1;

View File

@ -32,14 +32,14 @@ FuncExpr *
parseFuncExpr(const char *func, LibertyCell *cell, const char *error_msg,
Report *report)
{
if (func != NULL && func[0] != '\0') {
if (func != nullptr && func[0] != '\0') {
LibExprParser parser(func, cell, error_msg, report);
libexpr_parser = &parser;
LibertyExprParse_parse();
return parser.result();
}
else
return NULL;
return nullptr;
}
LibExprParser::LibExprParser(const char *func, LibertyCell *cell,
@ -48,7 +48,7 @@ LibExprParser::LibExprParser(const char *func, LibertyCell *cell,
cell_(cell),
error_msg_(error_msg),
report_(report),
result_(NULL),
result_(nullptr),
token_length_(100),
token_(new char[token_length_]),
token_next_(token_)
@ -64,7 +64,7 @@ FuncExpr *
LibExprParser::makeFuncExprPort(const char *port_name)
{
LibertyPort *port = cell_->findLibertyPort(port_name);
FuncExpr *expr = NULL;
FuncExpr *expr = nullptr;
if (port)
expr = FuncExpr::makePort(port);
else
@ -80,7 +80,7 @@ LibExprParser::makeFuncExprNot(FuncExpr *arg)
if (arg)
return FuncExpr::makeNot(arg);
else
return NULL;
return nullptr;
}
FuncExpr *
@ -89,7 +89,7 @@ LibExprParser::makeFuncExprXor(FuncExpr *arg1, FuncExpr *arg2)
if (arg1 && arg2)
return FuncExpr::makeXor(arg1, arg2);
else
return NULL;
return nullptr;
}
FuncExpr *
@ -98,7 +98,7 @@ LibExprParser::makeFuncExprAnd(FuncExpr *arg1, FuncExpr *arg2)
if (arg1 && arg2)
return FuncExpr::makeAnd(arg1, arg2);
else
return NULL;
return nullptr;
}
FuncExpr *
@ -107,7 +107,7 @@ LibExprParser::makeFuncExprOr(FuncExpr *arg1, FuncExpr *arg2)
if (arg1 && arg2)
return FuncExpr::makeOr(arg1, arg2);
else
return NULL;
return nullptr;
}
void

View File

@ -46,7 +46,7 @@ static Report *liberty_report;
static LibertyStmt *
makeLibertyDefine(LibertyAttrValueSeq *values,
int line);
static AttrType
static LibertyAttrType
attrValueType(const char *value_type_name);
static LibertyGroupType
groupType(const char *group_type_name);
@ -63,8 +63,8 @@ parseLibertyFile(const char *filename,
liberty_group_visitor = library_visitor;
liberty_group_stack.clear();
liberty_filename = filename;
liberty_filename_prev = NULL;
liberty_stream_prev = NULL;
liberty_filename_prev = nullptr;
liberty_stream_prev = nullptr;
liberty_line = 1;
liberty_report = report;
LibertyParse_parse();
@ -91,14 +91,14 @@ libertyGroupEnd()
liberty_group_visitor->end(group);
liberty_group_stack.pop_back();
LibertyGroup *parent =
liberty_group_stack.empty() ? NULL : liberty_group_stack.back();
liberty_group_stack.empty() ? nullptr : liberty_group_stack.back();
if (parent && liberty_group_visitor->save(group)) {
parent->addSubgroup(group);
return group;
}
else {
delete group;
return NULL;
return nullptr;
}
}
@ -115,17 +115,17 @@ LibertyGroup::LibertyGroup(const char *type,
LibertyStmt(line),
type_(type),
params_(params),
attrs_(NULL),
attr_map_(NULL),
subgroups_(NULL),
define_map_(NULL)
attrs_(nullptr),
attr_map_(nullptr),
subgroups_(nullptr),
define_map_(nullptr)
{
}
void
LibertyGroup::addSubgroup(LibertyGroup *subgroup)
{
if (subgroups_ == NULL)
if (subgroups_ == nullptr)
subgroups_ = new LibertyGroupSeq;
subgroups_->push_back(subgroup);
}
@ -133,7 +133,7 @@ LibertyGroup::addSubgroup(LibertyGroup *subgroup)
void
LibertyGroup::addDefine(LibertyDefine *define)
{
if (define_map_ == NULL)
if (define_map_ == nullptr)
define_map_ = new LibertyDefineMap;
const char *define_name = define->name();
LibertyDefine *prev_define = define_map_->findKey(define_name);
@ -147,7 +147,7 @@ LibertyGroup::addDefine(LibertyDefine *define)
void
LibertyGroup::addAttribute(LibertyAttr *attr)
{
if (attrs_ == NULL)
if (attrs_ == nullptr)
attrs_ = new LibertyAttrSeq;
attrs_->push_back(attr);
if (attr_map_)
@ -185,7 +185,7 @@ LibertyGroup::firstName()
if (value->isString())
return value->stringValue();
}
return NULL;
return nullptr;
}
const char *
@ -196,14 +196,14 @@ LibertyGroup::secondName()
if (value->isString())
return value->stringValue();
}
return NULL;
return nullptr;
}
LibertyAttr *
LibertyGroup::findAttr(const char *name)
{
if (attrs_) {
if (attr_map_ == NULL) {
if (attr_map_ == nullptr) {
// Build attribute name map on demand.
LibertyAttrSeq::Iterator attr_iter(attrs_);
while (attr_iter.hasNext()) {
@ -214,7 +214,7 @@ LibertyGroup::findAttr(const char *name)
return attr_map_->findKey(name);
}
else
return NULL;
return nullptr;
}
LibertySubgroupIterator::LibertySubgroupIterator(LibertyGroup *group) :
@ -256,7 +256,7 @@ makeLibertySimpleAttr(const char *name,
}
else {
delete attr;
return NULL;
return nullptr;
}
}
@ -283,7 +283,7 @@ LibertyAttrValueSeq *
LibertySimpleAttr::values() const
{
internalError("valueIterator called for LibertySimpleAttribute");
return NULL;
return nullptr;
}
LibertyStmt *
@ -313,7 +313,7 @@ makeLibertyComplexAttr(const char *name,
}
else {
delete attr;
return NULL;
return nullptr;
}
}
}
@ -340,7 +340,7 @@ LibertyComplexAttr::firstValue()
if (values_ && values_->size() > 0)
return (*values_)[0];
else
return NULL;
return nullptr;
}
LibertyAttrValue *
@ -394,7 +394,7 @@ const char *
LibertyFloatAttrValue::stringValue()
{
internalError("LibertyStringAttrValue called for float value");
return NULL;
return nullptr;
}
////////////////////////////////////////////////////////////////
@ -403,12 +403,12 @@ static LibertyStmt *
makeLibertyDefine(LibertyAttrValueSeq *values,
int line)
{
LibertyDefine *define = NULL;
LibertyDefine *define = nullptr;
if (values->size() == 3) {
const char *define_name = (*values)[0]->stringValue();
const char *group_type_name = (*values)[1]->stringValue();
const char *value_type_name = (*values)[2]->stringValue();
AttrType value_type = attrValueType(value_type_name);
LibertyAttrType value_type = attrValueType(value_type_name);
LibertyGroupType group_type = groupType(group_type_name);
define = new LibertyDefine(stringCopy(define_name), group_type,
value_type, line);
@ -424,39 +424,39 @@ makeLibertyDefine(LibertyAttrValueSeq *values,
// The Liberty User Guide Version 2001.08 fails to define the strings
// used to define valid attribute types. Beyond "string" these are
// guesses.
static AttrType
static LibertyAttrType
attrValueType(const char *value_type_name)
{
if (stringEq(value_type_name, "string"))
return liberty_attr_string;
return LibertyAttrType::attr_string;
else if (stringEq(value_type_name, "integer"))
return liberty_attr_int;
return LibertyAttrType::attr_int;
else if (stringEq(value_type_name, "float"))
return liberty_attr_double;
return LibertyAttrType::attr_double;
else if (stringEq(value_type_name, "boolean"))
return liberty_attr_boolean;
return LibertyAttrType::attr_boolean;
else
return liberty_attr_unknown;
return LibertyAttrType::attr_unknown;
}
static LibertyGroupType
groupType(const char *group_type_name)
{
if (stringEq(group_type_name, "library"))
return liberty_group_library;
return LibertyGroupType::library;
else if (stringEq(group_type_name, "cell"))
return liberty_group_cell;
return LibertyGroupType::cell;
else if (stringEq(group_type_name, "pin"))
return liberty_group_pin;
return LibertyGroupType::pin;
else if (stringEq(group_type_name, "timing"))
return liberty_group_timing;
return LibertyGroupType::timing;
else
return liberty_group_unknown;
return LibertyGroupType::unknown;
}
LibertyDefine::LibertyDefine(const char *name,
LibertyGroupType group_type,
AttrType value_type,
LibertyAttrType value_type,
int line) :
LibertyStmt(line),
name_(name),
@ -483,7 +483,7 @@ makeLibertyVariable(char *var,
return variable;
else {
delete variable;
return NULL;
return nullptr;
}
}
@ -506,14 +506,14 @@ LibertyVariable::~LibertyVariable()
bool
libertyInInclude()
{
return liberty_filename_prev != NULL;
return liberty_filename_prev != nullptr;
}
FILE *
libertyIncludeBegin(const char *filename)
{
FILE *stream = fopen(filename, "r" );
if (stream == NULL)
if (stream == nullptr)
libertyParseError("cannot open include file %s.\n", filename);
else {
liberty_filename_prev = liberty_filename;
@ -533,8 +533,8 @@ libertyIncludeEnd()
liberty_filename = liberty_filename_prev;
liberty_line = liberty_line_prev;
LibertyLex_in = liberty_stream_prev;
liberty_filename_prev = NULL;
liberty_stream_prev = NULL;
liberty_filename_prev = nullptr;
liberty_stream_prev = nullptr;
}
void

View File

@ -47,21 +47,10 @@ typedef Map<const char *, float, CharPtrLess> LibertyVariableMap;
typedef Map<const char*,LibertyGroupVisitor*,CharPtrLess>LibertyGroupVisitorMap;
typedef LibertyAttrValueSeq::Iterator LibertyAttrValueIterator;
typedef enum {
liberty_attr_string,
liberty_attr_int,
liberty_attr_double,
liberty_attr_boolean,
liberty_attr_unknown
} AttrType;
enum class LibertyAttrType { attr_string, attr_int, attr_double,
attr_boolean, attr_unknown };
typedef enum {
liberty_group_library,
liberty_group_cell,
liberty_group_pin,
liberty_group_timing,
liberty_group_unknown
} LibertyGroupType;
enum class LibertyGroupType { library, cell, pin, timing, unknown };
// Abstract base class for liberty statements.
class LibertyStmt
@ -254,18 +243,20 @@ class LibertyDefine : public LibertyStmt
public:
LibertyDefine(const char *name,
LibertyGroupType group_type,
AttrType value_type,
LibertyAttrType value_type,
int line);
virtual ~LibertyDefine();
virtual bool isDefine() const { return true; }
const char *name() const { return name_; }
LibertyGroupType groupType() const { return group_type_; }
LibertyAttrType valueType() const { return value_type_; }
private:
DISALLOW_COPY_AND_ASSIGN(LibertyDefine);
const char *name_;
LibertyGroupType group_type_;
AttrType value_type_;
LibertyAttrType value_type_;
};
// The Liberty User Guide Version 2003.12 fails to document variables.

File diff suppressed because it is too large Load Diff

View File

@ -168,7 +168,7 @@ GateTableModel::reportTableLookup(const char *result_name,
findAxisValues(model, in_slew, load_cap, related_out_cap,
axis_value1, axis_value2, axis_value3);
model->reportValue(result_name, library, cell, pvt,
axis_value1, NULL, axis_value2, axis_value3,
axis_value1, nullptr, axis_value2, axis_value3,
digits, result);
}
}
@ -258,19 +258,19 @@ GateTableModel::maxCapSlew(const LibertyCell *cell,
TableAxis *axis2 = slew_model_->axis2();
TableAxis *axis3 = slew_model_->axis3();
if (axis1
&& axis1->variable() == table_axis_total_output_net_capacitance) {
&& axis1->variable() == TableAxisVariable::total_output_net_capacitance) {
cap = axis1->axisValue(axis1->size() - 1);
slew = findValue(library, cell, pvt, slew_model_,
in_slew, cap, 0.0);
}
else if (axis2
&& axis2->variable()==table_axis_total_output_net_capacitance) {
&& axis2->variable()==TableAxisVariable::total_output_net_capacitance) {
cap = axis2->axisValue(axis2->size() - 1);
slew = findValue(library, cell, pvt, slew_model_,
in_slew, cap, 0.0);
}
else if (axis3
&& axis3->variable()==table_axis_total_output_net_capacitance) {
&& axis3->variable()==TableAxisVariable::total_output_net_capacitance) {
cap = axis3->axisValue(axis3->size() - 1);
slew = findValue(library, cell, pvt, slew_model_,
in_slew, cap, 0.0);
@ -292,12 +292,12 @@ GateTableModel::axisValue(TableAxis *axis,
float related_out_cap) const
{
TableAxisVariable var = axis->variable();
if (var == table_axis_input_transition_time
|| var == table_axis_input_net_transition)
if (var == TableAxisVariable::input_transition_time
|| var == TableAxisVariable::input_net_transition)
return in_slew;
else if (var == table_axis_total_output_net_capacitance)
else if (var == TableAxisVariable::total_output_net_capacitance)
return load_cap;
else if (var == table_axis_related_out_total_output_net_capacitance)
else if (var == TableAxisVariable::related_out_total_output_net_capacitance)
return related_out_cap;
else {
internalError("unsupported table axes");
@ -325,10 +325,10 @@ bool
GateTableModel::checkAxis(TableAxis *axis)
{
TableAxisVariable var = axis->variable();
return var == table_axis_total_output_net_capacitance
|| var == table_axis_input_transition_time
|| var == table_axis_input_net_transition
|| var == table_axis_related_out_total_output_net_capacitance;
return var == TableAxisVariable::total_output_net_capacitance
|| var == TableAxisVariable::input_transition_time
|| var == TableAxisVariable::input_net_transition
|| var == TableAxisVariable::related_out_total_output_net_capacitance;
}
////////////////////////////////////////////////////////////////
@ -498,11 +498,11 @@ CheckTableModel::axisValue(TableAxis *axis,
float related_out_cap) const
{
TableAxisVariable var = axis->variable();
if (var == table_axis_related_pin_transition)
if (var == TableAxisVariable::related_pin_transition)
return from_slew;
else if (var == table_axis_constrained_pin_transition)
else if (var == TableAxisVariable::constrained_pin_transition)
return to_slew;
else if (var == table_axis_related_out_total_output_net_capacitance)
else if (var == TableAxisVariable::related_out_total_output_net_capacitance)
return related_out_cap;
else {
internalError("unsupported table axes");
@ -530,9 +530,9 @@ bool
CheckTableModel::checkAxis(TableAxis *axis)
{
TableAxisVariable var = axis->variable();
return var == table_axis_constrained_pin_transition
|| var == table_axis_related_pin_transition
|| var == table_axis_related_out_total_output_net_capacitance;
return var == TableAxisVariable::constrained_pin_transition
|| var == TableAxisVariable::related_pin_transition
|| var == TableAxisVariable::related_out_total_output_net_capacitance;
}
////////////////////////////////////////////////////////////////
@ -541,7 +541,7 @@ TableModel::TableModel(Table *table,
ScaleFactorType scale_factor_type,
TransRiseFall *tr) :
table_(table),
scale_factor_type_(scale_factor_type),
scale_factor_type_(int(scale_factor_type)),
tr_index_(tr->index()),
is_scaled_(false)
{
@ -561,7 +561,7 @@ TableModel::order() const
void
TableModel::setScaleFactorType(ScaleFactorType type)
{
scale_factor_type_ = type;
scale_factor_type_ = int(type);
}
void
@ -609,10 +609,9 @@ TableModel::scaleFactor(const LibertyLibrary *library,
// Scaled tables are not derated because scale factors are wrt
// nominal pvt.
return 1.0F;
else {
ScaleFactorType type = static_cast<ScaleFactorType>(scale_factor_type_);
return library->scaleFactor(type, tr_index_, cell, pvt);
}
else
return library->scaleFactor(static_cast<ScaleFactorType>(scale_factor_type_),
tr_index_, cell, pvt);
}
void
@ -647,7 +646,7 @@ reportPvt(const LibertyLibrary *library,
int digits,
string *result)
{
if (pvt == NULL)
if (pvt == nullptr)
pvt = library->defaultOperatingConditions();
if (pvt) {
string pvt_str;
@ -666,7 +665,7 @@ TableModel::reportPvtScaleFactor(const LibertyLibrary *library,
int digits,
string *result) const
{
if (pvt == NULL)
if (pvt == nullptr)
pvt = library->defaultOperatingConditions();
if (pvt) {
string scale_str;
@ -1332,74 +1331,74 @@ TableAxisVariable
stringTableAxisVariable(const char *variable)
{
if (stringEq(variable, "total_output_net_capacitance"))
return table_axis_total_output_net_capacitance;
return TableAxisVariable::total_output_net_capacitance;
if (stringEq(variable, "equal_or_opposite_output_net_capacitance"))
return table_axis_equal_or_opposite_output_net_capacitance;
return TableAxisVariable::equal_or_opposite_output_net_capacitance;
else if (stringEq(variable, "input_net_transition"))
return table_axis_input_net_transition;
return TableAxisVariable::input_net_transition;
else if (stringEq(variable, "input_transition_time"))
return table_axis_input_transition_time;
return TableAxisVariable::input_transition_time;
else if (stringEq(variable, "related_pin_transition"))
return table_axis_related_pin_transition;
return TableAxisVariable::related_pin_transition;
else if (stringEq(variable, "constrained_pin_transition"))
return table_axis_constrained_pin_transition;
return TableAxisVariable::constrained_pin_transition;
else if (stringEq(variable, "output_pin_transition"))
return table_axis_output_pin_transition;
return TableAxisVariable::output_pin_transition;
else if (stringEq(variable, "connect_delay"))
return table_axis_connect_delay;
return TableAxisVariable::connect_delay;
else if (stringEq(variable,"related_out_total_output_net_capacitance"))
return table_axis_related_out_total_output_net_capacitance;
return TableAxisVariable::related_out_total_output_net_capacitance;
else if (stringEq(variable, "time"))
return table_axis_time;
return TableAxisVariable::time;
else if (stringEq(variable, "iv_output_voltage"))
return table_axis_iv_output_voltage;
return TableAxisVariable::iv_output_voltage;
else if (stringEq(variable, "input_noise_width"))
return table_axis_input_noise_width;
return TableAxisVariable::input_noise_width;
else if (stringEq(variable, "input_noise_height"))
return table_axis_input_noise_height;
return TableAxisVariable::input_noise_height;
else if (stringEq(variable, "input_voltage"))
return table_axis_input_voltage;
return TableAxisVariable::input_voltage;
else if (stringEq(variable, "output_voltage"))
return table_axis_output_voltage;
return TableAxisVariable::output_voltage;
else if (stringEq(variable, "path_depth"))
return table_axis_path_depth;
return TableAxisVariable::path_depth;
else if (stringEq(variable, "path_distance"))
return table_axis_path_distance;
return TableAxisVariable::path_distance;
else if (stringEq(variable, "normalzied_voltage"))
return table_axis_normalized_voltage;
return TableAxisVariable::normalized_voltage;
else
return table_axis_unknown;
return TableAxisVariable::unknown;
}
const char *
tableVariableString(TableAxisVariable variable)
{
switch (variable) {
case table_axis_total_output_net_capacitance:
case TableAxisVariable::total_output_net_capacitance:
return "total_output_net_capacitance";
case table_axis_equal_or_opposite_output_net_capacitance:
case TableAxisVariable::equal_or_opposite_output_net_capacitance:
return "equal_or_opposite_output_net_capacitance";
case table_axis_input_net_transition:
case TableAxisVariable::input_net_transition:
return "input_net_transition";
case table_axis_input_transition_time:
case TableAxisVariable::input_transition_time:
return "input_transition_time";
case table_axis_related_pin_transition:
case TableAxisVariable::related_pin_transition:
return "related_pin_transition";
case table_axis_constrained_pin_transition:
case TableAxisVariable::constrained_pin_transition:
return "constrained_pin_transition";
case table_axis_output_pin_transition:
case TableAxisVariable::output_pin_transition:
return "output_pin_transition";
case table_axis_connect_delay:
case TableAxisVariable::connect_delay:
return "connect_delay";
case table_axis_related_out_total_output_net_capacitance:
case TableAxisVariable::related_out_total_output_net_capacitance:
return "related_out_total_output_net_capacitance";
case table_axis_time:
case TableAxisVariable::time:
return "time";
case table_axis_iv_output_voltage:
case TableAxisVariable::iv_output_voltage:
return "iv_output_voltage";
case table_axis_input_noise_width:
case TableAxisVariable::input_noise_width:
return "input_noise_width";
case table_axis_input_noise_height:
case TableAxisVariable::input_noise_height:
return "input_noise_height";
default:
return "unknown";
@ -1411,33 +1410,33 @@ tableVariableUnit(TableAxisVariable variable,
const Units *units)
{
switch (variable) {
case table_axis_total_output_net_capacitance:
case table_axis_related_out_total_output_net_capacitance:
case table_axis_equal_or_opposite_output_net_capacitance:
case TableAxisVariable::total_output_net_capacitance:
case TableAxisVariable::related_out_total_output_net_capacitance:
case TableAxisVariable::equal_or_opposite_output_net_capacitance:
return units->capacitanceUnit();
case table_axis_input_net_transition:
case table_axis_input_transition_time:
case table_axis_related_pin_transition:
case table_axis_constrained_pin_transition:
case table_axis_output_pin_transition:
case table_axis_connect_delay:
case table_axis_time:
case table_axis_input_noise_height:
case TableAxisVariable::input_net_transition:
case TableAxisVariable::input_transition_time:
case TableAxisVariable::related_pin_transition:
case TableAxisVariable::constrained_pin_transition:
case TableAxisVariable::output_pin_transition:
case TableAxisVariable::connect_delay:
case TableAxisVariable::time:
case TableAxisVariable::input_noise_height:
return units->timeUnit();
case table_axis_input_voltage:
case table_axis_output_voltage:
case table_axis_iv_output_voltage:
case table_axis_input_noise_width:
case TableAxisVariable::input_voltage:
case TableAxisVariable::output_voltage:
case TableAxisVariable::iv_output_voltage:
case TableAxisVariable::input_noise_width:
return units->voltageUnit();
case table_axis_path_distance:
case TableAxisVariable::path_distance:
return units->distanceUnit();
case table_axis_path_depth:
case table_axis_normalized_voltage:
case table_axis_unknown:
case TableAxisVariable::path_depth:
case TableAxisVariable::normalized_voltage:
case TableAxisVariable::unknown:
return units->scalarUnit();
}
// Prevent warnings from lame compilers.
return NULL;
return nullptr;
}
} // namespace

View File

@ -239,8 +239,9 @@ protected:
string *result) const;
Table *table_;
unsigned int scale_factor_type_:scale_factor_bits;
unsigned int tr_index_:TransRiseFall::index_bit_count;
// ScaleFactorType gcc barfs if this is dcl'd.
unsigned scale_factor_type_:scale_factor_bits;
unsigned tr_index_:TransRiseFall::index_bit_count;
bool is_scaled_:1;
private:
@ -255,9 +256,9 @@ public:
virtual ~Table() {}
void setScaleFactorType(ScaleFactorType type);
virtual int order() const = 0;
virtual TableAxis *axis1() const { return NULL; }
virtual TableAxis *axis2() const { return NULL; }
virtual TableAxis *axis3() const { return NULL; }
virtual TableAxis *axis1() const { return nullptr; }
virtual TableAxis *axis2() const { return nullptr; }
virtual TableAxis *axis3() const { return nullptr; }
void setIsScaled(bool is_scaled);
// Table interpolated lookup.
virtual float findValue(float value1,

View File

@ -15,6 +15,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "Machine.hh"
#include "EnumNameMap.hh"
#include "FuncExpr.hh"
#include "TimingRole.hh"
#include "Liberty.hh"
@ -33,16 +34,16 @@ timingArcsLess(const TimingArcSet *set1,
////////////////////////////////////////////////////////////////
TimingArcAttrs::TimingArcAttrs() :
timing_type_(timing_type_combinational),
timing_sense_(timing_sense_unknown),
cond_(NULL),
sdf_cond_(NULL),
sdf_cond_start_(NULL),
sdf_cond_end_(NULL),
mode_name_(NULL),
mode_value_(NULL),
timing_type_(TimingType::combinational),
timing_sense_(TimingSense::unknown),
cond_(nullptr),
sdf_cond_(nullptr),
sdf_cond_start_(nullptr),
sdf_cond_end_(nullptr),
mode_name_(nullptr),
mode_value_(nullptr),
ocv_arc_depth_(0.0),
models_{NULL, NULL}
models_{nullptr, nullptr}
{
}
@ -135,7 +136,7 @@ TimingArcAttrs::setOcvArcDepth(float depth)
////////////////////////////////////////////////////////////////
TimingArcSet *TimingArcSet::wire_timing_arc_set_ = NULL;
TimingArcSet *TimingArcSet::wire_timing_arc_set_ = nullptr;
TimingArcSet::TimingArcSet(LibertyCell *cell,
LibertyPort *from,
@ -165,20 +166,20 @@ TimingArcSet::TimingArcSet(LibertyCell *cell,
}
TimingArcSet::TimingArcSet(TimingRole *role) :
from_(NULL),
to_(NULL),
related_out_(NULL),
from_(nullptr),
to_(nullptr),
related_out_(nullptr),
role_(role),
cond_(NULL),
cond_(nullptr),
is_cond_default_(false),
sdf_cond_start_(NULL),
sdf_cond_end_(NULL),
mode_name_(NULL),
mode_value_(NULL),
sdf_cond_start_(nullptr),
sdf_cond_end_(nullptr),
mode_name_(nullptr),
mode_value_(nullptr),
index_(0),
is_disabled_constraint_(false)
{
init(NULL);
init(nullptr);
}
void
@ -191,8 +192,8 @@ TimingArcSet::init(LibertyCell *cell)
while (tr_iter.hasNext()) {
TransRiseFall *tr = tr_iter.next();
int tr_index = tr->index();
from_arc1_[tr_index] = NULL;
from_arc2_[tr_index] = NULL;
from_arc1_[tr_index] = nullptr;
from_arc2_[tr_index] = nullptr;
}
}
@ -208,7 +209,7 @@ TimingArcSet::libertyCell() const
return from_->libertyCell();
else
// Wire timing arc set.
return NULL;
return nullptr;
}
TimingArcSetArcIterator *
@ -226,9 +227,9 @@ TimingArcSet::addTimingArc(TimingArc *arc)
arcs_.push_back(arc);
int from_tr_index = arc->fromTrans()->asRiseFall()->index();
if (from_arc1_[from_tr_index] == NULL)
if (from_arc1_[from_tr_index] == nullptr)
from_arc1_[from_tr_index] = arc;
else if (from_arc2_[from_tr_index] == NULL)
else if (from_arc2_[from_tr_index] == nullptr)
from_arc2_[from_tr_index] = arc;
return arc_index;
@ -248,10 +249,10 @@ TimingArcSet::deleteTimingArc(TimingArc *arc)
int from_tr_index = arc->fromTrans()->asRiseFall()->index();
if (from_arc1_[from_tr_index] == arc) {
from_arc1_[from_tr_index] = from_arc2_[from_tr_index];
from_arc2_[from_tr_index] = NULL;
from_arc2_[from_tr_index] = nullptr;
}
else if (from_arc2_[from_tr_index] == arc)
from_arc2_[from_tr_index] = NULL;
from_arc2_[from_tr_index] = nullptr;
delete arc;
}
@ -292,7 +293,7 @@ TimingArcSet::sense() const
else if (arcs_.size() == 2 && arcs_[0]->sense() == arcs_[1]->sense())
return arcs_[0]->sense();
else
return timing_sense_non_unate;
return TimingSense::non_unate;
}
TransRiseFall *
@ -308,7 +309,7 @@ TimingArcSet::isRisingFallingEdge() const
if (arcs_.size() == 1)
return arcs_[0]->fromTrans()->asRiseFall();
else
return NULL;
return nullptr;
}
void
@ -475,16 +476,16 @@ TimingArcSet::init()
{
wire_timing_arc_set_ = new TimingArcSet(TimingRole::wire());
new TimingArc(wire_timing_arc_set_, Transition::rise(),
Transition::rise(), NULL);
Transition::rise(), nullptr);
new TimingArc(wire_timing_arc_set_, Transition::fall(),
Transition::fall(), NULL);
Transition::fall(), nullptr);
}
void
TimingArcSet::destroy()
{
delete wire_timing_arc_set_;
wire_timing_arc_set_ = NULL;
wire_timing_arc_set_ = nullptr;
}
////////////////////////////////////////////////////////////////
@ -504,7 +505,7 @@ TimingArc::TimingArc(TimingArcSet *set,
from_tr_(from_tr),
to_tr_(to_tr),
model_(model),
scaled_models_(NULL)
scaled_models_(nullptr)
{
index_ = set->addTimingArc(this);
}
@ -534,7 +535,7 @@ void
TimingArc::addScaledModel(const OperatingConditions *op_cond,
TimingModel *scaled_model)
{
if (scaled_models_ == NULL)
if (scaled_models_ == nullptr)
scaled_models_ = new ScaledTimingModelMap;
(*scaled_models_)[op_cond] = scaled_model;
}
@ -582,154 +583,129 @@ TimingArc::sense() const
&& to_tr_ == Transition::rise())
|| (from_tr_ == Transition::fall()
&& to_tr_ == Transition::fall()))
return timing_sense_positive_unate;
return TimingSense::positive_unate;
else if ((from_tr_ == Transition::rise()
&& to_tr_ == Transition::fall())
|| (from_tr_ == Transition::fall()
&& to_tr_ == Transition::rise()))
return timing_sense_negative_unate;
return TimingSense::negative_unate;
else
return timing_sense_non_unate;
return TimingSense::non_unate;
}
static EnumNameMap<TimingSense> timing_sense_name_map =
{{TimingSense::positive_unate, "positive_unate"},
{TimingSense::negative_unate, "negative_unate"},
{TimingSense::non_unate, "non_unate"},
{TimingSense::none, "none"},
{TimingSense::unknown, "unknown"}
};
const char *
timingSenseString(TimingSense sense)
{
static const char *sense_string[] = {"positive_unate",
"negative_unate",
"non_unate",
"none",
"unknown"};
return sense_string[sense];
return timing_sense_name_map.find(sense);
}
TimingSense
timingSenseOpposite(TimingSense sense)
{
switch (sense) {
case timing_sense_positive_unate:
return timing_sense_negative_unate;
case timing_sense_negative_unate:
return timing_sense_positive_unate;
case timing_sense_non_unate:
return timing_sense_non_unate;
case timing_sense_unknown:
return timing_sense_unknown;
case timing_sense_none:
return timing_sense_none;
case TimingSense::positive_unate:
return TimingSense::negative_unate;
case TimingSense::negative_unate:
return TimingSense::positive_unate;
case TimingSense::non_unate:
return TimingSense::non_unate;
case TimingSense::unknown:
return TimingSense::unknown;
case TimingSense::none:
return TimingSense::none;
}
// Prevent warnings from lame compilers.
return timing_sense_unknown;
return TimingSense::unknown;
}
////////////////////////////////////////////////////////////////
// Same order as enum TimingType.
static const char *timing_type_strings[] = {
"clear",
"combinational",
"combinational_fall",
"combinational_rise",
"falling_edge",
"hold_falling",
"hold_rising",
"min_pulse_width",
"minimum_period",
"nochange_high_high",
"nochange_high_low",
"nochange_low_high",
"nochange_low_low",
"non_seq_hold_falling",
"non_seq_hold_rising",
"non_seq_setup_falling",
"non_seq_setup_rising",
"preset",
"recovery_falling",
"recovery_rising",
"removal_falling",
"removal_rising",
"retaining_time",
"rising_edge",
"setup_falling",
"setup_rising",
"skew_falling",
"skew_rising",
"three_state_disable",
"three_state_disable_fall",
"three_state_disable_rise",
"three_state_enable",
"three_state_enable_fall",
"three_state_enable_rise",
"min_clock_tree_path",
"max_clock_tree_path",
"unknown"
};
typedef Map<const char*,TimingType,CharPtrLess> TimingTypeMap;
static TimingTypeMap *timing_type_string_map = NULL;
void
makeTimingTypeMap()
{
timing_type_string_map = new TimingTypeMap();
int count = sizeof(timing_type_strings) / sizeof(const char*);
for (int i = 0; i < count; i++) {
const char *type_name = timing_type_strings[i];
(*timing_type_string_map)[type_name] = (TimingType) i;
}
}
void
deleteTimingTypeMap()
{
delete timing_type_string_map;
timing_type_string_map = NULL;
}
EnumNameMap<TimingType> timing_type_name_map =
{{TimingType::clear, "clear"},
{TimingType::combinational, "combinational"},
{TimingType::combinational_fall, "combinational_fall"},
{TimingType::combinational_rise, "combinational_rise"},
{TimingType::falling_edge, "falling_edge"},
{TimingType::hold_falling, "hold_falling"},
{TimingType::hold_rising, "hold_rising"},
{TimingType::min_pulse_width, "min_pulse_width"},
{TimingType::minimum_period, "minimum_period"},
{TimingType::nochange_high_high, "nochange_high_high"},
{TimingType::nochange_high_low, "nochange_high_low"},
{TimingType::nochange_low_high, "nochange_low_high"},
{TimingType::nochange_low_low, "nochange_low_low"},
{TimingType::non_seq_hold_falling, "non_seq_hold_falling"},
{TimingType::non_seq_hold_rising, "non_seq_hold_rising"},
{TimingType::non_seq_setup_falling, "non_seq_setup_falling"},
{TimingType::non_seq_setup_rising, "non_seq_setup_rising"},
{TimingType::preset, "preset"},
{TimingType::recovery_falling, "recovery_falling"},
{TimingType::recovery_rising, "recovery_rising"},
{TimingType::removal_falling, "removal_falling"},
{TimingType::removal_rising, "removal_rising"},
{TimingType::retaining_time, "retaining_time"},
{TimingType::rising_edge, "rising_edge"},
{TimingType::setup_falling, "setup_falling"},
{TimingType::setup_rising, "setup_rising"},
{TimingType::skew_falling, "skew_falling"},
{TimingType::skew_rising, "skew_rising"},
{TimingType::three_state_disable, "three_state_disable"},
{TimingType::three_state_disable_fall, "three_state_disable_fall"},
{TimingType::three_state_disable_rise, "three_state_disable_rise"},
{TimingType::three_state_enable, "three_state_enable"},
{TimingType::three_state_enable_fall, "three_state_enable_fall"},
{TimingType::three_state_enable_rise, "three_state_enable_rise"},
{TimingType::min_clock_tree_path, "min_clock_tree_path"},
{TimingType::max_clock_tree_path, "max_clock_tree_path"},
{TimingType::unknown, "unknown"}
};
const char *
timingTypeString(TimingType type)
{
return timing_type_strings[type];
return timing_type_name_map.find(type);
}
TimingType
findTimingType(const char *type_name)
{
TimingType type;
bool exists;
timing_type_string_map->findKey(type_name, type, exists);
if (exists)
return type;
else
return timing_type_unknown;
return timing_type_name_map.find(type_name, TimingType::unknown);
}
bool
timingTypeIsCheck(TimingType type)
{
switch (type) {
case timing_type_hold_falling:
case timing_type_hold_rising:
case timing_type_min_pulse_width:
case timing_type_minimum_period:
case timing_type_nochange_high_high:
case timing_type_nochange_high_low:
case timing_type_nochange_low_high:
case timing_type_nochange_low_low:
case timing_type_non_seq_hold_falling:
case timing_type_non_seq_hold_rising:
case timing_type_non_seq_setup_falling:
case timing_type_non_seq_setup_rising:
case timing_type_recovery_falling:
case timing_type_recovery_rising:
case timing_type_removal_falling:
case timing_type_removal_rising:
case timing_type_retaining_time:
case timing_type_setup_falling:
case timing_type_setup_rising:
case timing_type_skew_falling:
case timing_type_skew_rising:
case TimingType::hold_falling:
case TimingType::hold_rising:
case TimingType::min_pulse_width:
case TimingType::minimum_period:
case TimingType::nochange_high_high:
case TimingType::nochange_high_low:
case TimingType::nochange_low_high:
case TimingType::nochange_low_low:
case TimingType::non_seq_hold_falling:
case TimingType::non_seq_hold_rising:
case TimingType::non_seq_setup_falling:
case TimingType::non_seq_setup_rising:
case TimingType::recovery_falling:
case TimingType::recovery_rising:
case TimingType::removal_falling:
case TimingType::removal_rising:
case TimingType::retaining_time:
case TimingType::setup_falling:
case TimingType::setup_rising:
case TimingType::skew_falling:
case TimingType::skew_rising:
return true;
default:
return false;
@ -740,55 +716,55 @@ ScaleFactorType
timingTypeScaleFactorType(TimingType type)
{
switch (type) {
case timing_type_non_seq_setup_falling:
case timing_type_non_seq_setup_rising:
case timing_type_setup_falling:
case timing_type_setup_rising:
return scale_factor_setup;
case timing_type_hold_falling:
case timing_type_hold_rising:
case timing_type_non_seq_hold_falling:
case timing_type_non_seq_hold_rising:
return scale_factor_hold;
case timing_type_recovery_falling:
case timing_type_recovery_rising:
return scale_factor_recovery;
case timing_type_removal_falling:
case timing_type_removal_rising:
return scale_factor_removal;
case timing_type_skew_falling:
case timing_type_skew_rising:
return scale_factor_skew;
case timing_type_minimum_period:
return scale_factor_min_period;
case timing_type_nochange_high_high:
case timing_type_nochange_high_low:
case timing_type_nochange_low_high:
case timing_type_nochange_low_low:
return scale_factor_nochange;
case timing_type_min_pulse_width:
return scale_factor_min_pulse_width;
case timing_type_clear:
case timing_type_combinational:
case timing_type_combinational_fall:
case timing_type_combinational_rise:
case timing_type_falling_edge:
case timing_type_preset:
case timing_type_retaining_time:
case timing_type_rising_edge:
case timing_type_three_state_disable:
case timing_type_three_state_disable_fall:
case timing_type_three_state_disable_rise:
case timing_type_three_state_enable:
case timing_type_three_state_enable_fall:
case timing_type_three_state_enable_rise:
case timing_type_min_clock_tree_path:
case timing_type_max_clock_tree_path:
return scale_factor_cell;
case timing_type_unknown:
return scale_factor_unknown;
case TimingType::non_seq_setup_falling:
case TimingType::non_seq_setup_rising:
case TimingType::setup_falling:
case TimingType::setup_rising:
return ScaleFactorType::setup;
case TimingType::hold_falling:
case TimingType::hold_rising:
case TimingType::non_seq_hold_falling:
case TimingType::non_seq_hold_rising:
return ScaleFactorType::hold;
case TimingType::recovery_falling:
case TimingType::recovery_rising:
return ScaleFactorType::recovery;
case TimingType::removal_falling:
case TimingType::removal_rising:
return ScaleFactorType::removal;
case TimingType::skew_falling:
case TimingType::skew_rising:
return ScaleFactorType::skew;
case TimingType::minimum_period:
return ScaleFactorType::min_period;
case TimingType::nochange_high_high:
case TimingType::nochange_high_low:
case TimingType::nochange_low_high:
case TimingType::nochange_low_low:
return ScaleFactorType::nochange;
case TimingType::min_pulse_width:
return ScaleFactorType::min_pulse_width;
case TimingType::clear:
case TimingType::combinational:
case TimingType::combinational_fall:
case TimingType::combinational_rise:
case TimingType::falling_edge:
case TimingType::preset:
case TimingType::retaining_time:
case TimingType::rising_edge:
case TimingType::three_state_disable:
case TimingType::three_state_disable_fall:
case TimingType::three_state_disable_rise:
case TimingType::three_state_enable:
case TimingType::three_state_enable_fall:
case TimingType::three_state_enable_rise:
case TimingType::min_clock_tree_path:
case TimingType::max_clock_tree_path:
return ScaleFactorType::cell;
case TimingType::unknown:
return ScaleFactorType::unknown;
}
return scale_factor_unknown;
return ScaleFactorType::unknown;
}
} // namespace

View File

@ -33,50 +33,45 @@ typedef int TimingArcIndex;
typedef Vector<TimingArc*> TimingArcSeq;
typedef Map<const OperatingConditions*, TimingModel*> ScaledTimingModelMap;
typedef enum {
timing_type_clear,
timing_type_combinational,
timing_type_combinational_fall,
timing_type_combinational_rise,
timing_type_falling_edge,
timing_type_hold_falling,
timing_type_hold_rising,
timing_type_min_pulse_width,
timing_type_minimum_period,
timing_type_nochange_high_high,
timing_type_nochange_high_low,
timing_type_nochange_low_high,
timing_type_nochange_low_low,
timing_type_non_seq_hold_falling,
timing_type_non_seq_hold_rising,
timing_type_non_seq_setup_falling,
timing_type_non_seq_setup_rising,
timing_type_preset,
timing_type_recovery_falling,
timing_type_recovery_rising,
timing_type_removal_falling,
timing_type_removal_rising,
timing_type_retaining_time,
timing_type_rising_edge,
timing_type_setup_falling,
timing_type_setup_rising,
timing_type_skew_falling,
timing_type_skew_rising,
timing_type_three_state_disable,
timing_type_three_state_disable_fall,
timing_type_three_state_disable_rise,
timing_type_three_state_enable,
timing_type_three_state_enable_fall,
timing_type_three_state_enable_rise,
timing_type_min_clock_tree_path,
timing_type_max_clock_tree_path,
timing_type_unknown
} TimingType;
void
makeTimingTypeMap();
void
deleteTimingTypeMap();
enum class TimingType {
clear,
combinational,
combinational_fall,
combinational_rise,
falling_edge,
hold_falling,
hold_rising,
min_pulse_width,
minimum_period,
nochange_high_high,
nochange_high_low,
nochange_low_high,
nochange_low_low,
non_seq_hold_falling,
non_seq_hold_rising,
non_seq_setup_falling,
non_seq_setup_rising,
preset,
recovery_falling,
recovery_rising,
removal_falling,
removal_rising,
retaining_time,
rising_edge,
setup_falling,
setup_rising,
skew_falling,
skew_rising,
three_state_disable,
three_state_disable_fall,
three_state_disable_rise,
three_state_enable,
three_state_enable_fall,
three_state_enable_rise,
min_clock_tree_path,
max_clock_tree_path,
unknown
};
const char *
timingTypeString(TimingType type);
@ -164,8 +159,7 @@ public:
TimingArc *&arc1,
TimingArc *&arc2);
const TimingArcSeq &arcs() const { return arcs_; }
// Use the TimingArcSetArcIterator(arc_set) constructor instead.
TimingArcSetArcIterator *timingArcIterator() __attribute__ ((deprecated));
TimingArcSetArcIterator *timingArcIterator();
TimingArcIndex addTimingArc(TimingArc *arc);
void deleteTimingArc(TimingArc *arc);
TimingArc *findTimingArc(unsigned arc_index);

View File

@ -52,43 +52,43 @@ TimingRoleMap TimingRole::timing_roles_;
void
TimingRole::init()
{
wire_ = new TimingRole("wire", false, false, false, NULL, NULL, 0);
wire_ = new TimingRole("wire", false, false, false, nullptr, nullptr, 0);
combinational_ = new TimingRole("combinational", true, false, false,
NULL, NULL, 1);
nullptr, nullptr, 1);
tristate_enable_ = new TimingRole("tristate enable",
true, false, false,
NULL, NULL, 2);
nullptr, nullptr, 2);
tristate_disable_ = new TimingRole("tristate disable",
true, false, false,
NULL, NULL, 3);
nullptr, nullptr, 3);
reg_clk_q_ = new TimingRole("Reg Clk to Q", true, false, false,
NULL, NULL, 4);
nullptr, nullptr, 4);
reg_set_clr_ = new TimingRole("Reg Set/Clr", true, false, false,
NULL, NULL, 5);
nullptr, nullptr, 5);
latch_en_q_ = new TimingRole("Latch En to Q", true, false, false,
NULL, TimingRole::regClkToQ(), 6);
nullptr, TimingRole::regClkToQ(), 6);
latch_d_q_ = new TimingRole("Latch D to Q", true, false, false,
NULL, NULL, 7);
nullptr, nullptr, 7);
sdf_iopath_ = new TimingRole("sdf IOPATH", true, false, false,
NULL, NULL, 8);
nullptr, nullptr, 8);
setup_ = new TimingRole("setup", false, true, false,
MinMax::max(), NULL, 9);
MinMax::max(), nullptr, 9);
hold_ = new TimingRole("hold", false, true, false,
MinMax::min(), NULL, 10);
MinMax::min(), nullptr, 10);
recovery_ = new TimingRole("recovery", false, true, false,
MinMax::max(), TimingRole::setup(), 11);
removal_ = new TimingRole("removal", false, true, false,
MinMax::min(), TimingRole::hold(), 12);
width_ = new TimingRole("width", false, true, false,
NULL, NULL, 13);
nullptr, nullptr, 13);
period_ = new TimingRole("period", false, true, false,
NULL, NULL, 14);
nullptr, nullptr, 14);
skew_ = new TimingRole("skew", false, true, false,
NULL, NULL, 15);
nullptr, nullptr, 15);
nochange_ = new TimingRole("nochange", true, false, false,
NULL, NULL, 16);
nullptr, nullptr, 16);
output_setup_ = new TimingRole("output setup", false, true, false,
MinMax::max(), TimingRole::setup(), 17);
@ -118,59 +118,59 @@ void
TimingRole::destroy()
{
delete wire_;
wire_ = NULL;
wire_ = nullptr;
delete combinational_;
combinational_ = NULL;
combinational_ = nullptr;
delete tristate_enable_;
tristate_enable_ = NULL;
tristate_enable_ = nullptr;
delete tristate_disable_;
tristate_disable_ = NULL;
tristate_disable_ = nullptr;
delete reg_clk_q_;
reg_clk_q_ = NULL;
reg_clk_q_ = nullptr;
delete reg_set_clr_;
reg_set_clr_ = NULL;
reg_set_clr_ = nullptr;
delete latch_en_q_;
latch_en_q_ = NULL;
latch_en_q_ = nullptr;
delete latch_d_q_;
latch_d_q_ = NULL;
latch_d_q_ = nullptr;
delete sdf_iopath_;
sdf_iopath_ = NULL;
sdf_iopath_ = nullptr;
delete setup_;
setup_ = NULL;
setup_ = nullptr;
delete hold_;
hold_ = NULL;
hold_ = nullptr;
delete recovery_;
recovery_ = NULL;
recovery_ = nullptr;
delete removal_;
removal_ = NULL;
removal_ = nullptr;
delete width_;
width_ = NULL;
width_ = nullptr;
delete period_;
period_ = NULL;
period_ = nullptr;
delete skew_;
skew_ = NULL;
skew_ = nullptr;
delete nochange_;
nochange_ = NULL;
nochange_ = nullptr;
delete output_setup_;
output_setup_ = NULL;
output_setup_ = nullptr;
delete output_hold_;
output_hold_ = NULL;
output_hold_ = nullptr;
delete gated_clk_setup_;
gated_clk_setup_ = NULL;
gated_clk_setup_ = nullptr;
delete gated_clk_hold_;
gated_clk_hold_ = NULL;
gated_clk_hold_ = nullptr;
delete latch_setup_;
latch_setup_ = NULL;
latch_setup_ = nullptr;
delete latch_hold_;
latch_hold_ = NULL;
latch_hold_ = nullptr;
delete data_check_setup_;
data_check_setup_ = NULL;
data_check_setup_ = nullptr;
delete data_check_hold_;
data_check_hold_ = NULL;
data_check_hold_ = nullptr;
delete non_seq_setup_;
non_seq_setup_ = NULL;
non_seq_setup_ = nullptr;
delete non_seq_hold_;
non_seq_hold_ = NULL;
non_seq_hold_ = nullptr;
timing_roles_.clear();
}
@ -210,7 +210,7 @@ TimingRole::sdfRole() const
const TimingRole *
TimingRole::genericRole() const
{
if (generic_role_ == NULL)
if (generic_role_ == nullptr)
return this;
else
return generic_role_;

View File

@ -87,7 +87,7 @@ private:
bool is_timing_check,
bool is_non_seq_check,
MinMax *path_min_max,
// generic_type = NULL means type is the same as this.
// generic_type = nullptr means type is the same as this.
TimingRole *generic_role,
int index);
DISALLOW_COPY_AND_ASSIGN(TimingRole);

View File

@ -35,9 +35,9 @@ void
TransRiseFall::destroy()
{
delete rise_;
rise_ = NULL;
rise_ = nullptr;
delete fall_;
fall_ = NULL;
fall_ = nullptr;
}
TransRiseFall::TransRiseFall(const char *name,
@ -78,7 +78,7 @@ TransRiseFall::find(const char *tr_str)
else if (stringEq(tr_str, fall_->name()))
return fall_;
else
return NULL;
return nullptr;
}
TransRiseFall *
@ -128,18 +128,18 @@ TransRiseFallBoth::init()
{
rise_ = new TransRiseFallBoth("rise", "^", 0, TransRiseFall::rise());
fall_ = new TransRiseFallBoth("fall", "v", 1, TransRiseFall::fall());
rise_fall_ = new TransRiseFallBoth("rise_fall", "rf", 2, NULL);
rise_fall_ = new TransRiseFallBoth("rise_fall", "rf", 2, nullptr);
}
void
TransRiseFallBoth::destroy()
{
delete rise_;
rise_ = NULL;
rise_ = nullptr;
delete fall_;
fall_ = NULL;
fall_ = nullptr;
delete rise_fall_;
rise_fall_ = NULL;
rise_fall_ = nullptr;
}
TransRiseFallBoth::TransRiseFallBoth(const char *name,
@ -168,7 +168,7 @@ TransRiseFallBoth::find(const char *tr_str)
else if (stringEq(tr_str, rise_fall_->name()))
return rise_fall_;
else
return NULL;
return nullptr;
}
bool
@ -229,9 +229,9 @@ Transition::init()
tr_X1_ = new Transition("X1", "X1", TransRiseFall::rise(), 7);
tr_1X_ = new Transition("1X", "1X", TransRiseFall::fall(), 8);
tr_X0_ = new Transition("X0", "X0", TransRiseFall::fall(), 9);
tr_XZ_ = new Transition("XZ", "XZ", NULL, 10);
tr_ZX_ = new Transition("ZX", "ZX", NULL, 11);
rise_fall_ = new Transition("*", "**", NULL, -1);
tr_XZ_ = new Transition("XZ", "XZ", nullptr, 10);
tr_ZX_ = new Transition("ZX", "ZX", nullptr, 11);
rise_fall_ = new Transition("*", "**", nullptr, -1);
}
Transition::Transition(const char *name,
@ -271,7 +271,7 @@ Transition::destroy()
delete tr_ZX_;
delete rise_fall_;
delete transition_map_;
transition_map_ = NULL;
transition_map_ = nullptr;
}
}

View File

@ -130,7 +130,7 @@ Units::find(const char *unit_name)
else if (stringEq(unit_name, "distance"))
return &distance_unit_;
else
return NULL;
return nullptr;
}
void

View File

@ -141,9 +141,9 @@ Wireload::findWireload(float fanout,
}
// Scale resistance and capacitance.
cap = length * capacitance_
* library_->scaleFactor(scale_factor_wire_cap, op_cond);
* library_->scaleFactor(ScaleFactorType::wire_cap, op_cond);
res = length * resistance_
* library_->scaleFactor(scale_factor_wire_res, op_cond);
* library_->scaleFactor(ScaleFactorType::wire_res, op_cond);
}
////////////////////////////////////////////////////////////////
@ -239,13 +239,13 @@ const char *
wireloadTreeString(WireloadTree tree)
{
switch (tree) {
case wire_load_worst_case_tree:
case WireloadTree::worst_case:
return "worst_case_tree";
case wire_load_best_case_tree:
case WireloadTree::best_case:
return "best_case_tree";
case wire_load_balanced_tree:
case WireloadTree::balanced:
return "balanced_tree";
case wire_load_unknown_tree:
case WireloadTree::unknown:
return "unknown";
}
// Prevent warnings from lame compilers.
@ -256,26 +256,26 @@ WireloadTree
stringWireloadTree(const char *wire_load_type)
{
if (stringEq(wire_load_type, "worst_case_tree"))
return wire_load_worst_case_tree;
return WireloadTree::worst_case;
else if (stringEq(wire_load_type, "best_case_tree"))
return wire_load_best_case_tree;
return WireloadTree::best_case;
else if (stringEq(wire_load_type, "balanced_tree"))
return wire_load_balanced_tree;
return WireloadTree::balanced;
else
return wire_load_unknown_tree;
return WireloadTree::unknown;
}
const char *
wireloadModeString(WireloadMode wire_load_mode)
{
switch (wire_load_mode) {
case wire_load_mode_top:
case WireloadMode::top:
return "top";
case wire_load_mode_enclosed:
case WireloadMode::enclosed:
return "enclosed";
case wire_load_mode_segmented:
case WireloadMode::segmented:
return "segmented";
case wire_load_mode_unknown:
case WireloadMode::unknown:
return "unknown";
}
// Prevent warnings from lame compilers.
@ -286,13 +286,13 @@ WireloadMode
stringWireloadMode(const char *wire_load_mode)
{
if (stringEq(wire_load_mode, "top"))
return wire_load_mode_top;
return WireloadMode::top;
else if (stringEq(wire_load_mode, "enclosed"))
return wire_load_mode_enclosed;
return WireloadMode::enclosed;
else if (stringEq(wire_load_mode, "segmented"))
return wire_load_mode_segmented;
return WireloadMode::segmented;
else
return wire_load_mode_unknown;
return WireloadMode::unknown;
}
} // namespace

View File

@ -137,7 +137,7 @@ ConcreteCell::setName(const char *name)
ConcretePort *
ConcreteCell::makePort(const char *name)
{
ConcretePort *port = new ConcretePort(this, name, false, -1, -1, false, NULL);
ConcretePort *port = new ConcretePort(this, name, false, -1, -1, false, nullptr);
addPort(port);
return port;
}
@ -213,7 +213,7 @@ ConcreteCell::makePort(const char *bit_name,
int bit_index)
{
ConcretePort *port = new ConcretePort(this, bit_name, false, bit_index,
bit_index, false, NULL);
bit_index, false, nullptr);
addPortBit(port);
return port;
}
@ -531,7 +531,7 @@ ConcretePort::findBusBit(int index) const
&& index <= from_index_)
return (*member_ports_)[from_index_ - index];
else
return NULL;
return nullptr;
}
bool
@ -562,8 +562,8 @@ ConcretePort::memberIterator() const
ConcreteCellPortBitIterator::ConcreteCellPortBitIterator(const ConcreteCell*
cell) :
port_iter_(cell->ports_),
member_iter_(NULL),
next_(NULL)
member_iter_(nullptr),
next_(nullptr)
{
findNext();
}
@ -571,7 +571,7 @@ ConcreteCellPortBitIterator::ConcreteCellPortBitIterator(const ConcreteCell*
bool
ConcreteCellPortBitIterator::hasNext()
{
return next_ != NULL;
return next_ != nullptr;
}
ConcretePort *
@ -592,7 +592,7 @@ ConcreteCellPortBitIterator::findNext()
}
else {
delete member_iter_;
member_iter_ = NULL;
member_iter_ = nullptr;
}
}
while (port_iter_.hasNext()) {
@ -606,9 +606,9 @@ ConcreteCellPortBitIterator::findNext()
next_ = next;
return;
}
next_ = NULL;
next_ = nullptr;
}
next_ = NULL;
next_ = nullptr;
}
} // namespace

View File

@ -93,7 +93,7 @@ private:
ConcreteInstanceNetIterator::
ConcreteInstanceNetIterator(ConcreteInstanceNetMap *nets):
iter_(nets),
next_(NULL)
next_(nullptr)
{
findNext();
}
@ -101,7 +101,7 @@ ConcreteInstanceNetIterator(ConcreteInstanceNetMap *nets):
bool
ConcreteInstanceNetIterator::hasNext()
{
return next_ != NULL;
return next_ != nullptr;
}
// Skip nets that have been merged.
@ -110,10 +110,10 @@ ConcreteInstanceNetIterator::findNext()
{
while (iter_.hasNext()) {
next_ = iter_.next();
if (next_->mergedInto() == NULL)
if (next_->mergedInto() == nullptr)
return;
}
next_ = NULL;
next_ = nullptr;
}
Net *
@ -157,7 +157,7 @@ ConcreteInstancePinIterator(const ConcreteInstance *inst,
bool
ConcreteInstancePinIterator::hasNext()
{
return next_ != NULL;
return next_ != nullptr;
}
Pin *
@ -177,7 +177,7 @@ ConcreteInstancePinIterator::findNext()
if (next_)
return;
}
next_ = NULL;
next_ = nullptr;
}
////////////////////////////////////////////////////////////////
@ -203,7 +203,7 @@ ConcreteNetPinIterator::ConcreteNetPinIterator(const ConcreteNet *net) :
bool
ConcreteNetPinIterator::hasNext()
{
return next_ != NULL;
return next_ != nullptr;
}
Pin *
@ -237,7 +237,7 @@ ConcreteNetTermIterator::ConcreteNetTermIterator(const ConcreteNet *net) :
bool
ConcreteNetTermIterator::hasNext()
{
return next_ != NULL;
return next_ != nullptr;
}
Term *
@ -252,8 +252,8 @@ ConcreteNetTermIterator::next()
ConcreteNetwork::ConcreteNetwork() :
NetworkReader(),
top_instance_(NULL),
link_func_(NULL)
top_instance_(nullptr),
link_func_(nullptr)
{
}
@ -277,7 +277,7 @@ ConcreteNetwork::deleteTopInstance()
{
if (top_instance_) {
deleteInstance(reinterpret_cast<Instance*>(top_instance_));
top_instance_ = NULL;
top_instance_ = nullptr;
}
}
@ -358,7 +358,7 @@ private:
ConcreteLibertyLibraryIterator::
ConcreteLibertyLibraryIterator(const ConcreteNetwork *network):
iter_(network->library_seq_),
next_(NULL)
next_(nullptr)
{
findNext();
}
@ -370,7 +370,7 @@ ConcreteLibertyLibraryIterator::~ConcreteLibertyLibraryIterator()
bool
ConcreteLibertyLibraryIterator::hasNext()
{
return next_ != NULL;
return next_ != nullptr;
}
LibertyLibrary *
@ -384,7 +384,7 @@ ConcreteLibertyLibraryIterator::next()
void
ConcreteLibertyLibraryIterator::findNext()
{
next_ = NULL;
next_ = nullptr;
while (iter_.hasNext()) {
ConcreteLibrary *lib = iter_.next();
LibertyLibrary *liberty = dynamic_cast<LibertyLibrary*>(lib);
@ -406,7 +406,7 @@ ConcreteNetwork::libertyLibraryIterator() const
Library *
ConcreteNetwork::makeLibrary(const char *name)
{
ConcreteLibrary *library = new ConcreteLibrary(name, NULL);
ConcreteLibrary *library = new ConcreteLibrary(name, nullptr);
addLibrary(library);
return reinterpret_cast<Library*>(library);
}
@ -492,7 +492,7 @@ ConcreteNetwork::findAnyCell(const char *name)
if (cell)
return reinterpret_cast<Cell*>(cell);
}
return NULL;
return nullptr;
}
void
@ -1048,13 +1048,13 @@ ConcreteNetwork::instance(const Net *net) const
bool
ConcreteNetwork::isPower(const Net *net) const
{
return constant_nets_[logic_one].hasKey(const_cast<Net*>(net));
return constant_nets_[int(LogicValue::one)].hasKey(const_cast<Net*>(net));
}
bool
ConcreteNetwork::isGround(const Net *net) const
{
return constant_nets_[logic_zero].hasKey(const_cast<Net*>(net));
return constant_nets_[int(LogicValue::zero)].hasKey(const_cast<Net*>(net));
}
NetPinIterator *
@ -1132,7 +1132,7 @@ ConcreteNetwork::makePins(Instance *inst)
CellPortBitIterator *port_iterator = portBitIterator(cell(inst));
while (port_iterator->hasNext()) {
Port *port = port_iterator->next();
makePin(inst, port, NULL);
makePin(inst, port, nullptr);
}
delete port_iterator;
}
@ -1254,7 +1254,7 @@ ConcreteNetwork::connect(Instance *inst,
ConcreteTerm *cterm = new ConcreteTerm(cpin, cnet);
cnet->addTerm(cterm);
cpin->term_ = cterm;
cpin->net_ = NULL;
cpin->net_ = nullptr;
}
else {
cpin->net_ = cnet;
@ -1273,7 +1273,7 @@ ConcreteNetwork::connectNetPin(ConcreteNet *cnet,
// and it is safe to incrementally update the drivers.
Pin *pin = reinterpret_cast<Pin*>(cpin);
if (isDriver(pin)) {
if (cnet->terms_ == NULL) {
if (cnet->terms_ == nullptr) {
Net *net = reinterpret_cast<Net*>(cnet);
PinSet *drvrs = net_drvr_pin_map_.findKey(net);
if (drvrs)
@ -1296,7 +1296,7 @@ ConcreteNetwork::disconnectPin(Pin *pin)
cnet->deleteTerm(cterm);
clearNetDrvPinrMap();
}
cpin->term_ = NULL;
cpin->term_ = nullptr;
delete cterm;
}
}
@ -1304,7 +1304,7 @@ ConcreteNetwork::disconnectPin(Pin *pin)
ConcreteNet *cnet = cpin->net();
if (cnet)
disconnectNetPin(cnet, cpin);
cpin->net_ = NULL;
cpin->net_ = nullptr;
}
}
@ -1319,7 +1319,7 @@ ConcreteNetwork::disconnectNetPin(ConcreteNet *cnet,
ConcreteNet *cnet = cpin->net();
// If there are no terminals the net does not span hierarchy levels
// and it is safe to incrementally update the drivers.
if (cnet->terms_ == NULL) {
if (cnet->terms_ == nullptr) {
Net *net = reinterpret_cast<Net*>(cnet);
PinSet *drvrs = net_drvr_pin_map_.findKey(net);
if (drvrs)
@ -1363,11 +1363,11 @@ ConcreteNetwork::deleteNet(Net *net)
ConcretePin *pin = reinterpret_cast<ConcretePin*>(pin_iter.next());
// Do NOT use net->disconnectPin because it would be N^2
// to delete all of the pins from the net.
pin->net_ = NULL;
pin->net_ = nullptr;
}
constant_nets_[logic_zero].eraseKey(net);
constant_nets_[logic_one].eraseKey(net);
constant_nets_[int(LogicValue::zero)].eraseKey(net);
constant_nets_[int(LogicValue::one)].eraseKey(net);
PinSet *drvrs = net_drvr_pin_map_.findKey(net);
if (drvrs) {
delete drvrs;
@ -1383,22 +1383,23 @@ ConcreteNetwork::deleteNet(Net *net)
void
ConcreteNetwork::clearConstantNets()
{
constant_nets_[logic_zero].clear();
constant_nets_[logic_one].clear();
constant_nets_[int(LogicValue::zero)].clear();
constant_nets_[int(LogicValue::one)].clear();
}
void
ConcreteNetwork::addConstantNet(Net *net,
LogicValue const_value)
LogicValue value)
{
constant_nets_[const_value].insert(net);
constant_nets_[int(value)].insert(net);
}
ConstantPinIterator *
ConcreteNetwork::constantPinIterator()
{
return new NetworkConstantPinIterator(this, constant_nets_[logic_zero],
constant_nets_[logic_one]);
return new NetworkConstantPinIterator(this,
constant_nets_[int(LogicValue::zero)],
constant_nets_[int(LogicValue::one)]);
}
////////////////////////////////////////////////////////////////
@ -1447,13 +1448,13 @@ ConcreteInstance::ConcreteInstance(const char *name,
name_(stringCopy(name)),
cell_(cell),
parent_(parent),
children_(NULL),
nets_(NULL)
children_(nullptr),
nets_(nullptr)
{
int pin_count = reinterpret_cast<ConcreteCell*>(cell)->portBitCount();
pins_ = new ConcretePin*[pin_count];
for (int i = 0; i < pin_count; i++)
pins_[i] = NULL;
pins_[i] = nullptr;
}
ConcreteInstance::~ConcreteInstance()
@ -1470,7 +1471,7 @@ ConcreteInstance::findChild(const char *name) const
if (children_)
return reinterpret_cast<Instance*>(children_->findKey(name));
else
return NULL;
return nullptr;
}
ConcretePin *
@ -1483,7 +1484,7 @@ ConcreteInstance::findPin(const char *port_name) const
&& !cport->isBus())
return pins_[cport->pinIndex()];
else
return NULL;
return nullptr;
}
ConcretePin *
@ -1496,7 +1497,7 @@ ConcreteInstance::findPin(const Port *port) const
ConcreteNet *
ConcreteInstance::findNet(const char *net_name) const
{
ConcreteNet *net = NULL;
ConcreteNet *net = nullptr;
if (nets_) {
net = nets_->findKey(net_name);
// Follow merge pointer to surviving net.
@ -1545,7 +1546,7 @@ ConcreteInstance::childIterator() const
void
ConcreteInstance::addChild(ConcreteInstance *child)
{
if (children_ == NULL)
if (children_ == nullptr)
children_ = new ConcreteInstanceChildMap;
(*children_)[child->name()] = child;
}
@ -1567,13 +1568,13 @@ void
ConcreteInstance::deletePin(ConcretePin *pin)
{
ConcretePort *cport = reinterpret_cast<ConcretePort *>(pin->port());
pins_[cport->pinIndex()] = NULL;
pins_[cport->pinIndex()] = nullptr;
}
void
ConcreteInstance::addNet(ConcreteNet *net)
{
if (nets_ == NULL)
if (nets_ == nullptr)
nets_ = new ConcreteInstanceNetMap;
(*nets_)[net->name()] = net;
}
@ -1582,7 +1583,7 @@ void
ConcreteInstance::addNet(const char *name,
ConcreteNet *net)
{
if (nets_ == NULL)
if (nets_ == nullptr)
nets_ = new ConcreteInstanceNetMap;
(*nets_)[name] = net;
}
@ -1607,9 +1608,9 @@ ConcretePin::ConcretePin(ConcreteInstance *instance,
instance_(instance),
port_(port),
net_(net),
term_(NULL),
net_next_(NULL),
net_prev_(NULL),
term_(nullptr),
net_next_(nullptr),
net_prev_(nullptr),
vertex_index_(0)
{
}
@ -1641,7 +1642,7 @@ ConcreteTerm::ConcreteTerm(ConcretePin *pin,
ConcreteNet *net) :
pin_(pin),
net_(net),
net_next_(NULL)
net_next_(nullptr)
{
}
@ -1651,9 +1652,9 @@ ConcreteNet::ConcreteNet(const char *name,
ConcreteInstance *instance) :
name_(stringCopy(name)),
instance_(instance),
pins_(NULL),
terms_(NULL),
merged_into_(NULL)
pins_(nullptr),
terms_(nullptr),
merged_into_(nullptr)
{
}
@ -1675,7 +1676,7 @@ ConcreteNet::mergeInto(ConcreteNet *net)
net->addPin(cpin);
cpin->net_ = net;
}
pins_ = NULL;
pins_ = nullptr;
ConcreteNetTermIterator term_iter(this);
while (term_iter.hasNext()) {
Term *term = term_iter.next();
@ -1683,7 +1684,7 @@ ConcreteNet::mergeInto(ConcreteNet *net)
net->addTerm(cterm);
cterm->net_ = net;
}
terms_ = NULL;
terms_ = nullptr;
// Leave name map pointing to merged net because otherwise a top
// level merged net has no pointer to it and it is leaked.
merged_into_ = net;
@ -1695,7 +1696,7 @@ ConcreteNet::addPin(ConcretePin *pin)
if (pins_)
pins_->net_prev_ = pin;
pin->net_next_ = pins_;
pin->net_prev_ = NULL;
pin->net_prev_ = nullptr;
pins_ = pin;
}
@ -1723,7 +1724,7 @@ ConcreteNet::addTerm(ConcreteTerm *term)
void
ConcreteNet::deleteTerm(ConcreteTerm *term)
{
ConcreteTerm *net_prev_term = NULL;
ConcreteTerm *net_prev_term = nullptr;
for (ConcreteTerm *net_term=terms_;net_term;net_term=net_term->net_next_) {
if (net_term == term) {
if (net_prev_term)
@ -1810,7 +1811,7 @@ ConcreteNetwork::linkNetwork(const char *top_cell_name,
reinterpret_cast<ConcreteInstance*>(link_func_(top_cell,
make_black_boxes,
report, this));
return top_instance_ != NULL;
return top_instance_ != nullptr;
}
else {
report->error("cell %s not found.\n", top_cell_name);
@ -1831,9 +1832,9 @@ linkReaderNetwork(Cell *top_cell,
Instance *view = network->cellNetworkView(top_cell);
if (view) {
// Seed the recursion for expansion with the top level instance.
Instance *top_instance = network->makeInstance(top_cell, "", NULL);
Instance *top_instance = network->makeInstance(top_cell, "", nullptr);
ConcreteBindingTbl bindings(network);
makeClonePins(view, top_instance, view, &bindings, NULL, NULL, network);
makeClonePins(view, top_instance, view, &bindings, nullptr, nullptr, network);
InstanceChildIterator *child_iter = network->childIterator(view);
while (child_iter->hasNext()) {
Instance *child = child_iter->next();
@ -1843,7 +1844,7 @@ linkReaderNetwork(Cell *top_cell,
network->deleteCellNetworkViews();
return top_instance;
}
return NULL;
return nullptr;
}
static void
@ -1856,7 +1857,7 @@ makeChildNetwork(Instance *proto,
Instance *clone = network->makeInstance(proto_cell, network->name(proto),
parent);
if (network->isLeaf(proto_cell))
makeClonePins(proto, clone, NULL, NULL, parent, parent_bindings, network);
makeClonePins(proto, clone, nullptr, nullptr, parent, parent_bindings, network);
else {
// Recurse if this isn't a leaf cell.
ConcreteBindingTbl bindings(network);
@ -1888,14 +1889,14 @@ makeClonePins(Instance *proto,
Pin *proto_pin = proto_pin_iter->next();
Net *proto_net = network->net(proto_pin);
Port *proto_port = network->port(proto_pin);
Net *clone_net = NULL;
Net *clone_net = nullptr;
if (proto_net && parent_bindings)
clone_net = parent_bindings->ensureBinding(proto_net, parent);
Pin *clone_pin = network->connect(clone, proto_port, clone_net);
if (clone_view) {
Pin *clone_proto_pin = network->findPin(clone_view, proto_port);
Net *clone_proto_net = network->net(clone_proto_pin);
Net *clone_child_net = NULL;
Net *clone_child_net = nullptr;
if (clone_proto_net)
clone_child_net = bindings->ensureBinding(clone_proto_net, clone);
network->makeTerm(clone_pin, clone_child_net);
@ -1935,7 +1936,7 @@ ConcreteBindingTbl::ensureBinding(Net *proto_net,
Instance *parent)
{
Net *net = find(proto_net);
if (net == NULL) {
if (net == nullptr) {
net = network_->makeNet(network_->name(proto_net), parent);
map_[proto_net] = net;
}

View File

@ -152,7 +152,7 @@ public:
virtual ConstantPinIterator *constantPinIterator();
void addConstantNet(Net *net,
LogicValue const_value);
LogicValue value);
// Edit methods.
virtual Library *makeLibrary(const char *name);
@ -248,7 +248,7 @@ protected:
ConcreteLibrarySeq library_seq_;
ConcreteLibraryMap library_map_;
ConcreteInstance *top_instance_;
NetSet constant_nets_[2]; // logic_zero/one
NetSet constant_nets_[2]; // LogicValue::zero/one
LinkNetworkFunc *link_func_;
CellNetworkViewMap cell_network_view_map_;

View File

@ -27,8 +27,8 @@ HpinDrvrLoad::HpinDrvrLoad(Pin *drvr,
PinSet *hpins_to_load) :
drvr_(drvr),
load_(load),
hpins_from_drvr_(hpins_from_drvr ? new PinSet(*hpins_from_drvr) : NULL),
hpins_to_load_(hpins_to_load ? new PinSet(*hpins_to_load) : NULL)
hpins_from_drvr_(hpins_from_drvr ? new PinSet(*hpins_from_drvr) : nullptr),
hpins_to_load_(hpins_to_load ? new PinSet(*hpins_to_load) : nullptr)
{
}
@ -104,13 +104,13 @@ visitPinsAboveNet2(const Pin *hpin,
Pin *above_pin = pin_iter->next();
if (above_pin != hpin) {
if (network->isDriver(above_pin)) {
HpinDrvrLoad *drvr = new HpinDrvrLoad(above_pin, NULL,
hpin_path, NULL);
HpinDrvrLoad *drvr = new HpinDrvrLoad(above_pin, nullptr,
hpin_path, nullptr);
above_drvrs.insert(drvr);
}
if (network->isLoad(above_pin)) {
HpinDrvrLoad *load = new HpinDrvrLoad(NULL, above_pin,
NULL, hpin_path);
HpinDrvrLoad *load = new HpinDrvrLoad(nullptr, above_pin,
nullptr, hpin_path);
above_loads.insert(load);
}
Term *above_term = network->term(above_pin);
@ -145,13 +145,13 @@ visitPinsAboveNet2(const Pin *hpin,
}
if (network->isDriver(above_pin)) {
HpinDrvrLoad *drvr = new HpinDrvrLoad(above_pin, NULL,
hpin_path, NULL);
HpinDrvrLoad *drvr = new HpinDrvrLoad(above_pin, nullptr,
hpin_path, nullptr);
above_drvrs.insert(drvr);
}
if (network->isLoad(above_pin)) {
HpinDrvrLoad *load = new HpinDrvrLoad(NULL, above_pin,
NULL, hpin_path);
HpinDrvrLoad *load = new HpinDrvrLoad(nullptr, above_pin,
nullptr, hpin_path);
above_loads.insert(load);
}
}
@ -180,13 +180,13 @@ visitPinsBelowNet2(const Pin *hpin,
visited, below_drvrs, below_loads,
hpin_path, network);
if (network->isDriver(below_pin)) {
HpinDrvrLoad *drvr = new HpinDrvrLoad(below_pin, NULL,
hpin_path, NULL);
HpinDrvrLoad *drvr = new HpinDrvrLoad(below_pin, nullptr,
hpin_path, nullptr);
below_drvrs.insert(drvr);
}
if (network->isLoad(below_pin)) {
HpinDrvrLoad *load = new HpinDrvrLoad(NULL, below_pin,
NULL, hpin_path);
HpinDrvrLoad *load = new HpinDrvrLoad(nullptr, below_pin,
nullptr, hpin_path);
below_loads.insert(load);
}
if (network->isHierarchical(below_pin)) {
@ -279,7 +279,7 @@ visitHpinDrvrLoads(const Pin *pin,
}
else {
if (network->isDriver(pin)) {
HpinDrvrLoad drvr(const_cast<Pin*>(pin), NULL, &hpin_path, NULL);
HpinDrvrLoad drvr(const_cast<Pin*>(pin), nullptr, &hpin_path, nullptr);
HpinDrvrLoads drvrs;
drvrs.insert(&drvr);
visitHpinDrvrLoads(drvrs, below_loads, visitor);
@ -287,7 +287,7 @@ visitHpinDrvrLoads(const Pin *pin,
}
// Bidirects are drivers and loads.
if (network->isLoad(pin)) {
HpinDrvrLoad load(NULL, const_cast<Pin*>(pin), NULL, &hpin_path);
HpinDrvrLoad load(nullptr, const_cast<Pin*>(pin), nullptr, &hpin_path);
HpinDrvrLoads loads;
loads.insert(&load);
visitHpinDrvrLoads(below_drvrs, loads, visitor);

View File

@ -25,7 +25,7 @@
namespace sta {
Network::Network() :
default_liberty_(NULL),
default_liberty_(nullptr),
divider_('/'),
escape_('\\')
{
@ -39,14 +39,14 @@ Network::~Network()
void
Network::clear()
{
default_liberty_ = NULL;
default_liberty_ = nullptr;
clearNetDrvPinrMap();
}
bool
Network::isLinked() const
{
return topInstance() != NULL;
return topInstance() != nullptr;
}
LibertyLibrary *
@ -79,7 +79,7 @@ Network::findLibertyCell(const char *name) const
}
}
delete iter;
return NULL;
return nullptr;
}
LibertyLibrary *
@ -107,7 +107,7 @@ Network::findLibertyFilename(const char *filename)
}
}
delete lib_iter;
return NULL;
return nullptr;
}
LibertyCell *
@ -181,9 +181,9 @@ int
Network::pathNameCmp(const Instance *inst1,
const Instance *inst2) const
{
if (inst1 == NULL && inst2)
if (inst1 == nullptr && inst2)
return -1;
else if (inst1 && inst2 == NULL)
else if (inst1 && inst2 == nullptr)
return 1;
else if (inst1 == inst2)
return 0;
@ -321,7 +321,7 @@ Network::isHierarchical(const Pin *pin) const
bool
Network::isTopLevelPort(const Pin *pin) const
{
return (parent(instance(pin)) == NULL);
return (parent(instance(pin)) == nullptr);
}
bool
@ -704,7 +704,7 @@ Network::findPinRelative(const Instance *inst,
}
stringDelete(inst_path);
stringDelete(port_name);
return NULL;
return nullptr;
}
else
// Top level pin.
@ -724,7 +724,7 @@ Network::findPinLinear(const Instance *instance,
}
}
delete pin_iter;
return NULL;
return nullptr;
}
Pin *
@ -763,7 +763,7 @@ Network::findNetRelative(const Instance *inst,
}
stringDelete(inst_path);
stringDelete(net_name);
return NULL;
return nullptr;
}
else
// Top level net.
@ -783,7 +783,7 @@ Network::findNetLinear(const Instance *instance,
}
}
delete net_iter;
return NULL;
return nullptr;
}
void
@ -1075,7 +1075,7 @@ LeafInstanceIterator1::LeafInstanceIterator1(const Instance *inst,
const Network *network) :
network_(network),
child_iter_(network->childIterator(inst)),
next_(NULL)
next_(nullptr)
{
pending_child_iters_.reserve(512);
nextInst();
@ -1092,7 +1092,7 @@ LeafInstanceIterator1::next()
void
LeafInstanceIterator1::nextInst()
{
next_ = NULL;
next_ = nullptr;
while (child_iter_) {
while (child_iter_->hasNext()) {
next_ = child_iter_->next();
@ -1101,13 +1101,13 @@ LeafInstanceIterator1::nextInst()
else {
pending_child_iters_.push_back(child_iter_);
child_iter_ = network_->childIterator(next_);
next_ = NULL;
next_ = nullptr;
}
}
delete child_iter_;
if (pending_child_iters_.empty())
child_iter_ = NULL;
child_iter_ = nullptr;
else {
child_iter_ = pending_child_iters_.back();
pending_child_iters_.pop_back();
@ -1138,7 +1138,7 @@ Network::visitConnectedPins(Pin *pin,
Term *pin_term = term(pin);
if (pin_net)
visitConnectedPins(pin_net, visitor, visited_nets);
else if (pin_term == NULL)
else if (pin_term == nullptr)
// Unconnected or internal pin.
visitor(pin);
@ -1445,7 +1445,7 @@ Network::drivers(const Pin *pin)
if (net)
return drivers(net);
else
return NULL;
return nullptr;
}
void
@ -1458,7 +1458,7 @@ PinSet *
Network::drivers(const Net *net)
{
PinSet *drvrs = net_drvr_pin_map_.findKey(net);
if (drvrs == NULL) {
if (drvrs == nullptr) {
drvrs = new PinSet;
FindDrvrPins visitor(drvrs, this);
visitConnectedPins(net, visitor);
@ -1478,7 +1478,7 @@ Network::pathNameFirst(const char *path_name,
char divider = pathDivider();
const char *d = strchr(path_name, divider);
// Skip escaped dividers.
while (d != NULL
while (d != nullptr
&& d > path_name
&& d[-1] == escape)
d = strchr(d + 1, divider);
@ -1493,8 +1493,8 @@ Network::pathNameFirst(const char *path_name,
}
else {
// No divider in path_name.
first = NULL;
tail = NULL;
first = nullptr;
tail = nullptr;
}
}
@ -1526,8 +1526,8 @@ Network::pathNameLast(const char *path_name,
}
else {
// No divider in path_name.
head = NULL;
last = NULL;
head = nullptr;
last = nullptr;
}
}
@ -1554,10 +1554,10 @@ NetworkConstantPinIterator(const Network *network,
ConstantPinIterator(),
network_(network)
{
findConstantPins(zero_nets, logic_zero);
findConstantPins(one_nets, logic_one);
value_ = logic_zero;
pin_iter_ = new PinSet::Iterator(constant_pins_[value_]);
findConstantPins(zero_nets, constant_pins_[0]);
findConstantPins(one_nets, constant_pins_[1]);
value_ = LogicValue::zero;
pin_iter_ = new PinSet::Iterator(constant_pins_[0]);
}
NetworkConstantPinIterator::~NetworkConstantPinIterator()
@ -1567,7 +1567,7 @@ NetworkConstantPinIterator::~NetworkConstantPinIterator()
void
NetworkConstantPinIterator::findConstantPins(NetSet &nets,
LogicValue const_value)
PinSet &pins)
{
NetSet::Iterator net_iter(nets);
while (net_iter.hasNext()) {
@ -1575,7 +1575,7 @@ NetworkConstantPinIterator::findConstantPins(NetSet &nets,
NetConnectedPinIterator *pin_iter = network_->connectedPinIterator(net);
while (pin_iter->hasNext()) {
Pin *pin = pin_iter->next();
constant_pins_[const_value].insert(pin);
pins.insert(pin);
}
delete pin_iter;
}
@ -1586,10 +1586,10 @@ NetworkConstantPinIterator::hasNext()
{
if (pin_iter_->hasNext())
return true;
else if (value_ == logic_zero) {
else if (value_ == LogicValue::zero) {
delete pin_iter_;
value_ = logic_one;
pin_iter_ = new PinSet::Iterator(constant_pins_[value_]);
value_ = LogicValue::one;
pin_iter_ = new PinSet::Iterator(constant_pins_[1]);
return pin_iter_->hasNext();
}
else
@ -1825,7 +1825,7 @@ char
logicValueString(LogicValue value)
{
static char str[] = "01X^v";
return str[value];
return str[int(value)];
}
bool

View File

@ -34,7 +34,7 @@ class PinVisitor;
typedef Set<const Net*> ConstNetSet;
typedef Map<const char*, LibertyLibrary*, CharPtrLess> LibertyLibraryMap;
// Link network function returns top level instance.
// Return NULL if link fails.
// Return nullptr if link fails.
typedef Instance *(LinkNetworkFunc)(Cell *top_cell,
bool make_black_boxes,
Report *report,
@ -599,7 +599,7 @@ public:
private:
DISALLOW_COPY_AND_ASSIGN(NetworkConstantPinIterator);
void findConstantPins(NetSet &nets,
LogicValue const_value);
PinSet &pins);
const Network *network_;
PinSet constant_pins_[2];

View File

@ -75,13 +75,7 @@ public:
const PortPair *pair2) const;
};
typedef enum {
logic_zero,
logic_one,
logic_unknown,
logic_rise,
logic_fall
} LogicValue;
enum class LogicValue : unsigned { zero, one, unknown, rise, fall };
} // namespace
#endif

View File

@ -33,7 +33,7 @@ isBusName(const char *name,
size_t len_1 = strlen(name) - 1;
if (name[len_1] == brkt_right) {
const char *left = strrchr(name, brkt_left);
return left != NULL;
return left != nullptr;
}
else
return false;
@ -58,7 +58,7 @@ parseBusName(const char *name,
char *&bus_name,
int &index)
{
bus_name = NULL;
bus_name = nullptr;
size_t len_1 = strlen(name) - 1;
char last_ch = name[len_1];
const char *brkt_right_ptr = strchr(brkts_right, last_ch);
@ -98,7 +98,7 @@ parseBusRange(const char *name,
int &from,
int &to)
{
bus_name = NULL;
bus_name = nullptr;
size_t len_1 = strlen(name) - 1;
char last_ch = name[len_1];
const char *brkt_right_ptr = strchr(brkts_right, last_ch);

View File

@ -45,21 +45,21 @@ void
PortDirection::destroy()
{
delete input_;
input_ = NULL;
input_ = nullptr;
delete output_;
output_ = NULL;
output_ = nullptr;
delete tristate_;
tristate_ = NULL;
tristate_ = nullptr;
delete bidirect_;
bidirect_ = NULL;
bidirect_ = nullptr;
delete internal_;
internal_ = NULL;
internal_ = nullptr;
delete ground_;
ground_ = NULL;
ground_ = nullptr;
delete power_;
power_ = NULL;
power_ = nullptr;
delete unknown_;
unknown_ = NULL;
unknown_ = nullptr;
}
PortDirection::PortDirection(const char *name,

View File

@ -70,8 +70,8 @@ SdcPathParser::SdcPathParser(const char *path,
network_(network),
divider_(network->pathDivider()),
escape_(network->pathEscape()),
inst_path_(NULL),
inst_(NULL)
inst_path_(nullptr),
inst_(nullptr)
{
initialScan(path);
if (divider_count_ > 0)
@ -1012,7 +1012,7 @@ SdcNetwork::findPort(const Cell *cell,
const char *name) const
{
Port *port = network_->findPort(cell, name);
if (port == NULL) {
if (port == nullptr) {
// Look for matches after escaping brackets.
const char *port_name_ = escapeBrackets(name, this);
port = network_->findPort(cell, port_name_);
@ -1092,7 +1092,7 @@ SdcNetwork::findInstance(const char *path_name) const
{
SdcPathParser path_parser(path_name, this);
Instance *parent = path_parser.instance();
if (parent == NULL)
if (parent == nullptr)
parent = network_->topInstance();
const char *child_name = path_parser.pathTail();
return findChild(parent, child_name);
@ -1103,7 +1103,7 @@ SdcNetwork::findChild(const Instance *parent,
const char *name) const
{
Instance *child = network_->findChild(parent, name);
if (child == NULL) {
if (child == nullptr) {
const char *escaped = escapeBrackets(name, this);
child = network_->findChild(parent, escaped);
}
@ -1115,7 +1115,7 @@ SdcNetwork::findNet(const char *path_name) const
{
SdcPathParser path_parser(path_name, this);
const Instance *inst = path_parser.instance();
if (inst == NULL)
if (inst == nullptr)
inst = network_->topInstance();
const char *net_name = path_parser.pathTail();
return findNet(inst, net_name);
@ -1126,7 +1126,7 @@ SdcNetwork::findNet(const Instance *instance,
const char *net_name) const
{
Net *net = network_->findNet(instance, net_name);
if (net == NULL) {
if (net == nullptr) {
const char *net_name_ = escapeBrackets(net_name, this);
net = network_->findNet(instance, net_name_);
}
@ -1140,7 +1140,7 @@ SdcNetwork::findPin(const char *path_name) const
{
SdcPathParser path_parser(path_name, this);
const Instance *inst = path_parser.instance();
if (inst == NULL)
if (inst == nullptr)
inst = network_->topInstance();
const char *port_name = path_parser.pathTail();
return findPin(inst, port_name);
@ -1151,7 +1151,7 @@ SdcNetwork::findPin(const Instance *instance,
const char *port_name) const
{
Pin *pin = network_->findPin(instance, port_name);
if (pin == NULL) {
if (pin == nullptr) {
// Look for match after escaping brackets.
const char *port_name_ = escapeBrackets(port_name, this);
pin = network_->findPin(instance, port_name_);

View File

@ -20,6 +20,7 @@
#include "Report.hh"
#include "Debug.hh"
#include "Error.hh"
#include "Mutex.hh"
#include "Set.hh"
#include "MinMax.hh"
#include "Network.hh"
@ -124,7 +125,7 @@ ConcreteParasitic::setElmore(const Pin *,
Parasitic *
ConcreteParasitic::findPoleResidue(const Pin *) const
{
return NULL;
return nullptr;
}
void
@ -137,19 +138,19 @@ ConcreteParasitic::setPoleResidue(const Pin *,
ParasiticDeviceIterator *
ConcreteParasitic::deviceIterator()
{
return NULL;
return nullptr;
}
ParasiticNodeIterator *
ConcreteParasitic::nodeIterator()
{
return NULL;
return nullptr;
}
////////////////////////////////////////////////////////////////
ConcreteElmore::ConcreteElmore() :
loads_(NULL)
loads_(nullptr)
{
}
@ -179,7 +180,7 @@ void
ConcreteElmore::setElmore(const Pin *load_pin,
float elmore)
{
if (loads_ == NULL)
if (loads_ == nullptr)
loads_ = new ConcreteElmoreLoadMap;
(*loads_)[load_pin] = elmore;
}
@ -420,7 +421,7 @@ ConcretePiPoleResidue::ConcretePiPoleResidue(float c2,
float rpi,
float c1) :
ConcretePi(c2, rpi, c1),
load_pole_residue_(NULL)
load_pole_residue_(nullptr)
{
}
@ -472,7 +473,7 @@ ConcretePiPoleResidue::findPoleResidue(const Pin *load_pin) const
if (load_pole_residue_)
return load_pole_residue_->findKey(load_pin);
else
return NULL;
return nullptr;
}
void
@ -480,10 +481,10 @@ ConcretePiPoleResidue::setPoleResidue(const Pin *load_pin,
ComplexFloatSeq *poles,
ComplexFloatSeq *residues)
{
if (load_pole_residue_ == NULL)
if (load_pole_residue_ == nullptr)
load_pole_residue_ = new ConcretePoleResidueMap;
ConcretePoleResidue *pole_residue = load_pole_residue_->findKey(load_pin);
if (pole_residue == NULL) {
if (pole_residue == nullptr) {
pole_residue = new ConcretePoleResidue(poles, residues);
(*load_pole_residue_)[load_pin] = pole_residue;
}
@ -592,7 +593,7 @@ ConcreteParasiticResistor::otherNode(ParasiticNode *node) const
else if (node == other_node_)
return node_;
else
return NULL;
return nullptr;
}
void
@ -642,7 +643,7 @@ ConcreteCouplingCapInt::otherNode(ParasiticNode *node) const
else if (node == other_node_)
return node_;
else
return NULL;
return nullptr;
}
void
@ -670,7 +671,7 @@ ConcreteCouplingCapExtNode(const char *name,
ParasiticNode *
ConcreteCouplingCapExtNode::otherNode(ParasiticNode *) const
{
return NULL;
return nullptr;
}
void
@ -695,7 +696,7 @@ ConcreteCouplingCapExtPin(const char *name,
ParasiticNode *
ConcreteCouplingCapExtPin::otherNode(ParasiticNode *) const
{
return NULL;
return nullptr;
}
void
@ -817,7 +818,7 @@ ConcreteParasiticNetwork::ensureParasiticNode(Net *net,
{
NetId net_id(net, id);
ConcreteParasiticSubNode *node = sub_nodes_.findKey(&net_id);
if (node == NULL) {
if (node == nullptr) {
node = new ConcreteParasiticSubNode(net, id);
sub_nodes_[new NetId(net, id)] = node;
max_node_id_ = max((int) max_node_id_, id);
@ -856,7 +857,7 @@ ConcreteParasiticNode *
ConcreteParasiticNetwork::ensureParasiticNode(const Pin *pin)
{
ConcreteParasiticPinNode *node = pin_nodes_.findKey(pin);
if (node == NULL) {
if (node == nullptr) {
node = new ConcreteParasiticPinNode(pin);
pin_nodes_[pin] = node;
}
@ -886,10 +887,10 @@ makeConcreteParasitics(StaState *sta)
ConcreteParasitics::ConcreteParasitics(StaState *sta) :
Parasitics(sta),
lumped_elmore_maps_(NULL),
pi_elmore_maps_(NULL),
pi_pole_residue_maps_(NULL),
parasitic_network_maps_(NULL)
lumped_elmore_maps_(nullptr),
pi_elmore_maps_(nullptr),
pi_pole_residue_maps_(nullptr),
parasitic_network_maps_(nullptr)
{
}
@ -901,10 +902,10 @@ ConcreteParasitics::~ConcreteParasitics()
bool
ConcreteParasitics::haveParasitics()
{
return lumped_elmore_maps_ != NULL
|| pi_elmore_maps_ != NULL
|| pi_pole_residue_maps_ != NULL
|| parasitic_network_maps_ != NULL;
return lumped_elmore_maps_ != nullptr
|| pi_elmore_maps_ != nullptr
|| pi_pole_residue_maps_ != nullptr
|| parasitic_network_maps_ != nullptr;
}
void
@ -924,7 +925,7 @@ ConcreteParasitics::clear()
}
}
delete lumped_elmore_maps_;
lumped_elmore_maps_ = NULL;
lumped_elmore_maps_ = nullptr;
}
if (pi_elmore_maps_) {
@ -939,7 +940,7 @@ ConcreteParasitics::clear()
}
}
delete pi_elmore_maps_;
pi_elmore_maps_ = NULL;
pi_elmore_maps_ = nullptr;
}
if (pi_pole_residue_maps_) {
@ -954,7 +955,7 @@ ConcreteParasitics::clear()
}
}
delete pi_pole_residue_maps_;
pi_pole_residue_maps_ = NULL;
pi_pole_residue_maps_ = nullptr;
}
if (parasitic_network_maps_) {
@ -969,7 +970,7 @@ ConcreteParasitics::clear()
}
}
delete parasitic_network_maps_;
parasitic_network_maps_ = NULL;
parasitic_network_maps_ = nullptr;
}
}
@ -1083,7 +1084,7 @@ ConcreteParasitics::deleteParasitic(const Pin *drvr_pin,
// not require an analysis pt.
if (ap) {
int ap_index = parasiticAnalysisPtIndex(ap, tr);
lock_.writeLock();
UniqueLock lock(lock_);
if (cparasitic->isLumpedElmore())
(*lumped_elmore_maps_)[ap_index]->eraseKey(drvr_pin);
else if (cparasitic->isPiElmore() && pi_elmore_maps_)
@ -1094,7 +1095,6 @@ ConcreteParasitics::deleteParasitic(const Pin *drvr_pin,
const Net *net = network_->net(drvr_pin);
(*parasitic_network_maps_)[ap_index]->eraseKey(net);
}
lock_.unlock();
}
delete cparasitic;
}
@ -1277,9 +1277,8 @@ ConcreteParasitics::hasLumpedElmore(const Pin *drvr_pin,
{
if (lumped_elmore_maps_ && ap) {
int ap_index = parasiticAnalysisPtIndex(ap, tr);
lock_.readLock();
UniqueLock lock(lock_);
bool exists = (*lumped_elmore_maps_)[ap_index]->hasKey(drvr_pin);
lock_.unlock();
return exists;
}
else
@ -1293,13 +1292,12 @@ ConcreteParasitics::findLumpedElmore(const Pin *drvr_pin,
{
if (ap && lumped_elmore_maps_) {
int ap_index = parasiticAnalysisPtIndex(ap, tr);
lock_.readLock();
UniqueLock lock(lock_);
Parasitic *parasitic = (*lumped_elmore_maps_)[ap_index]->findKey(drvr_pin);
lock_.unlock();
return parasitic;
}
else
return NULL;
return nullptr;
}
Parasitic *
@ -1309,8 +1307,8 @@ ConcreteParasitics::makeLumpedElmore(const Pin *drvr_pin,
const ParasiticAnalysisPt *ap)
{
int ap_index = parasiticAnalysisPtIndex(ap, tr);
lock_.writeLock();
if (lumped_elmore_maps_ == NULL) {
UniqueLock lock(lock_);
if (lumped_elmore_maps_ == nullptr) {
lumped_elmore_maps_ = new ConcreteLumpedElmoreMapSeq(mapSize());
ParasiticAnalysisPtIterator ap_iter(corners_);
while (ap_iter.hasNext()) {
@ -1332,7 +1330,6 @@ ConcreteParasitics::makeLumpedElmore(const Pin *drvr_pin,
lumped_elmore = new ConcreteLumpedElmore(cap);
(*(*lumped_elmore_maps_)[ap_index])[drvr_pin] = lumped_elmore;
}
lock_.unlock();
return lumped_elmore;
}
@ -1343,14 +1340,13 @@ ConcreteParasitics::deleteLumpedElmore(const Pin *drvr_pin,
{
if (ap && lumped_elmore_maps_) {
int ap_index = parasiticAnalysisPtIndex(ap, tr);
lock_.writeLock();
UniqueLock lock(lock_);
ConcreteLumpedElmore *lumped_elmore =
(*lumped_elmore_maps_)[ap_index]->findKey(drvr_pin);
if (lumped_elmore) {
(*lumped_elmore_maps_)[ap_index]->eraseKey(drvr_pin);
delete lumped_elmore;
}
lock_.unlock();
}
}
@ -1370,13 +1366,12 @@ ConcreteParasitics::hasPiElmore(const Pin *drvr_pin,
{
if (ap && pi_elmore_maps_) {
int ap_index = parasiticAnalysisPtIndex(ap, tr);
lock_.readLock();
UniqueLock lock(lock_);
bool exists = (*pi_elmore_maps_)[ap_index]->hasKey(drvr_pin);
if (!exists && tr == TransRiseFall::fall()) {
ap_index = parasiticAnalysisPtIndex(ap, TransRiseFall::rise());
exists = (*pi_elmore_maps_)[ap_index]->hasKey(drvr_pin);
}
lock_.unlock();
return exists;
}
else
@ -1390,17 +1385,16 @@ ConcreteParasitics::findPiElmore(const Pin *drvr_pin,
{
if (ap && pi_elmore_maps_) {
int ap_index = parasiticAnalysisPtIndex(ap, tr);
lock_.readLock();
UniqueLock lock(lock_);
Parasitic *parasitic = (*pi_elmore_maps_)[ap_index]->findKey(drvr_pin);
if (parasitic == NULL && tr == TransRiseFall::fall()) {
if (parasitic == nullptr && tr == TransRiseFall::fall()) {
ap_index = parasiticAnalysisPtIndex(ap, TransRiseFall::rise());
parasitic = (*pi_elmore_maps_)[ap_index]->findKey(drvr_pin);
}
lock_.unlock();
return parasitic;
}
else
return NULL;
return nullptr;
}
Parasitic *
@ -1412,8 +1406,8 @@ ConcreteParasitics::makePiElmore(const Pin *drvr_pin,
float c1)
{
int ap_index = parasiticAnalysisPtIndex(ap, tr);
lock_.writeLock();
if (pi_elmore_maps_ == NULL) {
UniqueLock lock(lock_);
if (pi_elmore_maps_ == nullptr) {
pi_elmore_maps_ = new ConcretePiElmoreMapSeq(mapSize());
ParasiticAnalysisPtIterator ap_iter(corners_);
while (ap_iter.hasNext()) {
@ -1434,7 +1428,6 @@ ConcreteParasitics::makePiElmore(const Pin *drvr_pin,
pi_elmore = new ConcretePiElmore(c2, rpi, c1);
(*(*pi_elmore_maps_)[ap_index])[drvr_pin] = pi_elmore;
}
lock_.unlock();
return pi_elmore;
}
@ -1445,14 +1438,13 @@ ConcreteParasitics::deletePiElmore(const Pin *drvr_pin,
{
if (ap && pi_elmore_maps_) {
int ap_index = parasiticAnalysisPtIndex(ap, tr);
lock_.writeLock();
UniqueLock lock(lock_);
ConcretePiElmore *pi_elmore =
(*pi_elmore_maps_)[ap_index]->findKey(drvr_pin);
if (pi_elmore) {
(*pi_elmore_maps_)[ap_index]->eraseKey(drvr_pin);
delete pi_elmore;
}
lock_.unlock();
}
}
@ -1522,13 +1514,12 @@ ConcreteParasitics::hasPiPoleResidue(const Pin *drvr_pin,
{
if (ap && pi_pole_residue_maps_) {
int ap_index = parasiticAnalysisPtIndex(ap, tr);
lock_.readLock();
UniqueLock lock(lock_);
bool exists = (*pi_pole_residue_maps_)[ap_index]->hasKey(drvr_pin);
if (!exists && tr == TransRiseFall::fall()) {
ap_index = parasiticAnalysisPtIndex(ap, TransRiseFall::rise());
exists = (*pi_pole_residue_maps_)[ap_index]->hasKey(drvr_pin);
}
lock_.unlock();
return exists;
}
else
@ -1542,17 +1533,16 @@ ConcreteParasitics::findPiPoleResidue(const Pin *drvr_pin,
{
if (ap && pi_pole_residue_maps_) {
int ap_index = parasiticAnalysisPtIndex(ap, tr);
lock_.readLock();
UniqueLock lock(lock_);
Parasitic *parasitic = (*pi_pole_residue_maps_)[ap_index]->findKey(drvr_pin);
if (parasitic == NULL && tr == TransRiseFall::fall()) {
if (parasitic == nullptr && tr == TransRiseFall::fall()) {
ap_index = parasiticAnalysisPtIndex(ap, TransRiseFall::rise());
parasitic = (*pi_pole_residue_maps_)[ap_index]->findKey(drvr_pin);
}
lock_.unlock();
return parasitic;
}
else
return NULL;
return nullptr;
}
Parasitic *
@ -1564,8 +1554,8 @@ ConcreteParasitics::makePiPoleResidue(const Pin *drvr_pin,
float c1)
{
int ap_index = parasiticAnalysisPtIndex(ap, tr);
lock_.writeLock();
if (pi_pole_residue_maps_ == NULL) {
UniqueLock lock(lock_);
if (pi_pole_residue_maps_ == nullptr) {
pi_pole_residue_maps_ = new ConcretePiPoleResidueMapSeq(mapSize());
ParasiticAnalysisPtIterator ap_iter(corners_);
while (ap_iter.hasNext()) {
@ -1587,7 +1577,6 @@ ConcreteParasitics::makePiPoleResidue(const Pin *drvr_pin,
pi_pole_residue = new ConcretePiPoleResidue(c2, rpi, c1);
(*(*pi_pole_residue_maps_)[ap_index])[drvr_pin] = pi_pole_residue;
}
lock_.unlock();
return pi_pole_residue;
}
@ -1662,9 +1651,8 @@ ConcreteParasitics::hasParasiticNetwork(const Net *net,
{
if (ap && parasitic_network_maps_) {
int ap_index = parasiticNetworkAnalysisPtIndex(ap);
lock_.readLock();
UniqueLock lock(lock_);
bool exists = (*parasitic_network_maps_)[ap_index]->hasKey(net);
lock_.unlock();
return exists;
}
else
@ -1678,18 +1666,17 @@ ConcreteParasitics::findParasiticNetwork(const Pin *pin,
if (ap && parasitic_network_maps_) {
int ap_index = parasiticNetworkAnalysisPtIndex(ap);
ConcreteParasiticNetworkMap *parasitics = (*parasitic_network_maps_)[ap_index];
lock_.readLock();
Parasitic *parasitic = NULL;
UniqueLock lock(lock_);
Parasitic *parasitic = nullptr;
if (parasitics->size()) {
// Only call findParasiticNet if parasitics exist.
Net *net = findParasiticNet(pin);
parasitic = parasitics->findKey(net);
}
lock_.unlock();
return parasitic;
}
else
return NULL;
return nullptr;
}
Parasitic *
@ -1698,8 +1685,8 @@ ConcreteParasitics::makeParasiticNetwork(Net *net,
const ParasiticAnalysisPt *ap)
{
int ap_index = parasiticNetworkAnalysisPtIndex(ap);
lock_.writeLock();
if (parasitic_network_maps_ == NULL) {
UniqueLock lock(lock_);
if (parasitic_network_maps_ == nullptr) {
parasitic_network_maps_ = new ConcreteParasiticNetworkMapSeq(mapSize());
ParasiticAnalysisPtIterator ap_iter(corners_);
while (ap_iter.hasNext()) {
@ -1715,11 +1702,10 @@ ConcreteParasitics::makeParasiticNetwork(Net *net,
ConcreteParasiticNetwork *parasitic =
(*parasitic_network_maps_)[ap_index]->findKey(net);
if (parasitic == NULL) {
if (parasitic == nullptr) {
parasitic = new ConcreteParasiticNetwork(includes_pin_caps);
(*(*parasitic_network_maps_)[ap_index])[net] = parasitic;
}
lock_.unlock();
return parasitic;
}
@ -1729,14 +1715,13 @@ ConcreteParasitics::deleteParasiticNetwork(const Net *net,
{
if (ap && parasitic_network_maps_) {
int ap_index = parasiticNetworkAnalysisPtIndex(ap);
lock_.writeLock();
UniqueLock lock(lock_);
ConcreteParasiticNetwork *parasitic =
(*parasitic_network_maps_)[ap_index]->findKey(net);
if (parasitic) {
(*parasitic_network_maps_)[ap_index]->eraseKey(net);
delete parasitic;
}
lock_.unlock();
}
}
@ -1877,7 +1862,7 @@ ConcreteParasitics::connectionPin(const ParasiticNode *node) const
return pin_node->pin();
}
else
return NULL;
return nullptr;
}
ParasiticNode *
@ -1967,14 +1952,14 @@ ConcreteParasitics::reduceTo(Parasitic *parasitic,
const ParasiticAnalysisPt *ap)
{
switch (reduce_to) {
case reduce_parasitics_to_pi_elmore:
case ReduceParasiticsTo::pi_elmore:
reduceToPiElmore(parasitic, net, tr, op_cond, corner, cnst_min_max, ap);
break;
case reduce_parasitics_to_pi_pole_residue2:
case ReduceParasiticsTo::pi_pole_residue2:
reduceToPiPoleResidue2(parasitic, net, tr, op_cond, corner,
cnst_min_max, ap);
break;
case reduce_parasitics_to_none:
case ReduceParasiticsTo::none:
break;
}
}

View File

@ -17,10 +17,10 @@
#ifndef STA_CONCRETE_PARASITICS_H
#define STA_CONCRETE_PARASITICS_H
#include <mutex>
#include "Map.hh"
#include "Set.hh"
#include "MinMax.hh"
#include "ReadWriteLock.hh"
#include "EstimateParasitics.hh"
#include "Parasitics.hh"
@ -244,7 +244,7 @@ protected:
ConcretePiElmoreMapSeq *pi_elmore_maps_;
ConcretePiPoleResidueMapSeq *pi_pole_residue_maps_;
ConcreteParasiticNetworkMapSeq *parasitic_network_maps_;
mutable ReadWriteLock lock_;
mutable std::mutex lock_;
using EstimateParasitics::estimatePiElmore;
friend class ConcreteLumpedElmore;

View File

@ -343,7 +343,7 @@ public:
ConcreteParasiticNode *node,
float cap);
virtual bool isCouplingCap() const { return true; }
virtual ConcreteParasiticNode *node2() const { return NULL; }
virtual ConcreteParasiticNode *node2() const { return nullptr; }
virtual void replaceNode(ConcreteParasiticNode *from_node,
ConcreteParasiticNode *to_node);
};

View File

@ -46,26 +46,26 @@ EstimateParasitics::estimatePiElmore(const Pin *drvr_pin,
float wireload_cap, wireload_res;
wireload->findWireload(fanout, op_cond, wireload_cap, wireload_res);
WireloadTree tree = wire_load_unknown_tree;
WireloadTree tree = WireloadTree::unknown;
if (op_cond)
tree = op_cond->wireloadTree();
switch (tree) {
case wire_load_worst_case_tree:
case WireloadTree::worst_case:
estimatePiElmoreWorst(drvr_pin, wireload_cap, wireload_res,
fanout, net_pin_cap, tr, op_cond, corner,
min_max, sta,
c2, rpi, c1, elmore_res,
elmore_cap, elmore_use_load_cap);
break;
case wire_load_unknown_tree:
case wire_load_balanced_tree:
case WireloadTree::balanced:
case WireloadTree::unknown:
estimatePiElmoreBalanced(drvr_pin, wireload_cap, wireload_res,
fanout, net_pin_cap, tr, op_cond,
corner, min_max,sta,
c2, rpi, c1, elmore_res,
elmore_cap, elmore_use_load_cap);
break;
case wire_load_best_case_tree:
case WireloadTree::best_case:
estimatePiElmoreBest(drvr_pin, wireload_cap, net_pin_cap, tr,
op_cond, corner, min_max,
c2, rpi, c1, elmore_res, elmore_cap,

View File

@ -82,7 +82,7 @@ NullParasitics::findLumpedElmore(const Pin *,
const TransRiseFall *,
const ParasiticAnalysisPt *) const
{
return NULL;
return nullptr;
}
bool
@ -97,7 +97,7 @@ NullParasitics::makeLumpedElmore(const Pin *,
const TransRiseFall *,
const ParasiticAnalysisPt *)
{
return NULL;
return nullptr;
}
void
@ -120,7 +120,7 @@ NullParasitics::findPiElmore(const Pin *,
const TransRiseFall *,
const ParasiticAnalysisPt *) const
{
return NULL;
return nullptr;
}
Parasitic *
@ -131,7 +131,7 @@ NullParasitics::makePiElmore(const Pin *,
float,
float)
{
return NULL;
return nullptr;
}
void
@ -220,7 +220,7 @@ NullParasitics::findPiPoleResidue(const Pin *,
const TransRiseFall *,
const ParasiticAnalysisPt *) const
{
return NULL;
return nullptr;
}
Parasitic *
@ -231,14 +231,14 @@ NullParasitics::makePiPoleResidue(const Pin *,
float,
float)
{
return NULL;
return nullptr;
}
Parasitic *
NullParasitics::findPoleResidue(const Parasitic *,
const Pin *) const
{
return NULL;
return nullptr;
}
void
@ -280,7 +280,7 @@ Parasitic *
NullParasitics::findParasiticNetwork(const Pin *,
const ParasiticAnalysisPt *) const
{
return NULL;
return nullptr;
}
bool
@ -294,7 +294,7 @@ NullParasitics::makeParasiticNetwork(Net *,
bool,
const ParasiticAnalysisPt *)
{
return NULL;
return nullptr;
}
bool
@ -314,14 +314,14 @@ NullParasitics::ensureParasiticNode(Parasitic *,
Net *,
int)
{
return NULL;
return nullptr;
}
ParasiticNode *
NullParasitics::ensureParasiticNode(Parasitic *,
const Pin *)
{
return NULL;
return nullptr;
}
void
@ -370,20 +370,20 @@ NullParasitics::makeResistor(const char *,
const char *
NullParasitics::name(const ParasiticNode *)
{
return NULL;
return nullptr;
}
const Pin *
NullParasitics::connectionPin(const ParasiticNode *) const
{
return NULL;
return nullptr;
}
ParasiticNode *
NullParasitics::findNode(Parasitic *,
const Pin *) const
{
return NULL;
return nullptr;
}
float
@ -414,7 +414,7 @@ NullParasitics::isCouplingCap(const ParasiticDevice *) const
const char *
NullParasitics::name(const ParasiticDevice *) const
{
return NULL;
return nullptr;
}
float
@ -427,20 +427,20 @@ NullParasitics::value(const ParasiticDevice *,
ParasiticNode *
NullParasitics::node1(const ParasiticDevice *) const
{
return NULL;
return nullptr;
}
ParasiticNode *
NullParasitics::node2(const ParasiticDevice *) const
{
return NULL;
return nullptr;
}
ParasiticNode *
NullParasitics::otherNode(const ParasiticDevice *,
ParasiticNode *) const
{
return NULL;
return nullptr;
}
void
@ -475,7 +475,7 @@ NullParasitics::reduceToPiElmore(Parasitic *,
const MinMax *,
const ParasiticAnalysisPt *)
{
return NULL;
return nullptr;
}
void
@ -497,7 +497,7 @@ NullParasitics::reduceToPiPoleResidue2(Parasitic *,
const MinMax *,
const ParasiticAnalysisPt *)
{
return NULL;
return nullptr;
}
Parasitic *
@ -511,7 +511,7 @@ NullParasitics::estimatePiElmore(const Pin *,
const MinMax *,
const ParasiticAnalysisPt *)
{
return NULL;
return nullptr;
}
void

View File

@ -126,8 +126,8 @@ public:
makeParasiticNetwork(Net *net,
bool pin_cap_included,
const ParasiticAnalysisPt *ap);
virtual ParasiticDeviceIterator *deviceIterator(Parasitic *) { return NULL; }
virtual ParasiticNodeIterator *nodeIterator(Parasitic *) { return NULL; }
virtual ParasiticDeviceIterator *deviceIterator(Parasitic *) { return nullptr; }
virtual ParasiticNodeIterator *nodeIterator(Parasitic *) { return nullptr; }
virtual bool includesPinCaps(Parasitic *parasitic) const;
virtual void deleteParasiticNetwork(const Net *net,
const ParasiticAnalysisPt *ap);

View File

@ -51,17 +51,17 @@ Parasitics::findParasiticNet(const Pin *pin) const
Net *net = network_->net(pin);
// Pins on the top level instance may not have nets.
// Use the net connected to the pin's terminal.
if (net == NULL && network_->isTopLevelPort(pin)) {
if (net == nullptr && network_->isTopLevelPort(pin)) {
Term *term = network_->term(pin);
if (term)
return network_->net(term);
else
return NULL;
return nullptr;
}
if (net)
return network_->highestConnectedNet(net);
else
return NULL;
return nullptr;
}
void
@ -102,20 +102,20 @@ Parasitics::makeWireloadNetwork(const Pin *drvr_pin,
float wireload_cap, wireload_res;
wireload->findWireload(fanout, op_cond, wireload_cap, wireload_res);
WireloadTree tree = wire_load_balanced_tree;
WireloadTree tree = WireloadTree::balanced;
if (op_cond)
tree = op_cond->wireloadTree();
switch (tree) {
case wire_load_worst_case_tree:
case WireloadTree::worst_case:
makeWireloadNetworkWorst(parasitic, drvr_pin, wireload_cap,
wireload_res, fanout, ap);
break;
case wire_load_balanced_tree:
case WireloadTree::balanced:
makeWireloadNetworkBalanced(parasitic, drvr_pin, wireload_cap,
wireload_res, fanout, ap);
break;
case wire_load_unknown_tree:
case wire_load_best_case_tree:
case WireloadTree::best_case:
case WireloadTree::unknown:
makeWireloadNetworkBest(parasitic, drvr_pin, wireload_cap,
wireload_res, fanout, ap);
break;
@ -136,7 +136,7 @@ Parasitics::makeWireloadNetworkWorst(Parasitic *parasitic,
ParasiticNode *drvr_node = ensureParasiticNode(parasitic, drvr_pin);
Net *net = network_->net(drvr_pin);
ParasiticNode *load_node = ensureParasiticNode(parasitic, net, 0);
makeResistor(NULL, drvr_node, load_node, wireload_res, ap);
makeResistor(nullptr, drvr_node, load_node, wireload_res, ap);
parasitics_->incrCap(load_node, wireload_cap, ap);
PinConnectedPinIterator *load_iter =
network_->connectedPinIterator(drvr_pin);
@ -145,7 +145,7 @@ Parasitics::makeWireloadNetworkWorst(Parasitic *parasitic,
if (load_pin != drvr_pin
&& network_->isLoad(load_pin)) {
ParasiticNode *load_node1 = ensureParasiticNode(parasitic, load_pin);
makeResistor(NULL, load_node, load_node1, 0.0, ap);
makeResistor(nullptr, load_node, load_node1, 0.0, ap);
}
}
}
@ -168,7 +168,7 @@ Parasitics::makeWireloadNetworkBest(Parasitic *parasitic,
if (load_pin != drvr_pin
&& network_->isLoad(load_pin)) {
ParasiticNode *load_node1 = ensureParasiticNode(parasitic, load_pin);
makeResistor(NULL, drvr_node, load_node1, 0.0, ap);
makeResistor(nullptr, drvr_node, load_node1, 0.0, ap);
}
}
}
@ -193,7 +193,7 @@ Parasitics::makeWireloadNetworkBalanced(Parasitic *parasitic,
if (load_pin != drvr_pin
&& network_->isLoad(load_pin)) {
ParasiticNode *load_node1 = ensureParasiticNode(parasitic, load_pin);
makeResistor(NULL, drvr_node, load_node1, fanout_res, ap);
makeResistor(nullptr, drvr_node, load_node1, fanout_res, ap);
parasitics_->incrCap(load_node1, fanout_cap, ap);
}
}

View File

@ -25,11 +25,7 @@ class ParasiticDevice;
class ParasiticNode;
class ParasiticAnalysisPt;
typedef enum {
reduce_parasitics_to_pi_elmore,
reduce_parasitics_to_pi_pole_residue2,
reduce_parasitics_to_none
} ReduceParasiticsTo;
enum class ReduceParasiticsTo { pi_elmore, pi_pole_residue2, none };
} // namespace
#endif

View File

@ -80,10 +80,10 @@ protected:
ReduceToPi::ReduceToPi(StaState *sta) :
StaState(sta),
coupling_cap_multiplier_(1.0),
tr_(NULL),
op_cond_(NULL),
corner_(NULL),
cnst_min_max_(NULL)
tr_(nullptr),
op_cond_(nullptr),
corner_(nullptr),
cnst_min_max_(nullptr)
{
}
@ -401,7 +401,7 @@ private:
ReduceToPiPoleResidue2::ReduceToPiPoleResidue2(StaState *sta) :
ReduceToPi(sta),
moments_(NULL)
moments_(nullptr)
{
}

View File

@ -117,13 +117,13 @@ SpefReader::SpefReader(const char *filename,
delimiter_('\0'),
bus_brkt_left_('\0'),
bus_brkt_right_('\0'),
net_(NULL),
net_(nullptr),
report_(report),
network_(network),
parasitics_(parasitics),
triple_index_(0),
design_flow_(NULL),
parasitic_(NULL)
design_flow_(nullptr),
parasitic_(nullptr)
{
ap->setCouplingCapFactor(coupling_cap_factor);
}
@ -133,7 +133,7 @@ SpefReader::~SpefReader()
if (design_flow_) {
deleteContents(design_flow_);
delete design_flow_;
design_flow_ = NULL;
design_flow_ = nullptr;
}
SpefNameMap::Iterator map_iter(name_map_);
@ -202,7 +202,7 @@ SpefReader::getChars(char *buf,
{
char *status = gzgets(stream_, buf, max_size);
if (status == Z_NULL)
result = 0; // YY_NULL
result = 0; // YY_nullptr
else
result = static_cast<int>(strlen(buf));
}
@ -214,7 +214,7 @@ SpefReader::getChars(char *buf,
{
char *status = gzgets(stream_, buf, max_size);
if (status == Z_NULL)
result = 0; // YY_NULL
result = 0; // YY_nullptr
else
result = strlen(buf);
}
@ -358,7 +358,7 @@ SpefReader::findPin(char *name)
const char *port_name = delim + 1;
if (inst) {
pin = network_->findPin(inst, port_name);
if (pin == NULL)
if (pin == nullptr)
warn("pin %s not found.\n", name);
}
else
@ -366,7 +366,7 @@ SpefReader::findPin(char *name)
}
else {
pin = findPortPinRelative(name);
if (pin == NULL)
if (pin == nullptr)
warn("pin %s not found.\n", name);
}
}
@ -380,7 +380,7 @@ SpefReader::findNet(char *name)
name = nameMapLookup(name);
if (name) {
net = findNetRelative(name);
if (net == NULL)
if (net == nullptr)
warn("net %s not found.\n", name);
}
return net;
@ -473,7 +473,7 @@ SpefReader::dspfFinish()
// Checking "should" be done by report_annotated_parasitics.
if (!quiet_)
parasitics_->check(parasitic_);
if (reduce_to_ != reduce_parasitics_to_none) {
if (reduce_to_ != ReduceParasiticsTo::none) {
TransRiseFallIterator tr_iter;
while (tr_iter.hasNext()) {
TransRiseFall *tr = tr_iter.next();
@ -497,7 +497,7 @@ SpefReader::findParasiticNode(char *name)
int ext_node_id;
Pin *ext_pin;
findParasiticNode(name, node, ext_net, ext_node_id, ext_pin);
if (node == NULL
if (node == nullptr
&& (ext_net || ext_pin))
warn("%s not connected to net %s.\n", name, network_->pathName(net_));
return node;
@ -621,8 +621,8 @@ SpefReader::makeCouplingCap(int id,
char *node_name2,
float cap)
{
const char *name = NULL;
const char *name_tmp = NULL;
const char *name = nullptr;
const char *name_tmp = nullptr;
if (keep_device_names_)
// Prepend device type because OA uses one namespace for all devices.
name = name_tmp = stringPrint("C%d", id);
@ -635,14 +635,14 @@ SpefReader::makeCouplingCap(int id,
findParasiticNode(node_name2, node2, ext_net2, ext_node_id2, ext_pin2);
if (node1 && node2)
parasitics_->makeCouplingCap(name, node1, node2, cap, ap_);
if (node1 && node2 == NULL) {
if (node1 && node2 == nullptr) {
if (ext_net2)
parasitics_->makeCouplingCap(name, node1, ext_net2, ext_node_id2,
cap, ap_);
else if (ext_pin2)
parasitics_->makeCouplingCap(name, node1, ext_pin2, cap, ap_);
}
else if (node1 == NULL && node2) {
else if (node1 == nullptr && node2) {
if (ext_net1)
parasitics_->makeCouplingCap(name, node2, ext_net1, ext_node_id1,
cap, ap_);
@ -662,8 +662,8 @@ SpefReader::makeResistor(int id,
ParasiticNode *node2 = findParasiticNode(node_name2);
if (node1 && node2) {
float res1 = res->value(triple_index_) * res_scale_;
const char *name = NULL;
const char *name_tmp = NULL;
const char *name = nullptr;
const char *name_tmp = nullptr;
if (keep_device_names_)
// Prepend device type because OA uses one namespace for all devices.
name = name_tmp = stringPrint("R%d", id);

View File

@ -34,29 +34,29 @@ isPowerOfTwo(int i);
Clock::Clock(const char *name,
int index) :
name_(stringCopy(name)),
pins_(NULL),
pins_(nullptr),
add_to_pins_(false),
vertex_pins_(NULL),
pll_out_(NULL),
pll_fdbk_(NULL),
vertex_pins_(nullptr),
pll_out_(nullptr),
pll_fdbk_(nullptr),
period_(0.0),
waveform_(NULL),
waveform_(nullptr),
waveform_valid_(false),
index_(index),
clk_edges_(NULL),
clk_edges_(nullptr),
is_propagated_(false),
uncertainties_(NULL),
uncertainties_(nullptr),
is_generated_(false),
src_pin_(NULL),
master_clk_(NULL),
src_pin_(nullptr),
master_clk_(nullptr),
master_clk_infered_(false),
divide_by_(0),
multiply_by_(0),
duty_cycle_(0),
invert_(false),
combinational_(false),
edges_(NULL),
edge_shifts_(NULL)
edges_(nullptr),
edge_shifts_(nullptr)
{
makeClkEdges();
}
@ -85,7 +85,7 @@ Clock::initClk(PinSet *pins,
bool
Clock::isVirtual() const
{
return pins_ == NULL || pins_->empty();
return pins_ == nullptr || pins_->empty();
}
void
@ -150,10 +150,10 @@ Clock::~Clock()
void
Clock::addPin(Pin *pin)
{
if (pins_ == NULL)
if (pins_ == nullptr)
pins_ = new PinSet;
pins_->insert(pin);
if (vertex_pins_ == NULL)
if (vertex_pins_ == nullptr)
vertex_pins_ = new PinSet;
vertex_pins_->insert(pin);
}
@ -191,7 +191,7 @@ Clock::defaultPin() const
if (pin_iter.hasNext())
return pin_iter.next();
else
return NULL;
return nullptr;
}
ClockEdge *
@ -256,7 +256,7 @@ Clock::setSlewLimit(const TransRiseFallBoth *tr,
const MinMax *min_max,
float slew)
{
slew_limits_[clk_data].setValue(tr, min_max, slew);
slew_limits_[int(clk_data)].setValue(tr, min_max, slew);
}
void
@ -267,7 +267,7 @@ Clock::slewLimit(const TransRiseFall *tr,
float &slew,
bool &exists) const
{
slew_limits_[clk_data].value(tr, min_max, slew, exists);
slew_limits_[int(clk_data)].value(tr, min_max, slew, exists);
}
void
@ -288,7 +288,7 @@ void
Clock::setUncertainty(const SetupHoldAll *setup_hold,
float uncertainty)
{
if (uncertainties_ == NULL)
if (uncertainties_ == nullptr)
uncertainties_ = new ClockUncertainties;
uncertainties_->setValue(setup_hold, uncertainty);
}
@ -297,7 +297,7 @@ void
Clock::setUncertainty(const SetupHold *setup_hold,
float uncertainty)
{
if (uncertainties_ == NULL)
if (uncertainties_ == nullptr)
uncertainties_ = new ClockUncertainties;
uncertainties_->setValue(setup_hold, uncertainty);
}
@ -309,7 +309,7 @@ Clock::removeUncertainty(const SetupHoldAll *setup_hold)
uncertainties_->removeValue(setup_hold);
if (uncertainties_->empty()) {
delete uncertainties_;
uncertainties_ = NULL;
uncertainties_ = nullptr;
}
}
}
@ -361,7 +361,7 @@ Clock::initGeneratedClk(PinSet *pins,
if (edges
&& edges->empty()) {
delete edges;
edges = NULL;
edges = nullptr;
}
edges_ = edges;
@ -369,7 +369,7 @@ Clock::initGeneratedClk(PinSet *pins,
if (edge_shifts
&& edge_shifts->empty()) {
delete edge_shifts;
edge_shifts = NULL;
edge_shifts = nullptr;
}
edge_shifts_ = edge_shifts;
}
@ -400,7 +400,7 @@ Clock::isGeneratedWithPropagatedMaster() const
void
Clock::generate(const Clock *src_clk)
{
if (waveform_ == NULL)
if (waveform_ == nullptr)
waveform_ = new FloatSeq;
else
waveform_->clear();
@ -587,11 +587,11 @@ int
clkCmp(const Clock *clk1,
const Clock *clk2)
{
if (clk1 == NULL && clk2)
if (clk1 == nullptr && clk2)
return -1;
else if (clk1 == NULL && clk2 == NULL)
else if (clk1 == nullptr && clk2 == nullptr)
return 0;
else if (clk1 && clk2 == NULL)
else if (clk1 && clk2 == nullptr)
return 1;
else {
int index1 = clk1->index();
@ -609,11 +609,11 @@ int
clkEdgeCmp(ClockEdge *clk_edge1,
ClockEdge *clk_edge2)
{
if (clk_edge1 == NULL && clk_edge2)
if (clk_edge1 == nullptr && clk_edge2)
return -1;
else if (clk_edge1 == NULL && clk_edge2 == NULL)
else if (clk_edge1 == nullptr && clk_edge2 == nullptr)
return 0;
else if (clk_edge1 && clk_edge2 == NULL)
else if (clk_edge1 && clk_edge2 == nullptr)
return 1;
else {
int index1 = clk_edge1->index();

View File

@ -20,7 +20,7 @@
namespace sta {
ClockGatingCheck::ClockGatingCheck() :
active_value_(logic_unknown)
active_value_(LogicValue::unknown)
{
}

View File

@ -20,9 +20,7 @@
namespace sta {
ClockGroup::ClockGroup(ClockGroups *clk_groups,
ClockSet *clks) :
clk_groups_(clk_groups),
ClockGroup::ClockGroup(ClockSet *clks) :
clks_(clks)
{
}
@ -64,7 +62,7 @@ ClockGroups::~ClockGroups()
ClockGroup *
ClockGroups::makeClockGroup(ClockSet *clks)
{
ClockGroup *group = new ClockGroup(this, clks);
ClockGroup *group = new ClockGroup(clks);
groups_.insert(group);
return group;
}

View File

@ -26,8 +26,7 @@ namespace sta {
class ClockGroup
{
public:
ClockGroup(ClockGroups *clk_groups,
ClockSet *clks);
ClockGroup(ClockSet *clks);
~ClockGroup();
bool isMember(const Clock *clk);
ClockSet *clks() const { return clks_; }
@ -35,7 +34,6 @@ public:
private:
DISALLOW_COPY_AND_ASSIGN(ClockGroup);
ClockGroups *clk_groups_;
ClockSet *clks_;
};

View File

@ -309,6 +309,8 @@ CycleAccting::targetTimeOffset(const TimingRole *check_role)
return targetCycle(check_role) * tgt_->clock()->period();
}
////////////////////////////////////////////////////////////////
bool
CycleAcctingLess::operator()(const CycleAccting *acct1,
const CycleAccting *acct2) const
@ -321,4 +323,18 @@ CycleAcctingLess::operator()(const CycleAccting *acct1,
&& acct1->target()->index() < acct2->target()->index());
}
Hash
CycleAcctingHash::operator()(const CycleAccting *acct) const
{
return hashSum(acct->src()->index(), acct->target()->index());
}
bool
CycleAcctingEqual::operator()(const CycleAccting *acct1,
const CycleAccting *acct2) const
{
return acct1->src() == acct2->src()
&& acct1->target() == acct2->target();
}
} // namespace

View File

@ -88,5 +88,18 @@ public:
const CycleAccting *acct2) const;
};
class CycleAcctingHash
{
public:
Hash operator()(const CycleAccting *acct) const;
};
class CycleAcctingEqual
{
public:
bool operator()(const CycleAccting *acct1,
const CycleAccting *acct2) const;
};
} // namespace
#endif

View File

@ -19,6 +19,12 @@
namespace sta {
inline int
TimingDerateIndex(TimingDerateType type)
{
return int(type);
}
DeratingFactors::DeratingFactors()
{
clear();
@ -33,7 +39,7 @@ DeratingFactors::setFactor(PathClkOrData clk_data,
TransRiseFallIterator tr_iter(tr);
while (tr_iter.hasNext()) {
TransRiseFall *tr1 = tr_iter.next();
factors_[clk_data].setValue(tr1, early_late, factor);
factors_[int(clk_data)].setValue(tr1, early_late, factor);
}
}
@ -44,14 +50,14 @@ DeratingFactors::factor(PathClkOrData clk_data,
float &factor,
bool &exists) const
{
factors_[clk_data].value(tr, early_late, factor, exists);
factors_[int(clk_data)].value(tr, early_late, factor, exists);
}
void
DeratingFactors::clear()
{
for (int clk_data = 0; clk_data < path_clk_or_data_count;clk_data++)
factors_[clk_data].clear();
factors_[int(clk_data)].clear();
}
void
@ -59,13 +65,13 @@ DeratingFactors::isOneValue(const EarlyLate *early_late,
bool &is_one_value,
float &value) const
{
bool is_one_value1, is_one_value2;
float value1, value2;
is_one_value1 = factors_[path_clk].isOneValue(early_late, value1);
is_one_value2 = factors_[path_data].isOneValue(early_late, value2);
is_one_value = is_one_value1
&& is_one_value2
&& value1 == value2;
bool is_one_value0, is_one_value1;
float value0, value1;
is_one_value0 = factors_[0].isOneValue(early_late, value0);
is_one_value1 = factors_[1].isOneValue(early_late, value1);
is_one_value = is_one_value0
&& is_one_value1
&& value0 == value1;
value = value1;
}
@ -75,14 +81,14 @@ DeratingFactors::isOneValue(PathClkOrData clk_data,
bool &is_one_value,
float &value) const
{
is_one_value = factors_[clk_data].isOneValue(early_late, value);
is_one_value = factors_[int(clk_data)].isOneValue(early_late, value);
}
bool
DeratingFactors::hasValue() const
{
return factors_[path_clk].hasValue()
|| factors_[path_data].hasValue();
return factors_[0].hasValue()
|| factors_[1].hasValue();
}
////////////////////////////////////////////////////////////////
@ -99,7 +105,7 @@ DeratingFactorsGlobal::setFactor(TimingDerateType type,
const EarlyLate *early_late,
float factor)
{
factors_[type].setFactor(clk_data, tr, early_late, factor);
factors_[TimingDerateIndex(type)].setFactor(clk_data, tr, early_late, factor);
}
void
@ -110,7 +116,7 @@ DeratingFactorsGlobal::factor(TimingDerateType type,
float &factor,
bool &exists) const
{
factors_[type].factor(clk_data, tr, early_late, factor, exists);
factors_[TimingDerateIndex(type)].factor(clk_data, tr, early_late, factor, exists);
}
void
@ -123,7 +129,7 @@ DeratingFactorsGlobal::clear()
DeratingFactors *
DeratingFactorsGlobal::factors(TimingDerateType type)
{
return &factors_[type];
return &factors_[TimingDerateIndex(type)];
}
////////////////////////////////////////////////////////////////
@ -140,7 +146,7 @@ DeratingFactorsCell::setFactor(TimingDerateType type,
const EarlyLate *early_late,
float factor)
{
factors_[type].setFactor(clk_data, tr, early_late, factor);
factors_[TimingDerateIndex(type)].setFactor(clk_data, tr, early_late, factor);
}
void
@ -151,7 +157,7 @@ DeratingFactorsCell::factor(TimingDerateType type,
float &factor,
bool &exists) const
{
factors_[type].factor(clk_data, tr, early_late, factor, exists);
factors_[TimingDerateIndex(type)].factor(clk_data, tr, early_late, factor, exists);
}
void
@ -164,7 +170,7 @@ DeratingFactorsCell::clear()
DeratingFactors *
DeratingFactorsCell::factors(TimingDerateType type)
{
return &factors_[type];
return &factors_[TimingDerateIndex(type)];
}
void
@ -174,8 +180,10 @@ DeratingFactorsCell::isOneValue(const EarlyLate *early_late,
{
bool is_one_value1, is_one_value2;
float value1, value2;
factors_[timing_derate_cell_delay].isOneValue(early_late, is_one_value1, value1);
factors_[timing_derate_cell_check].isOneValue(early_late, is_one_value2, value2);
factors_[TimingDerateIndex(TimingDerateType::cell_delay)]
.isOneValue(early_late, is_one_value1, value1);
factors_[TimingDerateIndex(TimingDerateType::cell_check)]
.isOneValue(early_late, is_one_value2, value2);
is_one_value = is_one_value1
&& is_one_value2
&& value1 == value2;

View File

@ -26,9 +26,9 @@ namespace sta {
DisabledPorts::DisabledPorts() :
all_(false),
from_(NULL),
to_(NULL),
from_to_(NULL)
from_(nullptr),
to_(nullptr),
from_to_(nullptr)
{
}
@ -57,7 +57,7 @@ DisabledPorts::removeDisabledAll()
void
DisabledPorts::setDisabledFrom(LibertyPort *port)
{
if (from_ == NULL)
if (from_ == nullptr)
from_ = new LibertyPortSet;
from_->insert(port);
}
@ -72,7 +72,7 @@ DisabledPorts::removeDisabledFrom(LibertyPort *port)
void
DisabledPorts::setDisabledTo(LibertyPort *port)
{
if (to_ == NULL)
if (to_ == nullptr)
to_ = new LibertyPortSet;
to_->insert(port);
}
@ -87,7 +87,7 @@ DisabledPorts::removeDisabledTo(LibertyPort *port)
void
DisabledPorts::setDisabledFromTo(LibertyPort *from, LibertyPort *to)
{
if (from_to_ == NULL)
if (from_to_ == nullptr)
from_to_ = new LibertyPortPairSet;
LibertyPortPair pair(from, to);
if (!from_to_->hasKey(&pair)) {
@ -126,7 +126,7 @@ DisabledPorts::isDisabled(LibertyPort *from, LibertyPort *to,
DisabledCellPorts::DisabledCellPorts(LibertyCell *cell) :
DisabledPorts(),
cell_(cell),
arc_sets_(NULL)
arc_sets_(nullptr)
{
}
@ -139,7 +139,7 @@ DisabledCellPorts::~DisabledCellPorts()
void
DisabledCellPorts::setDisabled(TimingArcSet *arc_set)
{
if (arc_sets_ == NULL)
if (arc_sets_ == nullptr)
arc_sets_ = new TimingArcSetSet;
arc_sets_->insert(arc_set);
}

View File

@ -235,7 +235,7 @@ ExceptionPath::firstPt()
else if (to_)
return to_;
else
return NULL;
return nullptr;
}
bool
@ -295,7 +295,7 @@ ExceptionPath::fromThruToPriority(ExceptionFrom *from,
Hash
ExceptionPath::hash() const
{
return hash(NULL);
return hash(nullptr);
}
Hash
@ -317,7 +317,7 @@ bool
ExceptionPath::mergeablePts(ExceptionPath *exception) const
{
ExceptionPt *ignore;
return mergeablePts(exception, NULL, ignore);
return mergeablePts(exception, nullptr, ignore);
}
bool
@ -325,14 +325,14 @@ ExceptionPath::mergeablePts(ExceptionPath *exception2,
ExceptionPt *missing_pt2,
ExceptionPt *&missing_pt) const
{
missing_pt = NULL;
missing_pt = nullptr;
ExceptionFrom *from2 = exception2->from();
if ((from_ && from2
&& !(from_->transition() == from2->transition()
&& (from2 == missing_pt2
|| from_->equal(from2))))
|| (from_ && from2 == NULL)
|| (from_ == NULL && from2))
|| (from_ && from2 == nullptr)
|| (from_ == nullptr && from2))
return false;
if (from2 == missing_pt2)
missing_pt = from_;
@ -360,8 +360,8 @@ ExceptionPath::mergeablePts(ExceptionPath *exception2,
&& to_->endTransition() == to2->endTransition()
&& (to2 == missing_pt2
|| to_->equal(to2))))
|| (to_ && to2 == NULL)
|| (to_ == NULL && to2))
|| (to_ && to2 == nullptr)
|| (to_ == nullptr && to2))
return false;
if (to2 == missing_pt2)
missing_pt = to_;
@ -374,11 +374,11 @@ ExceptionPath::intersectsPts(ExceptionPath *exception) const
ExceptionFrom *from2 = exception->from();
ExceptionThruSeq *thrus2 = exception->thrus();
ExceptionTo *to2 = exception->to();
if (((from_ == NULL && from2 == NULL)
if (((from_ == nullptr && from2 == nullptr)
|| (from_ && from2 && from_->intersectsPts(from2)))
&& ((thrus_ == NULL && thrus2 == NULL)
&& ((thrus_ == nullptr && thrus2 == nullptr)
|| (thrus_ && thrus2 && thrus_->size() == thrus2->size()))
&& ((to_ == NULL && to2 == NULL)
&& ((to_ == nullptr && to2 == nullptr)
|| (to_ && to2 && to_->intersectsPts(to2)))) {
ExceptionThruSeq::Iterator thrus_iter1(thrus_);
ExceptionThruSeq::Iterator thrus_iter2(thrus2);
@ -438,14 +438,14 @@ void
ExceptionPath::makeStates()
{
if (thrus_) {
ExceptionState *prev_state = NULL;
ExceptionState *prev_state = nullptr;
ExceptionThruSeq::Iterator thru_iter(thrus_);
bool first = true;
int index = 0;
while (thru_iter.hasNext()) {
ExceptionThru *thru = thru_iter.next();
// No state for first -thru if no -from,since it kicks off the exception.
if (!(from_ == NULL && first)) {
if (!(from_ == nullptr && first)) {
ExceptionState *state = new ExceptionState(this, thru, index);
if (prev_state)
prev_state->setNextState(state);
@ -457,14 +457,14 @@ ExceptionPath::makeStates()
index++;
}
// Last state indicates all the thrus have been traversed.
ExceptionState *state = new ExceptionState(this, NULL, index);
ExceptionState *state = new ExceptionState(this, nullptr, index);
if (prev_state)
prev_state->setNextState(state);
else
states_ = state;
}
else
states_ = new ExceptionState(this, NULL, 0);
states_ = new ExceptionState(this, nullptr, 0);
}
bool
@ -478,33 +478,33 @@ ExceptionPath::resetMatch(ExceptionFrom *from,
// exceptions that match the -from even if they are more specific.
// -from
return ((from && from_
&& thrus == NULL
&& to == NULL
&& thrus == nullptr
&& to == nullptr
&& from_->intersectsPts(from))
// -thru
|| (from == NULL
|| (from == nullptr
&& thrus && thrus_
&& to == NULL
&& to == nullptr
&& thrusIntersectPts(thrus_, thrus))
// -to
|| (from == NULL
&& thrus == NULL
|| (from == nullptr
&& thrus == nullptr
&& to && to_
&& to_->intersectsPts(to))
// -from -thru
|| (from && from_
&& thrus && thrus_
&& to == NULL
&& to == nullptr
&& from_->intersectsPts(from)
&& thrusIntersectPts(thrus_, thrus))
// -from -to
|| (from && from_
&& thrus == NULL
&& thrus == nullptr
&& to && to_
&& from_->intersectsPts(from)
&& to_->intersectsPts(to))
// -thru -to
|| (from == NULL
|| (from == nullptr
&& thrus && thrus_
&& to && to_
&& thrusIntersectPts(thrus_, thrus)
@ -680,9 +680,9 @@ FalsePath::overrides(ExceptionPath *exception) const
////////////////////////////////////////////////////////////////
LoopPath::LoopPath(ExceptionThruSeq *thrus, bool own_pts) :
FalsePath(NULL, thrus, NULL, MinMaxAll::all(), own_pts,
falsePathPriority() + fromThruToPriority(NULL, thrus, NULL),
NULL)
FalsePath(nullptr, thrus, nullptr, MinMaxAll::all(), own_pts,
falsePathPriority() + fromThruToPriority(nullptr, thrus, nullptr),
nullptr)
{
}
@ -810,7 +810,7 @@ FilterPath::FilterPath(ExceptionFrom *from,
bool own_pts) :
ExceptionPath(from, thrus, to, MinMaxAll::all(), own_pts,
filterPathPriority() + fromThruToPriority(from, thrus, to),
NULL)
nullptr)
{
}
@ -962,17 +962,17 @@ ExceptionFromTo::ExceptionFromTo(PinSet *pins,
if (pins_ && pins_->empty()) {
if (own_pts)
delete pins_;
pins_ = NULL;
pins_ = nullptr;
}
if (clks_ && clks_->empty()) {
if (own_pts)
delete clks_;
clks_ = NULL;
clks_ = nullptr;
}
if (insts_ && insts_->empty()) {
if (own_pts)
delete insts_;
insts_ = NULL;
insts_ = nullptr;
}
findHash();
}
@ -989,19 +989,19 @@ ExceptionFromTo::~ExceptionFromTo()
bool
ExceptionFromTo::hasPins() const
{
return pins_ != NULL && !pins_->empty();
return pins_ != nullptr && !pins_->empty();
}
bool
ExceptionFromTo::hasClocks() const
{
return clks_ != NULL && !clks_->empty();
return clks_ != nullptr && !clks_->empty();
}
bool
ExceptionFromTo::hasInstances() const
{
return insts_ != NULL && !insts_->empty();
return insts_ != nullptr && !insts_->empty();
}
bool
@ -1161,7 +1161,7 @@ ExceptionFromTo::deleteObjects(ExceptionFromTo *pt)
void
ExceptionFromTo::addPin(Pin *pin)
{
if (pins_ == NULL)
if (pins_ == nullptr)
pins_ = new PinSet;
if (!pins_->hasKey(pin)) {
pins_->insert(pin);
@ -1173,7 +1173,7 @@ ExceptionFromTo::addPin(Pin *pin)
void
ExceptionFromTo::addClock(Clock *clk)
{
if (clks_ == NULL)
if (clks_ == nullptr)
clks_ = new ClockSet;
if (!clks_->hasKey(clk)) {
clks_->insert(clk);
@ -1185,7 +1185,7 @@ ExceptionFromTo::addClock(Clock *clk)
void
ExceptionFromTo::addInstance(Instance *inst)
{
if (insts_ == NULL)
if (insts_ == nullptr)
insts_ = new InstanceSet;
if (!insts_->hasKey(inst)) {
insts_->insert(inst);
@ -1320,13 +1320,13 @@ ExceptionFrom::findHash()
ExceptionFrom *
ExceptionFrom::clone()
{
PinSet *pins = NULL;
PinSet *pins = nullptr;
if (pins_)
pins = new PinSet(*pins_);
ClockSet *clks = NULL;
ClockSet *clks = nullptr;
if (clks_)
clks = new ClockSet(*clks_);
InstanceSet *insts = NULL;
InstanceSet *insts = nullptr;
if (insts_)
insts = new InstanceSet(*insts_);
return new ExceptionFrom(pins, clks, insts, tr_, true);
@ -1368,13 +1368,13 @@ ExceptionTo::ExceptionTo(PinSet *pins,
ExceptionTo *
ExceptionTo::clone()
{
PinSet *pins = NULL;
PinSet *pins = nullptr;
if (pins_)
pins = new PinSet(*pins_);
ClockSet *clks = NULL;
ClockSet *clks = nullptr;
if (clks_)
clks = new ClockSet(*clks_);
InstanceSet *insts = NULL;
InstanceSet *insts = nullptr;
if (insts_)
insts = new InstanceSet(*insts_);
return new ExceptionTo(pins, clks, insts, tr_, end_tr_, true);
@ -1449,9 +1449,9 @@ ExceptionTo::matches(const Pin *pin,
&& network->direction(pin)->isAnyInput()
&& tr_->matches(end_tr)
&& end_tr_->matches(end_tr))
|| (pins_ == NULL
&& clks_ == NULL
&& insts_ == NULL
|| (pins_ == nullptr
&& clks_ == nullptr
&& insts_ == nullptr
&& end_tr_->matches(end_tr));
}
@ -1463,9 +1463,9 @@ ExceptionTo::matches(const Pin *pin,
&& pins_->hasKey(const_cast<Pin*>(pin))
&& tr_->matches(end_tr)
&& end_tr_->matches(end_tr))
|| (pins_ == NULL
&& clks_ == NULL
&& insts_ == NULL
|| (pins_ == nullptr
&& clks_ == nullptr
&& insts_ == nullptr
&& end_tr_->matches(end_tr));
}
@ -1509,7 +1509,7 @@ ExceptionThru::ExceptionThru(PinSet *pins,
const Network *network) :
ExceptionPt(tr, own_pts),
pins_(pins),
edges_(NULL),
edges_(nullptr),
nets_(nets),
insts_(insts)
{
@ -1517,17 +1517,17 @@ ExceptionThru::ExceptionThru(PinSet *pins,
if (pins_ && pins_->empty()) {
if (own_pts)
delete pins_;
pins_ = NULL;
pins_ = nullptr;
}
if (nets_ && nets_->empty()) {
if (own_pts)
delete nets_;
nets_ = NULL;
nets_ = nullptr;
}
if (insts_ && insts_->empty()) {
if (own_pts)
delete insts_;
insts_ = NULL;
insts_ = nullptr;
}
makeAllEdges(network);
findHash();
@ -1599,7 +1599,7 @@ void
ExceptionThru::makeHpinEdges(const Pin *pin,
const Network *network)
{
if (edges_ == NULL)
if (edges_ == nullptr)
edges_ = new EdgePinsSet;
// Add edges thru pin to edges_.
insertPinPairsThruHierPin(pin, network, edges_);
@ -1611,7 +1611,7 @@ ExceptionThru::makeNetEdges(const Network *network)
NetSet::Iterator net_iter(nets_);
while (net_iter.hasNext()) {
Net *net = net_iter.next();
if (edges_ == NULL)
if (edges_ == nullptr)
edges_ = new EdgePinsSet;
// Add edges thru pin to edges_.
insertPinPairsThruNet(net, network, edges_);
@ -1622,7 +1622,7 @@ void
ExceptionThru::makeNetEdges(Net *net,
const Network *network)
{
if (edges_ == NULL)
if (edges_ == nullptr)
edges_ = new EdgePinsSet;
// Add edges thru pin to edges_.
insertPinPairsThruNet(net, network, edges_);
@ -1764,19 +1764,19 @@ exceptionThrusClone(ExceptionThruSeq *thrus,
return thrus_cpy;
}
else
return NULL;
return nullptr;
}
ExceptionThru *
ExceptionThru::clone(const Network *network)
{
PinSet *pins = NULL;
PinSet *pins = nullptr;
if (pins_)
pins = new PinSet(*pins_);
NetSet *nets = NULL;
NetSet *nets = nullptr;
if (nets_)
nets = new NetSet(*nets_);
InstanceSet *insts = NULL;
InstanceSet *insts = nullptr;
if (insts_)
insts = new InstanceSet(*insts_);
return new ExceptionThru(pins, nets, insts, tr_, true, network);
@ -1785,16 +1785,16 @@ ExceptionThru::clone(const Network *network)
bool
ExceptionThru::hasObjects() const
{
return (pins_ != NULL && !pins_->empty())
|| (nets_ != NULL && !nets_->empty())
|| (insts_ != NULL && !insts_->empty());
return (pins_ != nullptr && !pins_->empty())
|| (nets_ != nullptr && !nets_->empty())
|| (insts_ != nullptr && !insts_->empty());
}
void
ExceptionThru::addPin(Pin *pin)
{
if (pins_ == NULL)
if (pins_ == nullptr)
pins_ = new PinSet;
if (!pins_->hasKey(pin)) {
pins_->insert(pin);
@ -1806,7 +1806,7 @@ ExceptionThru::addPin(Pin *pin)
void
ExceptionThru::addNet(Net *net)
{
if (nets_ == NULL)
if (nets_ == nullptr)
nets_ = new NetSet;
if (!nets_->hasKey(net)) {
nets_->insert(net);
@ -1818,7 +1818,7 @@ ExceptionThru::addNet(Net *net)
void
ExceptionThru::addInstance(Instance *inst)
{
if (insts_ == NULL)
if (insts_ == nullptr)
insts_ = new InstanceSet;
if (!insts_->hasKey(inst)) {
insts_->insert(inst);
@ -1830,7 +1830,7 @@ ExceptionThru::addInstance(Instance *inst)
void
ExceptionThru::addEdge(EdgePins *edge)
{
if (edges_ == NULL)
if (edges_ == nullptr)
edges_ = new EdgePinsSet;
edges_->insert(edge);
// Hash is unchanged because edges are derived from hierarchical pins.
@ -2216,7 +2216,7 @@ ExpandedExceptionVisitor::visitExpansions()
Pin *pin = pin_iter.next();
PinSet pins;
pins.insert(pin);
ExceptionFrom expanded_from(&pins, NULL, NULL, tr, false);
ExceptionFrom expanded_from(&pins, nullptr, nullptr, tr, false);
expandThrus(&expanded_from);
}
ClockSet::Iterator clk_iter(from->clks());
@ -2224,7 +2224,7 @@ ExpandedExceptionVisitor::visitExpansions()
Clock *clk = clk_iter.next();
ClockSet clks;
clks.insert(clk);
ExceptionFrom expanded_from(NULL, &clks, NULL, tr, false);
ExceptionFrom expanded_from(nullptr, &clks, nullptr, tr, false);
expandThrus(&expanded_from);
}
InstanceSet::Iterator inst_iter(from->instances());
@ -2232,7 +2232,7 @@ ExpandedExceptionVisitor::visitExpansions()
Instance *inst = inst_iter.next();
InstanceSet insts;
insts.insert(inst);
ExceptionFrom expanded_from(NULL, NULL, &insts, tr, false);
ExceptionFrom expanded_from(nullptr, nullptr, &insts, tr, false);
expandThrus(&expanded_from);
}
}
@ -2251,7 +2251,7 @@ ExpandedExceptionVisitor::expandThrus(ExceptionFrom *expanded_from)
expandThru(expanded_from, thru_iter, &expanded_thrus);
}
else
expandTo(expanded_from, NULL);
expandTo(expanded_from, nullptr);
}
void
@ -2267,7 +2267,7 @@ ExpandedExceptionVisitor::expandThru(ExceptionFrom *expanded_from,
Pin *pin = pin_iter.next();
PinSet pins;
pins.insert(pin);
ExceptionThru expanded_thru(&pins, NULL, NULL, tr, false, network_);
ExceptionThru expanded_thru(&pins, nullptr, nullptr, tr, false, network_);
expanded_thrus->push_back(&expanded_thru);
expandThru(expanded_from, thru_iter, expanded_thrus);
expanded_thrus->pop_back();
@ -2277,7 +2277,7 @@ ExpandedExceptionVisitor::expandThru(ExceptionFrom *expanded_from,
Net *net = net_iter.next();
NetSet nets;
nets.insert(net);
ExceptionThru expanded_thru(NULL, &nets, NULL, tr, false, network_);
ExceptionThru expanded_thru(nullptr, &nets, nullptr, tr, false, network_);
expanded_thrus->push_back(&expanded_thru);
expandThru(expanded_from, thru_iter, expanded_thrus);
expanded_thrus->pop_back();
@ -2287,7 +2287,7 @@ ExpandedExceptionVisitor::expandThru(ExceptionFrom *expanded_from,
Instance *inst = inst_iter.next();
InstanceSet insts;
insts.insert(inst);
ExceptionThru expanded_thru(NULL, NULL, &insts, tr, false, network_);
ExceptionThru expanded_thru(nullptr, nullptr, &insts, tr, false, network_);
expanded_thrus->push_back(&expanded_thru);
expandThru(expanded_from, thru_iter, expanded_thrus);
expanded_thrus->pop_back();
@ -2311,7 +2311,7 @@ ExpandedExceptionVisitor::expandTo(ExceptionFrom *expanded_from,
Pin *pin = pin_iter.next();
PinSet pins;
pins.insert(pin);
ExceptionTo expanded_to(&pins, NULL, NULL, tr, end_tr, false);
ExceptionTo expanded_to(&pins, nullptr, nullptr, tr, end_tr, false);
visit(expanded_from, expanded_thrus, &expanded_to);
}
ClockSet::Iterator clk_iter(to->clks());
@ -2319,7 +2319,7 @@ ExpandedExceptionVisitor::expandTo(ExceptionFrom *expanded_from,
Clock *clk = clk_iter.next();
ClockSet clks;
clks.insert(clk);
ExceptionTo expanded_to(NULL, &clks, NULL, tr, end_tr, false);
ExceptionTo expanded_to(nullptr, &clks, nullptr, tr, end_tr, false);
visit(expanded_from, expanded_thrus, &expanded_to);
}
InstanceSet::Iterator inst_iter(to->instances());
@ -2327,12 +2327,12 @@ ExpandedExceptionVisitor::expandTo(ExceptionFrom *expanded_from,
Instance *inst = inst_iter.next();
InstanceSet insts;
insts.insert(inst);
ExceptionTo expanded_to(NULL, NULL, &insts, tr, end_tr, false);
ExceptionTo expanded_to(nullptr, nullptr, &insts, tr, end_tr, false);
visit(expanded_from, expanded_thrus, &expanded_to);
}
}
else
visit(expanded_from, expanded_thrus, NULL);
visit(expanded_from, expanded_thrus, nullptr);
}
////////////////////////////////////////////////////////////////
@ -2342,7 +2342,7 @@ ExceptionState::ExceptionState(ExceptionPath *exception,
int index) :
exception_(exception),
next_thru_(next_thru),
next_state_(NULL),
next_state_(nullptr),
index_(index)
{
}
@ -2369,8 +2369,8 @@ ExceptionState::matchesNextThru(const Pin *from_pin,
bool
ExceptionState::isComplete() const
{
return next_thru_ == NULL
&& exception_->to() == NULL;
return next_thru_ == nullptr
&& exception_->to() == nullptr;
}
Hash

View File

@ -113,7 +113,7 @@ public:
virtual bool useEndClk() const { return false; }
virtual int pathMultiplier() const { return 0; }
virtual float delay() const { return 0.0; }
virtual const char *name() const { return NULL; }
virtual const char *name() const { return nullptr; }
virtual bool isDefault() const { return false; }
virtual bool ignoreClkLatency() { return false; }
@ -156,7 +156,7 @@ public:
ExceptionTo *to,
bool own_pts);
virtual bool isFalse() const { return true; }
virtual ExceptionPathType type() const { return exception_type_false; }
virtual ExceptionPathType type() const { return ExceptionPathType::false_path; }
virtual const char *typeString() const;
virtual bool mergeable(ExceptionPath *exception) const;
virtual bool overrides(ExceptionPath *exception) const;
@ -175,7 +175,7 @@ public:
LoopPath(ExceptionThruSeq *thrus,
bool own_pts);
virtual bool isLoop() const { return true; }
virtual ExceptionPathType type() const { return exception_type_loop; }
virtual ExceptionPathType type() const { return ExceptionPathType::loop; }
virtual const char *typeString() const;
virtual bool mergeable(ExceptionPath *exception) const;
@ -200,7 +200,7 @@ public:
ExceptionTo *to,
bool own_pts);
virtual bool isPathDelay() const { return true; }
virtual ExceptionPathType type() const { return exception_type_path_delay; }
virtual ExceptionPathType type() const { return ExceptionPathType::path_delay; }
virtual const char *asString(const Network *network) const;
virtual const char *typeString() const;
virtual bool mergeable(ExceptionPath *exception) const;
@ -235,7 +235,7 @@ public:
ExceptionTo *to,
bool own_pts);
virtual bool isMultiCycle() const { return true; }
virtual ExceptionPathType type() const { return exception_type_multi_cycle; }
virtual ExceptionPathType type() const { return ExceptionPathType::multi_cycle; }
virtual bool matches(const MinMax *min_max,
bool exactly) const;
virtual const char *asString(const Network *network) const;
@ -272,7 +272,7 @@ public:
ExceptionTo *to,
bool own_pts);
virtual bool isFilter() const { return true; }
virtual ExceptionPathType type() const { return exception_type_filter; }
virtual ExceptionPathType type() const { return ExceptionPathType::filter; }
virtual const char *typeString() const;
virtual bool mergeable(ExceptionPath *exception) const;
virtual bool overrides(ExceptionPath *exception) const;
@ -303,7 +303,7 @@ public:
ExceptionTo *to,
bool own_pts);
virtual bool isGroupPath() const { return true; }
virtual ExceptionPathType type() const { return exception_type_group_path; }
virtual ExceptionPathType type() const { return ExceptionPathType::group_path; }
virtual const char *typeString() const;
virtual bool mergeable(ExceptionPath *exception) const;
virtual bool overrides(ExceptionPath *exception) const;
@ -388,8 +388,8 @@ public:
bool hasClocks() const;
InstanceSet *instances() { return insts_; }
bool hasInstances() const;
virtual NetSet *nets() { return NULL; }
virtual EdgePinsSet *edges() { return NULL; }
virtual NetSet *nets() { return nullptr; }
virtual EdgePinsSet *edges() { return nullptr; }
bool hasObjects() const;
void deleteObjects(ExceptionFromTo *pt);
virtual void allPins(const Network *network,
@ -509,7 +509,7 @@ public:
EdgePinsSet *edges() { return edges_; }
NetSet *nets() { return nets_; }
InstanceSet *instances() { return insts_; }
virtual ClockSet *clks() { return NULL; }
virtual ClockSet *clks() { return nullptr; }
bool hasObjects() const;
void deleteObjects(ExceptionThru *pt);
virtual void allPins(const Network *network,

View File

@ -19,8 +19,7 @@
namespace sta {
InputDrive::InputDrive(Port *port) :
port_(port)
InputDrive::InputDrive()
{
TransRiseFallIterator tr_iter;
while (tr_iter.hasNext()) {
@ -28,7 +27,7 @@ InputDrive::InputDrive(Port *port) :
MinMaxIterator mm_iter;
while (mm_iter.hasNext()) {
MinMax *mm = mm_iter.next();
drive_cells_[tr->index()][mm->index()] = NULL;
drive_cells_[tr->index()][mm->index()] = nullptr;
}
}
}
@ -138,7 +137,7 @@ InputDrive::driveCell(const TransRiseFall *tr,
to_port = drive->toPort();
}
else
cell = NULL;
cell = nullptr;
}
InputDriveCell *
@ -152,7 +151,7 @@ bool
InputDrive::hasDriveCell(const TransRiseFall *tr,
const MinMax *min_max)
{
return drive_cells_[tr->index()][min_max->index()] != NULL;
return drive_cells_[tr->index()][min_max->index()] != nullptr;
}
bool

View File

@ -34,7 +34,7 @@ class InputDriveCell;
class InputDrive
{
public:
explicit InputDrive(Port *port);
explicit InputDrive();
~InputDrive();
void setSlew(const TransRiseFallBoth *tr,
const MinMaxAll *min_max,
@ -77,7 +77,6 @@ public:
private:
DISALLOW_COPY_AND_ASSIGN(InputDrive);
Port *port_;
RiseFallMinMax slews_;
RiseFallMinMax drive_resistances_;
// Separate rise/fall/min/max drive cells.

View File

@ -39,7 +39,7 @@ PortDelay::clock() const
if (clk_edge_)
return clk_edge_->clock();
else
return NULL;
return nullptr;
}
bool
@ -82,7 +82,7 @@ InputDelay::InputDelay(Pin *pin,
int index,
Network *network) :
PortDelay(pin, clk_edge, ref_pin),
next_(NULL),
next_(nullptr),
index_(index)
{
findVertexLoadPins(pin, network, &vertex_pins_);
@ -99,7 +99,7 @@ OutputDelay::OutputDelay(Pin *pin,
Pin *ref_pin,
Network *network) :
PortDelay(pin, clk_edge, ref_pin),
next_(NULL)
next_(nullptr)
{
if (network)
findVertexDriverPins(pin, network, &vertex_pins_);
@ -113,15 +113,16 @@ OutputDelay::setNext(OutputDelay *next)
////////////////////////////////////////////////////////////////
PinInputDelayIterator::PinInputDelayIterator(InputDelay *input_delay) :
next_(input_delay)
PinInputDelayIterator::PinInputDelayIterator(const Pin *pin,
const Sdc *sdc)
{
next_ = sdc->input_delay_map_.findKey(pin);
}
bool
PinInputDelayIterator::hasNext()
{
return next_ != NULL;
return next_ != nullptr;
}
InputDelay *
@ -133,17 +134,25 @@ PinInputDelayIterator::next()
return next;
}
VertexPinInputDelayIterator::VertexPinInputDelayIterator(const Pin *vertex_pin,
const Sdc *sdc) :
PinInputDelayIterator()
{
next_ = sdc->input_delay_vertex_map_.findKey(vertex_pin);
}
////////////////////////////////////////////////////////////////
PinOutputDelayIterator::PinOutputDelayIterator(OutputDelay *output_delay) :
next_(output_delay)
PinOutputDelayIterator::PinOutputDelayIterator(const Pin *pin,
const Sdc *sdc)
{
next_ = sdc->output_delay_map_.findKey(pin);
}
bool
PinOutputDelayIterator::hasNext()
{
return next_ != NULL;
return next_ != nullptr;
}
OutputDelay *
@ -155,6 +164,13 @@ PinOutputDelayIterator::next()
return next;
}
VertexPinOutputDelayIterator::VertexPinOutputDelayIterator(const Pin *vertex_pin,
const Sdc *sdc) :
PinOutputDelayIterator()
{
next_ = sdc->output_delay_vertex_map_.findKey(vertex_pin);
}
////////////////////////////////////////////////////////////////
PortDelayLess::PortDelayLess(const Network *network) :

View File

@ -129,31 +129,53 @@ public:
class PinInputDelayIterator : public Iterator<InputDelay*>
{
public:
PinInputDelayIterator(const Pin *pin,
const Sdc *sdc);
virtual bool hasNext();
virtual InputDelay *next();
private:
DISALLOW_COPY_AND_ASSIGN(PinInputDelayIterator);
PinInputDelayIterator(InputDelay *input_delay);
protected:
PinInputDelayIterator() {}
InputDelay *next_;
friend class Sdc;
DISALLOW_COPY_AND_ASSIGN(PinInputDelayIterator);
};
class VertexPinInputDelayIterator : public PinInputDelayIterator
{
public:
VertexPinInputDelayIterator(const Pin *vertex_pin,
const Sdc *sdc);
private:
DISALLOW_COPY_AND_ASSIGN(VertexPinInputDelayIterator);
};
class PinOutputDelayIterator : public Iterator<OutputDelay*>
{
public:
PinOutputDelayIterator(const Pin *pin,
const Sdc *sdc);
virtual bool hasNext();
virtual OutputDelay *next();
private:
DISALLOW_COPY_AND_ASSIGN(PinOutputDelayIterator);
PinOutputDelayIterator(OutputDelay *output_delay);
protected:
PinOutputDelayIterator() {}
OutputDelay *next_;
friend class Sdc;
DISALLOW_COPY_AND_ASSIGN(PinOutputDelayIterator);
};
class VertexPinOutputDelayIterator : public PinOutputDelayIterator
{
public:
VertexPinOutputDelayIterator(const Pin *vertex_pin,
const Sdc *sdc);
private:
DISALLOW_COPY_AND_ASSIGN(VertexPinOutputDelayIterator);
};
// Prediate used to sort port delays.

File diff suppressed because it is too large Load Diff

View File

@ -17,11 +17,12 @@
#ifndef STA_SDC_H
#define STA_SDC_H
#include <mutex>
#include "DisallowCopyAssign.hh"
#include "ReadWriteLock.hh"
#include "StringUtil.hh"
#include "StringSet.hh"
#include "Map.hh"
#include "UnorderedSet.hh"
#include "UnorderedMap.hh"
#include "MinMax.hh"
#include "RiseFallValues.hh"
@ -56,6 +57,11 @@ class FindNetCaps;
class ClkHpinDisable;
class FindClkHpinDisables;
class Corner;
class ClockGroupIterator;
class GroupPathIterator;
class ClockVertexPinIterator;
class ClockPinIterator;
class ClockIterator;
typedef std::pair<const Pin*, const Clock*> PinClockPair;
@ -79,16 +85,16 @@ public:
class ClockPairLess
{
public:
bool operator()(const ClockPair *pair1,
const ClockPair *pair2) const;
bool operator()(const ClockPair &pair1,
const ClockPair &pair2) const;
};
class PinClockPairLess
{
public:
PinClockPairLess(const Network *network);
bool operator()(const PinClockPair *pin_clk1,
const PinClockPair *pin_clk2) const;
bool operator()(const PinClockPair &pin_clk1,
const PinClockPair &pin_clk2) const;
protected:
const Network *network_;
@ -108,7 +114,7 @@ typedef Set<InputDelay*> InputDelaySet;
typedef Map<const Pin*,InputDelaySet*> InputDelayRefPinMap;
typedef Map<const Pin*,InputDelaySet*> InputDelayInternalPinMap;
typedef Map<const Pin*,OutputDelay*> OutputDelayMap;
typedef Set<CycleAccting*, CycleAcctingLess> CycleAcctingSet;
typedef UnorderedSet<CycleAccting*, CycleAcctingHash, CycleAcctingEqual> CycleAcctingSet;
typedef Set<Instance*> InstanceSet;
typedef UnorderedMap<const Pin*,ExceptionPathSet*> PinExceptionsMap;
typedef Map<const Clock*,ExceptionPathSet*> ClockExceptionsMap;
@ -155,13 +161,11 @@ typedef Map<const LibertyCell*, DeratingFactorsCell*> CellDeratingFactorsMap;
typedef Set<ClockGroups*> ClockGroupsSet;
typedef Map<const Clock*, ClockGroupsSet*> ClockGroupsClkMap;
typedef Map<const char*, ClockGroups*, CharPtrLess> ClockGroupsNameMap;
typedef ClockGroupsNameMap::Iterator ClockGroupIterator;
typedef Map<PinClockPair*, ClockSense, PinClockPairLess> ClockSenseMap;
typedef Map<PinClockPair, ClockSense, PinClockPairLess> ClockSenseMap;
typedef Set<ClkHpinDisable*, ClkHpinDisableLess> ClkHpinDisables;
typedef Set<GroupPath*> GroupPathSet;
typedef Map<const char*, GroupPathSet*, CharPtrLess> GroupPathMap;
typedef GroupPathMap::Iterator GroupPathIterator;
typedef Set<ClockPair*, ClockPairLess> ClockPairSet;
typedef Set<ClockPair, ClockPairLess> ClockPairSet;
void
findVertexLoadPins(Pin *pin, const
@ -386,7 +390,6 @@ public:
void setPropagatedClock(Pin *pin);
void removePropagatedClock(Pin *pin);
bool isPropagatedClock(const Pin *pin);
bool isPropagatedClock(const Clock *clk) const __attribute__ ((deprecated));
void setClockSlew(Clock *clk,
const TransRiseFallBoth *tr,
const MinMaxAll *min_max,
@ -484,7 +487,7 @@ public:
void makeClockGroup(ClockGroups *clk_groups,
ClockSet *clks);
void removeClockGroups(const char *name);
// NULL name removes all.
// nullptr name removes all.
void removeClockGroupsLogicallyExclusive(const char *name);
void removeClockGroupsPhysicallyExclusive(const char *name);
void removeClockGroupsAsynchronous(const char *name);
@ -674,7 +677,7 @@ public:
void removeDisableClockGatingCheck(Pin *pin);
bool isDisableClockGatingCheck(const Pin *pin);
bool isDisableClockGatingCheck(const Instance *inst);
// set_logic_zero, set_logic_one, set_logic_dc
// set_LogicValue::zero, set_LogicValue::one, set_logic_dc
void setLogicValue(Pin *pin,
LogicValue value);
// set_case_analysis
@ -824,7 +827,7 @@ public:
Pin *ref_pin);
LogicValueMap *logicValues() { return &logic_value_map_; }
LogicValueMap *caseLogicValues() { return &case_value_map_; }
// Returns NULL if set_operating_conditions has not been called.
// Returns nullptr if set_operating_conditions has not been called.
OperatingConditions *operatingConditions(const MinMax *min_max);
// Instance specific process/voltage/temperature.
Pvt *pvt(Instance *inst, const MinMax *min_max) const;
@ -842,9 +845,10 @@ public:
// Find the clocks defined for pin.
ClockSet *findClocks(const Pin *pin) const;
ClockSet *findVertexPinClocks(const Pin *pin) const;
ClockIterator *clockIterator() const;
ClockIterator *clockIterator();
void sortedClocks(ClockSeq &clks);
ClockSeq *clocks() { return &clocks_; }
ClockSeq &clks() { return clocks_; }
bool clkDisabledByHpinThru(const Clock *clk,
const Pin *from_pin,
const Pin *to_pin);
@ -909,7 +913,7 @@ public:
// If the pin is hierarchical, the vertex pins are:
// hierarchical input - driver pins outside the hierarchical instance.
// hierarchical output - driver pins inside the hierarchical instance.
PinOutputDelayIterator *outputDelayVertexIterator(const Pin *vertex_pin)const;
PinOutputDelayIterator *outputDelayVertexIterator(const Pin *vertex_pin) const;
bool hasOutputDelay(const Pin *vertex_pin) const;
PortExtCap *portExtCap(Port *port) const;
bool hasPortExtCap(Port *port) const;
@ -1210,7 +1214,6 @@ protected:
void deleteClockLatenciesReferencing(Clock *clk);
void deleteClockLatency(ClockLatency *latency);
void deleteDeratingFactors();
void deleteClkSenses();
void annotateGraphOutputDelays(bool annotate);
void annotateGraphDataChecks(bool annotate);
void annotateGraphConstrained(const PinSet *pins,
@ -1318,7 +1321,7 @@ protected:
InstanceClockGatingCheckMap inst_clk_gating_check_map_;
PinClockGatingCheckMap pin_clk_gating_check_map_;
CycleAcctingSet cycle_acctings_;
ReadWriteLock cycle_acctings_lock_;
std::mutex cycle_acctings_lock_;
DataChecksMap data_checks_from_map_;
DataChecksMap data_checks_to_map_;
InputDelayMap input_delay_map_;
@ -1386,7 +1389,7 @@ protected:
// Group path exception names.
GroupPathMap group_path_map_;
InputDriveMap input_drive_map_;
// set_logic_one/zero/dc
// set_LogicValue::one/zero/dc
LogicValueMap logic_value_map_;
// set_case_analysis
LogicValueMap case_value_map_;
@ -1426,30 +1429,38 @@ private:
friend class InputDelayIterator;
friend class OutputDelayIterator;
friend class FindNetCaps;
friend class ClockGroupIterator;
friend class GroupPathIterator;
friend class InputDelayVertexPinsIterator;
friend class PinInputDelayIterator;
friend class VertexPinInputDelayIterator;
friend class PinOutputDelayIterator;
friend class VertexPinOutputDelayIterator;
};
class InputDelayVertexPinsIterator : public Iterator<const Pin*>
{
public:
InputDelayVertexPinsIterator(Sdc *sdc);
virtual bool hasNext();
virtual const Pin *next();
private:
DISALLOW_COPY_AND_ASSIGN(InputDelayVertexPinsIterator);
InputDelayVertexPinsIterator(InputDelayMap &input_delay_map);
InputDelayMap::ConstIterator input_iter_;
friend class Sdc;
DISALLOW_COPY_AND_ASSIGN(InputDelayVertexPinsIterator);
};
class InputDelayIterator : public Iterator<InputDelay*>
{
public:
InputDelayIterator(Sdc *sdc);
virtual bool hasNext();
virtual InputDelay *next();
private:
DISALLOW_COPY_AND_ASSIGN(InputDelayIterator);
InputDelayIterator(InputDelayMap &input_delay_map);
void findNext();
@ -1457,16 +1468,17 @@ private:
InputDelay *next_;
friend class Sdc;
DISALLOW_COPY_AND_ASSIGN(InputDelayIterator);
};
class OutputDelayIterator : public Iterator<OutputDelay*>
class OutputDelayIterator : public OutputDelayMap::Iterator
{
public:
OutputDelayIterator(Sdc *sdc);
virtual bool hasNext();
virtual OutputDelay *next();
private:
DISALLOW_COPY_AND_ASSIGN(OutputDelayIterator);
OutputDelayIterator(OutputDelayMap &output_delay_map);
void findNext();
@ -1474,6 +1486,42 @@ private:
OutputDelay *next_;
friend class Sdc;
DISALLOW_COPY_AND_ASSIGN(OutputDelayIterator);
};
class ClockIterator : public ClockSeq::Iterator
{
public:
ClockIterator(Sdc *sdc);
private:
ClockIterator(ClockSeq &clocks);
friend class Sdc;
DISALLOW_COPY_AND_ASSIGN(ClockIterator);
};
class ClockGroupIterator : public ClockGroupsNameMap::Iterator
{
public:
ClockGroupIterator(Sdc *sdc);
private:
ClockGroupIterator(ClockGroupsNameMap &clk_groups_name_map);
friend class Sdc;
DISALLOW_COPY_AND_ASSIGN(ClockGroupIterator);
};
class GroupPathIterator : public GroupPathMap::Iterator
{
public:
GroupPathIterator(Sdc *sdc);
private:
GroupPathIterator(GroupPathMap &group_path_map);
friend class Sdc;
DISALLOW_COPY_AND_ASSIGN(GroupPathIterator);
};
} // namespace

View File

@ -57,30 +57,13 @@ class ClockLatency;
class ClockInsertion;
class ClockGroup;
class ClockGroups;
class ClockVertexPinIterator;
class ClockPinIterator;
typedef enum {
analysis_type_single,
analysis_type_bc_wc,
analysis_type_on_chip_variation
} AnalysisType;
enum class AnalysisType { single, bc_wc, ocv };
typedef enum {
exception_type_false,
exception_type_loop,
exception_type_multi_cycle,
exception_type_path_delay,
exception_type_group_path,
exception_type_filter,
exception_type_any
} ExceptionPathType;
enum class ExceptionPathType { false_path, loop, multi_cycle, path_delay,
group_path, filter, any};
typedef enum {
clk_sense_positive,
clk_sense_negative,
clk_sense_stop
} ClockSense;
enum class ClockSense { positive, negative, stop };
typedef std::pair<const Clock*, const Clock*> ClockPair;
@ -88,7 +71,6 @@ typedef Vector<float> FloatSeq;
typedef Vector<int> IntSeq;
typedef Vector<Clock*> ClockSeq;
typedef Set<Clock*> ClockSet;
typedef ClockSeq::ConstIterator ClockIterator;
typedef Vector<PinSet*> PinSetSeq;
typedef MinMax SetupHold;
typedef MinMaxAll SetupHoldAll;
@ -108,26 +90,15 @@ class ExceptionState;
class ExceptionPath;
typedef Set<ExceptionState*> ExceptionStateSet;
typedef enum {
crpr_mode_same_pin,
crpr_mode_same_transition
} CrprMode;
enum class CrprMode { same_pin, same_transition };
// Constraint applies to clock or data paths.
typedef enum {
path_clk,
path_data
} PathClkOrData;
enum class PathClkOrData { clk, data };
const int path_clk_or_data_count = 2;
typedef enum {
timing_derate_cell_delay,
timing_derate_cell_check,
timing_derate_net_delay
} TimingDerateType;
const int timing_derate_type_count = 3;
enum class TimingDerateType { cell_delay, cell_check, net_delay };
const int timing_derate_type_count = int(TimingDerateType::net_delay) + 1 ;
const int timing_derate_cell_type_count = 2;
} // namespace

View File

@ -21,13 +21,13 @@
namespace sta {
SdcCmdComment::SdcCmdComment() :
comment_(NULL)
comment_(nullptr)
{
}
SdcCmdComment::SdcCmdComment(const char *comment)
{
comment_ = NULL;
comment_ = nullptr;
if (comment && comment[0] != '\0')
comment_ = stringCopy(comment);
}
@ -41,7 +41,7 @@ SdcCmdComment::setComment(const char *comment)
{
if (comment_)
stringDelete(comment_);
comment_ = NULL;
comment_ = nullptr;
if (comment && comment[0] != '\0')
comment_ = stringCopy(comment);
}

View File

@ -330,7 +330,7 @@ void
WriteSdc::openFile(const char *filename)
{
stream_ = fopen(filename, "w");
if (stream_ == NULL)
if (stream_ == nullptr)
throw FileNotWritable(filename);
}
@ -390,9 +390,7 @@ WriteSdc::writeClocks() const
{
// Write clocks in the order they were defined because generated
// clocks depend on master clocks having been previously defined.
ClockIterator *clk_iter = sdc_->clockIterator();
while (clk_iter->hasNext()) {
Clock *clk = clk_iter->next();
for (auto clk : sdc_->clocks_) {
if (clk->isGenerated())
writeGeneratedClock(clk);
else
@ -405,7 +403,6 @@ WriteSdc::writeClocks() const
fprintf(stream_, "\n");
}
}
delete clk_iter;
}
void
@ -726,14 +723,15 @@ WriteSdc::writeInputDelays() const
{
// Sort arrivals by pin and clock name.
PortDelaySeq delays;
InputDelayIterator *input_iter=sdc_->inputDelayIterator();
while (input_iter->hasNext()) {
InputDelay *input_delay = input_iter->next();
InputDelayIterator input_iter(sdc_);
while (input_iter.hasNext()) {
InputDelay *input_delay = input_iter.next();
delays.push_back(input_delay);
}
delete input_iter;
PortDelayLess port_delay_less(sdc_network_);
sort(delays, port_delay_less);
PortDelaySeq::Iterator delay_iter(delays);
while (delay_iter.hasNext()) {
PortDelay *input_delay = delay_iter.next();
@ -746,14 +744,15 @@ WriteSdc::writeOutputDelays() const
{
// Sort departures by pin and clock name.
PortDelaySeq delays;
OutputDelayIterator *output_iter=sdc_->outputDelayIterator();
while (output_iter->hasNext()) {
OutputDelay *output_delay = output_iter->next();
OutputDelayIterator output_iter(sdc_);
while (output_iter.hasNext()) {
OutputDelay *output_delay = output_iter.next();
delays.push_back(output_delay);
}
delete output_iter;
PortDelayLess port_delay_less(sdc_network_);
sort(delays, port_delay_less);
PortDelaySeq::Iterator delay_iter(delays);
while (delay_iter.hasNext()) {
PortDelay *output_delay = delay_iter.next();
@ -862,8 +861,8 @@ class PinClockPairNameLess
{
public:
PinClockPairNameLess(const Network *network);
bool operator()(const PinClockPair *pin_clk1,
const PinClockPair *pin_clk2) const;
bool operator()(const PinClockPair &pin_clk1,
const PinClockPair &pin_clk2) const;
private:
PinPathNameLess pin_less_;
@ -875,16 +874,16 @@ PinClockPairNameLess::PinClockPairNameLess(const Network *network) :
}
bool
PinClockPairNameLess::operator()(const PinClockPair *pin_clk1,
const PinClockPair *pin_clk2) const
PinClockPairNameLess::operator()(const PinClockPair &pin_clk1,
const PinClockPair &pin_clk2) const
{
const Pin *pin1 = pin_clk1->first;
const Pin *pin2 = pin_clk2->first;
const Clock *clk1 = pin_clk1->second;
const Clock *clk2 = pin_clk2->second;
const Pin *pin1 = pin_clk1.first;
const Pin *pin2 = pin_clk2.first;
const Clock *clk1 = pin_clk1.second;
const Clock *clk2 = pin_clk2.second;
return pin_less_(pin1, pin2)
|| (pin1 == pin2
&& ((clk1 == NULL && clk2)
&& ((clk1 == nullptr && clk2)
|| (clk1 && clk2
&& clk1->index() < clk2->index())));
}
@ -892,19 +891,14 @@ PinClockPairNameLess::operator()(const PinClockPair *pin_clk1,
void
WriteSdc::writeClockSenses() const
{
Vector<PinClockPair*> pin_clks;
ClockSenseMap::Iterator sense_iter(sdc_->clk_sense_map_);
while (sense_iter.hasNext()) {
PinClockPair *pin_clk;
ClockSense sense;
sense_iter.next(pin_clk, sense);
pin_clks.push_back(pin_clk);
}
Vector<PinClockPair> pin_clks;
for (auto iter : sdc_->clk_sense_map_)
pin_clks.push_back(iter.first);
// Sort by pin/clk pair so regressions results are stable.
sort(pin_clks, PinClockPairNameLess(sdc_network_));
Vector<PinClockPair*>::Iterator pin_clk_iter(pin_clks);
while (pin_clk_iter.hasNext()) {
PinClockPair *pin_clk = pin_clk_iter.next();
for (auto pin_clk : pin_clks) {
ClockSense sense;
bool exists;
sdc_->clk_sense_map_.findKey(pin_clk, sense, exists);
@ -914,24 +908,24 @@ WriteSdc::writeClockSenses() const
}
void
WriteSdc::writeClockSense(PinClockPair *pin_clk,
WriteSdc::writeClockSense(PinClockPair &pin_clk,
ClockSense sense) const
{
const char *flag = NULL;
if (sense == clk_sense_positive)
const char *flag = nullptr;
if (sense == ClockSense::positive)
flag = "-positive";
else if (sense == clk_sense_negative)
else if (sense == ClockSense::negative)
flag = "-negative";
else if (sense == clk_sense_stop)
else if (sense == ClockSense::stop)
flag = "-stop_propagation";
fprintf(stream_, "set_clock_sense %s ", flag);
const Clock *clk = pin_clk->second;
const Clock *clk = pin_clk.second;
if (clk) {
fprintf(stream_, "-clock ");
writeGetClock(clk);
fprintf(stream_, " ");
}
writeGetPin(pin_clk->first);
writeGetPin(pin_clk.first);
fprintf(stream_, "\n");
}
@ -986,12 +980,11 @@ ClockGroupLess::operator()(const ClockGroup *clk_group1,
void
WriteSdc::writeClockGroups() const
{
ClockGroupIterator *groups_iter = sdc_->clockGroupIterator();
while (groups_iter->hasNext()) {
ClockGroups *clk_groups = groups_iter->next();
ClockGroupIterator groups_iter(sdc_);
while (groups_iter.hasNext()) {
ClockGroups *clk_groups = groups_iter.next();
writeClockGroups(clk_groups);
}
delete groups_iter;
}
void
@ -1593,7 +1586,7 @@ void
WriteSdc::writeWireload() const
{
WireloadMode wireload_mode = sdc_->wireloadMode();
if (wireload_mode != wire_load_mode_unknown)
if (wireload_mode != WireloadMode::unknown)
fprintf(stream_, "set_wire_load_mode \"%s\"\n",
wireloadModeString(wireload_mode));
}
@ -1696,12 +1689,12 @@ WriteSdc::writeDrivingCells() const
&& drive_rise_min->equal(drive_fall_min)
&& drive_rise_min->equal(drive_fall_max))
// Only write one set_driving_cell if possible.
writeDrivingCell(port, drive_rise_min, NULL, NULL);
writeDrivingCell(port, drive_rise_min, nullptr, nullptr);
else {
if (drive_rise_min
&& drive_rise_max
&& drive_rise_min->equal(drive_rise_max))
writeDrivingCell(port, drive_rise_min, TransRiseFall::rise(), NULL);
writeDrivingCell(port, drive_rise_min, TransRiseFall::rise(), nullptr);
else {
if (drive_rise_min)
writeDrivingCell(port, drive_rise_min, TransRiseFall::rise(),
@ -1713,7 +1706,7 @@ WriteSdc::writeDrivingCells() const
if (drive_fall_min
&& drive_fall_max
&& drive_fall_min->equal(drive_fall_max))
writeDrivingCell(port, drive_fall_min, TransRiseFall::fall(), NULL);
writeDrivingCell(port, drive_fall_min, TransRiseFall::fall(), nullptr);
else {
if (drive_fall_min)
writeDrivingCell(port, drive_fall_min, TransRiseFall::fall(),
@ -1850,14 +1843,14 @@ WriteSdc::setConstantCmd(Pin *pin) const
bool exists;
sdc_->logicValue(pin, value, exists);
switch (value) {
case logic_zero:
return "set_logic_zero";
case logic_one:
case LogicValue::zero:
return "set_LogicValue::zero";
case LogicValue::one:
return "set_logic_one";
case logic_unknown:
case LogicValue::unknown:
return "set_logic_dc";
case logic_rise:
case logic_fall:
case LogicValue::rise:
case LogicValue::fall:
default:
internalError("illegal set_logic value");
}
@ -1892,15 +1885,15 @@ WriteSdc::caseAnalysisValueStr(Pin *pin) const
bool exists;
sdc_->caseLogicValue(pin, value, exists);
switch (value) {
case logic_zero:
case LogicValue::zero:
return "0";
case logic_one:
case LogicValue::one:
return "1";
case logic_rise:
case LogicValue::rise:
return "rising";
case logic_fall:
case LogicValue::fall:
return "falling";
case logic_unknown:
case LogicValue::unknown:
default:
internalError("invalid set_case_analysis value");
}
@ -1939,7 +1932,8 @@ WriteSdc::writeDeratings() const
MinMaxIterator mm_iter;
while (mm_iter.hasNext()) {
const MinMax *early_late = mm_iter.next();
writeDerating(factors, timing_derate_net_delay, early_late, &write_net);
writeDerating(factors, TimingDerateType::net_delay, early_late,
&write_net);
}
}
@ -1971,14 +1965,14 @@ WriteSdc::writeDerating(DeratingFactorsGlobal *factors) const
bool delay_is_one_value, check_is_one_value, net_is_one_value;
float delay_value, check_value, net_value;
factors->factors(timing_derate_cell_delay)->isOneValue(early_late,
factors->factors(TimingDerateType::cell_delay)->isOneValue(early_late,
delay_is_one_value,
delay_value);
factors->factors(timing_derate_net_delay)->isOneValue(early_late,
net_is_one_value,
net_value);
factors->factors(TimingDerateType::net_delay)->isOneValue(early_late,
net_is_one_value,
net_value);
DeratingFactors *cell_check_factors =
factors->factors(timing_derate_cell_check);
factors->factors(TimingDerateType::cell_check);
cell_check_factors->isOneValue(early_late, check_is_one_value, check_value);
if (delay_is_one_value
&& net_is_one_value
@ -1997,7 +1991,7 @@ WriteSdc::writeDerating(DeratingFactorsGlobal *factors) const
type_index++) {
TimingDerateType type = static_cast<TimingDerateType>(type_index);
DeratingFactors *type_factors = factors->factors(type);
writeDerating(type_factors, type, early_late, NULL);
writeDerating(type_factors, type, early_late, nullptr);
}
}
}
@ -2010,10 +2004,10 @@ WriteSdc::writeDerating(DeratingFactorsCell *factors,
MinMaxIterator mm_iter;
while (mm_iter.hasNext()) {
const MinMax *early_late = mm_iter.next();
DeratingFactors *delay_factors=factors->factors(timing_derate_cell_delay);
writeDerating(delay_factors, timing_derate_cell_delay, early_late, write_obj);
DeratingFactors *check_factors=factors->factors(timing_derate_cell_check);
writeDerating(check_factors, timing_derate_cell_check, early_late, write_obj);
DeratingFactors *delay_factors=factors->factors(TimingDerateType::cell_delay);
writeDerating(delay_factors, TimingDerateType::cell_delay, early_late, write_obj);
DeratingFactors *check_factors=factors->factors(TimingDerateType::cell_check);
writeDerating(check_factors, TimingDerateType::cell_check, early_late, write_obj);
}
}
@ -2277,13 +2271,13 @@ WriteSdc::writeClkSlewLimits() const
Clock *clk = clk_iter.next();
float rise_clk_limit, fall_clk_limit, rise_data_limit, fall_data_limit;
bool rise_clk_exists, fall_clk_exists, rise_data_exists, fall_data_exists;
clk->slewLimit(TransRiseFall::rise(), path_clk, min_max,
clk->slewLimit(TransRiseFall::rise(), PathClkOrData::clk, min_max,
rise_clk_limit, rise_clk_exists);
clk->slewLimit(TransRiseFall::fall(), path_clk, min_max,
clk->slewLimit(TransRiseFall::fall(), PathClkOrData::clk, min_max,
fall_clk_limit, fall_clk_exists);
clk->slewLimit(TransRiseFall::rise(), path_data, min_max,
clk->slewLimit(TransRiseFall::rise(), PathClkOrData::data, min_max,
rise_data_limit, rise_data_exists);
clk->slewLimit(TransRiseFall::fall(), path_data, min_max,
clk->slewLimit(TransRiseFall::fall(), PathClkOrData::data, min_max,
fall_data_limit, fall_data_exists);
if (rise_clk_exists && fall_clk_exists
&& rise_data_exists && fall_data_exists
@ -2462,7 +2456,7 @@ WriteSdc::writeGetTimingArcsOfOjbects(LibertyCell *cell) const
void
WriteSdc::writeGetTimingArcs(Edge *edge) const
{
writeGetTimingArcs(edge, NULL);
writeGetTimingArcs(edge, nullptr);
}
void
@ -2928,7 +2922,7 @@ transRiseFallFlag(const TransRiseFallBoth *tr)
else {
internalError("unknown transition");
}
return NULL;
return nullptr;
}
static const char *
@ -2942,7 +2936,7 @@ minMaxFlag(const MinMaxAll *min_max)
return " -max";
else {
internalError("unknown MinMaxAll");
return NULL;
return nullptr;
}
}
@ -2955,7 +2949,7 @@ minMaxFlag(const MinMax *min_max)
return " -max";
else {
internalError("unknown MinMax");
return NULL;
return nullptr;
}
}
@ -2968,7 +2962,7 @@ earlyLateFlag(const MinMax *early_late)
return "-late";
else {
internalError("unknown EarlyLate");
return NULL;
return nullptr;
}
}
@ -2990,7 +2984,7 @@ setupHoldFlag(const MinMax *min_max)
return " -setup";
else {
internalError("unknown MinMax");
return NULL;
return nullptr;
}
}

View File

@ -89,7 +89,7 @@ public:
const MinMaxAll *min_max,
const char *sdc_cmd) const;
void writeClockSenses() const;
void writeClockSense(PinClockPair *pin_clk,
void writeClockSense(PinClockPair &pin_clk,
ClockSense sense) const;
void writeClockGroups() const;
void writeClockGroups(ClockGroups *clk_groups) const;

View File

@ -56,7 +56,7 @@ class SdfPortSpec
public:
SdfPortSpec(Transition *tr,
const char *port,
const char *cond = NULL) :
const char *cond = nullptr) :
tr_(tr), port_(port), cond_(cond) {}
~SdfPortSpec()
{
@ -75,7 +75,7 @@ private:
const char *cond_; // timing checks only
};
SdfReader *sdf_reader = NULL;
SdfReader *sdf_reader = nullptr;
bool
readSdfSingle(const char *filename,
@ -144,8 +144,8 @@ SdfReader::SdfReader(const char *filename,
cond_use_(cond_use),
line_(1),
escape_('\\'),
instance_(NULL),
cell_name_(NULL),
instance_(nullptr),
cell_name_(nullptr),
in_timing_check_(false),
in_incremental_(false),
timescale_(1.0E-9F) // default units of ns
@ -231,9 +231,9 @@ SdfReader::interconnect(const char *from_pin_name,
}
}
else {
if (from_pin == NULL)
if (from_pin == nullptr)
sdfError("pin %s not found.\n", from_pin_name);
if (to_pin == NULL)
if (to_pin == nullptr)
sdfError("pin %s not found.\n", to_pin_name);
}
}
@ -251,7 +251,7 @@ SdfReader::port(const char *to_pin_name,
Pin *to_pin = (instance_)
? network_->findPinRelative(instance_, to_pin_name)
: network_->findPin(to_pin_name);
if (to_pin == NULL)
if (to_pin == nullptr)
sdfError("pin %s not found.\n", to_pin_name);
else {
Vertex *vertex = graph_->pinLoadVertex(to_pin);
@ -282,7 +282,7 @@ SdfReader::findWireEdge(Pin *from_pin,
&& edge_role->sdfRole()->isWire())
return edge;
}
return NULL;
return nullptr;
}
void
@ -325,7 +325,7 @@ SdfReader::setInstance(const char *instance_name)
if (instance_name) {
if (stringEq(instance_name, "*")) {
notSupported("INSTANCE wildcards");
instance_ = NULL;
instance_ = nullptr;
}
else {
instance_ = findInstance(instance_name);
@ -342,22 +342,22 @@ SdfReader::setInstance(const char *instance_name)
stringDelete(instance_name);
}
else
instance_ = NULL;
instance_ = nullptr;
}
void
SdfReader::setInstanceWildcard()
{
notSupported("INSTANCE wildcards");
instance_ = NULL;
instance_ = nullptr;
}
void
SdfReader::cellFinish()
{
stringDelete(cell_name_);
cell_name_ = NULL;
instance_ = NULL;
cell_name_ = nullptr;
instance_ = nullptr;
}
void
@ -372,9 +372,9 @@ SdfReader::iopath(SdfPortSpec *from_edge,
Cell *cell = network_->cell(instance_);
Port *from_port = network_->findPort(cell, from_port_name);
Port *to_port = network_->findPort(cell, to_port_name);
if (from_port == NULL)
if (from_port == nullptr)
portNotFound(from_port_name);
if (to_port == NULL)
if (to_port == nullptr)
portNotFound(to_port_name);
if (from_port && to_port) {
Pin *from_pin = network_->findPin(instance_, from_port_name);
@ -394,14 +394,14 @@ SdfReader::iopath(SdfPortSpec *from_edge,
TimingArcSet *arc_set = edge->timingArcSet();
const char *lib_cond = arc_set->sdfCond();
const TimingRole *edge_role = arc_set->role();
bool cond_use_flag = cond_use_ && cond && lib_cond == NULL
bool cond_use_flag = cond_use_ && cond && lib_cond == nullptr
&& !(!is_incremental_only_ && in_incremental_);
if (edge->from(graph_)->pin() == from_pin
&& edge_role->sdfRole() == TimingRole::sdfIopath()
&& (cond_use_flag
|| (!condelse && condMatch(cond, lib_cond))
// condelse matches the default (unconditional) arc.
|| (condelse && lib_cond == NULL))) {
|| (condelse && lib_cond == nullptr))) {
matched = true;
TimingArcSetArcIterator arc_iter(arc_set);
while (arc_iter.hasNext()) {
@ -409,7 +409,7 @@ SdfReader::iopath(SdfPortSpec *from_edge,
if ((from_edge->transition() == Transition::riseFall())
|| (arc->fromTrans() == from_edge->transition())) {
size_t triple_index = arc->toTrans()->sdfTripleIndex();
SdfTriple *triple = NULL;
SdfTriple *triple = nullptr;
if (triple_index < triple_count)
triple = (*triples)[triple_index];
if (triple_count == 1)
@ -466,9 +466,9 @@ SdfReader::timingCheck1(TimingRole *role,
Cell *cell = network_->cell(instance_);
Port *data_port = network_->findPort(cell, data_port_name);
Port *clk_port = network_->findPort(cell, clk_port_name);
if (data_port == NULL && warn)
if (data_port == nullptr && warn)
portNotFound(data_port_name);
if (clk_port == NULL && warn)
if (clk_port == nullptr && warn)
portNotFound(clk_port_name);
if (data_port && clk_port) {
Pin *data_pin = network_->findPin(instance_, data_port_name);
@ -482,15 +482,15 @@ SdfReader::timingCheck1(TimingRole *role,
float *value_max = values[triple_max_index_];
if (value_min && value_max) {
switch (analysis_type_) {
case analysis_type_single:
case AnalysisType::single:
break;
case analysis_type_bc_wc:
case AnalysisType::bc_wc:
if (role->genericRole() == TimingRole::setup())
*value_min = *value_max;
else
*value_max = *value_min;
break;
case analysis_type_on_chip_variation:
case AnalysisType::ocv:
*value_min = *value_max;
break;
}
@ -576,7 +576,7 @@ SdfReader::timingCheckWidth(SdfPortSpec *edge,
const char *port_name = edge->port();
Cell *cell = network_->cell(instance_);
Port *port = network_->findPort(cell, port_name);
if (port == NULL)
if (port == nullptr)
portNotFound(port_name);
else {
Pin *pin = network_->findPin(instance_, port_name);
@ -614,7 +614,7 @@ SdfReader::timingCheckPeriod(SdfPortSpec *edge,
const char *port_name = edge->port();
Cell *cell = network_->cell(instance_);
Port *port = network_->findPort(cell, port_name);
if (port == NULL)
if (port == nullptr)
portNotFound(port_name);
else {
// Edge specifier is ignored for period checks.
@ -706,7 +706,7 @@ SdfReader::device(const char *to_port_name,
&& instance_) {
Cell *cell = network_->cell(instance_);
Port *to_port = network_->findPort(cell, to_port_name);
if (to_port == NULL)
if (to_port == nullptr)
portNotFound(to_port_name);
else {
Pin *to_pin = network_->findPin(instance_, to_port_name);
@ -768,10 +768,10 @@ SdfReader::setEdgeArcDelaysCondUse(Edge *edge,
SdfTriple *triple)
{
float **values = triple->values();
float *value_min = NULL;
float *value_min = nullptr;
if (triple_min_index_ != null_index_)
value_min = values[triple_min_index_];
float *value_max = NULL;
float *value_max = nullptr;
if (triple_max_index_ != null_index_)
value_max = values[triple_max_index_];
MinMax *min, *max;
@ -808,7 +808,7 @@ SdfReader::setEdgeArcDelaysCondUse(Edge *edge,
delay = graph_->arcDelay(edge, arc, arc_delay_index) + *value;
else if (graph_->arcDelayAnnotated(edge, arc, arc_delay_index)) {
ArcDelay prev_value = graph_->arcDelay(edge, arc, arc_delay_index);
if (delayFuzzyGreater(prev_value, delay, min_max))
if (fuzzyGreater(prev_value, delay, min_max))
delay = prev_value;
}
graph_->setArcDelay(edge, arc, arc_delay_index, delay);
@ -822,7 +822,7 @@ SdfReader::condMatch(const char *sdf_cond,
const char *lib_cond)
{
// If the sdf is not conditional it matches any library condition.
if (sdf_cond == NULL)
if (sdf_cond == nullptr)
return true;
else if (sdf_cond && lib_cond) {
// Match sdf_cond and lib_cond ignoring blanks.
@ -1000,7 +1000,7 @@ SdfReader::getChars(char *buf,
{
char *status = gzgets(stream_, buf, max_size);
if (status == Z_NULL)
result = 0; // YY_NULL
result = 0; // YY_nullptr
else
result = strlen(buf);
}
@ -1012,7 +1012,7 @@ SdfReader::getChars(char *buf,
{
char *status = gzgets(stream_, buf, max_size);
if (status == Z_NULL)
result = 0; // YY_NULL
result = 0; // YY_nullptr
else
result = strlen(buf);
}
@ -1060,7 +1060,7 @@ SdfReader::findInstance(const char *name)
if (path_)
stringPrint(inst_name, "%s%c%s", path_, divider_, name);
Instance *inst = network_->findInstance(inst_name.c_str());
if (inst == NULL)
if (inst == nullptr)
sdfError("instance %s not found.\n", inst_name.c_str());
return inst;
}

View File

@ -40,7 +40,7 @@ class Corner;
// If incremental_only is true non-incremental annoatations are ignored.
//
// path is a hierararchial path prefix for instances and pins in the
// sdf file. Pass 0 (NULL) to specify no path.
// sdf file. Pass 0 (nullptr) to specify no path.
//
// The cond_use option is used when the SDF file contains conditional
// delays and the library does not have conditional delay arcs. If

View File

@ -108,7 +108,6 @@ private:
char sdf_divider_;
float timescale_;
int digits_;
char sdf_escape_;
char network_escape_;
@ -139,7 +138,7 @@ SdfWriter::SdfWriter(StaState *sta) :
StaState(sta),
sdf_escape_('\\'),
network_escape_(network_->pathEscape()),
delay_format_(NULL)
delay_format_(nullptr)
{
}
@ -158,7 +157,7 @@ SdfWriter::write(const char *filename,
bool no_version)
{
sdf_divider_ = sdf_divider;
if (delay_format_ == NULL)
if (delay_format_ == nullptr)
delay_format_ = new char[10];
sprintf(delay_format_, "%%.%df", digits);
@ -183,7 +182,7 @@ SdfWriter::write(const char *filename,
writeTrailer();
gzclose(stream_);
stream_ = NULL;
stream_ = nullptr;
}
void
@ -213,11 +212,11 @@ SdfWriter::writeHeader(LibertyLibrary *default_lib,
OperatingConditions *cond_min =
sdc_->operatingConditions(MinMax::min());
if (cond_min == NULL)
if (cond_min == nullptr)
cond_min = default_lib->defaultOperatingConditions();
OperatingConditions *cond_max =
sdc_->operatingConditions(MinMax::max());
if (cond_max == NULL)
if (cond_max == nullptr)
cond_max = default_lib->defaultOperatingConditions();
if (cond_min && cond_max) {
gzprintf(stream_, " (VOLTAGE %.3f::%.3f)\n",
@ -231,7 +230,7 @@ SdfWriter::writeHeader(LibertyLibrary *default_lib,
cond_max->temperature());
}
const char *sdf_timescale = NULL;
const char *sdf_timescale = nullptr;
if (fuzzyEqual(timescale_, 1e-6))
sdf_timescale = "1us";
else if (fuzzyEqual(timescale_, 10e-6))
@ -490,7 +489,7 @@ SdfWriter::writeTimingChecks(const Instance *inst,
while (edge_iter.hasNext()) {
Edge *edge = edge_iter.next();
TimingRole *role = edge->role();
const char *sdf_check = NULL;
const char *sdf_check = nullptr;
if (role == TimingRole::setup())
sdf_check = "SETUP";
else if (role == TimingRole::hold())
@ -568,7 +567,7 @@ SdfWriter::writeCheck(Edge *edge,
TimingArcSet *arc_set = edge->timingArcSet();
// Examine the arcs to see if the check requires clk or data edge specifiers.
TimingArc *arcs[TransRiseFall::index_count][TransRiseFall::index_count] =
{{NULL, NULL}, {NULL, NULL}};
{{nullptr, nullptr}, {nullptr, nullptr}};
TimingArcSetArcIterator arc_iter(arc_set);
while (arc_iter.hasNext()) {
TimingArc *arc = arc_iter.next();
@ -577,11 +576,11 @@ SdfWriter::writeCheck(Edge *edge,
arcs[clk_tr->index()][data_tr->index()] = arc;
}
if (arcs[TransRiseFall::fallIndex()][TransRiseFall::riseIndex()] == NULL
&& arcs[TransRiseFall::fallIndex()][TransRiseFall::fallIndex()] == NULL)
if (arcs[TransRiseFall::fallIndex()][TransRiseFall::riseIndex()] == nullptr
&& arcs[TransRiseFall::fallIndex()][TransRiseFall::fallIndex()] == nullptr)
writeEdgeCheck(edge, sdf_check, TransRiseFall::riseIndex(), arcs);
else if (arcs[TransRiseFall::riseIndex()][TransRiseFall::riseIndex()] == NULL
&& arcs[TransRiseFall::riseIndex()][TransRiseFall::fallIndex()] == NULL)
else if (arcs[TransRiseFall::riseIndex()][TransRiseFall::riseIndex()] == nullptr
&& arcs[TransRiseFall::riseIndex()][TransRiseFall::fallIndex()] == nullptr)
writeEdgeCheck(edge, sdf_check, TransRiseFall::fallIndex(), arcs);
else {
// No special case; write all the checks with data and clock edge specifiers.
@ -607,13 +606,13 @@ SdfWriter::writeEdgeCheck(Edge *edge,
&& arcs[clk_tr_index][TransRiseFall::fallIndex()]
&& arcs[clk_tr_index][TransRiseFall::riseIndex()]
&& arcs[clk_tr_index][TransRiseFall::fallIndex()]
&& delayFuzzyEqual(graph_->arcDelay(edge,
&& fuzzyEqual(graph_->arcDelay(edge,
arcs[clk_tr_index][TransRiseFall::riseIndex()],
arc_delay_min_index_),
graph_->arcDelay(edge,
arcs[clk_tr_index][TransRiseFall::fallIndex()],
arc_delay_min_index_))
&& delayFuzzyEqual(graph_->arcDelay(edge,
&& fuzzyEqual(graph_->arcDelay(edge,
arcs[clk_tr_index][TransRiseFall::riseIndex()],
arc_delay_max_index_),
graph_->arcDelay(edge,
@ -714,7 +713,7 @@ SdfWriter::sdfEdge(const Transition *tr)
return "posedge";
else if (tr == Transition::fall())
return "negedge";
return NULL;
return nullptr;
}
////////////////////////////////////////////////////////////////

View File

@ -18,6 +18,7 @@
#include "Machine.hh"
#include "Report.hh"
#include "Debug.hh"
#include "Mutex.hh"
#include "ThreadForEach.hh"
#include "Network.hh"
#include "Graph.hh"
@ -28,66 +29,6 @@
namespace sta {
BfsList::BfsList(Vertex *vertex,
BfsList *next) :
vertex_(vertex),
next_(next)
{
}
void
BfsList::setVertex(Vertex *vertex)
{
vertex_ = vertex;
}
void
BfsList::setNext(BfsList *next)
{
next_ = next;
}
class BfsListIterator
{
public:
explicit BfsListIterator(BfsList *list,
BfsIterator *bfs,
BfsIndex bfs_index);
bool hasNext() { return next_ != NULL; }
Vertex *next();
int count() const { return count_; }
private:
BfsIterator *bfs_;
BfsIndex bfs_index_;
BfsList *next_;
int count_;
};
BfsListIterator::BfsListIterator(BfsList *list,
BfsIterator *bfs,
BfsIndex bfs_index) :
bfs_(bfs),
bfs_index_(bfs_index),
next_(list),
count_(0)
{
}
Vertex *
BfsListIterator::next()
{
Vertex *vertex = next_->vertex();
BfsList *next = next_->next();
bfs_->freeList(next_);
next_ = next;
vertex->setBfsInQueue(bfs_index_, false);
count_++;
return vertex;
}
////////////////////////////////////////////////////////////////
BfsIterator::BfsIterator(BfsIndex bfs_index,
Level level_min,
Level level_max,
@ -97,9 +38,9 @@ BfsIterator::BfsIterator(BfsIndex bfs_index,
bfs_index_(bfs_index),
level_min_(level_min),
level_max_(level_max),
search_pred_(search_pred),
list_free_(NULL)
search_pred_(search_pred)
{
init();
}
void
@ -122,12 +63,6 @@ BfsIterator::ensureSize()
BfsIterator::~BfsIterator()
{
// Delete free list.
while (list_free_) {
BfsList *next = list_free_->next();
delete list_free_;
list_free_ = next;
}
}
void
@ -135,16 +70,12 @@ BfsIterator::clear()
{
Level level = first_level_;
while (levelLessOrEqual(level, last_level_)) {
BfsList *level_vertices = queue_[level];
if (level_vertices) {
for (BfsList *l = level_vertices, *next; l; l = next) {
Vertex *vertex = l->vertex();
VertexSeq &level_vertices = queue_[level];
for (auto vertex : level_vertices) {
if (vertex)
vertex->setBfsInQueue(bfs_index_, false);
next = l->next();
freeList(l);
}
queue_[level] = NULL;
}
level_vertices.clear();
incrLevel(level);
}
init();
@ -155,13 +86,12 @@ BfsIterator::reportEntries(const Network *network)
{
Level level = first_level_;
while (levelLessOrEqual(level, last_level_)) {
BfsList *level_vertices = queue_[level];
if (level_vertices) {
VertexSeq &level_vertices = queue_[level];
if (!level_vertices.empty()) {
printf("Level %d\n", level);
for (BfsList *l = level_vertices, *next; l; l = next) {
Vertex *vertex = l->vertex();
printf(" %s\n", vertex->name(network));
next = l->next();
for (auto vertex : level_vertices) {
if (vertex)
printf(" %s\n", vertex->name(network));
}
}
incrLevel(level);
@ -171,15 +101,12 @@ BfsIterator::reportEntries(const Network *network)
void
BfsIterator::deleteEntries(Level level)
{
BfsList *level_vertices = queue_[level];
if (level_vertices) {
for (BfsList *l = level_vertices, *next; l; l = next) {
Vertex *vertex = l->vertex();
VertexSeq &level_vertices = queue_[level];
for (auto vertex : level_vertices) {
if (vertex)
vertex->setBfsInQueue(bfs_index_, false);
next = l->next();
delete l;
}
}
level_vertices.clear();
}
bool
@ -215,26 +142,67 @@ BfsIterator::visit(Level to_level,
int visit_count = 0;
while (levelLessOrEqual(first_level_, last_level_)
&& levelLessOrEqual(first_level_, to_level)) {
BfsList *level_vertices = queue_[first_level_];
if (level_vertices) {
// Remove vertices from queue.
queue_[first_level_] = NULL;
incrLevel(first_level_);
for (BfsList *l = level_vertices, *next; l; l = next) {
Vertex *vertex = l->vertex();
vertex->setBfsInQueue(bfs_index_, false);
visitor->visit(vertex);
next = l->next();
freeList(l);
visit_count++;
VertexSeq &level_vertices = queue_[first_level_];
incrLevel(first_level_);
if (!level_vertices.empty()) {
for (auto vertex : level_vertices) {
if (vertex) {
vertex->setBfsInQueue(bfs_index_, false);
visitor->visit(vertex);
visit_count++;
}
}
level_vertices.clear();
}
else
incrLevel(first_level_);
}
return visit_count;
}
// VertexSeq::Iterator that filters null objects,
// and pops objects so the vector does not need to be cleared.
class QueueIterator : Iterator<Vertex*>
{
public:
QueueIterator(VertexSeq &vertices,
BfsIndex bfs_index);
virtual bool hasNext();
virtual Vertex *next();
unsigned count() { return count_; }
private:
VertexSeq &vertices_;
BfsIndex bfs_index_;
unsigned count_;
};
QueueIterator::QueueIterator(VertexSeq &vertices,
BfsIndex bfs_index) :
vertices_(vertices),
bfs_index_(bfs_index),
count_(0)
{
}
bool
QueueIterator::hasNext()
{
Vertex *next = nullptr;
while (!vertices_.empty()
&& (next = vertices_.back()) == nullptr)
vertices_.pop_back();
return next != nullptr;
}
Vertex *
QueueIterator::next()
{
Vertex *next = vertices_.back();
next->setBfsInQueue(bfs_index_, false);
vertices_.pop_back();
count_++;
return next;
}
int
BfsIterator::visitParallel(Level to_level,
VertexVisitor *visitor)
@ -244,37 +212,27 @@ BfsIterator::visitParallel(Level to_level,
if (thread_count_ <= 1)
visit_count = visit(to_level, visitor);
else {
ForEachArg<BfsListIterator, VertexVisitor> args[thread_count_];
Thread threads[thread_count_];
Mutex lock;
for (int i = 0; i < thread_count_; i++) {
ForEachArg<BfsListIterator,VertexVisitor> &arg = args[i];
arg.lock_ = &lock;
arg.func_ = visitor->copy();
}
std::mutex lock;
Level level = first_level_;
while (levelLessOrEqual(level, last_level_)
&& levelLessOrEqual(level, to_level)) {
BfsList *level_vertices = queue_[level];
if (level_vertices) {
// Remove level vertices from queue.
queue_[level] = NULL;
VertexSeq &level_vertices = queue_[level];
if (!level_vertices.empty()) {
incrLevel(first_level_);
BfsListIterator iter(level_vertices, this, bfs_index_);
QueueIterator iter(level_vertices, bfs_index_);
std::vector<std::thread> threads;
for (int i = 0; i < thread_count_; i++) {
ForEachArg<BfsListIterator,VertexVisitor> &arg = args[i];
// Initialize the iterator for this level's vertices.
arg.iter_ = &iter;
threads[i].beginTask(forEachBegin<BfsListIterator,
VertexVisitor, Vertex*>,
reinterpret_cast<void*>(&arg));
ForEachArg<QueueIterator, VertexVisitor> arg(&iter, lock,
visitor->copy());
// Missing check for null vertex.
threads.push_back(std::thread(forEachBegin<QueueIterator,
VertexVisitor, Vertex*>, arg));
}
// Wait for all threads working on this level before moving on.
for (int i = 0; i < thread_count_; i++)
threads[i].wait();
for (auto &thread : threads)
thread.join();
visit_count += iter.count();
level = first_level_;
@ -284,11 +242,6 @@ BfsIterator::visitParallel(Level to_level,
level = first_level_;
}
}
for (int i = 0; i < thread_count_; i++) {
ForEachArg<BfsListIterator,VertexVisitor> *arg = &args[i];
delete arg->func_;
}
}
}
return visit_count;
@ -305,17 +258,16 @@ BfsIterator::hasNext(Level to_level)
{
findNext(to_level);
return levelLessOrEqual(first_level_, last_level_)
&& queue_[first_level_] != NULL;
&& !queue_[first_level_].empty();
}
Vertex *
BfsIterator::next()
{
BfsList *head = queue_[first_level_];
Vertex *vertex = head->vertex();
VertexSeq &level_vertices = queue_[first_level_];
Vertex *vertex = level_vertices.back();
level_vertices.pop_back();
vertex->setBfsInQueue(bfs_index_, false);
queue_[first_level_] = head->next();
freeList(head);
return vertex;
}
@ -324,7 +276,7 @@ BfsIterator::findNext(Level to_level)
{
while (levelLessOrEqual(first_level_, last_level_)
&& levelLessOrEqual(first_level_, to_level)
&& queue_[first_level_] == NULL)
&& queue_[first_level_].empty())
incrLevel(first_level_);
}
@ -332,19 +284,18 @@ void
BfsIterator::enqueue(Vertex *vertex)
{
debugPrint1(debug_, "bfs", 2, "enqueue %s\n", vertex->name(sdc_network_));
Level level = vertex->level();
if (!vertex->bfsInQueue(bfs_index_)) {
queue_lock_.lock();
Level level = vertex->level();
UniqueLock lock(queue_lock_);
if (!vertex->bfsInQueue(bfs_index_)) {
vertex->setBfsInQueue(bfs_index_, true);
queue_[level] = makeList(vertex, queue_[level]);
queue_[level].push_back(vertex);
if (levelLess(last_level_, level))
last_level_ = level;
if (levelLess(level, first_level_))
first_level_ = level;
}
queue_lock_.unlock();
}
}
@ -360,8 +311,8 @@ BfsIterator::checkInQueue(Vertex *vertex)
{
Level level = vertex->level();
if (static_cast<Level>(queue_.size()) > level) {
for (BfsList *l = queue_[level]; l; l = l->next()) {
if (l->vertex() == vertex) {
for (auto v : queue_[level]) {
if (v == vertex) {
if (vertex->bfsInQueue(bfs_index_))
return;
else
@ -379,6 +330,7 @@ BfsIterator::deleteVertexBefore(Vertex *vertex)
remove(vertex);
}
// Remove by inserting null vertex pointer.
void
BfsIterator::remove(Vertex *vertex)
{
@ -386,63 +338,16 @@ BfsIterator::remove(Vertex *vertex)
Level level = vertex->level();
if (vertex->bfsInQueue(bfs_index_)
&& static_cast<Level>(queue_.size()) > level) {
BfsList *next, *prev = NULL;
for (BfsList *l = queue_[level]; l; l = next) {
next = l->next();
if (l->vertex() == vertex) {
if (prev)
prev->setNext(next);
else
queue_[level] = next;
for (auto &v : queue_[level]) {
if (v == vertex) {
v = nullptr;
vertex->setBfsInQueue(bfs_index_, false);
freeList(l);
break;
}
prev = l;
}
}
}
BfsList *
BfsIterator::makeList(Vertex *vertex,
BfsList *next)
{
BfsList *l;
list_lock_.lock();
if (list_free_) {
l = list_free_;
list_free_ = l->next();
list_lock_.unlock();
l->setVertex(vertex);
l->setNext(next);
}
else {
list_lock_.unlock();
l = new BfsList(vertex, next);
}
return l;
}
void
BfsIterator::freeList(BfsList *l)
{
list_lock_.lock();
l->setNext(list_free_);
list_free_ = l;
list_lock_.unlock();
}
void
BfsIterator::deleteList(BfsList *list)
{
while (list) {
BfsList *next = list->next();
list->vertex()->setBfsInQueue(bfs_index_, false);
delete list;
list = next;
}
}
////////////////////////////////////////////////////////////////
BfsFwdIterator::BfsFwdIterator(BfsIndex bfs_index,
@ -450,7 +355,6 @@ BfsFwdIterator::BfsFwdIterator(BfsIndex bfs_index,
StaState *sta) :
BfsIterator(bfs_index, 0, INT_MAX, search_pred, sta)
{
init();
}
// clear() without saving lists to list_free_.
@ -505,7 +409,6 @@ BfsBkwdIterator::BfsBkwdIterator(BfsIndex bfs_index,
StaState *sta) :
BfsIterator(bfs_index, INT_MAX, 0, search_pred, sta)
{
init();
}
// clear() without saving lists to list_free_.

View File

@ -17,10 +17,10 @@
#ifndef STA_BFS_H
#define STA_BFS_H
#include <mutex>
#include "DisallowCopyAssign.hh"
#include "Iterator.hh"
#include "Set.hh"
#include "Mutex.hh"
#include "StaState.hh"
#include "GraphClass.hh"
#include "VertexVisitor.hh"
@ -30,11 +30,9 @@ namespace sta {
class SearchPred;
class BfsFwdIterator;
class BfsBkwdIterator;
class BfsList;
class BfsListIterator;
// LevelQueue is a vector of vertex lists indexed by logic level.
typedef Vector<BfsList*> LevelQueue;
// LevelQueue is a vector of vertex vectors indexed by logic level.
typedef Vector<VertexSeq> LevelQueue;
// Abstract base class for forward and backward breadth first search iterators.
// Visit all of the vertices at a level before moving to the next.
@ -100,10 +98,6 @@ protected:
Level level2) const = 0;
virtual void incrLevel(Level &level) = 0;
void findNext(Level to_level);
BfsList *makeList(Vertex *vertex,
BfsList *next);
void freeList(BfsList *l);
void deleteList(BfsList *list);
void deleteEntries();
BfsIndex bfs_index_;
@ -111,17 +105,14 @@ protected:
Level level_max_;
SearchPred *search_pred_;
LevelQueue queue_;
Mutex queue_lock_;
std::mutex queue_lock_;
// Min (max) level of queued vertices.
Level first_level_;
// Max (min) level of queued vertices.
Level last_level_;
BfsList *list_free_;
Mutex list_lock_;
friend class BfsFwdIterator;
friend class BfsBkwdIterator;
friend class BfsListIterator;
private:
DISALLOW_COPY_AND_ASSIGN(BfsIterator);
@ -173,21 +164,5 @@ private:
DISALLOW_COPY_AND_ASSIGN(BfsBkwdIterator);
};
// Single linked list (STL list is doubly linked).
class BfsList
{
public:
BfsList(Vertex *vertex,
BfsList *next);
Vertex *vertex() const { return vertex_; }
void setVertex(Vertex *vertex);
BfsList *next() const { return next_; }
void setNext(BfsList *next);
protected:
Vertex *vertex_;
BfsList *next_;
};
} // namespace
#endif

View File

@ -107,7 +107,7 @@ void
MaxSkewViolatorsVisititor::visit(MaxSkewCheck &check,
const StaState *sta)
{
if (delayFuzzyLess(check.slack(sta), 0.0))
if (fuzzyLess(check.slack(sta), 0.0))
checks_.push_back(check.copy());
}
@ -137,7 +137,7 @@ private:
MaxSkewSlackVisitor::MaxSkewSlackVisitor() :
MaxSkewCheckVisitor(),
min_slack_check_(NULL)
min_slack_check_(nullptr)
{
}
@ -146,7 +146,7 @@ MaxSkewSlackVisitor::visit(MaxSkewCheck &check,
const StaState *sta)
{
MaxSkewSlackLess slack_less(sta);
if (min_slack_check_ == NULL)
if (min_slack_check_ == nullptr)
min_slack_check_ = check.copy();
else if (slack_less(&check, min_slack_check_)) {
delete min_slack_check_;
@ -288,7 +288,7 @@ MaxSkewSlackLess::operator()(const MaxSkewCheck *check1,
Slack slack1 = check1->slack(sta_);
Slack slack2 = check2->slack(sta_);
return slack1 < slack2
|| (delayFuzzyEqual(slack1, slack2)
|| (fuzzyEqual(slack1, slack2)
// Break ties based on constrained pin names.
&& sta_->network()->pinLess(check1->clkPin(sta_),check2->clkPin(sta_)));
}

View File

@ -21,7 +21,6 @@
#include "Clock.hh"
#include "Sdc.hh"
#include "Graph.hh"
#include "Corner.hh"
#include "DcalcAnalysisPt.hh"
#include "GraphDelayCalc.hh"
#include "Search.hh"
@ -61,21 +60,17 @@ CheckMinPeriods::clear()
class MinPeriodViolatorsVisitor : public MinPeriodCheckVisitor
{
public:
MinPeriodViolatorsVisitor(const Corner *corner,
MinPeriodCheckSeq &checks);
MinPeriodViolatorsVisitor(MinPeriodCheckSeq &checks);
virtual void visit(MinPeriodCheck &check,
StaState *sta);
private:
DISALLOW_COPY_AND_ASSIGN(MinPeriodViolatorsVisitor);
const Corner *corner_;
MinPeriodCheckSeq &checks_;
};
MinPeriodViolatorsVisitor::MinPeriodViolatorsVisitor(const Corner *corner,
MinPeriodCheckSeq &checks):
corner_(corner),
MinPeriodViolatorsVisitor::MinPeriodViolatorsVisitor(MinPeriodCheckSeq &checks):
checks_(checks)
{
}
@ -84,15 +79,15 @@ void
MinPeriodViolatorsVisitor::visit(MinPeriodCheck &check,
StaState *sta)
{
if (delayFuzzyLess(check.slack(sta), 0.0))
if (fuzzyLess(check.slack(sta), 0.0))
checks_.push_back(check.copy());
}
MinPeriodCheckSeq &
CheckMinPeriods::violations(const Corner *corner)
CheckMinPeriods::violations()
{
clear();
MinPeriodViolatorsVisitor visitor(corner, checks_);
MinPeriodViolatorsVisitor visitor(checks_);
visitMinPeriodChecks(&visitor);
sort(checks_, MinPeriodSlackLess(sta_));
return checks_;
@ -137,7 +132,7 @@ CheckMinPeriods::visitMinPeriodChecks(Vertex *vertex,
class MinPeriodSlackVisitor : public MinPeriodCheckVisitor
{
public:
MinPeriodSlackVisitor(const Corner *corner);
MinPeriodSlackVisitor();
virtual void visit(MinPeriodCheck &check,
StaState *sta);
MinPeriodCheck *minSlackCheck();
@ -145,13 +140,11 @@ public:
private:
DISALLOW_COPY_AND_ASSIGN(MinPeriodSlackVisitor);
const Corner *corner_;
MinPeriodCheck *min_slack_check_;
};
MinPeriodSlackVisitor::MinPeriodSlackVisitor(const Corner *corner) :
corner_(corner),
min_slack_check_(NULL)
MinPeriodSlackVisitor::MinPeriodSlackVisitor() :
min_slack_check_(nullptr)
{
}
@ -160,7 +153,7 @@ MinPeriodSlackVisitor::visit(MinPeriodCheck &check,
StaState *sta)
{
MinPeriodSlackLess slack_less(sta);
if (min_slack_check_ == NULL)
if (min_slack_check_ == nullptr)
min_slack_check_ = check.copy();
else if (slack_less(&check, min_slack_check_)) {
delete min_slack_check_;
@ -175,10 +168,10 @@ MinPeriodSlackVisitor::minSlackCheck()
}
MinPeriodCheck *
CheckMinPeriods::minSlackCheck(const Corner *corner)
CheckMinPeriods::minSlackCheck()
{
clear();
MinPeriodSlackVisitor visitor(corner);
MinPeriodSlackVisitor visitor;
visitMinPeriodChecks(&visitor);
MinPeriodCheck *check = visitor.minSlackCheck();
// Save check for cleanup.
@ -238,9 +231,9 @@ MinPeriodSlackLess::operator()(const MinPeriodCheck *check1,
Slack slack2 = check2->slack(sta_);
const Pin *pin1 = check1->pin();
const Pin *pin2 = check2->pin();
return delayFuzzyLess(slack1, slack2)
return fuzzyLess(slack1, slack2)
// Break ties based on pin and clock names.
|| (delayFuzzyEqual(slack1, slack2)
|| (fuzzyEqual(slack1, slack2)
&& (sta_->network()->pinLess(pin1, pin2)
|| (pin1 == pin2
&& ClockNameLess()(check1->clk(),

View File

@ -35,12 +35,9 @@ public:
explicit CheckMinPeriods(StaState *sta);
~CheckMinPeriods();
void clear();
// All violating min period checks.
// corner=NULL checks all corners.
MinPeriodCheckSeq &violations(const Corner *corner);
MinPeriodCheckSeq &violations();
// Min period check with the least slack.
// corner=NULL checks all corners.
MinPeriodCheck *minSlackCheck(const Corner *corner);
MinPeriodCheck *minSlackCheck();
protected:
void visitMinPeriodChecks(MinPeriodCheckVisitor *visitor);

View File

@ -103,7 +103,7 @@ void
MinPulseWidthChecksVisitor::visit(MinPulseWidthCheck &check,
const StaState *sta)
{
if (corner_ == NULL
if (corner_ == nullptr
|| check.corner(sta) == corner_) {
MinPulseWidthCheck *copy = new MinPulseWidthCheck(check.openPath());
checks_.push_back(copy);
@ -166,8 +166,8 @@ void
MinPulseWidthViolatorsVisitor::visit(MinPulseWidthCheck &check,
const StaState *sta)
{
if (delayFuzzyLess(check.slack(sta), 0.0)
&& (corner_ == NULL
if (fuzzyLess(check.slack(sta), 0.0)
&& (corner_ == nullptr
|| check.corner(sta) == corner_)) {
MinPulseWidthCheck *copy = new MinPulseWidthCheck(check.openPath());
checks_.push_back(copy);
@ -203,7 +203,7 @@ private:
MinPulseWidthSlackVisitor::MinPulseWidthSlackVisitor(const Corner *corner) :
corner_(corner),
min_slack_check_(NULL)
min_slack_check_(nullptr)
{
}
@ -212,9 +212,9 @@ MinPulseWidthSlackVisitor::visit(MinPulseWidthCheck &check,
const StaState *sta)
{
MinPulseWidthSlackLess slack_less(sta);
if (corner_ == NULL
if (corner_ == nullptr
|| check.corner(sta) == corner_) {
if (min_slack_check_ == NULL)
if (min_slack_check_ == nullptr)
min_slack_check_ = check.copy();
else if (slack_less(&check, min_slack_check_)) {
delete min_slack_check_;
@ -334,7 +334,7 @@ MinPulseWidthCheck::closePath(const StaState *sta,
open_clk_info->genClkSrc(),
open_clk_info->isGenClkSrcPath(),
open_clk_info->pulseClkSense(),
delay_zero, 0.0, NULL,
delay_zero, 0.0, nullptr,
open_clk_info->pathAPIndex(),
open_clk_info->crprClkPath(),
sta);
@ -499,7 +499,7 @@ MinPulseWidthSlackLess::operator()(const MinPulseWidthCheck *check1,
const Pin *pin1 = check1->pin(sta_);
const Pin *pin2 = check2->pin(sta_);
return slack1 < slack2
|| (delayFuzzyEqual(slack1, slack2)
|| (fuzzyEqual(slack1, slack2)
// Break ties for the sake of regression stability.
&& (sta_->network()->pinLess(pin1, pin2)
|| (pin1 == pin2

View File

@ -36,17 +36,17 @@ public:
~CheckMinPulseWidths();
void clear();
// Min pulse width checks for pins.
// corner=NULL checks all corners.
// corner=nullptr checks all corners.
MinPulseWidthCheckSeq &check(PinSeq *pins,
const Corner *corner);
// All min pulse width checks.
// corner=NULL checks all corners.
// corner=nullptr checks all corners.
MinPulseWidthCheckSeq &check(const Corner *corner);
// All violating min pulse width checks.
// corner=NULL checks all corners.
// corner=nullptr checks all corners.
MinPulseWidthCheckSeq &violations(const Corner *corner);
// Min pulse width check with the least slack.
// corner=NULL checks all corners.
// corner=nullptr checks all corners.
MinPulseWidthCheck *minSlackCheck(const Corner *corner);
protected:

View File

@ -107,8 +107,8 @@ CheckSlewLimits::checkSlews(const Pin *pin,
float &limit,
float &slack) const
{
corner1 = NULL;
tr = NULL;
corner1 = nullptr;
tr = nullptr;
slew = 0.0;
limit = 0.0;
slack = MinMax::min()->initValue();
@ -189,7 +189,7 @@ CheckSlewLimits::findLimit(const Pin *pin,
ClockSet::Iterator clk_iter(clks);
while (clk_iter.hasNext()) {
Clock *clk = clk_iter.next();
PathClkOrData clk_data = is_clk ? path_clk : path_data;
PathClkOrData clk_data = is_clk ? PathClkOrData::clk : PathClkOrData::data;
float clk_limit;
bool clk_limit_exists;
sdc->slewLimit(clk, tr, clk_data, min_max,
@ -281,7 +281,7 @@ CheckSlewLimits::checkSlew(Vertex *vertex,
float slew2 = delayAsFloat(slew1);
float slack1 = (min_max == MinMax::max())
? limit1 - slew2 : slew2 - limit1;
if (corner == NULL
if (corner == nullptr
|| (slack1 < slack
// Break ties for the sake of regression stability.
|| (fuzzyEqual(slack1, slack)

View File

@ -34,21 +34,21 @@ public:
CheckSlewLimits(const StaState *sta);
void init(const MinMax *min_max);
// Requires init().
// corner=NULL checks all corners.
// corner=nullptr checks all corners.
void checkSlews(const Pin *pin,
const Corner *corner,
const MinMax *min_max,
// Return values.
// Corner is NULL for no slew limit.
// Corner is nullptr for no slew limit.
const Corner *&corner1,
const TransRiseFall *&tr,
Slew &slew,
float &limit,
float &slack) const;
// corner=NULL checks all corners.
// corner=nullptr checks all corners.
PinSeq *pinSlewLimitViolations(const Corner *corner,
const MinMax *min_max);
// corner=NULL checks all corners.
// corner=nullptr checks all corners.
Pin *pinMinSlewLimitSlack(const Corner *corner,
const MinMax *min_max);

View File

@ -196,7 +196,7 @@ CheckTiming::checkLoops()
GraphLoop *loop = loop_iter2.next();
if (loop->isCombinational()) {
EdgeSeq::Iterator edge_iter(loop->edges());
Edge *last_edge = NULL;
Edge *last_edge = nullptr;
while (edge_iter.hasNext()) {
Edge *edge = edge_iter.next();
Pin *pin = edge->from(graph_)->pin();
@ -247,15 +247,12 @@ CheckTiming::checkUnconstraintedOutputs(PinSet &unconstrained_ends)
bool
CheckTiming::hasClkedDepature(Pin *pin)
{
PinOutputDelayIterator *delay_iter = sdc_->outputDelayIterator(pin);
while (delay_iter->hasNext()) {
OutputDelay *output_delay = delay_iter->next();
if (output_delay->clkEdge() != NULL) {
delete delay_iter;
PinOutputDelayIterator delay_iter(pin, sdc_);
while (delay_iter.hasNext()) {
OutputDelay *output_delay = delay_iter.next();
if (output_delay->clkEdge() != nullptr)
return true;
}
}
delete delay_iter;
return false;
}
@ -313,9 +310,7 @@ void
CheckTiming::checkGeneratedClocks()
{
ClockSet gen_clk_errors;
ClockIterator *clk_iter = sdc_->clockIterator();
while (clk_iter->hasNext()) {
Clock *clk = clk_iter->next();
for (auto clk : sdc_->clks()) {
if (clk->isGenerated()) {
search_->genclks()->checkMaster(clk);
bool found_clk = false;
@ -333,7 +328,6 @@ CheckTiming::checkGeneratedClocks()
gen_clk_errors.insert(clk);
}
}
delete clk_iter;
pushClkErrors("Warning: There %is %d generated clock%s that %is not connected to a clock source.",
gen_clk_errors);
}

View File

@ -56,7 +56,7 @@ ClkInfo::ClkInfo(ClockEdge *clk_edge,
latency_(latency),
is_propagated_(is_propagated),
is_gen_clk_src_path_(is_gen_clk_src_path),
is_pulse_clk_(pulse_clk_sense != NULL),
is_pulse_clk_(pulse_clk_sense != nullptr),
pulse_clk_sense_(pulse_clk_sense ? pulse_clk_sense->index() : 0),
path_ap_index_(path_ap_index)
{
@ -149,7 +149,7 @@ ClkInfo::clock() const
if (clk_edge_)
return clk_edge_->clock();
else
return NULL;
return nullptr;
}
TransRiseFall *
@ -158,7 +158,7 @@ ClkInfo::pulseClkSense() const
if (is_pulse_clk_)
return TransRiseFall::find(pulse_clk_sense_);
else
return NULL;
return nullptr;
}
const Pin *
@ -167,7 +167,7 @@ ClkInfo::crprClkPin(const StaState *sta) const
if (!crpr_clk_path_.isNull())
return crpr_clk_path_.vertex(sta)->pin();
else
return NULL;
return nullptr;
}
bool
@ -214,8 +214,8 @@ clkInfoEqual(const ClkInfo *clk_info1,
&& (!crpr_on
|| (PathVertexRep::equal(clk_info1->crprClkPath(),
clk_info2->crprClkPath())))
&& ((uncertainties1 == NULL
&& uncertainties2 == NULL)
&& ((uncertainties1 == nullptr
&& uncertainties2 == nullptr)
|| (uncertainties1 && uncertainties2
&& MinMaxValues<float>::equal(uncertainties1,
uncertainties2)))

Some files were not shown because too many files have changed in this diff Show More