latest STA plus changes to fix prima dcalc and read_spef issues, TCL regression added

Signed-off-by: dsengupta0628 <dsengupta@precisioninno.com>
This commit is contained in:
dsengupta0628 2026-04-07 20:48:15 +00:00
commit 371b85cd20
19 changed files with 340 additions and 182 deletions

View File

@ -931,17 +931,20 @@ std::string
PrimaDelayCalc::reportGateDelay(const Pin *drvr_pin,
const TimingArc *arc,
const Slew &in_slew,
float,
const Parasitic *,
const LoadPinIndexMap &,
float load_cap,
const Parasitic *parasitic,
const LoadPinIndexMap &load_pin_index_map,
const Scene *scene,
const MinMax *min_max,
int digits)
{
GateTimingModel *model = arc->gateModel(scene, min_max);
if (model) {
// Delay calc to find ceff.
gateDelay(drvr_pin, arc, in_slew, load_cap, parasitic,
load_pin_index_map, scene, min_max);
float in_slew1 = delayAsFloat(in_slew);
float ceff = ceff_vth_[0];
float ceff = ceff_vth_.empty() ? load_cap : ceff_vth_[0];
return model->reportGateDelay(pinPvt(drvr_pin, scene, min_max),
in_slew1, ceff, min_max,
PocvMode::scalar, digits);

View File

@ -1 +1,6 @@
sta_module_tests("dcalc"
TESTS
prima_report
)
add_subdirectory(cpp)

View File

@ -166,9 +166,8 @@ TEST_F(FindRootAdditionalTest, RootAtX1) {
y = x - 5.0;
dy = 1.0;
};
bool fail = false;
// y1 = 5-5 = 0, y2 = 10-5 = 5
double root = findRoot(func, 5.0, 0.0, 10.0, 5.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 5.0, 0.0, 10.0, 5.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 5.0, 1e-8);
}
@ -179,9 +178,8 @@ TEST_F(FindRootAdditionalTest, RootAtX2) {
y = x - 5.0;
dy = 1.0;
};
bool fail = false;
// y1 = 0-5 = -5, y2 = 5-5 = 0
double root = findRoot(func, 0.0, -5.0, 5.0, 0.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 0.0, -5.0, 5.0, 0.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 5.0, 1e-8);
}
@ -192,9 +190,8 @@ TEST_F(FindRootAdditionalTest, BothPositiveFails) {
y = x * x + 1.0;
dy = 2.0 * x;
};
bool fail = false;
// y1 = 2, y2 = 5 -- both positive
findRoot(func, 1.0, 2.0, 2.0, 5.0, 1e-10, 100, fail);
auto [root_, fail] = findRoot(func, 1.0, 2.0, 2.0, 5.0, 1e-10, 100);
EXPECT_TRUE(fail);
}
@ -204,8 +201,7 @@ TEST_F(FindRootAdditionalTest, BothNegativeFails) {
y = -x * x - 1.0;
dy = -2.0 * x;
};
bool fail = false;
findRoot(func, 1.0, -2.0, 2.0, -5.0, 1e-10, 100, fail);
auto [root_, fail] = findRoot(func, 1.0, -2.0, 2.0, -5.0, 1e-10, 100);
EXPECT_TRUE(fail);
}
@ -215,9 +211,8 @@ TEST_F(FindRootAdditionalTest, MaxIterationsExceeded) {
y = x * x - 2.0;
dy = 2.0 * x;
};
bool fail = false;
// Very tight tolerance with only 1 iteration
findRoot(func, 0.0, 3.0, 1e-15, 1, fail);
auto [root_, fail] = findRoot(func, 0.0, 3.0, 1e-15, 1);
EXPECT_TRUE(fail);
}
@ -227,9 +222,8 @@ TEST_F(FindRootAdditionalTest, SwapWhenY1Positive) {
y = x - 3.0;
dy = 1.0;
};
bool fail = false;
// y1 = 2.0 > 0, y2 = -2.0 < 0 => swap internally
double root = findRoot(func, 5.0, 2.0, 1.0, -2.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 5.0, 2.0, 1.0, -2.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 3.0, 1e-8);
}
@ -240,8 +234,7 @@ TEST_F(FindRootAdditionalTest, CubicRoot) {
y = x * x * x - 8.0;
dy = 3.0 * x * x;
};
bool fail = false;
double root = findRoot(func, 1.0, 3.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 1.0, 3.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 2.0, 1e-8);
}
@ -252,8 +245,7 @@ TEST_F(FindRootAdditionalTest, TwoArgOverloadCubic) {
y = x * x * x - 27.0;
dy = 3.0 * x * x;
};
bool fail = false;
double root = findRoot(func, 2.0, 4.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 2.0, 4.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 3.0, 1e-8);
}
@ -1503,9 +1495,8 @@ TEST_F(FindRootAdditionalTest, FlatDerivative) {
y = (x - 2.0) * (x - 2.0) * (x - 2.0);
dy = 3.0 * (x - 2.0) * (x - 2.0);
};
bool fail = false;
// y at x=1 = -1, y at x=3 = 1
double root = findRoot(func, 1.0, 3.0, 1e-8, 100, fail);
auto [root, fail] = findRoot(func, 1.0, 3.0, 1e-8, 100);
if (!fail) {
EXPECT_NEAR(root, 2.0, 1e-4);
}
@ -1517,8 +1508,7 @@ TEST_F(FindRootAdditionalTest, LinearFunction) {
y = 2.0 * x - 6.0;
dy = 2.0;
};
bool fail = false;
double root = findRoot(func, 0.0, 10.0, 1e-12, 100, fail);
auto [root, fail] = findRoot(func, 0.0, 10.0, 1e-12, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 3.0, 1e-8);
}
@ -1529,9 +1519,8 @@ TEST_F(FindRootAdditionalTest, FourArgNormalBracket) {
y = x * x - 4.0;
dy = 2.0 * x;
};
bool fail = false;
// y1 = 1-4 = -3, y2 = 9-4 = 5
double root = findRoot(func, 1.0, -3.0, 3.0, 5.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 1.0, -3.0, 3.0, 5.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 2.0, 1e-8);
}
@ -2092,9 +2081,8 @@ TEST_F(FindRootAdditionalTest, TightBoundsLinear) {
y = 2.0 * x - 6.0;
dy = 2.0;
};
bool fail = false;
// y1 = 2*2.9-6 = -0.2, y2 = 2*3.1-6 = 0.2
double root = findRoot(func, 2.9, -0.2, 3.1, 0.2, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 2.9, -0.2, 3.1, 0.2, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 3.0, 1e-8);
}
@ -2106,8 +2094,7 @@ TEST_F(FindRootAdditionalTest, NewtonOutOfBracket) {
y = x * x * x - x - 2.0;
dy = 3.0 * x * x - 1.0;
};
bool fail = false;
double root = findRoot(func, 1.0, 2.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 1.0, 2.0, 1e-10, 100);
EXPECT_FALSE(fail);
// Root is near 1.52138
EXPECT_NEAR(root, 1.52138, 1e-4);
@ -2119,9 +2106,8 @@ TEST_F(FindRootAdditionalTest, SinRoot) {
y = sin(x);
dy = cos(x);
};
bool fail = false;
// Root near pi
double root = findRoot(func, 3.0, 3.3, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 3.0, 3.3, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, M_PI, 1e-8);
}
@ -2132,8 +2118,7 @@ TEST_F(FindRootAdditionalTest, ExpMinusConst) {
y = exp(x) - 3.0;
dy = exp(x);
};
bool fail = false;
double root = findRoot(func, 0.0, 2.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 0.0, 2.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, log(3.0), 1e-8);
}
@ -2395,8 +2380,7 @@ TEST_F(FindRootAdditionalTest, QuadraticExact) {
y = x * x - 4.0;
dy = 2.0 * x;
};
bool fail = false;
double root = findRoot(func, 1.0, 3.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 1.0, 3.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 2.0, 1e-8);
}
@ -2407,9 +2391,8 @@ TEST_F(FindRootAdditionalTest, QuadraticFourArg) {
y = x * x - 9.0;
dy = 2.0 * x;
};
bool fail = false;
// y(2.5) = 6.25-9 = -2.75, y(3.5) = 12.25-9 = 3.25
double root = findRoot(func, 2.5, -2.75, 3.5, 3.25, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 2.5, -2.75, 3.5, 3.25, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 3.0, 1e-8);
}
@ -2590,8 +2573,7 @@ TEST_F(FindRootAdditionalTest, LinearFunction2) {
y = 2.0 * x - 10.0;
dy = 2.0;
};
bool fail = false;
double root = findRoot(func, 0.0, 10.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 0.0, 10.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 5.0, 1e-8);
}
@ -2601,9 +2583,8 @@ TEST_F(FindRootAdditionalTest, FourArgLinear) {
y = 3.0 * x - 6.0;
dy = 3.0;
};
bool fail = false;
// y(1.0) = -3, y(3.0) = 3
double root = findRoot(func, 1.0, -3.0, 3.0, 3.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 1.0, -3.0, 3.0, 3.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 2.0, 1e-8);
}
@ -2613,8 +2594,7 @@ TEST_F(FindRootAdditionalTest, HighOrderPoly) {
y = x * x * x * x - 16.0;
dy = 4.0 * x * x * x;
};
bool fail = false;
double root = findRoot(func, 1.0, 3.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 1.0, 3.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 2.0, 1e-6);
}
@ -2624,8 +2604,7 @@ TEST_F(FindRootAdditionalTest, NegativeRoot) {
y = x + 3.0;
dy = 1.0;
};
bool fail = false;
double root = findRoot(func, -5.0, -1.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, -5.0, -1.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, -3.0, 1e-8);
}
@ -2635,9 +2614,8 @@ TEST_F(FindRootAdditionalTest, TrigFunction) {
y = std::cos(x);
dy = -std::sin(x);
};
bool fail = false;
// Root at pi/2
double root = findRoot(func, 1.0, 2.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 1.0, 2.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, M_PI / 2.0, 1e-8);
}
@ -2647,8 +2625,7 @@ TEST_F(FindRootAdditionalTest, VeryTightBounds) {
y = x - 5.0;
dy = 1.0;
};
bool fail = false;
double root = findRoot(func, 4.999, 5.001, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 4.999, 5.001, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 5.0, 1e-8);
}
@ -2658,8 +2635,7 @@ TEST_F(FindRootAdditionalTest, ExpFunction) {
y = std::exp(x) - 10.0;
dy = std::exp(x);
};
bool fail = false;
double root = findRoot(func, 1.0, 3.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 1.0, 3.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, std::log(10.0), 1e-8);
}
@ -2669,9 +2645,8 @@ TEST_F(FindRootAdditionalTest, FourArgSwap) {
y = x - 7.0;
dy = 1.0;
};
bool fail = false;
// y1 = 3.0 > 0, y2 = -7.0 < 0 => internal swap
double root = findRoot(func, 10.0, 3.0, 0.0, -7.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 10.0, 3.0, 0.0, -7.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 7.0, 1e-8);
}
@ -3369,8 +3344,7 @@ TEST_F(FindRootAdditionalTest, SteepDerivative) {
y = 1000.0 * x - 500.0;
dy = 1000.0;
};
bool fail = false;
double root = findRoot(func, 0.0, 1.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 0.0, 1.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 0.5, 1e-8);
}
@ -3381,8 +3355,7 @@ TEST_F(FindRootAdditionalTest, QuarticRoot) {
y = x*x*x*x - 81.0;
dy = 4.0*x*x*x;
};
bool fail = false;
double root = findRoot(func, 2.0, 4.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 2.0, 4.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 3.0, 1e-6);
}
@ -3393,8 +3366,7 @@ TEST_F(FindRootAdditionalTest, FourArgNegBracket) {
y = x + 5.0;
dy = 1.0;
};
bool fail = false;
double root = findRoot(func, -8.0, -3.0, -2.0, 3.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, -8.0, -3.0, -2.0, 3.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, -5.0, 1e-8);
}

