HARDWARE & DEVICE SECURITY

RTL Anti-Tampering11/16

RTL Anti-Tampering Design Lesson 11: Reset, Clocks, CDC and Lifecycle

Reset release is not one simultaneous instant across the chip. If permission crosses a clock domain or precedes startup checks, it may be used while the system appears to be booting.

10 min read

Reset release is not one simultaneous instant across the chip. If permission crosses a clock domain or precedes startup checks, it may be used while the system appears to be booting.

Learning objectives and classroom plan

By the end of this lesson, you should be able to:

  • Calculate ideal-phase pulse capture and two-stage observation latency.
  • Trace handshake events and explain data hold, clock stoppage, and independent reset.
  • Distinguish DUT flags from independent authorization evidence at debug acceptance.

Suggested 50-minute teaching plan: Prerequisites 10 minutes; timing calculations 15; handshake and lab 15; reset counterexample discussion 10. This includes student calculations, lab work, and discussion. It is a teaching plan, not measured student completion time.

Go to the interactive lab

Lesson 11: Reset, Clocks, CDC and Lifecycle

Startup is a gated sequence

A hospital backup-power transfer makes the point: lights can be on before every ward has passed its checks. A controller waits for stable power, self-tests, and then enables selected outlets. A chip must likewise distinguish stable power, reset release, valid OTP/lifecycle data, ROM checks, and CPU fetch enable. These are separate events. The analogy only conveys staged readiness; it does not model asynchronous reset networks, metastability, or fused lifecycle states.

List reset assertion and deassertion in each domain. Asynchronous assertion can clear state promptly; deassertion is commonly synchronized to each destination clock to avoid recovery/removal violations. OpenTitan’s public lifecycle-controller theory describes waiting for OTP sensing, decoding and broadcasting lifecycle, then checking straps/ROM after stabilization. That is a design-specific document, not a timing guarantee for every product. Lifecycle controller.

A one-bit ready pulse sampled directly across domains may be missed. Synchronizing each bit of a multi-bit lifecycle bus independently can instead produce a combination that never existed because bits arrive on different cycles. Transfer data with a handshake or stable encoding, and authorize using reset state synchronized locally. For split reset groups, examine transactions and FIFO clearing while the producer is awake but the consumer is not. A CDC report is structural evidence; it does not prove lifecycle policy.

Counterexample: ROM check is complete in clk_sys, but clk_dbg has not yet observed synchronized check_done. If permission arrives first, the destination accepts debug too early. Assert at the actual debug-accept boundary, not only on the reset controller’s eventual state. The SVA below is a harness proposal, not compiled; every debug_accept requires stable lifecycle and a completed check.

Acceptance boundary

Test reset release order, pause or speed each domain, inject one-cycle cross-domain requests, repeat reset, and cover each lifecycle value. Positive controls must show that an authorized startup eventually becomes usable; safety checks must show no acceptance before prerequisites hold. An edge model cannot replace CDC/RDC analysis, reset-tree timing, power-ramp testing, or analog brownout validation.

Worked case: the check finished, so why is debug still blocked?

Open this lesson’s interactive lab

Use a teaching chip with a ROM boot check and a debug interface. ROM runs in clk_sys; the debug acceptance point runs in clk_dbg. Management software sees the source check complete and issues a debug request, but the destination has not observed that completion. Predict the failure first: if debug checks permission alone, when can an unauthorized acceptance occur?

Separate three events: the source completes its work, the destination receives evidence of completion, and the destination accepts a request. The first does not make the second happen automatically. If permission and check_done travel through different paths, they may arrive in different orders. Both signals eventually becoming 1 does not legitimize an earlier transaction. Check the property at each debug_accept event and retain the waveform at that time.

Work through the interactive model below. step is a shared teaching event order, not an actual clock cycle in either domain. check means this case produces a check_done completion event at step 2; sync means the destination has observed synchronized check_done at the current step. It defines checkAvailable = check && step >= 2, then destObserved = checkAvailable && sync. With a request already present and independently permitted, the gated policy sets accept to destObserved. These Boolean rules do not simulate synchronizer latency or metastability.

Teaching stepchecksynccheckAvailabledestObservedpermissionweakAcceptweakAcceptEarlyGated accept
110001110
210101110
211111101
301001110

