In a linear pipeline between two flops whose clocks are fixed, delaying the intermediate flops changes each stage's slack but not the total: the changes telescope and cancel. A negative total means no skew can fix it; a positive total is necessary but not sufficient, because each flop's four-bound window must also be non-empty (each shift is limited by hold: here stage 1's hold slack fell to 5 ps).
setup = [-0.040, 0.050, 0.020, 0.030] # stage 1..4 setup slacks; flops 0 and 4 have fixed clocks
hold = [ 0.060, 0.050, 0.070, 0.040]
total = round(sum(setup), 3)
assert total == 0.060
target = total / 4 # equal slack per stage
c = [0.0] # clock delay of flop k (flop 0 is the reference)
for k in range(4):
c.append(c[-1] + (target - setup[k]))
c = [round(x, 3) for x in c]
assert c == [0.0, 0.055, 0.020, 0.015, 0.0]
new_setup = [round(setup[k] + (c[k + 1] - c[k]), 3) for k in range(4)]
new_hold = [round(hold[k] - (c[k + 1] - c[k]), 3) for k in range(4)]
assert new_setup == [0.015] * 4
assert new_hold == [0.005, 0.085, 0.075, 0.055]
print("PASS: clock delays", c, "; setup", new_setup, "; hold", new_hold, "; worst hold", min(new_hold))Stage | Setup before | Setup after | Hold before | Hold after |
|---|---|---|---|---|
1 | -0.040 | 0.015 | 0.060 | 0.005 |
2 | 0.050 | 0.015 | 0.050 | 0.085 |
3 | 0.020 | 0.015 | 0.070 | 0.075 |
4 | 0.030 | 0.015 | 0.040 | 0.055 |
The four setup slacks sum to 0.060 ns, so equalising gives 0.015 ns each. That requires flop 1 to be 55 ps late, flop 2 20 ps late and flop 3 15 ps late, with flops 0 and 4 unchanged. Setup is now comfortable everywhere, but stage 1's hold slack fell from 60 ps to 5 ps, because the 55 ps delay on its capture flop is paid for in hold. Stages 2 to 4 gained hold margin. Evening out setup is therefore not the goal in itself: the real constraint is the smallest of all the setup and hold slacks, and equal setup slack can be a poor balance if one hold slack is nearly gone.
Skews are chosen by a computation over the whole pipeline, not stage by stage.
The minimum of all setup and hold slacks after skewing is reported, with the stage that owns it.
Pipelines with a negative total slack are flagged: skew cannot help them.
No: the sum is -0.010, so the average stage slack would still be negative. The structure itself must change.