W4.9.1 Retain with Level Controls

MediumImplementOpenPA + Icarus · serverReview the topic

Keep the packet epoch across a nap. Traffic can still change it while the save window is open.

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

Keep the packet epoch across a nap. Traffic can still change it while the save window is open.

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

Full specification
DecisionBoard requirement
SelectionRetain the whole epoch byte in u_queue. Leave tail and temp volatile.
SupplyUse the KEEP supply set for the shadow. The bench can drop VKEEP independently.
FormThe board integration requires the compatibility option -retention_supply_set.
Save windowstore is active high. Capture the final epoch when that window closes.
Recall windowrecall_n is active low. Hold epoch during the entire recall window.
Uncertain controlKeep default corruption on keeper loss and overlapping active levels. An unknown save must spoil the later recall.

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; the domain of every instance; supply ports, nets and their connections; the primary supply of every domain
UPF forms
Power cellsat most 1

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'h13); store=1; #1; show("save opens");
    write_word(8'ha7); store=0; #1; show("save closes");
    void'(supply_off("VUNIT")); #2; show("asleep");
    void'(supply_on("VUNIT",1.0)); #2; write_word(0); show("restart");
    recall_n=0; #1; show("recall"); write_word(8'hfe); show("held");
    recall_n=1; #1; write_word(8'h19); show("released");
    #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 INDEX (answer.upf:2): u_queue.tail; save store posedge, restore recall_n negedge; supply UNIT

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)
save opens tail=13 epoch=ec temp=14
save closes tail=a7 epoch=58 temp=a8
asleep tail=xx epoch=xx temp=xx
restart tail=00 epoch=ff temp=01
recall tail=00 epoch=58 temp=01
held tail=fe epoch=58 temp=ff
released tail=19 epoch=e6 temp=1a

The second write precedes the closing save edge. Compare epoch at recall and during the next write.

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