Control mapping: set the permission-step slider to 1, 2, 2, 3 in turn; check to on, on, on, off; sync to off, off, on, on. permission = 1 and weakAccept = permission are added comparison assumptions, not new UI controls. The UI’s “weak-policy early accept” corresponds to weakAcceptEarly = weakAccept && !destObserved, not all acceptances. The third row accepts under the weak policy without accepting early.

The second row is easy to misread. The source completion event is available, but destination observation remains 0. A weak permission-only policy accepting here produces a use-before-evidence counterexample. The third row is a positive row for this check_done-gating submodel: both the check and destination observation hold, so a legitimate request can be accepted. The fourth row shows that setting the destination-observation input to 1 does not create a source completion event: the model still produces an observation result of 0. In real hardware, having a synchronizer is not itself authorization.

Return to the actual clock domains

A real design needs at least two event tables. One records source completion and data stability; the other records destination observation and acceptance. A source-domain cycle number cannot stand in for a destination-domain cycle number. If clk_dbg stops, the source can complete its check while the destination has no new observation. The destination must continue rejecting, or follow an explicitly defined timeout policy.

A one-cycle pulse can be visible in the source domain and completely missed by a slower or stopped destination. If the event must not be lost, a request held until acknowledgment or a suitable event encoding may be needed; the actual circuit still requires verification under its clock and reset conditions. Do not infer from sync = 1 that two flip-flops guarantee pulse delivery. The table models acceptance policy, not pulse width.

A multibit lifecycle value adds a coherence failure. Suppose a two-bit source value changes from 01 to 10. Independently synchronized bits could temporarily form 00 or 11 at the destination. This is a hypothetical illustration of coherence, not the legal encoding of a particular chip. Even if each bit passes structural CDC checks, the protocol must preserve whether the bits belong to one update. Authorization decoding must also define its treatment of reserved or illegal values.

Now add independent reset: the producer restarts while the consumer continues running, and the FIFO retains a completion message from the previous boot. The message may contain correct data but belong to an obsolete boot. The design must choose to clear it, drain it, or distinguish messages with a new boot epoch. Here, epoch is a proposed transaction-generation concept; the interactive model does not implement it. Reset handling also determines which in-flight evidence remains eligible for use.

Deeper exercises: from a Boolean table to a verification plan

Exercise A: locate the first counterexample. Keep check at 1. At step 2, disable sync, then enable it. Record the weak and gated acceptance results for each setting. If the weak policy accepted before destination observation, does subsequently enabling sync erase the counterexample?

Answer and reasoning: No. The security event already occurred at the earlier acceptance boundary. Preserve the request, acceptance time, and destination observation at that time. Do not replace them with the final ready state. The gated policy rejects before observation and permits acceptance afterward. Retain the legitimate acceptance row too: permanently rejecting everything can make a safety check appear successful while disabling the interface.

Exercise B: design a test outside this model. The destination clock stops. The source emits a one-cycle check_done pulse and then clears it. List the signals you need to observe and the information missing from the interactive model.

Answer and reasoning: You need source pulse width, destination clock edges, handshake request and acknowledgment, the data-hold interval, and destination acceptance. This model has no continuous or per-domain timing, so it supports a test plan rather than a claim that a missed pulse was measured. If a handshake is used, also check recovery when reset occurs between request and acknowledgment. A repair must not introduce an indefinite wait.

Exercise C: review the reset exclusion. The SVA draft below disables checking during destination reset. If the debug acceptance point can still produce external side effects during reset, is a passing assertion sufficient?

Answer and reasoning: No. disable iff excludes that interval from the property; it does not prevent hardware acceptance. Define and substantiate the interface contract during reset: whether acceptance is isolated, whether external requests are retained, and how authorization is re-established after reset. This exercise identifies missing evidence. It does not claim that the SVA has been compiled or proved.

Classroom derivation: calculate when a pulse is missed

The prerequisite is an edge-triggered D flip-flop. Setup/hold require stable data around a sampling edge; asynchronous reset release has recovery/removal constraints. A two-stage synchronizer gives possible first-stage metastability time to resolve. The second stage reads the previous first-stage value at the next destination edge. This reduces propagation risk, while first-stage capture of a short pulse remains a separate question.

