Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Prove retention across a power cycle

Hardware interview practice

Prove retention across a power cycle

HardLow PowerSystemVerilog

A four-bit retained register can be written while powered, saved before shutdown, clamped to zero while off, and restored after power returns. Write SystemVerilog assertions and minimal reference state for the retention protocol.

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Starting point

Question code

input logic clk,rst_n,power_on,save,restore,wr_en;
input logic [3:0] wr_data,q;
Reviewed example

Work through one case

Input
q is written to 4'hA, save is accepted, power turns off with q clamped to zero, power returns, and restore is accepted.
Expected output
On the following edge q must equal 4'hA and all saved/off/restore-pending flags clear.

The checker snapshots q at save time and performs the required one-cycle-later comparison only after a valid shutdown and restore sequence.

What to cover

Requirements

  1. Reset clears saved_valid, off_seen, and restore_pending. save is legal only while power_on=1 with all three clear and wr_en=0; it captures q and sets saved_valid. Any other save fails and changes no reference state.
  2. On the first sampled power_on=0 while off_seen=0, require saved_valid and set off_seen. On every off edge require q=0 and save=restore=wr_en=0.
  3. restore is legal only with power_on, saved_valid, off_seen, and no restore_pending. It sets restore_pending; on the next edge q must equal the saved value, then clear all three flags. Any other restore fails and preserves state.
  4. wr_en is legal only while power_on=1 before a save and before shutdown. A write after save, a save after shutdown, or a power-off transition without a saved value must assert-fail.
Continue practicing

Related questions

Low PowerEthernet low-power idle entry timer→Low PowerSequence retention, isolation, power switch, and restore→Low PowerClassify CMOS power components→
asic.fyi · Learn silicon end to end.info@asic.fyi