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) 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_VERBOSE_MAKEFILE ON)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
@ -186,16 +186,12 @@ set(STA_SOURCE
search/WorstSlack.cc search/WorstSlack.cc
search/WritePathSpice.cc search/WritePathSpice.cc
util/Condition.cc
util/Debug.cc util/Debug.cc
util/Error.cc util/Error.cc
util/Fuzzy.cc util/Fuzzy.cc
util/Machine.cc util/Machine.cc
util/MinMax.cc util/MinMax.cc
util/Mutex.cc
util/PatternMatch.cc util/PatternMatch.cc
util/Pthread.cc
util/ReadWriteLock.cc
util/Report.cc util/Report.cc
util/ReportStd.cc util/ReportStd.cc
util/ReportTcl.cc util/ReportTcl.cc
@ -203,10 +199,6 @@ set(STA_SOURCE
util/StringSeq.cc util/StringSeq.cc
util/StringSet.cc util/StringSet.cc
util/StringUtil.cc util/StringUtil.cc
util/Thread.cc
util/ThreadException.cc
util/ThreadPool.cc
util/ThreadWorker.cc
util/TokenParser.cc util/TokenParser.cc
verilog/VerilogReader.cc verilog/VerilogReader.cc
@ -353,14 +345,13 @@ set(STA_HEADERS
search/WorstSlack.hh search/WorstSlack.hh
search/WritePathSpice.hh search/WritePathSpice.hh
util/Condition.hh
util/Debug.hh util/Debug.hh
util/DisallowCopyAssign.hh util/DisallowCopyAssign.hh
util/EnumNameMap.hh
util/Error.hh util/Error.hh
util/Fuzzy.hh util/Fuzzy.hh
util/Hash.hh util/Hash.hh
util/HashSet.hh util/HashSet.hh
util/HashMap.hh
util/Iterator.hh util/Iterator.hh
util/Machine.hh util/Machine.hh
util/Map.hh util/Map.hh
@ -368,9 +359,7 @@ set(STA_HEADERS
util/Mutex.hh util/Mutex.hh
util/ObjectIndex.hh util/ObjectIndex.hh
util/PatternMatch.hh util/PatternMatch.hh
util/Pthread.hh
util/Pool.hh util/Pool.hh
util/ReadWriteLock.hh
util/Report.hh util/Report.hh
util/ReportStd.hh util/ReportStd.hh
util/ReportTcl.hh util/ReportTcl.hh
@ -379,13 +368,10 @@ set(STA_HEADERS
util/StringSeq.hh util/StringSeq.hh
util/StringSet.hh util/StringSet.hh
util/StringUtil.hh util/StringUtil.hh
util/Thread.hh
util/ThreadException.hh
util/ThreadForEach.hh util/ThreadForEach.hh
util/ThreadPool.hh
util/ThreadWorker.hh
util/TokenParser.hh util/TokenParser.hh
util/UnorderedMap.hh util/UnorderedMap.hh
util/UnorderedSet.hh
util/Vector.hh util/Vector.hh
util/Zlib.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 # Zlib
include(FindZLIB) include(FindZLIB)
# translate cmake bool to ifdef bool # translate cmake bool to ifdef bool
@ -458,11 +435,12 @@ if("${CUDD}" STREQUAL "")
set(CUDD $ENV{CUDD}) set(CUDD $ENV{CUDD})
endif() endif()
if("${CUDD}" STREQUAL "") if("${CUDD}" STREQUAL "" OR "${CUDD}" STREQUAL "0")
set(CUDD_INCLUDE "") set(CUDD_INCLUDE "")
set(CUDD_LIB "") set(CUDD_LIB "")
set(CUDD_FOUND FALSE) set(CUDD_FOUND FALSE)
set(CUDD 0) set(CUDD 0)
message(STATUS "CUDD library: not found")
else() else()
set(CUDD_INCLUDE ${CUDD}/include) set(CUDD_INCLUDE ${CUDD}/include)
find_library(CUDD_LIB NAMES cudd PATHS ${CUDD}/lib) find_library(CUDD_LIB NAMES cudd PATHS ${CUDD}/lib)
@ -476,7 +454,7 @@ endif()
if("${SSTA}" STREQUAL "") if("${SSTA}" STREQUAL "")
set(SSTA 0) set(SSTA 0)
endif() endif()
message(STATUS "Enable SSTA: ${SSTA}") message(STATUS "SSTA: ${SSTA}")
# configure a header file to pass some of the CMake settins # configure a header file to pass some of the CMake settins
configure_file(${STA_HOME}/util/StaConfig.hh.cmake 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) add_executable(sta app/Main.cc)
target_link_libraries(sta target_link_libraries(sta
OpenSTA OpenSTA
Threads::Threads
${TCL_LIB} ${TCL_LIB}
${CUDD_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) 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) if (CMAKE_CXX_COMPILER_ID MATCHES AppleClang|Clang|GNU)
target_compile_options(OpenSTA PUBLIC ${STA_COMPILE_OPTIONS}) target_compile_options(OpenSTA PUBLIC ${STA_COMPILE_OPTIONS})
target_compile_options(sta PUBLIC ${STA_COMPILE_OPTIONS}) target_compile_options(sta PUBLIC ${STA_COMPILE_OPTIONS})
message(STATUS "Compiler options: ${STA_COMPILE_OPTIONS}") message(STATUS "Compiler options: ${STA_COMPILE_OPTIONS}")
endif() endif()
# g++ still needs -pthreads when using std::thread
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_link_libraries(sta -pthread)
endif()
################################################################ ################################################################
# Install # Install
# cmake .. -DCMAKE_INSTALL_PREFIX=<prefix_path> # cmake .. -DCMAKE_INSTALL_PREFIX=<prefix_path>

View File

@ -108,9 +108,8 @@ make
make install make install
``` ```
The Zlib library is an optional. If CMake or the configure script The Zlib library is an optional. If CMake finds libz, OpenSTA can
finds libz, OpenSTA can read Verilog, SDF, SPF, and SPEF files read Verilog, SDF, SPF, and SPEF files compressed with gzip.
compressed with gzip.
### Installing with CMake ### Installing with CMake
@ -163,11 +162,6 @@ files in the build directory.
### Installing on Windoz ### 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 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 support the Microcruft cl compiler by calling the vsvars32.bat script
from the Visual C++ installation. from the Visual C++ installation.

View File

@ -37,7 +37,7 @@ class Pin;
class arnoldi1 class arnoldi1
{ {
public: 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(); ~arnoldi1();
double elmore(int term_index); double elmore(int term_index);

View File

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

View File

@ -35,7 +35,7 @@
namespace sta { namespace sta {
rcmodel::rcmodel() : rcmodel::rcmodel() :
pinV(NULL) pinV(nullptr)
{ {
} }
@ -188,7 +188,7 @@ ArnoldiReduce::loadWork()
ts_edge *e; ts_edge *e;
int tindex; int tindex;
for (p = p0; p!=pend; p++) { for (p = p0; p!=pend; p++) {
p->node_ = NULL; p->node_ = nullptr;
p->eN = 0; p->eN = 0;
p->is_term = false; p->is_term = false;
} }
@ -323,7 +323,7 @@ ArnoldiReduce::makeRcmodelDrv()
makeRcmodelDfs(pdrv); makeRcmodelDfs(pdrv);
getRC(); getRC();
if (ctot_ < 1e-22) // 1e-10ps if (ctot_ < 1e-22) // 1e-10ps
return NULL; return nullptr;
setTerms(pdrv); setTerms(pdrv);
makeRcmodelFromTs(); makeRcmodelFromTs();
rcmodel *mod = makeRcmodelFromW(); rcmodel *mod = makeRcmodelFromW();
@ -350,7 +350,7 @@ ArnoldiReduce::makeRcmodelDfs(ts_point *pdrv)
stackV[0] = e = pdrv->eV[0]; stackV[0] = e = pdrv->eV[0];
ts_orient(pdrv,e); ts_orient(pdrv,e);
pdrv->visited = 1; pdrv->visited = 1;
pdrv->in_edge = NULL; pdrv->in_edge = nullptr;
pdrv->ts = 0; pdrv->ts = 0;
ts_ordV[0] = pdrv-p0; ts_ordV[0] = pdrv-p0;
ts_pordV[0] = pdrv; ts_pordV[0] = pdrv;
@ -620,7 +620,7 @@ ArnoldiReduce::makeRcmodelFromW()
int totd = order + order - 1 + order*n; int totd = order + order - 1 + order*n;
mod->d = (double *)malloc(totd*sizeof(double)); mod->d = (double *)malloc(totd*sizeof(double));
if (order>1) mod->e = mod->d + order; 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 = (double **)malloc(order*sizeof(double*));
mod->U[0] = mod->d + order + order - 1; mod->U[0] = mod->d + order + order - 1;
for (h=1;h<order;h++) mod->U[h]=mod->U[0] + h*n; 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; typedef Map<const char*, MakeArcDelayCalc, CharPtrLess> DelayCalcMap;
static DelayCalcMap *delay_calcs = NULL; static DelayCalcMap *delay_calcs = nullptr;
void void
registerDelayCalcs() registerDelayCalcs()
@ -45,7 +45,7 @@ void
registerDelayCalc(const char *name, registerDelayCalc(const char *name,
MakeArcDelayCalc maker) MakeArcDelayCalc maker)
{ {
if (delay_calcs == NULL) if (delay_calcs == nullptr)
delay_calcs = new DelayCalcMap; delay_calcs = new DelayCalcMap;
(*delay_calcs)[name] = maker; (*delay_calcs)[name] = maker;
} }
@ -54,7 +54,7 @@ void
deleteDelayCalcs() deleteDelayCalcs()
{ {
delete delay_calcs; delete delay_calcs;
delay_calcs = NULL; delay_calcs = nullptr;
} }
ArcDelayCalc * ArcDelayCalc *
@ -65,7 +65,7 @@ makeDelayCalc(const char *name,
if (maker) if (maker)
return maker(sta); return maker(sta);
else else
return NULL; return nullptr;
} }
bool bool

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

Binary file not shown.

Binary file not shown.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -32,8 +32,6 @@
namespace sta { namespace sta {
const char *bfs_index_names[] = {"dcalc", "arrival", "required", "other"};
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
// //
// Graph // Graph
@ -45,17 +43,17 @@ Graph::Graph(StaState *sta,
bool have_arc_delays, bool have_arc_delays,
DcalcAPIndex ap_count) : DcalcAPIndex ap_count) :
StaState(sta), StaState(sta),
vertices_(NULL), vertices_(nullptr),
edges_(NULL), edges_(nullptr),
vertex_count_(0), vertex_count_(0),
edge_count_(0), edge_count_(0),
arc_count_(0), arc_count_(0),
slew_tr_count_(slew_tr_count), slew_tr_count_(slew_tr_count),
have_arc_delays_(have_arc_delays), have_arc_delays_(have_arc_delays),
ap_count_(ap_count), ap_count_(ap_count),
float_pool_(NULL), float_pool_(nullptr),
width_check_annotations_(NULL), width_check_annotations_(nullptr),
period_check_annotations_(NULL) period_check_annotations_(nullptr)
{ {
} }
@ -144,7 +142,7 @@ Graph::vertexAndEdgeCounts(const Instance *inst,
vertex_count++; vertex_count++;
if (cell) { if (cell) {
LibertyPort *port = network_->libertyPort(pin); LibertyPort *port = network_->libertyPort(pin);
LibertyCellTimingArcSetIterator set_iter(cell, port, NULL); LibertyCellTimingArcSetIterator set_iter(cell, port, nullptr);
while (set_iter.hasNext()) { while (set_iter.hasNext()) {
TimingArcSet *arc_set = set_iter.next(); TimingArcSet *arc_set = set_iter.next();
LibertyPort *to_port = arc_set->to(); LibertyPort *to_port = arc_set->to();
@ -261,7 +259,7 @@ Graph::makeInstanceEdges(const Instance *inst)
{ {
LibertyCell *cell = network_->libertyCell(inst); LibertyCell *cell = network_->libertyCell(inst);
if (cell) if (cell)
makePortInstanceEdges(inst, cell, NULL); makePortInstanceEdges(inst, cell, nullptr);
} }
void void
@ -287,7 +285,7 @@ Graph::makePortInstanceEdges(const Instance *inst,
TimingArcSet *arc_set = timing_iter.next(); TimingArcSet *arc_set = timing_iter.next();
LibertyPort *from_port = arc_set->from(); LibertyPort *from_port = arc_set->from();
LibertyPort *to_port = arc_set->to(); LibertyPort *to_port = arc_set->to();
if (from_to_port == NULL if (from_to_port == nullptr
|| from_port == from_to_port || from_port == from_to_port
|| to_port == from_to_port) { || to_port == from_to_port) {
Pin *from_pin = network_->findPin(inst, from_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_); FindNetDrvrLoads visitor(drvr_pin, visited_drvrs, loads, drvrs, network_);
network_->visitConnectedPins(drvr_pin, visitor); network_->visitConnectedPins(drvr_pin, visitor);
PinSeq::Iterator load_iter(loads); for (auto load_pin : loads) {
while (load_iter.hasNext()) {
Pin *load_pin = load_iter.next();
if (drvr_pin != load_pin) if (drvr_pin != load_pin)
makeWireEdge(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_); FindNetDrvrLoads visitor(drvr_pin, visited_drvrs, loads, drvrs, network_);
network_->visitConnectedPins(drvr_pin, visitor); network_->visitConnectedPins(drvr_pin, visitor);
PinSeq::Iterator drvr_iter(drvrs); for (auto drvr_pin : drvrs) {
while (drvr_iter.hasNext()) { for (auto load_pin : loads) {
Pin *drvr_pin = drvr_iter.next();
PinSeq::Iterator load_iter(loads);
while (load_iter.hasNext()) {
Pin *load_pin = load_iter.next();
if (drvr_pin != load_pin) if (drvr_pin != load_pin)
makeWireEdge(drvr_pin, load_pin); makeWireEdge(drvr_pin, load_pin);
} }
@ -397,9 +389,7 @@ Graph::makeWireEdgesToPin(Pin *to_pin)
{ {
PinSet *drvrs = network_->drivers(to_pin); PinSet *drvrs = network_->drivers(to_pin);
if (drvrs) { if (drvrs) {
PinSet::Iterator drvr_iter(drvrs); for (auto drvr : *drvrs) {
while (drvr_iter.hasNext()) {
Pin *drvr = drvr_iter.next();
if (drvr != to_pin) if (drvr != to_pin)
makeWireEdge(drvr, to_pin); makeWireEdge(drvr, to_pin);
} }
@ -409,8 +399,7 @@ Graph::makeWireEdgesToPin(Pin *to_pin)
class MakeEdgesThruHierPin : public HierPinThruVisitor class MakeEdgesThruHierPin : public HierPinThruVisitor
{ {
public: public:
MakeEdgesThruHierPin(Graph *graph, MakeEdgesThruHierPin(Graph *graph);
Network *network);
private: private:
DISALLOW_COPY_AND_ASSIGN(MakeEdgesThruHierPin); DISALLOW_COPY_AND_ASSIGN(MakeEdgesThruHierPin);
@ -418,14 +407,11 @@ private:
Pin *load); Pin *load);
Graph *graph_; Graph *graph_;
Network *network_;
}; };
MakeEdgesThruHierPin::MakeEdgesThruHierPin(Graph *graph, MakeEdgesThruHierPin::MakeEdgesThruHierPin(Graph *graph) :
Network *network) :
HierPinThruVisitor(), HierPinThruVisitor(),
graph_(graph), graph_(graph)
network_(network)
{ {
} }
@ -439,7 +425,7 @@ MakeEdgesThruHierPin::visit(Pin *drvr,
void void
Graph::makeWireEdgesThruPin(Pin *hpin) Graph::makeWireEdgesThruPin(Pin *hpin)
{ {
MakeEdgesThruHierPin visitor(this, network_); MakeEdgesThruHierPin visitor(this);
visitDrvrLoadsThruHierPin(hpin, network_, &visitor); visitDrvrLoadsThruHierPin(hpin, network_, &visitor);
} }
@ -494,7 +480,7 @@ Graph::makePinVertices(Pin *pin,
pin_bidirect_drvr_vertex_map_[pin] = bidir_drvr_vertex; pin_bidirect_drvr_vertex_map_[pin] = bidir_drvr_vertex;
} }
else else
bidir_drvr_vertex = NULL; bidir_drvr_vertex = nullptr;
} }
} }
@ -522,7 +508,7 @@ Graph::pinVertices(const Pin *pin,
if (network_->direction(pin)->isBidirect()) if (network_->direction(pin)->isBidirect())
bidirect_drvr_vertex = pin_bidirect_drvr_vertex_map_.findKey(pin); bidirect_drvr_vertex = pin_bidirect_drvr_vertex_map_.findKey(pin);
else else
bidirect_drvr_vertex = NULL; bidirect_drvr_vertex = nullptr;
} }
Vertex * Vertex *
@ -1017,10 +1003,10 @@ Graph::setWidthCheckAnnotation(const Pin *pin,
DcalcAPIndex ap_index, DcalcAPIndex ap_index,
float width) float width)
{ {
if (width_check_annotations_ == NULL) if (width_check_annotations_ == nullptr)
width_check_annotations_ = new WidthCheckAnnotations; width_check_annotations_ = new WidthCheckAnnotations;
float *widths = width_check_annotations_->findKey(pin); float *widths = width_check_annotations_->findKey(pin);
if (widths == NULL) { if (widths == nullptr) {
int width_count = TransRiseFall::index_count * ap_count_; int width_count = TransRiseFall::index_count * ap_count_;
widths = makeFloats(width_count); widths = makeFloats(width_count);
// Use negative (illegal) width values to indicate unannotated checks. // Use negative (illegal) width values to indicate unannotated checks.
@ -1043,7 +1029,7 @@ Graph::removeWidthCheckAnnotations()
deleteFloats(widths, width_count); deleteFloats(widths, width_count);
} }
delete width_check_annotations_; delete width_check_annotations_;
width_check_annotations_ = NULL; width_check_annotations_ = nullptr;
} }
} }
@ -1072,10 +1058,10 @@ Graph::setPeriodCheckAnnotation(const Pin *pin,
DcalcAPIndex ap_index, DcalcAPIndex ap_index,
float period) float period)
{ {
if (period_check_annotations_ == NULL) if (period_check_annotations_ == nullptr)
period_check_annotations_ = new PeriodCheckAnnotations; period_check_annotations_ = new PeriodCheckAnnotations;
float *periods = period_check_annotations_->findKey(pin); float *periods = period_check_annotations_->findKey(pin);
if (periods == NULL) { if (periods == nullptr) {
periods = makeFloats(ap_count_); periods = makeFloats(ap_count_);
// Use negative (illegal) period values to indicate unannotated checks. // Use negative (illegal) period values to indicate unannotated checks.
for (DcalcAPIndex i = 0; i < ap_count_; i++) for (DcalcAPIndex i = 0; i < ap_count_; i++)
@ -1089,13 +1075,12 @@ void
Graph::removePeriodCheckAnnotations() Graph::removePeriodCheckAnnotations()
{ {
if (period_check_annotations_) { if (period_check_annotations_) {
PeriodCheckAnnotations::Iterator check_iter(period_check_annotations_); for (auto pin_floats : *period_check_annotations_) {
while (check_iter.hasNext()) { float *periods = pin_floats.second;
float *periods = check_iter.next();
deleteFloats(periods, ap_count_); deleteFloats(periods, ap_count_);
} }
delete period_check_annotations_; delete period_check_annotations_;
period_check_annotations_ = NULL; period_check_annotations_ = nullptr;
} }
} }
@ -1119,7 +1104,7 @@ Graph::removeDelaySlewAnnotations()
float * float *
Graph::makeFloats(ObjectIndex count) Graph::makeFloats(ObjectIndex count)
{ {
if (float_pool_ == NULL) if (float_pool_ == nullptr)
float_pool_ = new Pool<float>(100); float_pool_ = new Pool<float>(100);
return float_pool_->makeObjects(count); return float_pool_->makeObjects(count);
} }
@ -1138,7 +1123,7 @@ Graph::deleteFloats(float *floats, ObjectIndex count)
Vertex::Vertex() Vertex::Vertex()
{ {
init(NULL, false, false); init(nullptr, false, false);
} }
void void
@ -1151,19 +1136,19 @@ Vertex::init(Pin *pin,
is_bidirect_drvr_ = is_bidirect_drvr; is_bidirect_drvr_ = is_bidirect_drvr;
in_edges_ = 0; in_edges_ = 0;
out_edges_ = 0; out_edges_ = 0;
arrivals_ = NULL; arrivals_ = nullptr;
prev_paths_ = NULL; prev_paths_ = nullptr;
has_requireds_ = false; has_requireds_ = false;
tag_group_index_ = tag_group_index_max; tag_group_index_ = tag_group_index_max;
slew_annotated_ = false; slew_annotated_ = false;
sim_value_ = logic_unknown; sim_value_ = unsigned(LogicValue::unknown);
is_disabled_constraint_ = false; is_disabled_constraint_ = false;
is_gated_clk_enable_ = false; is_gated_clk_enable_ = false;
has_checks_ = false; has_checks_ = false;
is_check_clk_ = false; is_check_clk_ = false;
is_constrained_ = false; is_constrained_ = false;
has_downstream_clk_pin_ = false; has_downstream_clk_pin_ = false;
color_ = vertex_color_white; color_ = unsigned(LevelColor::white);
level_ = 0; level_ = 0;
bfs_in_queue_ = 0; bfs_in_queue_ = 0;
crpr_path_pruning_disabled_ = false; crpr_path_pruning_disabled_ = false;
@ -1190,9 +1175,9 @@ Vertex::setLevel(Level level)
} }
void void
Vertex::setColor(VertexColor color) Vertex::setColor(LevelColor color)
{ {
color_ = color; color_ = unsigned(color);
} }
bool bool
@ -1282,14 +1267,15 @@ Vertex::simValue() const
void void
Vertex::setSimValue(LogicValue value) Vertex::setSimValue(LogicValue value)
{ {
sim_value_ = value; sim_value_ = unsigned(value);
} }
bool bool
Vertex::isConstant() const Vertex::isConstant() const
{ {
return sim_value_ == logic_zero LogicValue value = static_cast<LogicValue>(sim_value_);
|| sim_value_ == logic_one; return value == LogicValue::zero
|| value == LogicValue::one;
} }
void void
@ -1331,7 +1317,7 @@ Vertex::setHasDownstreamClkPin(bool has_clk_pin)
bool bool
Vertex::bfsInQueue(BfsIndex index) const Vertex::bfsInQueue(BfsIndex index) const
{ {
return (bfs_in_queue_ >> index) & 1; return (bfs_in_queue_ >> unsigned(index)) & 1;
} }
void void
@ -1339,9 +1325,9 @@ Vertex::setBfsInQueue(BfsIndex index,
bool value) bool value)
{ {
if (value) if (value)
bfs_in_queue_ |= 1 << index; bfs_in_queue_ |= 1 << int(index);
else else
bfs_in_queue_ &= ~(1 << index); bfs_in_queue_ &= ~(1 << int(index));
} }
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
@ -1352,7 +1338,7 @@ Vertex::setBfsInQueue(BfsIndex index,
Edge::Edge() Edge::Edge()
{ {
init(0, 0, NULL); init(0, 0, nullptr);
} }
void void
@ -1371,7 +1357,7 @@ Edge::init(VertexIndex from,
is_bidirect_inst_path_ = false; is_bidirect_inst_path_ = false;
is_bidirect_net_path_ = false; is_bidirect_net_path_ = false;
delay_annotation_is_incremental_ = false; delay_annotation_is_incremental_ = false;
sim_timing_sense_ = timing_sense_unknown; sim_timing_sense_ = unsigned(TimingSense::unknown);
is_disabled_constraint_ = false; is_disabled_constraint_ = false;
is_disabled_cond_ = false; is_disabled_cond_ = false;
is_disabled_loop_ = false; is_disabled_loop_ = false;
@ -1423,13 +1409,13 @@ Edge::sense() const
TimingSense TimingSense
Edge::simTimingSense() const Edge::simTimingSense() const
{ {
return static_cast<TimingSense>(sim_timing_sense_); return static_cast<TimingSense>(sim_timing_sense_);
} }
void void
Edge::setSimTimingSense(TimingSense sense) Edge::setSimTimingSense(TimingSense sense)
{ {
sim_timing_sense_ = sense; sim_timing_sense_ = unsigned(sense);
} }
bool bool
@ -1486,9 +1472,9 @@ VertexIterator::VertexIterator(Graph *graph) :
network_(graph->network()), network_(graph->network()),
top_inst_(network_->topInstance()), top_inst_(network_->topInstance()),
inst_iter_(network_->leafInstanceIterator()), inst_iter_(network_->leafInstanceIterator()),
pin_iter_(NULL), pin_iter_(nullptr),
vertex_(NULL), vertex_(nullptr),
bidir_vertex_(NULL) bidir_vertex_(nullptr)
{ {
if (inst_iter_) if (inst_iter_)
findNext(); findNext();
@ -1497,16 +1483,16 @@ VertexIterator::VertexIterator(Graph *graph) :
Vertex * Vertex *
VertexIterator::next() VertexIterator::next()
{ {
Vertex *next = NULL; Vertex *next = nullptr;
if (vertex_) { if (vertex_) {
next = vertex_; next = vertex_;
vertex_ = NULL; vertex_ = nullptr;
} }
else if (bidir_vertex_) { else if (bidir_vertex_) {
next = bidir_vertex_; next = bidir_vertex_;
bidir_vertex_ = NULL; bidir_vertex_ = nullptr;
} }
if (bidir_vertex_ == NULL) if (bidir_vertex_ == nullptr)
findNext(); findNext();
return next; return next;
} }
@ -1519,12 +1505,12 @@ VertexIterator::findNextPin()
vertex_ = graph_->vertex(network_->vertexIndex(pin)); vertex_ = graph_->vertex(network_->vertexIndex(pin));
bidir_vertex_ = network_->direction(pin)->isBidirect() bidir_vertex_ = network_->direction(pin)->isBidirect()
? graph_->pin_bidirect_drvr_vertex_map_.findKey(pin) ? graph_->pin_bidirect_drvr_vertex_map_.findKey(pin)
: NULL; : nullptr;
if (vertex_ || bidir_vertex_) if (vertex_ || bidir_vertex_)
return true; return true;
} }
delete pin_iter_; delete pin_iter_;
pin_iter_ = NULL; pin_iter_ = nullptr;
return false; return false;
} }
@ -1541,10 +1527,10 @@ VertexIterator::findNext()
pin_iter_ = network_->pinIterator(inst); pin_iter_ = network_->pinIterator(inst);
} else { } else {
delete inst_iter_; delete inst_iter_;
inst_iter_ = NULL; inst_iter_ = nullptr;
if (top_inst_) { if (top_inst_) {
pin_iter_ = network_->pinIterator(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 Sdc;
class PathVertexRep; class PathVertexRep;
enum VertexColor { enum class LevelColor { white, gray, black };
vertex_color_white,
vertex_color_gray,
vertex_color_black
};
typedef Pool<Delay> DelayPool; typedef Pool<Delay> DelayPool;
typedef Pool<Vertex> VertexPool; typedef Pool<Vertex> VertexPool;
@ -271,8 +267,8 @@ public:
Level level() const { return level_; } Level level() const { return level_; }
void setLevel(Level level); void setLevel(Level level);
bool isRoot() const{ return level_ == 0; } bool isRoot() const{ return level_ == 0; }
VertexColor color() const { return (VertexColor) color_; } LevelColor color() const { return static_cast<LevelColor>(color_); }
void setColor(VertexColor color); void setColor(LevelColor color);
Arrival *arrivals() const { return arrivals_; } Arrival *arrivals() const { return arrivals_; }
void setArrivals(Arrival *arrivals); void setArrivals(Arrival *arrivals);
PathVertexRep *prevPaths() const { return prev_paths_; } PathVertexRep *prevPaths() const { return prev_paths_; }
@ -337,14 +333,16 @@ protected:
// 4 bytes // 4 bytes
unsigned int tag_group_index_:tag_group_index_bits; // 24 unsigned int tag_group_index_:tag_group_index_bits; // 24
// Each bit corresponds to a different BFS queue. // 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; unsigned int slew_annotated_:slew_annotated_bits;
// 4 bytes (32 bits) // 4 bytes (32 bits)
unsigned int level_:16; unsigned int level_:16;
// Levelization search state. // Levelization search state.
unsigned int color_:2; // LevelColor gcc barfs if this is dcl'd.
unsigned int sim_value_:3; // LogicValue unsigned color_:2;
// LogicValue gcc barfs if this is dcl'd.
unsigned sim_value_:3;
bool has_requireds_:1; bool has_requireds_:1;
// Bidirect pins have two vertices. // Bidirect pins have two vertices.
// This flag distinguishes the driver and load 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_next_; // Vertex out edges doubly linked list.
VertexIndex vertex_out_prev_; VertexIndex vertex_out_prev_;
ArcIndex arc_delays_; ArcIndex arc_delays_;
unsigned int delay_annotation_is_incremental_:1; bool delay_annotation_is_incremental_:1;
unsigned int is_bidirect_inst_path_:1; bool is_bidirect_inst_path_:1;
unsigned int is_bidirect_net_path_:1; bool is_bidirect_net_path_:1;
// Timing sense from function and constants on edge instance. // Timing sense from function and constants on edge instance.
unsigned int sim_timing_sense_:timing_sense_bit_count; unsigned sim_timing_sense_:timing_sense_bit_count;
unsigned int is_disabled_constraint_:1; bool is_disabled_constraint_:1;
unsigned int is_disabled_cond_:1; bool is_disabled_cond_:1;
unsigned int is_disabled_loop_:1; bool is_disabled_loop_:1;
private: private:
DISALLOW_COPY_AND_ASSIGN(Edge); DISALLOW_COPY_AND_ASSIGN(Edge);
@ -468,7 +466,7 @@ public:
const Graph *graph); const Graph *graph);
VertexInEdgeIterator(VertexIndex vertex_index, VertexInEdgeIterator(VertexIndex vertex_index,
const Graph *graph); const Graph *graph);
bool hasNext() { return (next_ != NULL); } bool hasNext() { return (next_ != nullptr); }
Edge *next(); Edge *next();
private: private:
@ -483,7 +481,7 @@ class VertexOutEdgeIterator : public VertexEdgeIterator
public: public:
VertexOutEdgeIterator(Vertex *vertex, VertexOutEdgeIterator(Vertex *vertex,
const Graph *graph); const Graph *graph);
bool hasNext() { return (next_ != NULL); } bool hasNext() { return (next_ != nullptr); }
Edge *next(); Edge *next();
private: 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 TagGroupIndex tag_group_index_max = (1<<tag_group_index_bits)-1;
static const int slew_annotated_bits = MinMax::index_count * TransRiseFall::index_count; static const int slew_annotated_bits = MinMax::index_count * TransRiseFall::index_count;
enum BfsIndex { // Bit shifts used to mark vertices in a Bfs queue.
bfs_dcalc, enum class BfsIndex { dcalc, arrival, required, other, bits };
bfs_arrival,
bfs_required,
bfs_other
};
static const int bfs_index_bits = bfs_other + 1;
extern const char *bfs_index_names[];
} // namespace } // namespace
#endif #endif

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -67,86 +67,70 @@ typedef Set<LibertyCell*> LibertyCellSet;
typedef Vector<float> FloatSeq; typedef Vector<float> FloatSeq;
typedef Vector<FloatSeq*> FloatTable; typedef Vector<FloatSeq*> FloatTable;
typedef enum { enum class ScaleFactorType : unsigned {
scale_factor_pin_cap, pin_cap,
scale_factor_wire_cap, wire_cap,
scale_factor_wire_res, wire_res,
scale_factor_min_period, min_period,
// Liberty attributes have rise/fall suffix. // Liberty attributes have rise/fall suffix.
scale_factor_cell, cell,
scale_factor_hold, hold,
scale_factor_setup, setup,
scale_factor_recovery, recovery,
scale_factor_removal, removal,
scale_factor_nochange, nochange,
scale_factor_skew, skew,
scale_factor_leakage_power, leakage_power,
scale_factor_internal_power, internal_power,
// Liberty attributes have rise/fall prefix. // Liberty attributes have rise/fall prefix.
scale_factor_transition, transition,
// Liberty attributes have low/high suffix (indexed as rise/fall). // Liberty attributes have low/high suffix (indexed as rise/fall).
scale_factor_min_pulse_width, min_pulse_width,
scale_factor_unknown, unknown,
scale_factor_count };
} ScaleFactorType; const int scale_factor_type_count = int(ScaleFactorType::unknown) + 1;
// Enough bits to hold a ScaleFactorType enum. // Enough bits to hold a ScaleFactorType enum.
const int scale_factor_bits = 4; const int scale_factor_bits = 4;
typedef enum { enum class WireloadTree { worst_case, best_case, balanced, unknown };
wire_load_worst_case_tree,
wire_load_best_case_tree,
wire_load_balanced_tree,
wire_load_unknown_tree
} WireloadTree;
typedef enum { enum class WireloadMode { top, enclosed, segmented, unknown };
wire_load_mode_top,
wire_load_mode_enclosed,
wire_load_mode_segmented,
wire_load_mode_unknown
} WireloadMode;
typedef enum { enum class TimingSense {
timing_sense_positive_unate, positive_unate,
timing_sense_negative_unate, negative_unate,
timing_sense_non_unate, non_unate,
timing_sense_none, none,
timing_sense_unknown unknown
} TimingSense; };
const int timing_sense_count = int(TimingSense::unknown) + 1;
const int timing_sense_bit_count = 3;
typedef enum { enum class TableAxisVariable {
table_axis_total_output_net_capacitance, total_output_net_capacitance,
table_axis_equal_or_opposite_output_net_capacitance, equal_or_opposite_output_net_capacitance,
table_axis_input_net_transition, input_net_transition,
table_axis_input_transition_time, input_transition_time,
table_axis_related_pin_transition, related_pin_transition,
table_axis_constrained_pin_transition, constrained_pin_transition,
table_axis_output_pin_transition, output_pin_transition,
table_axis_connect_delay, connect_delay,
table_axis_related_out_total_output_net_capacitance, related_out_total_output_net_capacitance,
table_axis_time, time,
table_axis_iv_output_voltage, iv_output_voltage,
table_axis_input_noise_width, input_noise_width,
table_axis_input_noise_height, input_noise_height,
table_axis_input_voltage, input_voltage,
table_axis_output_voltage, output_voltage,
table_axis_path_depth, path_depth,
table_axis_path_distance, path_distance,
table_axis_normalized_voltage, normalized_voltage,
table_axis_unknown unknown
} TableAxisVariable; };
typedef enum {
path_type_clk,
path_type_data,
path_type_clk_and_data
} PathType;
enum class PathType { clk, data, clk_and_data };
const int path_type_count = 2; 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. // Rise/fall to rise/fall.
const int timing_arc_index_bit_count = 2; const int timing_arc_index_bit_count = 2;
const int timing_arc_index_max = (1<<timing_arc_index_bit_count)-1; 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, parseFuncExpr(const char *func, LibertyCell *cell, const char *error_msg,
Report *report) Report *report)
{ {
if (func != NULL && func[0] != '\0') { if (func != nullptr && func[0] != '\0') {
LibExprParser parser(func, cell, error_msg, report); LibExprParser parser(func, cell, error_msg, report);
libexpr_parser = &parser; libexpr_parser = &parser;
LibertyExprParse_parse(); LibertyExprParse_parse();
return parser.result(); return parser.result();
} }
else else
return NULL; return nullptr;
} }
LibExprParser::LibExprParser(const char *func, LibertyCell *cell, LibExprParser::LibExprParser(const char *func, LibertyCell *cell,
@ -48,7 +48,7 @@ LibExprParser::LibExprParser(const char *func, LibertyCell *cell,
cell_(cell), cell_(cell),
error_msg_(error_msg), error_msg_(error_msg),
report_(report), report_(report),
result_(NULL), result_(nullptr),
token_length_(100), token_length_(100),
token_(new char[token_length_]), token_(new char[token_length_]),
token_next_(token_) token_next_(token_)
@ -64,7 +64,7 @@ FuncExpr *
LibExprParser::makeFuncExprPort(const char *port_name) LibExprParser::makeFuncExprPort(const char *port_name)
{ {
LibertyPort *port = cell_->findLibertyPort(port_name); LibertyPort *port = cell_->findLibertyPort(port_name);
FuncExpr *expr = NULL; FuncExpr *expr = nullptr;
if (port) if (port)
expr = FuncExpr::makePort(port); expr = FuncExpr::makePort(port);
else else
@ -80,7 +80,7 @@ LibExprParser::makeFuncExprNot(FuncExpr *arg)
if (arg) if (arg)
return FuncExpr::makeNot(arg); return FuncExpr::makeNot(arg);
else else
return NULL; return nullptr;
} }
FuncExpr * FuncExpr *
@ -89,7 +89,7 @@ LibExprParser::makeFuncExprXor(FuncExpr *arg1, FuncExpr *arg2)
if (arg1 && arg2) if (arg1 && arg2)
return FuncExpr::makeXor(arg1, arg2); return FuncExpr::makeXor(arg1, arg2);
else else
return NULL; return nullptr;
} }
FuncExpr * FuncExpr *
@ -98,7 +98,7 @@ LibExprParser::makeFuncExprAnd(FuncExpr *arg1, FuncExpr *arg2)
if (arg1 && arg2) if (arg1 && arg2)
return FuncExpr::makeAnd(arg1, arg2); return FuncExpr::makeAnd(arg1, arg2);
else else
return NULL; return nullptr;
} }
FuncExpr * FuncExpr *
@ -107,7 +107,7 @@ LibExprParser::makeFuncExprOr(FuncExpr *arg1, FuncExpr *arg2)
if (arg1 && arg2) if (arg1 && arg2)
return FuncExpr::makeOr(arg1, arg2); return FuncExpr::makeOr(arg1, arg2);
else else
return NULL; return nullptr;
} }
void void

View File

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

View File

@ -47,21 +47,10 @@ typedef Map<const char *, float, CharPtrLess> LibertyVariableMap;
typedef Map<const char*,LibertyGroupVisitor*,CharPtrLess>LibertyGroupVisitorMap; typedef Map<const char*,LibertyGroupVisitor*,CharPtrLess>LibertyGroupVisitorMap;
typedef LibertyAttrValueSeq::Iterator LibertyAttrValueIterator; typedef LibertyAttrValueSeq::Iterator LibertyAttrValueIterator;
typedef enum { enum class LibertyAttrType { attr_string, attr_int, attr_double,
liberty_attr_string, attr_boolean, attr_unknown };
liberty_attr_int,
liberty_attr_double,
liberty_attr_boolean,
liberty_attr_unknown
} AttrType;
typedef enum { enum class LibertyGroupType { library, cell, pin, timing, unknown };
liberty_group_library,
liberty_group_cell,
liberty_group_pin,
liberty_group_timing,
liberty_group_unknown
} LibertyGroupType;
// Abstract base class for liberty statements. // Abstract base class for liberty statements.
class LibertyStmt class LibertyStmt
@ -254,18 +243,20 @@ class LibertyDefine : public LibertyStmt
public: public:
LibertyDefine(const char *name, LibertyDefine(const char *name,
LibertyGroupType group_type, LibertyGroupType group_type,
AttrType value_type, LibertyAttrType value_type,
int line); int line);
virtual ~LibertyDefine(); virtual ~LibertyDefine();
virtual bool isDefine() const { return true; } virtual bool isDefine() const { return true; }
const char *name() const { return name_; } const char *name() const { return name_; }
LibertyGroupType groupType() const { return group_type_; }
LibertyAttrType valueType() const { return value_type_; }
private: private:
DISALLOW_COPY_AND_ASSIGN(LibertyDefine); DISALLOW_COPY_AND_ASSIGN(LibertyDefine);
const char *name_; const char *name_;
LibertyGroupType group_type_; LibertyGroupType group_type_;
AttrType value_type_; LibertyAttrType value_type_;
}; };
// The Liberty User Guide Version 2003.12 fails to document variables. // 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, findAxisValues(model, in_slew, load_cap, related_out_cap,
axis_value1, axis_value2, axis_value3); axis_value1, axis_value2, axis_value3);
model->reportValue(result_name, library, cell, pvt, model->reportValue(result_name, library, cell, pvt,
axis_value1, NULL, axis_value2, axis_value3, axis_value1, nullptr, axis_value2, axis_value3,
digits, result); digits, result);
} }
} }
@ -258,19 +258,19 @@ GateTableModel::maxCapSlew(const LibertyCell *cell,
TableAxis *axis2 = slew_model_->axis2(); TableAxis *axis2 = slew_model_->axis2();
TableAxis *axis3 = slew_model_->axis3(); TableAxis *axis3 = slew_model_->axis3();
if (axis1 if (axis1
&& axis1->variable() == table_axis_total_output_net_capacitance) { && axis1->variable() == TableAxisVariable::total_output_net_capacitance) {
cap = axis1->axisValue(axis1->size() - 1); cap = axis1->axisValue(axis1->size() - 1);
slew = findValue(library, cell, pvt, slew_model_, slew = findValue(library, cell, pvt, slew_model_,
in_slew, cap, 0.0); in_slew, cap, 0.0);
} }
else if (axis2 else if (axis2
&& axis2->variable()==table_axis_total_output_net_capacitance) { && axis2->variable()==TableAxisVariable::total_output_net_capacitance) {
cap = axis2->axisValue(axis2->size() - 1); cap = axis2->axisValue(axis2->size() - 1);
slew = findValue(library, cell, pvt, slew_model_, slew = findValue(library, cell, pvt, slew_model_,
in_slew, cap, 0.0); in_slew, cap, 0.0);
} }
else if (axis3 else if (axis3
&& axis3->variable()==table_axis_total_output_net_capacitance) { && axis3->variable()==TableAxisVariable::total_output_net_capacitance) {
cap = axis3->axisValue(axis3->size() - 1); cap = axis3->axisValue(axis3->size() - 1);
slew = findValue(library, cell, pvt, slew_model_, slew = findValue(library, cell, pvt, slew_model_,
in_slew, cap, 0.0); in_slew, cap, 0.0);
@ -292,12 +292,12 @@ GateTableModel::axisValue(TableAxis *axis,
float related_out_cap) const float related_out_cap) const
{ {
TableAxisVariable var = axis->variable(); TableAxisVariable var = axis->variable();
if (var == table_axis_input_transition_time if (var == TableAxisVariable::input_transition_time
|| var == table_axis_input_net_transition) || var == TableAxisVariable::input_net_transition)
return in_slew; return in_slew;
else if (var == table_axis_total_output_net_capacitance) else if (var == TableAxisVariable::total_output_net_capacitance)
return load_cap; 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; return related_out_cap;
else { else {
internalError("unsupported table axes"); internalError("unsupported table axes");
@ -325,10 +325,10 @@ bool
GateTableModel::checkAxis(TableAxis *axis) GateTableModel::checkAxis(TableAxis *axis)
{ {
TableAxisVariable var = axis->variable(); TableAxisVariable var = axis->variable();
return var == table_axis_total_output_net_capacitance return var == TableAxisVariable::total_output_net_capacitance
|| var == table_axis_input_transition_time || var == TableAxisVariable::input_transition_time
|| var == table_axis_input_net_transition || var == TableAxisVariable::input_net_transition
|| var == table_axis_related_out_total_output_net_capacitance; || var == TableAxisVariable::related_out_total_output_net_capacitance;
} }
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
@ -498,11 +498,11 @@ CheckTableModel::axisValue(TableAxis *axis,
float related_out_cap) const float related_out_cap) const
{ {
TableAxisVariable var = axis->variable(); TableAxisVariable var = axis->variable();
if (var == table_axis_related_pin_transition) if (var == TableAxisVariable::related_pin_transition)
return from_slew; return from_slew;
else if (var == table_axis_constrained_pin_transition) else if (var == TableAxisVariable::constrained_pin_transition)
return to_slew; 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; return related_out_cap;
else { else {
internalError("unsupported table axes"); internalError("unsupported table axes");
@ -530,9 +530,9 @@ bool
CheckTableModel::checkAxis(TableAxis *axis) CheckTableModel::checkAxis(TableAxis *axis)
{ {
TableAxisVariable var = axis->variable(); TableAxisVariable var = axis->variable();
return var == table_axis_constrained_pin_transition return var == TableAxisVariable::constrained_pin_transition
|| var == table_axis_related_pin_transition || var == TableAxisVariable::related_pin_transition
|| var == table_axis_related_out_total_output_net_capacitance; || var == TableAxisVariable::related_out_total_output_net_capacitance;
} }
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
@ -541,7 +541,7 @@ TableModel::TableModel(Table *table,
ScaleFactorType scale_factor_type, ScaleFactorType scale_factor_type,
TransRiseFall *tr) : TransRiseFall *tr) :
table_(table), table_(table),
scale_factor_type_(scale_factor_type), scale_factor_type_(int(scale_factor_type)),
tr_index_(tr->index()), tr_index_(tr->index()),
is_scaled_(false) is_scaled_(false)
{ {
@ -561,7 +561,7 @@ TableModel::order() const
void void
TableModel::setScaleFactorType(ScaleFactorType type) TableModel::setScaleFactorType(ScaleFactorType type)
{ {
scale_factor_type_ = type; scale_factor_type_ = int(type);
} }
void void
@ -609,10 +609,9 @@ TableModel::scaleFactor(const LibertyLibrary *library,
// Scaled tables are not derated because scale factors are wrt // Scaled tables are not derated because scale factors are wrt
// nominal pvt. // nominal pvt.
return 1.0F; return 1.0F;
else { else
ScaleFactorType type = static_cast<ScaleFactorType>(scale_factor_type_); return library->scaleFactor(static_cast<ScaleFactorType>(scale_factor_type_),
return library->scaleFactor(type, tr_index_, cell, pvt); tr_index_, cell, pvt);
}
} }
void void
@ -647,7 +646,7 @@ reportPvt(const LibertyLibrary *library,
int digits, int digits,
string *result) string *result)
{ {
if (pvt == NULL) if (pvt == nullptr)
pvt = library->defaultOperatingConditions(); pvt = library->defaultOperatingConditions();
if (pvt) { if (pvt) {
string pvt_str; string pvt_str;
@ -666,7 +665,7 @@ TableModel::reportPvtScaleFactor(const LibertyLibrary *library,
int digits, int digits,
string *result) const string *result) const
{ {
if (pvt == NULL) if (pvt == nullptr)
pvt = library->defaultOperatingConditions(); pvt = library->defaultOperatingConditions();
if (pvt) { if (pvt) {
string scale_str; string scale_str;
@ -1332,74 +1331,74 @@ TableAxisVariable
stringTableAxisVariable(const char *variable) stringTableAxisVariable(const char *variable)
{ {
if (stringEq(variable, "total_output_net_capacitance")) 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")) 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")) 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")) 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")) 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")) 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")) else if (stringEq(variable, "output_pin_transition"))
return table_axis_output_pin_transition; return TableAxisVariable::output_pin_transition;
else if (stringEq(variable, "connect_delay")) 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")) 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")) else if (stringEq(variable, "time"))
return table_axis_time; return TableAxisVariable::time;
else if (stringEq(variable, "iv_output_voltage")) 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")) 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")) else if (stringEq(variable, "input_noise_height"))
return table_axis_input_noise_height; return TableAxisVariable::input_noise_height;
else if (stringEq(variable, "input_voltage")) else if (stringEq(variable, "input_voltage"))
return table_axis_input_voltage; return TableAxisVariable::input_voltage;
else if (stringEq(variable, "output_voltage")) else if (stringEq(variable, "output_voltage"))
return table_axis_output_voltage; return TableAxisVariable::output_voltage;
else if (stringEq(variable, "path_depth")) else if (stringEq(variable, "path_depth"))
return table_axis_path_depth; return TableAxisVariable::path_depth;
else if (stringEq(variable, "path_distance")) else if (stringEq(variable, "path_distance"))
return table_axis_path_distance; return TableAxisVariable::path_distance;
else if (stringEq(variable, "normalzied_voltage")) else if (stringEq(variable, "normalzied_voltage"))
return table_axis_normalized_voltage; return TableAxisVariable::normalized_voltage;
else else
return table_axis_unknown; return TableAxisVariable::unknown;
} }
const char * const char *
tableVariableString(TableAxisVariable variable) tableVariableString(TableAxisVariable variable)
{ {
switch (variable) { switch (variable) {
case table_axis_total_output_net_capacitance: case TableAxisVariable::total_output_net_capacitance:
return "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"; return "equal_or_opposite_output_net_capacitance";
case table_axis_input_net_transition: case TableAxisVariable::input_net_transition:
return "input_net_transition"; return "input_net_transition";
case table_axis_input_transition_time: case TableAxisVariable::input_transition_time:
return "input_transition_time"; return "input_transition_time";
case table_axis_related_pin_transition: case TableAxisVariable::related_pin_transition:
return "related_pin_transition"; return "related_pin_transition";
case table_axis_constrained_pin_transition: case TableAxisVariable::constrained_pin_transition:
return "constrained_pin_transition"; return "constrained_pin_transition";
case table_axis_output_pin_transition: case TableAxisVariable::output_pin_transition:
return "output_pin_transition"; return "output_pin_transition";
case table_axis_connect_delay: case TableAxisVariable::connect_delay:
return "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"; return "related_out_total_output_net_capacitance";
case table_axis_time: case TableAxisVariable::time:
return "time"; return "time";
case table_axis_iv_output_voltage: case TableAxisVariable::iv_output_voltage:
return "iv_output_voltage"; return "iv_output_voltage";
case table_axis_input_noise_width: case TableAxisVariable::input_noise_width:
return "input_noise_width"; return "input_noise_width";
case table_axis_input_noise_height: case TableAxisVariable::input_noise_height:
return "input_noise_height"; return "input_noise_height";
default: default:
return "unknown"; return "unknown";
@ -1411,33 +1410,33 @@ tableVariableUnit(TableAxisVariable variable,
const Units *units) const Units *units)
{ {
switch (variable) { switch (variable) {
case table_axis_total_output_net_capacitance: case TableAxisVariable::total_output_net_capacitance:
case table_axis_related_out_total_output_net_capacitance: case TableAxisVariable::related_out_total_output_net_capacitance:
case table_axis_equal_or_opposite_output_net_capacitance: case TableAxisVariable::equal_or_opposite_output_net_capacitance:
return units->capacitanceUnit(); return units->capacitanceUnit();
case table_axis_input_net_transition: case TableAxisVariable::input_net_transition:
case table_axis_input_transition_time: case TableAxisVariable::input_transition_time:
case table_axis_related_pin_transition: case TableAxisVariable::related_pin_transition:
case table_axis_constrained_pin_transition: case TableAxisVariable::constrained_pin_transition:
case table_axis_output_pin_transition: case TableAxisVariable::output_pin_transition:
case table_axis_connect_delay: case TableAxisVariable::connect_delay:
case table_axis_time: case TableAxisVariable::time:
case table_axis_input_noise_height: case TableAxisVariable::input_noise_height:
return units->timeUnit(); return units->timeUnit();
case table_axis_input_voltage: case TableAxisVariable::input_voltage:
case table_axis_output_voltage: case TableAxisVariable::output_voltage:
case table_axis_iv_output_voltage: case TableAxisVariable::iv_output_voltage:
case table_axis_input_noise_width: case TableAxisVariable::input_noise_width:
return units->voltageUnit(); return units->voltageUnit();
case table_axis_path_distance: case TableAxisVariable::path_distance:
return units->distanceUnit(); return units->distanceUnit();
case table_axis_path_depth: case TableAxisVariable::path_depth:
case table_axis_normalized_voltage: case TableAxisVariable::normalized_voltage:
case table_axis_unknown: case TableAxisVariable::unknown:
return units->scalarUnit(); return units->scalarUnit();
} }
// Prevent warnings from lame compilers. // Prevent warnings from lame compilers.
return NULL; return nullptr;
} }
} // namespace } // namespace

View File

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

View File

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

View File

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

View File

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

View File

@ -87,7 +87,7 @@ private:
bool is_timing_check, bool is_timing_check,
bool is_non_seq_check, bool is_non_seq_check,
MinMax *path_min_max, 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, TimingRole *generic_role,
int index); int index);
DISALLOW_COPY_AND_ASSIGN(TimingRole); DISALLOW_COPY_AND_ASSIGN(TimingRole);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -309,6 +309,8 @@ CycleAccting::targetTimeOffset(const TimingRole *check_role)
return targetCycle(check_role) * tgt_->clock()->period(); return targetCycle(check_role) * tgt_->clock()->period();
} }
////////////////////////////////////////////////////////////////
bool bool
CycleAcctingLess::operator()(const CycleAccting *acct1, CycleAcctingLess::operator()(const CycleAccting *acct1,
const CycleAccting *acct2) const const CycleAccting *acct2) const
@ -321,4 +323,18 @@ CycleAcctingLess::operator()(const CycleAccting *acct1,
&& acct1->target()->index() < acct2->target()->index()); && 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 } // namespace

View File

@ -88,5 +88,18 @@ public:
const CycleAccting *acct2) const; 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 } // namespace
#endif #endif

View File

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

View File

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

View File

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

View File

@ -113,7 +113,7 @@ public:
virtual bool useEndClk() const { return false; } virtual bool useEndClk() const { return false; }
virtual int pathMultiplier() const { return 0; } virtual int pathMultiplier() const { return 0; }
virtual float delay() const { return 0.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 isDefault() const { return false; }
virtual bool ignoreClkLatency() { return false; } virtual bool ignoreClkLatency() { return false; }
@ -156,7 +156,7 @@ public:
ExceptionTo *to, ExceptionTo *to,
bool own_pts); bool own_pts);
virtual bool isFalse() const { return true; } 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 const char *typeString() const;
virtual bool mergeable(ExceptionPath *exception) const; virtual bool mergeable(ExceptionPath *exception) const;
virtual bool overrides(ExceptionPath *exception) const; virtual bool overrides(ExceptionPath *exception) const;
@ -175,7 +175,7 @@ public:
LoopPath(ExceptionThruSeq *thrus, LoopPath(ExceptionThruSeq *thrus,
bool own_pts); bool own_pts);
virtual bool isLoop() const { return true; } 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 const char *typeString() const;
virtual bool mergeable(ExceptionPath *exception) const; virtual bool mergeable(ExceptionPath *exception) const;
@ -200,7 +200,7 @@ public:
ExceptionTo *to, ExceptionTo *to,
bool own_pts); bool own_pts);
virtual bool isPathDelay() const { return true; } 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 *asString(const Network *network) const;
virtual const char *typeString() const; virtual const char *typeString() const;
virtual bool mergeable(ExceptionPath *exception) const; virtual bool mergeable(ExceptionPath *exception) const;
@ -235,7 +235,7 @@ public:
ExceptionTo *to, ExceptionTo *to,
bool own_pts); bool own_pts);
virtual bool isMultiCycle() const { return true; } 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, virtual bool matches(const MinMax *min_max,
bool exactly) const; bool exactly) const;
virtual const char *asString(const Network *network) const; virtual const char *asString(const Network *network) const;
@ -272,7 +272,7 @@ public:
ExceptionTo *to, ExceptionTo *to,
bool own_pts); bool own_pts);
virtual bool isFilter() const { return true; } 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 const char *typeString() const;
virtual bool mergeable(ExceptionPath *exception) const; virtual bool mergeable(ExceptionPath *exception) const;
virtual bool overrides(ExceptionPath *exception) const; virtual bool overrides(ExceptionPath *exception) const;
@ -303,7 +303,7 @@ public:
ExceptionTo *to, ExceptionTo *to,
bool own_pts); bool own_pts);
virtual bool isGroupPath() const { return true; } 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 const char *typeString() const;
virtual bool mergeable(ExceptionPath *exception) const; virtual bool mergeable(ExceptionPath *exception) const;
virtual bool overrides(ExceptionPath *exception) const; virtual bool overrides(ExceptionPath *exception) const;
@ -388,8 +388,8 @@ public:
bool hasClocks() const; bool hasClocks() const;
InstanceSet *instances() { return insts_; } InstanceSet *instances() { return insts_; }
bool hasInstances() const; bool hasInstances() const;
virtual NetSet *nets() { return NULL; } virtual NetSet *nets() { return nullptr; }
virtual EdgePinsSet *edges() { return NULL; } virtual EdgePinsSet *edges() { return nullptr; }
bool hasObjects() const; bool hasObjects() const;
void deleteObjects(ExceptionFromTo *pt); void deleteObjects(ExceptionFromTo *pt);
virtual void allPins(const Network *network, virtual void allPins(const Network *network,
@ -509,7 +509,7 @@ public:
EdgePinsSet *edges() { return edges_; } EdgePinsSet *edges() { return edges_; }
NetSet *nets() { return nets_; } NetSet *nets() { return nets_; }
InstanceSet *instances() { return insts_; } InstanceSet *instances() { return insts_; }
virtual ClockSet *clks() { return NULL; } virtual ClockSet *clks() { return nullptr; }
bool hasObjects() const; bool hasObjects() const;
void deleteObjects(ExceptionThru *pt); void deleteObjects(ExceptionThru *pt);
virtual void allPins(const Network *network, virtual void allPins(const Network *network,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -40,7 +40,7 @@ class Corner;
// If incremental_only is true non-incremental annoatations are ignored. // If incremental_only is true non-incremental annoatations are ignored.
// //
// path is a hierararchial path prefix for instances and pins in the // 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 // The cond_use option is used when the SDF file contains conditional
// delays and the library does not have conditional delay arcs. If // delays and the library does not have conditional delay arcs. If

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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