Let the source clock be 200 MHz, with a 5 ns period, and the destination be 25 MHz, with a 40 ns period. In this new hand-calculation model, the source pulse is high only in [0, 5) ns. Destination sampling phase φ satisfies 0 ≤ φ < 40 ns. An edge meets the high pulse only when φ is in [0, 5), a fraction of 5/40 = 12.5%. This is a geometric fraction under uniform phase and ideal instantaneous sampling, excluding setup/hold and metastability. It is not circuit reliability.

φDestination sampling edges (ns)Captures the [0, 5) pulse?
2 ns2, 42, 82Yes, at 2 ns
10 ns10, 50, 90No
30 ns30, 70, 110No

Compare this with the four-row table above: that table uses shared teaching steps for policy, whereas this table assigns units to two clocks. To expose the weak-policy counterexample, assume a legitimate request and all other permissions, then set permission = 1 and weakAccept = permission. WeakAccept is 1 in all four earlier rows. In particular, the second row has weakAccept = 1 and gated accept = 0. This adds an explicit comparison in the article; the original lab has no new permission control.

Holding the request still leaves synchronization time

Now hold req high from 6 ns, with destination edges at 40, 80, and 120 ns. Both stages start at 0. The ideal model sets q1 = 1 and q2 = 0 at 40 ns; q2 becomes 1 at 80 ns. Observation lags request rise by 74 ns, or about 1.85 destination periods. Two sampling edges are crossed, but the delay is not invariably two whole periods. Phase and metastability change actual latency.

Track a four-phase handshake through six events: the source holds data and raises req; destination synchronization observes req; the destination receives data and raises ack; the source synchronizes ack and lowers req; the destination observes req clear and lowers ack; the source observes ack clear and finishes the transaction. The protocol defines data hold and release. If the destination clock may stop without a bounded stop interval, no finite completion bound follows. Timeout initiates a defined cancellation or recovery policy; it cannot declare delivery complete.

Give the six-event handshake a numerical trace

Keep req rising at 6 ns and the 40 ns destination period. Specify source edges at 1, 6, 11…ns (5 ns period) and destination edges at 0, 40, 80…ns. Both directions use two-stage synchronization, and both controllers are registered: they read the old q2 at an edge and act at the following edge. All registers start at 0; metastability and setup/hold are excluded.

Time nsEventData/protocol state
6Source raises req and holds data stableWaiting for ack
40Destination req stage 1 becomes 1Stage 2 remains 0
80Destination req stage 2 becomes 1Controller still reads old q2=0
120Destination controller captures data and raises ackData saved by receiver
121, 126Source ack stages 1 and 2 become 1Sender controller still reads the old value at 126
131Source controller observes ack and lowers reqOriginal data may be released under this contract; no next transaction yet
160, 200Destination req stages 1 and 2 become 0Waiting for receiver-controller action
240Destination controller observes req clear and lowers ackReceiver returns to waiting
241, 246Source ack stages 1 and 2 become 0Waiting for sender-controller action
251Source controller observes ack clearTransaction complete; next transaction may begin

Req observation by q2 at 80 ns and capture by the controller at 120 ns are separate events. The two-stage 74 ns delay remains correct; the round trip adds controller sampling and return synchronization. In this specified model, data is held until 131 ns and the next transaction may start at 251 ns. A changed controller or clock phase requires recalculation; clock stoppage and reset recovery need their own contract checks.

Handshake exercise: If the destination clock stops after 80 ns, may the source still lower req at 131 ns?

Answer: This trace no longer applies. The receiver has not captured data or raised ack at 120 ns. Hold request and data until acknowledgment is re-established, or complete a defined cancellation/recovery sequence. No finite completion bound follows without a bound on clock stoppage.

For the multibit 01→10 example, bit1 arriving first produces 11; bit0 arriving first produces 00. Adjacent Gray codes change one bit and reduce skew ambiguity for those specified adjacent transitions. Arbitrary transitions, skipped states, fault flips, and authorization still require analysis. Gray encoding alone is not lifecycle-security evidence.

Calculation exercise: With the same 40 ns destination period, change ideal pulse width to 10 ns. What is the phase fraction? If a held req rises at 41 ns, at which destination edge does q2 first observe it in this ideal two-stage model?

Worked answer: The fraction is 10/40 = 25%. The 41 ns rise misses the 40 ns edge; the first stage captures at 80 ns and the second observes at 120 ns, a 79 ns delay. Metastability is excluded. Actual verification also checks synchronizer/reset structure, timing constraints, and handshake recovery. SVA reference_*_sync signals must derive the expected observation point independently from the destination contract, rather than copy DUT flags.

