From b9e439f41c1d3c8b5165378c36bf310f279115ee Mon Sep 17 00:00:00 2001 From: James Cherry Date: Tue, 24 Mar 2026 18:42:47 -0700 Subject: [PATCH] delay calc clip delay to 0.0 resolves #405 Signed-off-by: James Cherry --- dcalc/DmpCeff.cc | 14 +++++++------- dcalc/GraphDelayCalc.cc | 34 +++++++++++++++++----------------- liberty/TableModel.cc | 4 +++- 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/dcalc/DmpCeff.cc b/dcalc/DmpCeff.cc index 38c04648..1cccadaf 100644 --- a/dcalc/DmpCeff.cc +++ b/dcalc/DmpCeff.cc @@ -448,10 +448,10 @@ DmpAlg::showJacobian() { std::string line = " "; for (int j = 0; j < nr_order_; j++) - line += sta::format("{:12}", dmp_param_index_strings[j]); + line += sta::format("{:>12}", dmp_param_index_strings[j]); report_->reportLine(line); - line.clear(); for (int i = 0; i < nr_order_; i++) { + line.clear(); line += sta::format("{:4} ", dmp_func_index_strings[i]); for (int j = 0; j < nr_order_; j++) line += sta::format("{:12.3e} ", fjac_[i][j]); @@ -551,10 +551,10 @@ DmpAlg::loadDelaySlew(const Pin *, // Use the driver thresholds and rely on thresholdAdjust to // convert the delay and slew to the load's thresholds. try { - if (debug_->check("dmp_ceff", 4)) - showVl(); elmore_ = elmore; p3_ = 1.0 / elmore; + if (debug_->check("dmp_ceff", 4)) + showVl(); double t_lower = t0_; double t_upper = vlCrossingUpperBound(); double load_delay = findVlCrossing(vth_, t_lower, t_upper); @@ -1189,9 +1189,9 @@ DmpZeroC2::init(const LibertyLibrary *drvr_library, } void -DmpZeroC2::gateDelaySlew( // Return values. - double &delay, - double &slew) +DmpZeroC2::gateDelaySlew(// Return values. + double &delay, + double &slew) { try { findDriverParams(c1_); diff --git a/dcalc/GraphDelayCalc.cc b/dcalc/GraphDelayCalc.cc index 8c12cdf1..9c95ed1b 100644 --- a/dcalc/GraphDelayCalc.cc +++ b/dcalc/GraphDelayCalc.cc @@ -411,27 +411,27 @@ GraphDelayCalc::seedDrvrSlew(Vertex *drvr_vertex, for (const MinMax *min_max : MinMax::range()) { for (const RiseFall *rf : RiseFall::range()) { InputDrive *drive = nullptr; - if (network_->isTopLevelPort(drvr_pin)) { - Port *port = network_->port(drvr_pin); + if (network_->isTopLevelPort(drvr_pin)) { + Port *port = network_->port(drvr_pin); drive = sdc->findInputDrive(port); - } - if (drive) { - const LibertyCell *drvr_cell; - const LibertyPort *from_port, *to_port; - float *from_slews; + } + if (drive) { + const LibertyCell *drvr_cell; + const LibertyPort *from_port, *to_port; + float *from_slews; drive->driveCell(rf, min_max, drvr_cell, from_port, - from_slews, to_port); - if (drvr_cell) { - if (from_port == nullptr) - from_port = driveCellDefaultFromPort(drvr_cell, to_port); - findInputDriverDelay(drvr_cell, drvr_pin, drvr_vertex, rf, + from_slews, to_port); + if (drvr_cell) { + if (from_port == nullptr) + from_port = driveCellDefaultFromPort(drvr_cell, to_port); + findInputDriverDelay(drvr_cell, drvr_pin, drvr_vertex, rf, from_port, from_slews, to_port, scene, min_max); - } - else + } + else seedNoDrvrCellSlew(drvr_vertex, drvr_pin, rf, drive, scene, min_max, - arc_delay_calc); - } - else + arc_delay_calc); + } + else seedNoDrvrSlew(drvr_vertex, drvr_pin, rf, scene, min_max, arc_delay_calc); } } diff --git a/liberty/TableModel.cc b/liberty/TableModel.cc index 46dd6d6b..c3e8856f 100644 --- a/liberty/TableModel.cc +++ b/liberty/TableModel.cc @@ -116,7 +116,9 @@ GateTableModel::gateDelay(const Pvt *pvt, drvr_slew = findValue(pvt, slew_models_->model(), in_slew, load_cap, 0.0); else drvr_slew = 0.0; - // Clip negative slews to zero. + // Clip negative delays and slews to zero. + if (gate_delay < 0.0) + gate_delay = 0.0; if (drvr_slew < 0.0) drvr_slew = 0.0; }