View File

@ -17,8 +17,7 @@ TEST_F(FindRootTest, QuadraticPositiveRoot) {
y = x * x - 4.0;
dy = 2.0 * x;
};
bool fail = false;
double root = findRoot(func, 1.0, 3.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 1.0, 3.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 2.0, 1e-8);
}
@ -29,8 +28,7 @@ TEST_F(FindRootTest, QuadraticNegativeRoot) {
y = x * x - 4.0;
dy = 2.0 * x;
};
bool fail = false;
double root = findRoot(func, -3.0, -1.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, -3.0, -1.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, -2.0, 1e-8);
}
@ -41,8 +39,7 @@ TEST_F(FindRootTest, LinearRoot) {
y = x - 1.0;
dy = 1.0;
};
bool fail = false;
double root = findRoot(func, 0.0, 2.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 0.0, 2.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 1.0, 1e-8);
}
@ -53,8 +50,7 @@ TEST_F(FindRootTest, SinRoot) {
y = sin(x);
dy = cos(x);
};
bool fail = false;
double root = findRoot(func, 2.5, 3.8, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 2.5, 3.8, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, M_PI, 1e-6);
}
@ -65,8 +61,7 @@ TEST_F(FindRootTest, ExponentialRoot) {
y = exp(x) - 2.0;
dy = exp(x);
};
bool fail = false;
double root = findRoot(func, 0.0, 1.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 0.0, 1.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, log(2.0), 1e-8);
}
@ -77,8 +72,7 @@ TEST_F(FindRootTest, TightTolerance) {
y = x * x - 2.0;
dy = 2.0 * x;
};
bool fail = false;
double root = findRoot(func, 1.0, 2.0, 1e-14, 200, fail);
auto [root, fail] = findRoot(func, 1.0, 2.0, 1e-14, 200);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, sqrt(2.0), 1e-12);
}
@ -89,9 +83,8 @@ TEST_F(FindRootTest, WithPrecomputedY) {
y = x * x - 9.0;
dy = 2.0 * x;
};
bool fail = false;
// x1=2, y1=4-9=-5, x2=4, y2=16-9=7
double root = findRoot(func, 2.0, -5.0, 4.0, 7.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 2.0, -5.0, 4.0, 7.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 3.0, 1e-8);
}
@ -106,8 +99,7 @@ TEST_F(FindRootTest, VeryTightTolerance) {
y = x - 5.0;
dy = 1.0;
};
bool fail = false;
double root = findRoot(func, 3.0, 7.0, 1e-15, 500, fail);
auto [root, fail] = findRoot(func, 3.0, 7.0, 1e-15, 500);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 5.0, 1e-13);
}
@ -118,8 +110,7 @@ TEST_F(FindRootTest, LooseTolerance) {
y = x * x - 25.0;
dy = 2.0 * x;
};
bool fail = false;
double root = findRoot(func, 3.0, 7.0, 1e-1, 100, fail);
auto [root, fail] = findRoot(func, 3.0, 7.0, 1e-1, 100);
EXPECT_FALSE(fail);
// With 10% relative tolerance, result should still be in the right ballpark
EXPECT_NEAR(root, 5.0, 0.6);
@ -132,8 +123,7 @@ TEST_F(FindRootTest, ZeroTolerance) {
y = x - 3.0;
dy = 1.0;
};
bool fail = false;
double root = findRoot(func, 1.0, 5.0, 0.0, 100, fail);
auto [root, fail] = findRoot(func, 1.0, 5.0, 0.0, 100);
// May or may not converge -- for a linear function Newton converges in 1 step
// so dx can be exactly 0. Accept either outcome.
if (!fail) {
@ -152,8 +142,7 @@ TEST_F(FindRootTest, OneIteration) {
y = x * x - 4.0;
dy = 2.0 * x;
};
bool fail = false;
double root = findRoot(func, 1.0, 3.0, 1e-10, 1, fail);
auto [root, fail] = findRoot(func, 1.0, 3.0, 1e-10, 1);
// With only 1 iteration, a quadratic likely won't converge to tight tol
// The algorithm may or may not fail depending on initial bisection step
// Root should still be a finite number within the bracket
@ -169,8 +158,7 @@ TEST_F(FindRootTest, TwoIterations) {
y = x - 7.0;
dy = 1.0;
};
bool fail = false;
double root = findRoot(func, 5.0, 9.0, 1e-10, 2, fail);
auto [root, fail] = findRoot(func, 5.0, 9.0, 1e-10, 2);
// Linear function: Newton should converge very fast
// After the initial midpoint (7.0), Newton step should nail it
if (!fail) {
@ -184,8 +172,7 @@ TEST_F(FindRootTest, ZeroMaxIterations) {
y = x - 1.0;
dy = 1.0;
};
bool fail = false;
findRoot(func, 0.0, 2.0, 1e-10, 0, fail);
auto [root_, fail] = findRoot(func, 0.0, 2.0, 1e-10, 0);
EXPECT_TRUE(fail);
}
@ -195,8 +182,7 @@ TEST_F(FindRootTest, LargeMaxIter) {
y = x * x - 16.0;
dy = 2.0 * x;
};
bool fail = false;
double root = findRoot(func, 1.0, 10.0, 1e-12, 10000, fail);
auto [root, fail] = findRoot(func, 1.0, 10.0, 1e-12, 10000);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 4.0, 1e-10);
}
@ -211,8 +197,7 @@ TEST_F(FindRootTest, CubicRoot) {
y = x * x * x - 8.0;
dy = 3.0 * x * x;
};
bool fail = false;
double root = findRoot(func, 1.0, 3.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 1.0, 3.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 2.0, 1e-8);
}
@ -223,8 +208,7 @@ TEST_F(FindRootTest, QuarticRoot) {
y = x * x * x * x - 16.0;
dy = 4.0 * x * x * x;
};
bool fail = false;
double root = findRoot(func, 1.0, 3.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 1.0, 3.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 2.0, 1e-8);
}
@ -235,8 +219,7 @@ TEST_F(FindRootTest, ExponentialRoot2) {
y = exp(x) - 10.0;
dy = exp(x);
};
bool fail = false;
double root = findRoot(func, 1.0, 4.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 1.0, 4.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, log(10.0), 1e-8);
}
@ -248,8 +231,7 @@ TEST_F(FindRootTest, SqrtFunctionRoot) {
y = sqrt(x) - 3.0;
dy = 0.5 / sqrt(x);
};
bool fail = false;
double root = findRoot(func, 1.0, 20.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 1.0, 20.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 9.0, 1e-6);
}
@ -267,8 +249,7 @@ TEST_F(FindRootTest, NearZeroRootLinear) {
y = x - 1e-10;
dy = 1.0;
};
bool fail = false;
double root = findRoot(func, -1.0, 1.0, 1e-6, 200, fail);
auto [root, fail] = findRoot(func, -1.0, 1.0, 1e-6, 200);
// Newton on a linear function converges in 1-2 steps regardless of root location
if (!fail) {
EXPECT_NEAR(root, 1e-10, 1e-6);
@ -283,8 +264,7 @@ TEST_F(FindRootTest, RootExactlyAtZero) {
y = x;
dy = 1.0;
};
bool fail = false;
double root = findRoot(func, -1.0, 1.0, 1e-10, 200, fail);
auto [root, fail] = findRoot(func, -1.0, 1.0, 1e-10, 200);
// Even if fail is true, root should be very close to 0
EXPECT_NEAR(root, 0.0, 1e-6);
}
@ -299,8 +279,7 @@ TEST_F(FindRootTest, NegativeDomainRoot) {
y = x + 100.0;
dy = 1.0;
};
bool fail = false;
double root = findRoot(func, -200.0, 0.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, -200.0, 0.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, -100.0, 1e-6);
}
@ -311,8 +290,7 @@ TEST_F(FindRootTest, NegativeBracketRoot) {
y = x * x - 1.0;
dy = 2.0 * x;
};
bool fail = false;
double root = findRoot(func, -2.0, -0.5, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, -2.0, -0.5, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, -1.0, 1e-8);
}
@ -327,8 +305,7 @@ TEST_F(FindRootTest, SinRootAtZero) {
y = sin(x);
dy = cos(x);
};
bool fail = false;
double root = findRoot(func, -1.0, 1.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, -1.0, 1.0, 1e-10, 100);
// Root at 0 has the relative-tolerance issue, but Newton converges fast for sin
EXPECT_NEAR(root, 0.0, 1e-4);
}
@ -339,8 +316,7 @@ TEST_F(FindRootTest, SinRootAt2Pi) {
y = sin(x);
dy = cos(x);
};
bool fail = false;
double root = findRoot(func, 5.5, 7.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 5.5, 7.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 2.0 * M_PI, 1e-6);
}
@ -351,8 +327,7 @@ TEST_F(FindRootTest, CosRootAtPiOver2) {
y = cos(x);
dy = -sin(x);
};
bool fail = false;
double root = findRoot(func, 1.0, 2.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 1.0, 2.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, M_PI / 2.0, 1e-6);
}
@ -368,8 +343,7 @@ TEST_F(FindRootTest, MultipleRootsFindFirst) {
y = (x - 1.0) * (x - 2.0);
dy = 2.0 * x - 3.0;
};
bool fail = false;
double root = findRoot(func, 0.5, 1.5, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 0.5, 1.5, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 1.0, 1e-8);
}
@ -380,8 +354,7 @@ TEST_F(FindRootTest, MultipleRootsFindSecond) {
y = (x - 1.0) * (x - 2.0);
dy = 2.0 * x - 3.0;
};
bool fail = false;
double root = findRoot(func, 1.5, 2.5, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 1.5, 2.5, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 2.0, 1e-8);
}
@ -397,8 +370,7 @@ TEST_F(FindRootTest, AbsValueRoot) {
y = fabs(x) - 1.0;
dy = (x >= 0.0) ? 1.0 : -1.0;
};
bool fail = false;
double root = findRoot(func, 0.5, 2.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 0.5, 2.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 1.0, 1e-8);
}
@ -409,8 +381,7 @@ TEST_F(FindRootTest, AbsValueNegativeRoot) {
y = fabs(x) - 1.0;
dy = (x >= 0.0) ? 1.0 : -1.0;
};
bool fail = false;
double root = findRoot(func, -2.0, -0.5, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, -2.0, -0.5, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, -1.0, 1e-8);
}
@ -430,8 +401,7 @@ TEST_F(FindRootTest, FlatFifthOrderRootFails) {
y = d4 * d; // (x-3)^5
dy = 5.0 * d4; // 5*(x-3)^4
};
bool fail = false;
findRoot(func, 2.0, 4.0, 1e-6, 500, fail);
auto [root_, fail] = findRoot(func, 2.0, 4.0, 1e-6, 500);
// The algorithm is expected to fail because dy -> 0 at the root
EXPECT_TRUE(fail);
}
@ -444,8 +414,7 @@ TEST_F(FindRootTest, FlatSinhRoot) {
y = sinh(x - 3.0);
dy = cosh(x - 3.0);
};
bool fail = false;
double root = findRoot(func, 2.0, 4.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 2.0, 4.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 3.0, 1e-6);
}
@ -460,8 +429,7 @@ TEST_F(FindRootTest, SteepLinearRoot) {
y = 1000.0 * (x - 5.0);
dy = 1000.0;
};
bool fail = false;
double root = findRoot(func, 3.0, 7.0, 1e-12, 100, fail);
auto [root, fail] = findRoot(func, 3.0, 7.0, 1e-12, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 5.0, 1e-10);
}
@ -472,8 +440,7 @@ TEST_F(FindRootTest, VerySteepLinearRoot) {
y = 1e6 * (x - 2.0);
dy = 1e6;
};
bool fail = false;
double root = findRoot(func, 1.0, 3.0, 1e-14, 100, fail);
auto [root, fail] = findRoot(func, 1.0, 3.0, 1e-14, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 2.0, 1e-12);
}
@ -488,8 +455,7 @@ TEST_F(FindRootTest, LargeBracket) {
y = x - 42.0;
dy = 1.0;
};
bool fail = false;
double root = findRoot(func, -1000.0, 1000.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, -1000.0, 1000.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 42.0, 1e-6);
}
@ -500,8 +466,7 @@ TEST_F(FindRootTest, LargeBracketQuadratic) {
y = x * x - 100.0;
dy = 2.0 * x;
};
bool fail = false;
double root = findRoot(func, 1.0, 1000.0, 1e-10, 200, fail);
auto [root, fail] = findRoot(func, 1.0, 1000.0, 1e-10, 200);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 10.0, 1e-6);
}
@ -516,8 +481,7 @@ TEST_F(FindRootTest, SmallBracket) {
y = x - 1.0;
dy = 1.0;
};
bool fail = false;
double root = findRoot(func, 0.999999, 1.000001, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 0.999999, 1.000001, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 1.0, 1e-6);
}
@ -528,8 +492,7 @@ TEST_F(FindRootTest, SmallBracketQuadratic) {
y = x * x - 4.0;
dy = 2.0 * x;
};
bool fail = false;
double root = findRoot(func, 1.9999, 2.0001, 1e-12, 100, fail);
auto [root, fail] = findRoot(func, 1.9999, 2.0001, 1e-12, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 2.0, 1e-8);
}
@ -545,14 +508,12 @@ TEST_F(FindRootTest, OverloadsProduceSameResult) {
dy = 3.0 * x * x;
};
bool fail_2arg = false;
double root_2arg = findRoot(func, 2.0, 4.0, 1e-12, 100, fail_2arg);
auto [root_2arg, fail_2arg] = findRoot(func, 2.0, 4.0, 1e-12, 100);
// Pre-compute y values for 4-arg version
double y1 = 2.0 * 2.0 * 2.0 - 27.0; // 8 - 27 = -19
double y2 = 4.0 * 4.0 * 4.0 - 27.0; // 64 - 27 = 37
bool fail_4arg = false;
double root_4arg = findRoot(func, 2.0, y1, 4.0, y2, 1e-12, 100, fail_4arg);
auto [root_4arg, fail_4arg] = findRoot(func, 2.0, y1, 4.0, y2, 1e-12, 100);
EXPECT_FALSE(fail_2arg);
EXPECT_FALSE(fail_4arg);
@ -567,9 +528,8 @@ TEST_F(FindRootTest, FourArgX1IsRoot) {
y = x - 5.0;
dy = 1.0;
};
bool fail = false;
// y1 = 5 - 5 = 0
double root = findRoot(func, 5.0, 0.0, 8.0, 3.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 5.0, 0.0, 8.0, 3.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_DOUBLE_EQ(root, 5.0);
}
@ -580,9 +540,8 @@ TEST_F(FindRootTest, FourArgX2IsRoot) {
y = x - 5.0;
dy = 1.0;
};
bool fail = false;
// y2 = 5 - 5 = 0
double root = findRoot(func, 2.0, -3.0, 5.0, 0.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 2.0, -3.0, 5.0, 0.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_DOUBLE_EQ(root, 5.0);
}
@ -597,8 +556,7 @@ TEST_F(FindRootTest, BothEndpointsPositiveFails) {
y = x * x + 1.0; // Always positive, no real root
dy = 2.0 * x;
};
bool fail = false;
findRoot(func, 1.0, 3.0, 1e-10, 100, fail);
auto [root_, fail] = findRoot(func, 1.0, 3.0, 1e-10, 100);
EXPECT_TRUE(fail);
}
@ -608,8 +566,7 @@ TEST_F(FindRootTest, BothEndpointsNegativeFails) {
y = -x * x - 1.0; // Always negative
dy = -2.0 * x;
};
bool fail = false;
findRoot(func, -3.0, 3.0, 1e-10, 100, fail);
auto [root_, fail] = findRoot(func, -3.0, 3.0, 1e-10, 100);
EXPECT_TRUE(fail);
}
@ -619,9 +576,8 @@ TEST_F(FindRootTest, FourArgSameSignFails) {
y = x * x;
dy = 2.0 * x;
};
bool fail = false;
// Both y values positive
findRoot(func, 1.0, 1.0, 2.0, 4.0, 1e-10, 100, fail);
auto [root_, fail] = findRoot(func, 1.0, 1.0, 2.0, 4.0, 1e-10, 100);
EXPECT_TRUE(fail);
}
@ -635,8 +591,7 @@ TEST_F(FindRootTest, SymmetryPositiveBracket) {
y = x * x - 4.0;
dy = 2.0 * x;
};
bool fail = false;
double root = findRoot(func, 0.5, 3.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 0.5, 3.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 2.0, 1e-8);
}
@ -646,8 +601,7 @@ TEST_F(FindRootTest, SymmetryNegativeBracket) {
y = x * x - 4.0;
dy = 2.0 * x;
};
bool fail = false;
double root = findRoot(func, -3.0, -0.5, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, -3.0, -0.5, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, -2.0, 1e-8);
}
@ -662,9 +616,8 @@ TEST_F(FindRootTest, SwappedBracketOrder) {
y = x - 3.0;
dy = 1.0;
};
bool fail = false;
// x1=5 > x2=1 (reversed order)
double root = findRoot(func, 5.0, 1.0, 1e-10, 100, fail);
auto [root, fail] = findRoot(func, 5.0, 1.0, 1e-10, 100);
EXPECT_FALSE(fail);
EXPECT_NEAR(root, 3.0, 1e-8);
}

