W4.1.1 Make the File Readable

EasyFixOpenPA + Icarus · serverReview the topic

A UPF file copied out of a slide deck does not load. Fix it so that OpenPA reads it, without changing the power intent it describes.

Hardware context: A power controller with a switchable core, and a hub with three switchable units. Write power intent that tools read the same way, by hand or from a Tcl loop.

A colleague copied the power intent of pmu_soc out of a slide deck. The design is the controller and core of lesson W4.1: an always-on PMU and a core that can be switched off.

OpenPA refuses the file. It stops at the first problem and names the line. Fix each problem, run again, and read the next message.

The intent in the file is right: two domains, a switch, isolation of the core's outputs and retention of the accumulator. Keep all of it. The file must also say which edition of UPF it follows: IEEE 1801-2024, which calls itself version "4.0".

Full specification
RuleWhat the grader checks
The file loadsOpenPA reads it with no refusal: no typographic quote or dash substitutions, and every option is a real option of its command.
The edition is declaredThe file declares the edition this page uses, IEEE 1801-2024.
The intent is unchangedDomains, supplies, isolation and retention equal the reference file's.
The scenarios passA sleep and wake run, and two hidden runs, print the expected values.

Simulator note: OpenPA stops at the first error, so you see one message at a time. IEEE 1801-2024 8.4 lets a tool go on after an error; OpenPA does not.

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
Three beats, sleep, wake: the accumulator comes backpublic scenario: Run shows it
The core is off and the bench raises enhidden scenario
Two sleep and wake cycles with work betweenhidden scenario
Intent equals the referencethe domain of every instance; supply sets and switches; isolation cells (clamp, enable, sense, supply); retained registers and their controls
Editiondeclares upf_version 4.0

The Design

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

pmu_soc.sv
// pmu_soc: two power domains. The top and the controller are always on; u_core can be switched off.
// The RTL is power-unaware: no isolation cell, no supply, no retention register is written here.
module pmu_soc (
  input  logic       clk,
  input  logic       rst_n,
  input  logic       sleep_req,
  input  logic       wake_req,
  input  logic       en,
  input  logic [7:0] d,
  input  logic [1:0] rf_addr,
  input  logic       rf_we,
  output logic [7:0] total,
  output logic       led,
  output logic [7:0] rd,
  output logic [3:0] beats,
  output logic [7:0] status,
  output logic [2:0] pmu_state
);
  logic iso_en, save, restore, pwr_en, core_rst_n;
  logic [7:0] acc, rf_rd;
  logic busy;
  logic [3:0] core_beats;

  pmu u_pmu (
    .clk        (clk),
    .rst_n      (rst_n),
    .sleep_req  (sleep_req),
    .wake_req   (wake_req),
    .iso_en     (iso_en),
    .save       (save),
    .restore    (restore),
    .pwr_en     (pwr_en),
    .core_rst_n (core_rst_n),
    .state_o    (pmu_state)
  );

  core u_core (
    .clk     (clk),
    .rst_n   (core_rst_n),
    .en      (en),
    .d       (d),
    .rf_addr (rf_addr),
    .rf_we   (rf_we),
    .acc     (acc),
    .rf_rd   (rf_rd),
    .busy    (busy),
    .beats   (core_beats)
  );

  // Always-on consumers of the core's outputs.
  assign total = acc;
  assign led   = busy;
  assign rd    = rf_rd;
  assign beats = core_beats;
  // A status register: keeps the last accumulator value seen while the core was busy.
  always_ff @(posedge clk or negedge rst_n)
    if (!rst_n) status <= '0;
    else if (busy) status <= acc;
endmodule
pmu.sv
// pmu_soc: the always-on power controller. Power-unaware RTL: it only drives control signals.
// Sleep: isolate, save, switch off. Wake: switch on, reset, restore, release isolation.
module pmu (
  input  logic       clk,
  input  logic       rst_n,
  input  logic       sleep_req,
  input  logic       wake_req,
  output logic       iso_en,
  output logic       save,
  output logic       restore,
  output logic       pwr_en,
  output logic       core_rst_n,
  output logic [2:0] state_o
);
  typedef enum logic [2:0] { RUN, ISOLATE, SAVE, OFF, PWRUP, RESET, RESTORE, RELEASE } st_e;
  st_e st;
  always_ff @(posedge clk or negedge rst_n)
    if (!rst_n) st <= RUN;
    else case (st)
      RUN:     if (sleep_req) st <= ISOLATE;
      ISOLATE: st <= SAVE;
      SAVE:    st <= OFF;
      OFF:     if (wake_req) st <= PWRUP;
      PWRUP:   st <= RESET;
      RESET:   st <= RESTORE;
      RESTORE: st <= RELEASE;
      RELEASE: st <= RUN;
      default: st <= RUN;
    endcase
  assign iso_en     = (st != RUN);
  assign save       = (st == SAVE);
  assign restore    = (st == RESTORE);
  assign pwr_en     = !(st == OFF);
  assign core_rst_n = rst_n && (st != RESET);
  assign state_o    = st;
