W4.9.2 Retain Selected Registers Safely

MediumImplementOpenPA + Icarus · serverReview the topic

A queue checkpoint has two bytes of state. Save them together and diagnose traffic during a forbidden control event.

Hardware context: A packet queue with separately powered register shadows. Preserve the queue checkpoint while disposable state restarts.

A queue checkpoint has two bytes of state. Save them together and diagnose traffic during a forbidden control event.

Load board.upf, then add the strategy described in the table.

Full specification
DecisionBoard requirement
Initial listName u_queue/tail in POINTER. Use POINTER as the initial element list of FRAME in PD_UNIT.
RefinementAdd the whole epoch byte with an element update to FRAME. Leave temp volatile.
PowerRun both shadows on KEEP.
EdgesSave on rising store. Recall on falling recall_n.
Clock exclusionReport a save edge or a recall edge while clk is high. Use the matching save-side or restore-side mutex.
Traffic exclusionUse the joint save/restore mutex to report either event while busy is high.

What the Grader Checks

OpenPA reads your file. A refusal ends the check with OpenPA's message and line. Otherwise every row below must pass.

RowRule
Board sequencepublic scenario: Run shows it
Additional sequence Bhidden scenario
Additional sequence Chidden scenario
Intent equals the referenceretained registers and their controls; supply ports, nets and their connections; the primary supply of every domain; the domain of every instance
UPF formsuses initial queue inventory; uses save exclusion; uses restore exclusion; uses joint exclusion
Power cellsat most 2

The Design

The power-unaware RTL your UPF describes (top packet_soc). Open a file to read it.

bank.sv
module bank(input logic clk, input logic [7:0] d);
  logic [7:0] tail, epoch, temp;
  always_ff @(posedge clk) begin
    tail <= d;
    epoch <= ~d;
    temp <= d + 1'b1;
  end
endmodule
module packet_soc(input logic clk, input logic [7:0] d, input logic store, recall_n, busy);
  bank u_queue(.clk(clk), .d(d));
endmodule

Given UPF Files

Your file may load these with load_upf. The grader uses the same text.

board.upf
upf_version 4.0
set_design_top packet_soc
create_power_domain PD_TOP -include_scope
create_power_domain PD_UNIT -elements {u_queue}
create_supply_port VHOST -direction in
create_supply_net HOST_N
connect_supply_net HOST_N -ports {VHOST}
create_supply_port VUNIT -direction in
create_supply_net UNIT_N
connect_supply_net UNIT_N -ports {VUNIT}
create_supply_port VKEEP -direction in
create_supply_net KEEP_N
connect_supply_net KEEP_N -ports {VKEEP}
create_supply_port VSS -direction in
create_supply_net GND_N
connect_supply_net GND_N -ports {VSS}
create_supply_set HOST -function {power HOST_N} -function {ground GND_N}
create_supply_set UNIT -function {power UNIT_N} -function {ground GND_N}
create_supply_set KEEP -function {power KEEP_N} -function {ground GND_N}
associate_supply_set HOST -handle PD_TOP.primary
associate_supply_set UNIT -handle PD_UNIT.primary

The Public Scenario

Board sequence. Run checks its output and shows the expected lines and any failure.

tb.sv (public scenario)
`timescale 1ns/1ps
module tb;
  import UPF::*;
  logic clk=0, store=0, recall_n=1, busy=0;
  logic [7:0] d=0;
  packet_soc dut(.*);
  task write_word(input logic [7:0] word);
    d=word; #1 clk=1; #1 clk=0; #1;
  endtask
  task show(input string label);
    $display("%s tail=%02h epoch=%02h temp=%02h", label, dut.u_queue.tail, dut.u_queue.epoch, dut.u_queue.temp);
  endtask
  initial begin
    void'(supply_on("VHOST",1.0));
    void'(supply_on("VUNIT",1.0));
    void'(supply_on("VKEEP",1.0));
    void'(supply_on("VSS",0.0));
    #4;
    write_word(8'h17); store=1; #1; show("edge capture");
    write_word(8'h69); store=0; #1; show("later write");
    void'(supply_off("VUNIT")); #2; show("asleep");
    void'(supply_on("VUNIT",1.0)); #2; write_word(0); recall_n=0; #1; show("edge recall");
    recall_n=1; #1;
    #2; $finish;
  end
endmodule

Examples

Example 1

Recorded Board Connections
Input
Load board.upf alone.
OpenPA reports (recorded)
Power domains
  PD_TOP (board.upf:3): packet_soc
    primary supply HOST: power HOST_N, ground GND_N
    0 register(s); 0 memory(ies)
  PD_UNIT (board.upf:4): u_queue
    primary supply UNIT: power UNIT_N, ground GND_N
    3 register(s): u_queue.epoch, u_queue.tail, u_queue.temp; 0 memory(ies)

Locate the unit in the power-domain report.

Example 2

Recorded Starting Policy
Input
Compile the starter.
OpenPA reports (recorded)
Strategies
  set_retention FRAME (answer.upf:3): u_queue.tail; save store high, restore recall_n low; supply KEEP

Read this selection against the board requirements.

Example 3

Recorded Board Sequence
Input
Run the public bench with the completed policy.
The bench prints (recorded)
edge capture tail=17 epoch=e8 temp=18
later write tail=69 epoch=96 temp=6a
asleep tail=xx epoch=xx temp=xx
edge recall tail=17 epoch=e8 temp=01

D7 flags the intentional write after capture. The recall row recovers the earlier tail and epoch bytes.

Constraints and Contract

  • Keep board.upf loaded. Preserve its domain and supply connections.
  • The sample and hidden sequences run on OpenPA and Icarus.

Hints

Hint 1

Follow one byte from the last write through the first read after wake.

Hint 2

Compare a control event with a window during which data can still change.

Hint 3

Use the restart write to distinguish a retained byte from fresh state.

What the grader checks: The judge checks the modeled paths and their behavior in Icarus. Physical implementation is outside this exercise.

Run checks the public scenario only and never accepts. Submit runs every row. OpenPA is our open power-aware tool: it reads the UPF, writes a power-aware copy of the RTL, and Icarus runs that copy.

See all 2 problems on this path
Your UPF file UPFSaved locally
Ln 1, Col 1Tab indents · Ctrl/⌘ + Enter runs
Not run yet

Run checks the public scenario. Submit checks every row in the description.

OpenPA + Icarus · server