View File

@ -0,0 +1,91 @@
Warning 1212: ../../test/asap7/asap7sc7p5t_SIMPLE_RVT_FF_nldm_211120.lib.gz line 13178, timing group from output port.
Warning 1212: ../../test/asap7/asap7sc7p5t_SIMPLE_RVT_FF_nldm_211120.lib.gz line 13211, timing group from output port.
Warning 1212: ../../test/asap7/asap7sc7p5t_SIMPLE_RVT_FF_nldm_211120.lib.gz line 13244, timing group from output port.
Warning 1212: ../../test/asap7/asap7sc7p5t_SIMPLE_RVT_FF_nldm_211120.lib.gz line 13277, timing group from output port.
Warning 1212: ../../test/asap7/asap7sc7p5t_SIMPLE_RVT_FF_nldm_211120.lib.gz line 13310, timing group from output port.
Warning 1212: ../../test/asap7/asap7sc7p5t_SIMPLE_RVT_FF_nldm_211120.lib.gz line 13343, timing group from output port.
Warning 1212: ../../test/asap7/asap7sc7p5t_SIMPLE_RVT_FF_nldm_211120.lib.gz line 13376, timing group from output port.
Warning 1212: ../../test/asap7/asap7sc7p5t_SIMPLE_RVT_FF_nldm_211120.lib.gz line 14772, timing group from output port.
Warning 1212: ../../test/asap7/asap7sc7p5t_SIMPLE_RVT_FF_nldm_211120.lib.gz line 14805, timing group from output port.
Warning 1212: ../../test/asap7/asap7sc7p5t_SIMPLE_RVT_FF_nldm_211120.lib.gz line 14838, timing group from output port.
Startpoint: r2 (rising edge-triggered flip-flop clocked by clk)
Endpoint: r3 (rising edge-triggered flip-flop clocked by clk)
Path Group: clk
Path Type: max
Delay Time Description
---------------------------------------------------------
0.00 0.00 clock clk (rise edge)
0.00 0.00 clock network delay (ideal)
0.00 0.00 ^ r2/CLK (DFFHQx4_ASAP7_75t_R)
52.65 52.65 ^ r2/Q (DFFHQx4_ASAP7_75t_R)
49.30 101.95 ^ u1/Y (BUFx2_ASAP7_75t_R)
61.03 162.97 ^ u2/Y (AND2x2_ASAP7_75t_R)
15.77 178.74 ^ r3/D (DFFHQx4_ASAP7_75t_R)
178.74 data arrival time
500.00 500.00 clock clk (rise edge)
0.00 500.00 clock network delay (ideal)
0.00 500.00 clock reconvergence pessimism
500.00 ^ r3/CLK (DFFHQx4_ASAP7_75t_R)
-13.66 486.34 library setup time
486.34 data required time
---------------------------------------------------------
486.34 data required time
-178.74 data arrival time
---------------------------------------------------------
307.59 slack (MET)
Library: asap7sc7p5t_INVBUF_RVT_FF_nldm_211120
Cell: BUFx2_ASAP7_75t_R
Arc sense: positive_unate
Arc type: combinational
A ^ -> Y ^
P = 1.00 V = 0.77 T = 0.00
------- input_net_transition = 50.73
| total_output_net_capacitance = 13.97
| 11.52 23.04
v --------------------
40.00 | 35.12 50.39
80.00 | 40.08 55.44
Table value = 39.70
PVT scale factor = 1.00
Delay = 39.70
------- input_net_transition = 50.73
| total_output_net_capacitance = 13.97
| 11.52 23.04
v --------------------
40.00 | 37.28 71.28
80.00 | 38.13 71.69
Table value = 44.70
PVT scale factor = 1.00
Slew = 44.70
.............................................
A v -> Y v
P = 1.00 V = 0.77 T = 0.00
------- input_net_transition = 48.72
| total_output_net_capacitance = 13.97
| 11.52 23.04
v --------------------
40.00 | 36.17 49.65
80.00 | 43.28 56.72
Table value = 40.58
PVT scale factor = 1.00
Delay = 40.58
------- input_net_transition = 48.72
| total_output_net_capacitance = 13.97
| 11.52 23.04
v --------------------
40.00 | 31.72 59.66
80.00 | 32.63 60.23
Table value = 37.84
PVT scale factor = 1.00
Slew = 37.84
.............................................

