Dmp cleanup
Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
parent
6bb888b218
commit
2f85fdfee3
|
|
@ -445,14 +445,13 @@ CcsCeffDelayCalc::findVlTime(double v,
|
|||
{
|
||||
double t_init = region_ramp_times_[0];
|
||||
double t_final = region_ramp_times_[region_count_];
|
||||
bool root_fail = false;
|
||||
double time = findRoot(
|
||||
[&](double t, double &y, double &dy) {
|
||||
vl(t, elmore, y, dy);
|
||||
y -= v;
|
||||
},
|
||||
t_init, t_final + elmore * 3.0, .001, 20, root_fail);
|
||||
vl_fail_ |= root_fail;
|
||||
auto [time, failed] =
|
||||
findRoot([&](double t, double &y, double &dy) {
|
||||
vl(t, elmore, y, dy);
|
||||
y -= v;
|
||||
},
|
||||
t_init, t_final + elmore * 3.0, .001, 20);
|
||||
vl_fail_ |= failed;
|
||||
return time;
|
||||
}
|
||||
|
||||
|
|
|
|||
798
dcalc/DmpCeff.cc
798
dcalc/DmpCeff.cc
File diff suppressed because it is too large
Load Diff
|
|
@ -24,6 +24,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
|
||||
#include "LibertyClass.hh"
|
||||
#include "LumpedCapDelayCalc.hh"
|
||||
|
||||
|
|
@ -71,13 +74,10 @@ protected:
|
|||
// Return values.
|
||||
double &wire_delay,
|
||||
double &load_slew) = 0;
|
||||
void gateDelaySlew(// Return values.
|
||||
double &delay,
|
||||
double &slew);
|
||||
void loadDelaySlewElmore(const Pin *load_pin,
|
||||
double elmore,
|
||||
double &delay,
|
||||
double &slew);
|
||||
std::pair<double, double> gateDelaySlew();
|
||||
std::optional<std::pair<double, double>>
|
||||
loadDelaySlewElmore(const Pin *load_pin,
|
||||
double elmore);
|
||||
// Select the appropriate special case Dartu/Menezes/Pileggi algorithm.
|
||||
void setCeffAlgorithm(const LibertyLibrary *library,
|
||||
const LibertyCell *cell,
|
||||
|
|
|
|||
|
|
@ -125,8 +125,12 @@ DmpCeffElmoreDelayCalc::loadDelaySlew(const Pin *load_pin,
|
|||
float elmore = 0.0;
|
||||
if (parasitic)
|
||||
parasitics_->findElmore(parasitic, load_pin, elmore, elmore_exists);
|
||||
if (elmore_exists)
|
||||
loadDelaySlewElmore(load_pin, elmore, wire_delay, load_slew);
|
||||
if (elmore_exists) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,47 +28,38 @@
|
|||
|
||||
namespace sta {
|
||||
|
||||
double
|
||||
std::pair<double, bool>
|
||||
findRoot(FindRootFunc func,
|
||||
double x1,
|
||||
double x2,
|
||||
double x_tol,
|
||||
int max_iter,
|
||||
// Return value.
|
||||
bool &fail)
|
||||
int max_iter)
|
||||
{
|
||||
double y1, y2, dy1;
|
||||
func(x1, y1, 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,
|
||||
double x1,
|
||||
double y1,
|
||||
double x2,
|
||||
double y2,
|
||||
double x_tol,
|
||||
int max_iter,
|
||||
// Return value.
|
||||
bool &fail)
|
||||
int max_iter)
|
||||
{
|
||||
if ((y1 > 0.0 && y2 > 0.0) || (y1 < 0.0 && y2 < 0.0)) {
|
||||
// Initial bounds do not surround a root.
|
||||
fail = true;
|
||||
return 0.0;
|
||||
return {0.0, true};
|
||||
}
|
||||
|
||||
if (y1 == 0.0) {
|
||||
fail = false;
|
||||
return x1;
|
||||
}
|
||||
if (y1 == 0.0)
|
||||
return {x1, false};
|
||||
|
||||
if (y2 == 0.0) {
|
||||
fail = false;
|
||||
return x2;
|
||||
}
|
||||
if (y2 == 0.0)
|
||||
return {x2, false};
|
||||
|
||||
if (y1 > 0.0)
|
||||
// Swap x1/x2 so func(x1) < 0.
|
||||
|
|
@ -95,8 +86,7 @@ findRoot(FindRootFunc func,
|
|||
}
|
||||
if (std::abs(dx) <= x_tol * std::abs(root)) {
|
||||
// Converged.
|
||||
fail = false;
|
||||
return root;
|
||||
return {root, false};
|
||||
}
|
||||
|
||||
func(root, y, dy);
|
||||
|
|
@ -105,8 +95,7 @@ findRoot(FindRootFunc func,
|
|||
else
|
||||
x2 = root;
|
||||
}
|
||||
fail = true;
|
||||
return root;
|
||||
return {root, true};
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <utility>
|
||||
|
||||
namespace sta {
|
||||
|
||||
|
|
@ -33,24 +34,22 @@ using FindRootFunc = const std::function<void (double x,
|
|||
double &y,
|
||||
double &dy)>;
|
||||
|
||||
double
|
||||
// first: root estimate; second: true if the search failed.
|
||||
std::pair<double, bool>
|
||||
findRoot(FindRootFunc func,
|
||||
double x1,
|
||||
double x2,
|
||||
double x_tol,
|
||||
int max_iter,
|
||||
// Return value.
|
||||
bool &fail);
|
||||
int max_iter);
|
||||
|
||||
double
|
||||
// first: root estimate; second: true if the search failed.
|
||||
std::pair<double, bool>
|
||||
findRoot(FindRootFunc func,
|
||||
double x1,
|
||||
double y1,
|
||||
double x2,
|
||||
double y2,
|
||||
double x_tol,
|
||||
int max_iter,
|
||||
// Return value.
|
||||
bool &fail);
|
||||
int max_iter);
|
||||
|
||||
} // namespace
|
||||
|
|
|
|||
Loading…
Reference in New Issue