Each delay table has two indexes: input slew along one axis and output load along the other. The teaching tables use 0.01 and 0.1 on both axes.
A lookup inside the rectangle interpolates between corners. A lookup outside it extrapolates, which the tool avoids by fixing slew and load first.
Input slew / output load | 0.01 | 0.1 |
|---|---|---|
0.01 | 0.08 | 0.11 |
0.1 | 0.10 | 0.14 |
Bilinear interpolation weights the four corners by distance. Fractions fx and fy measure how far the point sits along each axis.
The delay is the weighted sum of the four entries. The weights always add to one, so corners return their own entries exactly.
EXAMPLE table (EXAMPLE ns): T(0.01, 0.01) = 0.08, T(0.1, 0.01) = 0.10
T(0.01, 0.1) = 0.11, T(0.1, 0.1) = 0.14
lookup point: slew = 0.04, load = 0.04
fx = (0.04 - 0.01) / (0.1 - 0.01) = 0.03 / 0.09 = 1/3
fy = (0.04 - 0.01) / (0.1 - 0.01) = 1/3
delay = (1 - fx)(1 - fy) x 0.08 + fx(1 - fy) x 0.10 + (1 - fx)fy x 0.11 + fx fy x 0.14
= (4/9) x 0.08 + (2/9) x 0.10 + (2/9) x 0.11 + (1/9) x 0.14
= 0.0355556 + 0.0222222 + 0.0244444 + 0.0155556
= 0.0977778 EXAMPLE ns = 22/225 EXAMPLE nsThe program below interpolates the same table and replays the hand arithmetic. Its five self-checks cover the corners, two midpoints, and the worked point.
import sys
X0, X1 = 0.01, 0.1
Y0, Y1 = 0.01, 0.1
T00, T10, T01, T11 = 0.08, 0.10, 0.11, 0.14
def lookup(slew, load):
fx = (slew - X0) / (X1 - X0)
fy = (load - Y0) / (Y1 - Y0)
return ((1.0 - fx) * (1.0 - fy) * T00 + fx * (1.0 - fy) * T10
+ (1.0 - fx) * fy * T01 + fx * fy * T11)
def close(got, want):
return abs(got - want) < 1e-9
checks = [
(lookup(0.01, 0.01), 0.08),
(lookup(0.1, 0.1), 0.14),
(lookup(0.055, 0.01), 0.09),
(lookup(0.055, 0.055), 0.1075),
(lookup(0.04, 0.04), 22.0 / 225.0),
]
for i in range(len(checks)):
got, want = checks[i]
if not close(got, want):
print("FAIL: check " + str(i + 1) + " got " + str(got) + " want " + str(want))
sys.exit(1)
print("PASS: bilinear lookup matches hand arithmetic on 5 checks")fx is 0.5 and fy is 0. The delay is 0.5 x 0.08 + 0.5 x 0.10 = 0.09 EXAMPLE ns.
All four weights are 0.25. The delay is the plain mean: 0.43 / 4 = 0.1075 EXAMPLE ns.