View File

@ -0,0 +1,16 @@
# Prima report_dcalc with -name spef
read_liberty ../../test/asap7/asap7sc7p5t_SEQ_RVT_FF_nldm_220123.lib
read_liberty ../../test/asap7/asap7sc7p5t_INVBUF_RVT_FF_nldm_220122.lib.gz
read_liberty ../../test/asap7/asap7sc7p5t_SIMPLE_RVT_FF_nldm_211120.lib.gz
read_liberty ../../test/asap7/asap7sc7p5t_OA_RVT_FF_nldm_211120.lib.gz
read_liberty ../../test/asap7/asap7sc7p5t_AO_RVT_FF_nldm_211120.lib.gz
read_verilog ../../test/reg1_asap7.v
link_design top
read_spef -name spef -reduce ../../test/reg1_asap7.spef
create_clock -name clk -period 500 -waveform {0 250} {clk1 clk2 clk3}
set_delay_calculator prima
read_spef -name spef ../../test/reg1_asap7.spef
report_checks
report_dcalc -from u1/A -to u1/Y

View File

@ -41,7 +41,7 @@ public:
static PortDirection *internal() { return internal_; }
static PortDirection *ground() { return ground_; }
static PortDirection *power() { return power_; }
static PortDirection *bias() { return bias_; }
static PortDirection *well() { return well_; }
static PortDirection *unknown() { return unknown_; }
static PortDirection *find(const char *dir_name);
std::string_view name() const { return name_; }
@ -58,8 +58,8 @@ public:
bool isAnyTristate() const;
bool isGround() const { return this == ground_; }
bool isPower() const { return this == power_; }
bool isBias() const { return this == bias_; }
// Ground, power, or bias.
bool isWell() const { return this == well_; }
// Ground, power, or well.
bool isPowerGround() const;
bool isInternal() const { return this == internal_; }
bool isUnknown() const { return this == unknown_; }
@ -78,7 +78,7 @@ private:
static PortDirection *internal_;
static PortDirection *ground_;
static PortDirection *power_;
static PortDirection *bias_;
static PortDirection *well_;
static PortDirection *unknown_;
};

