Dmp cleanup

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry 2026-04-03 16:46:05 -07:00
parent 6bb888b218
commit 2f85fdfee3
6 changed files with 348 additions and 537 deletions

View File

@ -445,14 +445,13 @@ CcsCeffDelayCalc::findVlTime(double v,
{ {
double t_init = region_ramp_times_[0]; double t_init = region_ramp_times_[0];
double t_final = region_ramp_times_[region_count_]; double t_final = region_ramp_times_[region_count_];
bool root_fail = false; auto [time, failed] =
double time = findRoot( findRoot([&](double t, double &y, double &dy) {
[&](double t, double &y, double &dy) {
vl(t, elmore, y, dy); vl(t, elmore, y, dy);
y -= v; y -= v;
}, },
t_init, t_final + elmore * 3.0, .001, 20, root_fail); t_init, t_final + elmore * 3.0, .001, 20);
vl_fail_ |= root_fail; vl_fail_ |= failed;
return time; return time;
} }

File diff suppressed because it is too large Load Diff

View File

@ -24,6 +24,9 @@
#pragma once #pragma once
#include <optional>
#include <utility>
#include "LibertyClass.hh" #include "LibertyClass.hh"
#include "LumpedCapDelayCalc.hh" #include "LumpedCapDelayCalc.hh"
@ -71,13 +74,10 @@ protected:
// Return values. // Return values.
double &wire_delay, double &wire_delay,
double &load_slew) = 0; double &load_slew) = 0;
void gateDelaySlew(// Return values. std::pair<double, double> gateDelaySlew();
double &delay, std::optional<std::pair<double, double>>
double &slew); loadDelaySlewElmore(const Pin *load_pin,
void loadDelaySlewElmore(const Pin *load_pin, double elmore);
double elmore,
double &delay,
double &slew);
// Select the appropriate special case Dartu/Menezes/Pileggi algorithm. // Select the appropriate special case Dartu/Menezes/Pileggi algorithm.
void setCeffAlgorithm(const LibertyLibrary *library, void setCeffAlgorithm(const LibertyLibrary *library,
const LibertyCell *cell, const LibertyCell *cell,

View File

@ -125,8 +125,12 @@ DmpCeffElmoreDelayCalc::loadDelaySlew(const Pin *load_pin,
float elmore = 0.0; float elmore = 0.0;
if (parasitic) if (parasitic)
parasitics_->findElmore(parasitic, load_pin, elmore, elmore_exists); parasitics_->findElmore(parasitic, load_pin, elmore, elmore_exists);
if (elmore_exists) if (elmore_exists) {
loadDelaySlewElmore(load_pin, elmore, wire_delay, load_slew); if (auto r = loadDelaySlewElmore(load_pin, elmore)) {
wire_delay = r->first;
load_slew = r->second;
}
}
thresholdAdjust(load_pin, drvr_library, rf, wire_delay, load_slew); thresholdAdjust(load_pin, drvr_library, rf, wire_delay, load_slew);
} }

View File

@ -28,47 +28,38 @@
namespace sta { namespace sta {
double std::pair<double, bool>
findRoot(FindRootFunc func, findRoot(FindRootFunc func,
double x1, double x1,
double x2, double x2,
double x_tol, double x_tol,
int max_iter, int max_iter)
// Return value.
bool &fail)
{ {
double y1, y2, dy1; double y1, y2, dy1;
func(x1, y1, dy1); func(x1, y1, dy1);
func(x2, y2, dy1); func(x2, y2, dy1);
return findRoot(func, x1, y1, x2, y2, x_tol, max_iter, fail); return findRoot(func, x1, y1, x2, y2, x_tol, max_iter);
} }
double std::pair<double, bool>
findRoot(FindRootFunc func, findRoot(FindRootFunc func,
double x1, double x1,
double y1, double y1,
double x2, double x2,
double y2, double y2,
double x_tol, double x_tol,
int max_iter, int max_iter)
// Return value.
bool &fail)
{ {
if ((y1 > 0.0 && y2 > 0.0) || (y1 < 0.0 && y2 < 0.0)) { if ((y1 > 0.0 && y2 > 0.0) || (y1 < 0.0 && y2 < 0.0)) {
// Initial bounds do not surround a root. // Initial bounds do not surround a root.
fail = true; return {0.0, true};
return 0.0;
} }
if (y1 == 0.0) { if (y1 == 0.0)
fail = false; return {x1, false};
return x1;
}
if (y2 == 0.0) { if (y2 == 0.0)
fail = false; return {x2, false};
return x2;
}
if (y1 > 0.0) if (y1 > 0.0)
// Swap x1/x2 so func(x1) < 0. // Swap x1/x2 so func(x1) < 0.
@ -95,8 +86,7 @@ findRoot(FindRootFunc func,
} }
if (std::abs(dx) <= x_tol * std::abs(root)) { if (std::abs(dx) <= x_tol * std::abs(root)) {
// Converged. // Converged.
fail = false; return {root, false};
return root;
} }
func(root, y, dy); func(root, y, dy);
@ -105,8 +95,7 @@ findRoot(FindRootFunc func,
else else
x2 = root; x2 = root;
} }
fail = true; return {root, true};
return root;
} }
} // namespace } // namespace

View File

@ -25,6 +25,7 @@
#pragma once #pragma once
#include <functional> #include <functional>
#include <utility>
namespace sta { namespace sta {
@ -33,24 +34,22 @@ using FindRootFunc = const std::function<void (double x,
double &y, double &y,
double &dy)>; double &dy)>;
double // first: root estimate; second: true if the search failed.
std::pair<double, bool>
findRoot(FindRootFunc func, findRoot(FindRootFunc func,
double x1, double x1,
double x2, double x2,
double x_tol, double x_tol,
int max_iter, int max_iter);
// Return value.
bool &fail);
double // first: root estimate; second: true if the search failed.
std::pair<double, bool>
findRoot(FindRootFunc func, findRoot(FindRootFunc func,
double x1, double x1,
double y1, double y1,
double x2, double x2,
double y2, double y2,
double x_tol, double x_tol,
int max_iter, int max_iter);
// Return value.
bool &fail);
} // namespace } // namespace