endmodule
core.sv
// pmu_soc: the switchable core. An accumulator, a beat counter and a 4-word register file.
// Power-unaware RTL: nothing here knows about supplies.
module core (
  input  logic       clk,
  input  logic       rst_n,
  input  logic       en,
  input  logic [7:0] d,
  input  logic [1:0] rf_addr,
  input  logic       rf_we,
  output logic [7:0] acc,
  output logic [7:0] rf_rd,
  output logic       busy,
  output logic [3:0] beats
);
  logic [7:0] rf [0:3];
  always_ff @(posedge clk or negedge rst_n)
    if (!rst_n) begin
      acc   <= '0;
      beats <= '0;
    end else if (en) begin
      acc   <= acc + d;
      beats <= beats + 4'd1;
    end
  always_ff @(posedge clk)
    if (rf_we) rf[rf_addr] <= acc;
  assign rf_rd = rf[rf_addr];
  assign busy  = en;
endmodule

The Public Scenario

Three beats, sleep, wake: the accumulator comes back. 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, rst_n = 0, sleep_req = 0, wake_req = 0, en = 0, rf_we = 0;
  logic [7:0] d = 0; logic [1:0] rf_addr = 0;
  wire [7:0] total, rd, status; wire led; wire [3:0] beats; wire [2:0] pmu_state;
  pmu_soc dut (.*);
  always #5 clk = ~clk;
  task show(string what);
    $display("%-12s acc=%0h total=%0h led=%0b iso=%0b pwr=%0b", what, dut.u_core.acc, total, led, dut.iso_en, dut.pwr_en);
  endtask
  task beats_of(input logic [7:0] x, input int n);
    en = 1; d = x; repeat (n) @(posedge clk); #1 en = 0;
  endtask
  task sleep(); sleep_req = 1; @(posedge clk); #1 sleep_req = 0; wait (pmu_state == 3'd3); #1; endtask
  task wake();  wake_req = 1;  @(posedge clk); #1 wake_req = 0;  wait (pmu_state == 3'd0); #1; endtask
  initial begin
    void'(supply_on("VDD", 1.0));
    void'(supply_on("VSS", 0.0));
    repeat (2) @(posedge clk);
    #1 rst_n = 1;
    beats_of(8'h11, 3); show("ran");
    sleep(); show("asleep");
    wake(); show("woken");
    #20 $finish;
  end
endmodule

Examples

Example 1

The File as It Arrived
Input
The starter, unchanged
OpenPA says (recorded)
Refused: answer.upf:6: character U+2013 is an en dash (write "-"); it usually comes from copying UPF out of a slide or PDF

OpenPA stops at the first problem and names the file and line. Fix that line and run again to see the next one.

Example 2

The Intent the File Describes
Input
The reference file, read by OpenPA (its strategies)
OpenPA reports (recorded)
Strategies
  set_isolation ISO_CORE (answer.upf:24): clamp 0, enable u_pmu.iso_en active high, supply {VDD_N VSS_N}, location parent
  set_retention RET_CORE (answer.upf:30): u_core.acc; save u_pmu.save posedge, restore u_pmu.restore posedge; supply {VDD_N VSS_N}

This is what your fixed file must build: one isolation strategy and one retention strategy, with these controls and supplies.

Example 3

The Sample Run: Three Beats, Sleep, Wake: The Accumulator Comes Back
Input
The reference file, run on the public scenario
The bench prints (recorded)
ran          acc=33 total=33 led=1 iso=0 pwr=1
asleep       acc=xx total=0 led=0 iso=1 pwr=0
woken        acc=33 total=33 led=0 iso=0 pwr=1

The core runs three beats of 0x11, sleeps and wakes. While it is off, its accumulator is X and the always-on total reads the clamp value 0. After wake-up the retained 0x33 is back.

Constraints and Contract

  • Submit the whole UPF file for pmu_soc. Keep the strategy names and the domain names.
  • Do not remove a command to make the file load: every command in the starter is part of the intent.
  • The bench drives the supply ports VDD and VSS by name.

Hints

Hint 1

Read the line number in each message. Characters that look like a minus sign or a quote may not be the ASCII ones.

Hint 2

An unknown option is usually a typing slip. The message lists the options the command takes.

Hint 3

The version string is not the year of the standard.

What the grader checks: OpenPA reads your file. The grader compares its domains, supplies, isolation and retention with the reference file, and checks the declared upf_version. Then it runs a public and two hidden power scenarios.

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