Clock Stretching
Clock stretching recovery is what happens the instant a timing-speculation circuit like a Razor flip-flop actually catches a path that was too slow for the clock period it was given: detecting the error is only half the job, and the other half is giving the pipeline a way to redo the computation correctly without a full pipeline flush or a system reset — which is exactly what stretching the clock period for one cycle, right after the error is flagged, accomplishes.
The recovery mechanism exploits a detail this series has already covered in passing: a Razor-style design keeps a second, delayed shadow latch sampling the same signal slightly later than the main pipeline register, specifically so the shadow copy can catch the value that the main register missed. When the error-detection logic compares the main register's value against the shadow latch's value and finds a mismatch, it knows a timing violation occurred on that specific path during that specific cycle — but the shadow latch, clocked later, has already captured what the correct value actually was, since it samples after the slow path has had more time to settle. Recovery, then, does not mean recomputing from scratch; it means getting that already-correct shadow value into the main pipeline register properly, which simply requires giving the circuit one extra cycle's worth of time before continuing.
Clock stretching accomplishes exactly that by inserting a single widened clock cycle immediately after the error is detected, rather than stopping the whole pipeline or restarting the instruction from an earlier stage. The clock generation logic, upon receiving the error flag, holds the next clock edge back for an extra, bounded amount of time — long enough for the shadow latch's value to propagate cleanly into the main register — and then resumes normal-period clocking from the following cycle onward. This is a localized, single-cycle correction rather than a global stall: only the specific pipeline stage and cycle where the error occurred experiences the stretch, and throughput elsewhere in the pipeline is unaffected except for that one recovery cycle's worth of lost cycle time.
This recovery mechanism is what makes the entire timing-speculation strategy safe to adopt in the first place, rather than merely academically interesting. A conventional design sets its clock period to accommodate the single worst-case critical path, paying that margin on every cycle even though the worst case rarely actually occurs — a conservative but simple guarantee of correctness. Better-than-worst-case design instead sets the clock for the typical case, runs faster on the overwhelming majority of cycles, and accepts that occasionally a particular path will not finish in time; clock stretching recovery is the specific mechanism that turns that occasional slow path from a silent correctness failure into a detected, corrected, single-cycle delay. Without a reliable recovery path, detecting a timing error would be useless — the pipeline would still need to be reset or the whole system marked unreliable — which is exactly why error detection and stretching recovery are always designed as a matched pair rather than either one being deployed alone.
The cost of recovery has to stay low and bounded for the whole approach to pay off, which places a real constraint on how the technique is actually deployed. If timing violations occurred frequently, the cumulative cost of repeated stretched cycles would erase the speed advantage the faster typical-case clock was supposed to deliver in the first place — the entire value proposition depends on timing errors being rare events under normal operating conditions, with the faster clock paying off across the much larger number of cycles that never need recovery at all. This is why better-than-worst-case techniques are typically deployed alongside dynamic voltage and frequency scaling or adaptive guard-banding rather than as a replacement for conservative timing margin altogether — the system tunes itself to keep the error rate low enough that recovery remains the rare exception, not a frequent event eating into the speed gain.
| Design approach | Clock period set for | Handles rare slow paths by | Throughput cost |
|---|---|---|---|
| Conventional worst-case | Slowest possible critical path | Never occurring, by margin | Paid every cycle |
| Better-than-worst-case + clock stretching | Typical-case critical path | Detect, then stretch one cycle to recover | Paid only on rare error cycles |
Clock stretching recovery is the half of timing speculation that makes the other half trustworthy — detecting a late path is only useful information if the system also has a cheap, local way to act on it correctly. By reusing a shadow latch's already-correct value and giving it exactly one extra cycle to arrive, the pipeline recovers from a rare timing miss the same way it would have avoided one entirely under worst-case design, just paying that cost only when it is actually needed instead of on every single cycle.