W4.6.2 Partial, Error and Two Inputs

HardImplementOpenPA + Icarus · serverReview the topic

Write a switch that feeds a core from a high or a low rail. It starts the high rail softly, flags an illegal selection and acknowledges late.

Hardware context: A tile with a soft-start switch that acknowledges, and a switch that picks a 1.0 V or a 0.8 V rail. Describe each switch state, flag illegal controls, and time the acknowledge the power controller waits for.

The design dvfs has an always-on top and a core. The core runs from a high rail (VHI, 1.0 V) or a low rail (VLO, 0.8 V). The domains, supplies and supply sets are given in dvfs_rails.upf, and the isolation is in dvfs_iso.upf.

One power switch, SW_CORE, picks the rail. Three control signals drive it: sel_hi, sel_lo and ramp. You write the switch.

The controller waits on the wire core_ack. It has no driver in the RTL: the switch's acknowledge port drives it, 5 ns after the switch turns on or off.

Full specification
sel_hisel_lorampVDD_CORE
00anyOFF
100FULL_ON, from VHI
101PARTIAL_ON, from VHI (soft start: current limited)
01anyFULL_ON, from VLO
11anyillegal: an error state, whatever the rail voltages are
RuleWhat the grader checks
Two inputsVHI_N and VLO_N are the switch's two inputs; VDD_CORE is its output.
Full and partial statesEach row of the table gives the state shown, from the input shown.
The error stateBoth selects high is an error, even at a moment when the two rails have the same voltage. OpenPA's D10 check must fire.
Acknowledgecore_ack is 1 from 5 ns after the switch starts to turn on, and 0 from 5 ns after it turns off. A change that lasts less than 5 ns is not seen.
Acknowledge supplyThe acknowledge logic runs on SS_AON.
The scenarios passA public run and four hidden control sequences print the expected rail states and acknowledges, with the expected check counts.

Simulator note: While the core runs from VLO, the top is at 1.0 V and the core at 0.8 V. OpenPA's D11 check reports crossings with no level shifter. The design has none yet (lesson W4.10), so the expected check counts include D11.

Simulator note: Standard behaviour: a bare number in -ack_delay counts in the simulator's precision, here 1 ps (IEEE 1801-2024 6.23). OpenPA 0.3.0 counts it in the design's time unit, 1 ns. Write the unit, as in 5ns, and both readings agree.

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
Soft start from the high rail, then full power, then offpublic scenario: Run shows it
High rail, off, then low railhidden scenario
Both selects high while the rails agree in voltagehidden scenario
Every binary control combinationhidden scenario
A short dip in the controlhidden scenario
Intent equals the referencethe domain of every instance; supply sets and switches; the primary supply of every domain; isolation cells (clamp, enable, sense, supply); where each isolation cell is placed; supply ports, nets and their connections; switch names, acknowledge wires, supplies and delays
Static reportno forbidden finding

The Design

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

dvfs.sv
// dvfs: an always-on top and a core that runs from a high or a low rail. Power-unaware RTL.
module dvfs (
  input  logic       clk,
  input  logic       rst_n,
  input  logic       en,
  input  logic [7:0] d,
  input  logic       sel_hi,
  input  logic       sel_lo,
  input  logic       ramp,
  input  logic       iso_core,
  output logic [7:0] q,
  output logic       ready
);
  wire core_ack;   // no RTL drives this wire: the UPF switch's -ack_port does
  acc u_core (.clk(clk), .rst_n(rst_n), .en(en), .d(d), .q(q));
  assign ready = core_ack;
endmodule
acc.sv
// acc: an 8-bit accumulator.
module acc (
  input  logic       clk,
  input  logic       rst_n,
  input  logic       en,
  input  logic [7:0] d,
  output logic [7:0] q
);
  always_ff @(posedge clk or negedge rst_n)
    if (!rst_n)  q <= '0;
    else if (en) q <= q + d;
endmodule

Given UPF Files

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

dvfs_rails.upf
# dvfs_rails.upf: the domains, supplies and supply sets of dvfs (given).
create_power_domain PD_TOP -elements {.}
create_power_domain PD_CORE -elements {u_core}

create_supply_port VDD -direction in
create_supply_port VSS -direction in
create_supply_port VHI -direction in
create_supply_port VLO -direction in
create_supply_net VDD_N
create_supply_net VSS_N
create_supply_net VHI_N
create_supply_net VLO_N
create_supply_net VDD_CORE
connect_supply_net VDD_N -ports {VDD}
connect_supply_net VSS_N -ports {VSS}
connect_supply_net VHI_N -ports {VHI}
connect_supply_net VLO_N -ports {VLO}