Replay and compare

Download the program and result JSON into one folder. Run with Python 3.8 or newer:

python rtl-university-workbook-v1.py --output replay.json

Compare replay.json with the supplied result, starting with this lesson’s lesson11 field. sourceSha256 identifies the program’s bytes, separately from mathematical correctness. Editing content or resaving LF as CRLF changes that value. Keep the downloaded original and save student changes separately to distinguish method changes from file changes.

Download the classroom replay program · Inspect fixed JSON results

Offline interactive lab

RTL / SVA review direction

These are property sketches: define the harness transaction, reset and oracle, then confirm sampling boundaries before binding to the design. They have not been compiled or proven.

assert property (@(posedge clk_dbg) disable iff (!rst_dbg_n)
  debug_accept |-> reference_lifecycle_stable_sync && reference_rom_check_done_sync);

cover property (@(posedge clk_dbg) disable iff (!rst_dbg_n)
  debug_accept && reference_lifecycle_stable_sync && reference_rom_check_done_sync);

reference_* signals belong to an oracle independent of the DUT. A synchronized flag only says the destination observed a state; it does not prove correct CDC or a legal source lifecycle.

This snippet does not prove CDC, timing, side-channel, or physical injection behavior; each requires its own tool evidence or measurement.

Check your reasoning

  1. Recognition — Which startup events must the design treat separately? Reasoning: Reset release, valid lifecycle data, ROM check completion, and CPU or debug acceptance are distinct events; one ready bit cannot stand in for all of them.
  2. Contrast — Why synchronize reset deassertion locally, but use a handshake for a multi-bit lifecycle value? Reasoning: A local reset synchronizer controls release timing in that domain. A handshake or stable encoded transfer preserves the relationship among multiple data bits.
  3. Scenario — On a common teaching timeline, permission reaches the destination first. Source check_done completes later and has not yet been observed through synchronization in clk_dbg. What should debug_accept do? Reasoning: It must remain low until the destination domain has observed the prerequisite. A weak policy that accepts the early permission is the counterexample.
  4. Failure diagnosis — What can happen if each bit of a lifecycle bus crosses through its own synchronizer? Reasoning: Different bits can arrive on different cycles, producing a combination that the source never sent. Use a coherent transfer protocol or a safely held encoding.
  5. Design risk / transfer — A producer restarts while a consumer and its FIFO remain active. What must the review establish? Reasoning: Define which reset groups may restart independently, how in-flight entries are invalidated or drained, and which transactions remain authorized. CDC/RDC structure alone does not prove that policy.

References

OpenTitan Lifecycle Controller

MY ACADEMY · LESSON FILM

Lesson video

The film explains this lesson’s data path. After a section, return to the interactive exercise and change the input or fault conditions. The animation presents a teaching model; it does not replace RTL simulation.

Diagram scope
Teaching model · Not RTL simulation or silicon testing
Common teaching timeline; not cycle-index comparison, metastability probability or STA

Download MP4 · Captions VTT

Narration uses a synthetic voice. Both the interaction and animation have model boundaries; interpret results using this lesson’s sources and validation scope.

Wrap-up: take this lesson into a design review

Threat model and assumptions

During startup, debug permission and ROM check_done cross different clock domains. After the destination reset releases, permission may arrive before check_done is synchronized there.

Why the design fails

The destination accepts debug permission before synchronized check_done; reset-release ordering and clock phase can let that path arrive first.

Defenses

Synchronize reset release in each domain, handshake lifecycle/check status, and check stable conditions at acceptance.

Validation and checks to perform

Cross phase/state enumeration, CDC/RDC structural checks, timing and positive startup controls; no RTL/formal/STA has run for this lesson.

Limits and unverified claims

An edge model does not represent metastability probability, analog power, the actual reset tree or physical lifecycle fuses.

Try a changed assumption

Change destination frequency and add a CDC FIFO. Define which reset groups may restart independently and the minimum evidence required at acceptance.

This wrap-up summarizes the lesson’s teaching cases, references and experiment scope. Checks not reported as completed remain future work.

Thanks for reading.

Take the concept with you, not just the terminology.

#RTL#Fault Injection