View File

@ -1219,7 +1219,7 @@ LibertyReader::makePgPinPort(LibertyCell *cell,
case PwrGndType::pwell:
case PwrGndType::deepnwell:
case PwrGndType::deeppwell:
dir = PortDirection::bias();
dir = PortDirection::well();
break;
case PwrGndType::none:
error(1291, pg_pin_group, "unknown pg_type.");

View File

@ -569,8 +569,9 @@ LibertyWriter::asString(const PortDirection *dir)
return "internal";
else if (dir == PortDirection::bidirect())
return "inout";
else if (dir == PortDirection::ground() || dir == PortDirection::power()
|| dir == PortDirection::bias())
else if (dir == PortDirection::ground()
|| dir == PortDirection::power()
|| dir == PortDirection::well())
return "input";
return "unknown";
}

View File

@ -35,7 +35,7 @@ PortDirection *PortDirection::bidirect_;
PortDirection *PortDirection::internal_;
PortDirection *PortDirection::ground_;
PortDirection *PortDirection::power_;
PortDirection *PortDirection::bias_;
PortDirection *PortDirection::well_;
PortDirection *PortDirection::unknown_;
void
@ -48,7 +48,7 @@ PortDirection::init()
internal_ = new PortDirection("internal", 4);
ground_ = new PortDirection("ground", 5);
power_ = new PortDirection("power", 6);
bias_ = new PortDirection("bias", 7);
well_ = new PortDirection("well", 7);
unknown_ = new PortDirection("unknown", 8);
}
@ -69,8 +69,8 @@ PortDirection::destroy()
ground_ = nullptr;
delete power_;
power_ = nullptr;
delete bias_;
bias_ = nullptr;
delete well_;
well_ = nullptr;
delete unknown_;
unknown_ = nullptr;
}
@ -99,8 +99,8 @@ PortDirection::find(const char *dir_name)
return ground_;
else if (stringEqual(dir_name, "power"))
return power_;
else if (stringEqual(dir_name, "bias"))
return bias_;
else if (stringEqual(dir_name, "well"))
return well_;
else
return nullptr;
}
@ -130,7 +130,9 @@ PortDirection::isAnyTristate() const
bool
PortDirection::isPowerGround() const
{
return this == ground_ || this == power_ || this == bias_;
return this == ground_
|| this == power_
|| this == well_;
}
} // namespace