create_supply_set SS_AON -function {power VDD_N} -function {ground VSS_N}
create_supply_set SS_CORE -function {power VDD_CORE} -function {ground VSS_N}
associate_supply_set SS_AON -handle PD_TOP.primary
associate_supply_set SS_CORE -handle PD_CORE.primary
dvfs_iso.upf
# dvfs_iso.upf: isolation of the core (given).
set_isolation ISO_CORE -domain PD_CORE -applies_to outputs -clamp_value 0 \
    -isolation_supply SS_AON -isolation_signal iso_core -isolation_sense high -location parent

The Public Scenario

Soft start from the high rail, then full power, then off. 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, en = 0, sel_hi = 0, sel_lo = 0, ramp = 0, iso_core = 1;
  logic [7:0] d = 0;
  wire [7:0] q; wire ready;
  dvfs dut (.*);
  always #5 clk = ~clk;
  function automatic string rail(string net);
    upfSupplyTypeT v; upfSupplyStateE s;
    v = get_supply_value(net); s = get_supply_state(v);
    return $sformatf("%s %0d mV", s.name(), $rtoi(get_supply_voltage(v) * 1000.0));
  endfunction
  task show(string what);
    $display("%-9s core=%-17s ready=%b", what, rail("VDD_CORE"), ready);
  endtask
  initial begin
    void'(supply_on("VDD", 1.0));
    void'(supply_on("VSS", 0.0));
    void'(supply_on("VHI", 1.0));
    void'(supply_on("VLO", 0.8));
    #10 rst_n = 1;
    sel_hi = 1; ramp = 1; #1 show("soft");
    #3 show("soft+4");
    #2 show("soft+6");
    ramp = 0; #1 show("full");
    sel_hi = 0; #1 show("off");
    #6 show("off+7");
    #20 $finish;
  end
endmodule

Examples

Example 1

The Starter's Supply Network
Input
The starter, read by OpenPA (its supply network)
OpenPA reports (recorded)
Supply network
  VDD_N: port VDD  {port:VDD net:VDD_N fn:SS_AON.power fn:PD_TOP.primary.power}
  VSS_N: port VSS  {port:VSS net:VSS_N fn:SS_AON.ground fn:SS_CORE.ground fn:PD_TOP.primary.ground fn:PD_CORE.primary.ground}
  VHI_N: port VHI  {port:VHI net:VHI_N}
  VLO_N: port VLO  {port:VLO net:VLO_N}
  VDD_CORE: root VDD_CORE  {net:VDD_CORE fn:SS_CORE.power fn:PD_CORE.primary.power}

VDD_CORE has no source yet. The two rails VHI_N and VLO_N reach nothing.

Example 2

A State That Names a Net
Input
-input_supply_port {hi VHI_N} with -on_state {high VHI_N {h}} (a wrong idea, for the message)
OpenPA says (recorded)
Refused: answer.upf:8: create_power_switch SW_CORE -on_state high: "VHI_N" is not an input supply port of the switch

An on state names the switch's own input port, not the net that port connects to.

Example 3

The Sample Run: Soft Start from the High Rail, Then Full Power, Then Off
Input
The reference file, run on the public scenario
The bench prints (recorded)
soft      core=PARTIAL_ON 1000 mV ready=0
soft+4    core=PARTIAL_ON 1000 mV ready=0
soft+6    core=PARTIAL_ON 1000 mV ready=1
full      core=FULL_ON 1000 mV   ready=1
off       core=OFF 0 mV          ready=1
off+7     core=OFF 0 mV          ready=0

The high rail starts softly: VDD_CORE is PARTIAL_ON and ready rises 5 ns after the switch started to turn on. Then the rail is full on. After sel_hi falls, ready falls 5 ns later.

Constraints and Contract

  • Preserve the given supply wiring and isolation placement. Add no extra supply nets or ports. No supply net may lack a source.
  • Submit the whole UPF file for dvfs. Keep the two load_upf lines: dvfs_rails.upf first, dvfs_iso.upf last.
  • Name the switch SW_CORE. Port and state names are your choice.
  • The design uses a timescale of 1ns/1ps. Give the delay with its unit (see the simulator note).
  • The bench drives the supply ports, sel_hi, sel_lo, ramp and iso_core. It reads VDD_CORE and the output ready (= core_ack).

Hints

Hint 1

Give each input its own on state. Add a partial state for the soft start of the high rail.

Hint 2

With no -off_state, the off state is every value that no on, partial or error state covers. Then an uncovered combination reads OFF, not as an error.

Hint 3

An acknowledge that changes during a 1 ns dip in the control has no delay, or too short a one.

What the grader checks: OpenPA reads your file and the two given files. The grader compares domains, supply sets, the switch (inputs, output and controls) and isolation with the reference. Then it runs a public and four hidden control sequences, reading the rail, the acknowledge, their timing and the check counts.

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