View File

@ -161,13 +161,13 @@ TEST_F(PortDirectionTest, PowerSingleton) {
EXPECT_TRUE(dir->isPower());
}
TEST_F(PortDirectionTest, BiasSingleton)
TEST_F(PortDirectionTest, WellSingleton)
{
PortDirection *dir = PortDirection::bias();
PortDirection *dir = PortDirection::well();
EXPECT_NE(dir, nullptr);
EXPECT_EQ(dir->name(), "bias");
EXPECT_EQ(dir->name(), "well");
EXPECT_EQ(dir->index(), 7);
EXPECT_TRUE(dir->isBias());
EXPECT_TRUE(dir->isWell());
}
TEST_F(PortDirectionTest, UnknownSingleton) {
@ -186,7 +186,7 @@ TEST_F(PortDirectionTest, FindByName) {
EXPECT_EQ(PortDirection::find("internal"), PortDirection::internal());
EXPECT_EQ(PortDirection::find("ground"), PortDirection::ground());
EXPECT_EQ(PortDirection::find("power"), PortDirection::power());
EXPECT_EQ(PortDirection::find("bias"), PortDirection::bias());
EXPECT_EQ(PortDirection::find("well"), PortDirection::well());
EXPECT_EQ(PortDirection::find("nonexistent"), nullptr);
}
@ -198,7 +198,7 @@ TEST_F(PortDirectionTest, IsAnyInput) {
EXPECT_FALSE(PortDirection::internal()->isAnyInput());
EXPECT_FALSE(PortDirection::ground()->isAnyInput());
EXPECT_FALSE(PortDirection::power()->isAnyInput());
EXPECT_FALSE(PortDirection::bias()->isAnyInput());
EXPECT_FALSE(PortDirection::well()->isAnyInput());
EXPECT_FALSE(PortDirection::unknown()->isAnyInput());
}
@ -210,7 +210,7 @@ TEST_F(PortDirectionTest, IsAnyOutput) {
EXPECT_FALSE(PortDirection::internal()->isAnyOutput());
EXPECT_FALSE(PortDirection::ground()->isAnyOutput());
EXPECT_FALSE(PortDirection::power()->isAnyOutput());
EXPECT_FALSE(PortDirection::bias()->isAnyOutput());
EXPECT_FALSE(PortDirection::well()->isAnyOutput());
EXPECT_FALSE(PortDirection::unknown()->isAnyOutput());
}
@ -222,14 +222,14 @@ TEST_F(PortDirectionTest, IsAnyTristate) {
EXPECT_FALSE(PortDirection::internal()->isAnyTristate());
EXPECT_FALSE(PortDirection::ground()->isAnyTristate());
EXPECT_FALSE(PortDirection::power()->isAnyTristate());
EXPECT_FALSE(PortDirection::bias()->isAnyTristate());
EXPECT_FALSE(PortDirection::well()->isAnyTristate());
EXPECT_FALSE(PortDirection::unknown()->isAnyTristate());
}
TEST_F(PortDirectionTest, IsPowerGround) {
EXPECT_TRUE(PortDirection::power()->isPowerGround());
EXPECT_TRUE(PortDirection::ground()->isPowerGround());
EXPECT_TRUE(PortDirection::bias()->isPowerGround());
EXPECT_TRUE(PortDirection::well()->isPowerGround());
EXPECT_FALSE(PortDirection::input()->isPowerGround());
EXPECT_FALSE(PortDirection::output()->isPowerGround());
EXPECT_FALSE(PortDirection::tristate()->isPowerGround());
@ -865,7 +865,7 @@ TEST(PortDirectionExtraTest, AllDirections) {
EXPECT_NE(PortDirection::internal(), nullptr);
EXPECT_NE(PortDirection::ground(), nullptr);
EXPECT_NE(PortDirection::power(), nullptr);
EXPECT_NE(PortDirection::bias(), nullptr);
EXPECT_NE(PortDirection::well(), nullptr);
EXPECT_NE(PortDirection::unknown(), nullptr);
}
@ -888,7 +888,7 @@ TEST(PortDirectionExtraTest, DirectionProperties) {
EXPECT_TRUE(PortDirection::ground()->isPowerGround());
EXPECT_TRUE(PortDirection::power()->isPowerGround());
EXPECT_TRUE(PortDirection::bias()->isPowerGround());
EXPECT_TRUE(PortDirection::well()->isPowerGround());
}
TEST(PortDirectionExtraTest, DirectionNames) {
@ -902,7 +902,7 @@ TEST(PortDirectionExtraTest, DirectionNames) {
EXPECT_EQ(PortDirection::internal()->name(), "internal");
EXPECT_EQ(PortDirection::ground()->name(), "ground");
EXPECT_EQ(PortDirection::power()->name(), "power");
EXPECT_EQ(PortDirection::bias()->name(), "bias");
EXPECT_EQ(PortDirection::well()->name(), "well");
EXPECT_EQ(PortDirection::unknown()->name(), "unknown");
}
@ -917,7 +917,7 @@ TEST(PortDirectionExtraTest, FindAllByName) {
EXPECT_EQ(PortDirection::find("internal"), PortDirection::internal());
EXPECT_EQ(PortDirection::find("ground"), PortDirection::ground());
EXPECT_EQ(PortDirection::find("power"), PortDirection::power());
EXPECT_EQ(PortDirection::find("bias"), PortDirection::bias());
EXPECT_EQ(PortDirection::find("well"), PortDirection::well());
// "unknown" is not findable by name, returns nullptr
EXPECT_EQ(PortDirection::find("nonexistent"), nullptr);
}

View File

@ -4167,6 +4167,12 @@ Sta::readSpef(std::string_view name,
parasitics = findParasitics(std::string(name));
if (parasitics == nullptr)
parasitics = makeConcreteParasitics(std::string(name), std::string(filename));
if (scene)
scene->setParasitics(parasitics, min_max);
else {
for (Scene *scn : scenes_)
scn->setParasitics(parasitics, min_max);
}
}
bool success = readSpefFile(filename, instance, pin_cap_included,

View File

@ -31,3 +31,55 @@ Path Type: max
228.48 slack (MET)
Library: asap7_small
Cell: BUFx2_ASAP7_75t_R
Arc sense: positive_unate
Arc type: combinational
A ^ -> Y ^
P = 1.00 V = 0.70 T = 25.00
------- input_net_transition = 59.28
| total_output_net_capacitance = 13.54
| 11.52 23.04
v --------------------
40.00 | 48.68 71.50
80.00 | 56.23 79.10
Table value = 56.33
PVT scale factor = 1.00
Delay = 56.33
------- input_net_transition = 59.28
| total_output_net_capacitance = 13.54
| 11.52 23.04
v --------------------
40.00 | 53.99 104.08
80.00 | 54.58 104.40
Table value = 63.04
PVT scale factor = 1.00
Slew = 63.04
.............................................
A v -> Y v
P = 1.00 V = 0.70 T = 25.00
------- input_net_transition = 52.93
| total_output_net_capacitance = 12.09
| 11.52 23.04
v --------------------
40.00 | 48.42 67.20
80.00 | 57.92 76.86
Table value = 52.43
PVT scale factor = 1.00
Delay = 52.43
------- input_net_transition = 52.93
| total_output_net_capacitance = 12.09
| 11.52 23.04
v --------------------
40.00 | 42.77 80.89
80.00 | 43.84 81.48
Table value = 45.00
PVT scale factor = 1.00
Slew = 45.00
.............................................

View File

@ -9,3 +9,4 @@ set_propagated_clock {clk1 clk2 clk3}
read_spef reg1_asap7.spef
sta::set_delay_calculator prima
report_checks -fields {input_pins slew} -format full_clock
report_dcalc -from u1/A -to u1/Y

View File

@ -166,6 +166,7 @@ record_public_tests {
report_json2
suppress_msg
verilog_attribute
verilog_well_supplies
verilog_specify
verilog_write_escape
verilog_unconnected_hpin

View File

@ -0,0 +1,26 @@
module top (y,
a);
output y;
input a;
sky130_fd_sc_hd__buf_1 u1 (.A(a),
.X(y));
endmodule
module top (y,
a);
output y;
input a;
wire VGND;
wire VNB;
wire VPB;
wire VPWR;
sky130_fd_sc_hd__buf_1 u1 (.VGND(VGND),
.VNB(VNB),
.VPB(VPB),
.VPWR(VPWR),
.A(a),
.X(y));
endmodule

View File

@ -0,0 +1,12 @@
# Check that write_verilog excludes well pins along with power/ground pins.
source helpers.tcl
read_liberty ../examples/sky130hd_tt.lib.gz
read_verilog verilog_well_supplies.v
link_design top
set verilog_file [make_result_file "verilog_well_supplies.v"]
write_verilog $verilog_file
report_file $verilog_file
set verilog_pwr_file [make_result_file "verilog_well_supplies_pwr.v"]
write_verilog -include_pwr_gnd $verilog_pwr_file
report_file $verilog_pwr_file

View File

@ -0,0 +1,17 @@
module top (
output y,
input a
);
supply1 VPWR;
supply0 VGND;
supply1 VPB;
supply0 VNB;
sky130_fd_sc_hd__buf_1 u1 (
.X(y),
.A(a),
.VPWR(VPWR),
.VGND(VGND),
.VPB(VPB),
.VNB(VNB)
);
endmodule

View File

@ -253,7 +253,7 @@ VerilogWriter::verilogPortDir(PortDirection *dir)
return "inout";
else if (dir == PortDirection::ground())
return "inout";
else if (dir == PortDirection::bias())
else if (dir == PortDirection::well())
return "inout";
else if (dir == PortDirection::internal()
|| dir == PortDirection::unknown())