Write a supply network in which the CPU rail comes from its switch or a separate regulator, never both at once.
Hardware context: A radio with a two-regulator RF rail and a two-switch baseband rail. Wire supply ports and nets, and pick the resolution that matches how the sources take turns.
The design hub has three switchable units. The domains and the three unit switches are given, and so is the isolation, in hub_iso.upf. The supply network is missing: you write it.
The CPU rail VDD_CPU has two sources. One is the CPU switch SW_CPU. The other is VRET, a quiet regulator outside the chip that holds the CPU while its switch is open. They take turns: at most one of them may be on.
The chip also brings the CPU rail out to a test pin, VCPU_MON, so a tester can watch it.
Full specification
| Supply port | Direction | Role |
|---|---|---|
| VDD | in | the always-on supply |
| VSS | in | ground |
| VRET | in | the quiet regulator that can hold the CPU rail |
| VCPU_MON | out | the CPU rail, brought out to a test pin |
| Supply net | Sources and loads | Resolution |
|---|---|---|
| VDD_N | port VDD; feeds the three switches | one source |
| VSS_N | port VSS | one source |
| VDD_CPU | switch SW_CPU and port VRET; drives port VCPU_MON | two sources, at most one on |
| VDD_DSP | switch SW_DSP | one source |
| VDD_NPU | switch SW_NPU | one source |
| Domain | Primary power | Primary ground |
|---|---|---|
| PD_TOP | VDD_N | VSS_N |
| PD_CPU | VDD_CPU | VSS_N |
| PD_DSP | VDD_DSP | VSS_N |
| PD_NPU | VDD_NPU | VSS_N |
| Rule | What the grader checks |
|---|---|
| One source per plain net | A net without a resolution takes one source. Two are refused. |
| The right resolution | The CPU rail's resolution allows two sources from different supplies, one at a time. |
| Port directions | A port that brings a supply in is an input; the test pin is an output. The static report must not list the test pin as a source of the CPU rail. |
| Every connection made | Each port is connected to its net, so each rail has the state the hidden supply sequences expect. |
| Complete primaries | Every domain has a primary power and a primary ground net. The static report must not warn about a missing one. |
| The scenarios pass | A public run and two hidden supply sequences, with the rail states and check counts they expect. |
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.
| Row | Rule |
|---|---|
| Hand the CPU rail from its switch to the regulator | public scenario: Run shows it |
| Both CPU sources on at once | hidden scenario |
| DSP and NPU off, CPU from the regulator only | hidden scenario |
| Intent equals the reference | the 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 |
| Static report | no forbidden finding |
The Design
The power-unaware RTL your UPF describes (top hub). Open a file to read it.
hub.sv
// hub: an always-on top with three switchable units. Power-unaware RTL: no supply, no isolation cell.
module hub (
input logic clk,
input logic rst_n,
input logic en,
input logic [7:0] d,
input logic pwr_cpu,
input logic pwr_dsp,
input logic pwr_npu,
input logic iso_cpu,
input logic iso_dsp,
input logic iso_npu_n,
output logic [7:0] q_cpu,
output logic [7:0] q_dsp,
output logic [7:0] q_npu,
output logic [7:0] seen
);
unit u_cpu (.clk(clk), .rst_n(rst_n), .en(en), .d(d), .q(q_cpu));
unit u_dsp (.clk(clk), .rst_n(rst_n), .en(en), .d(d + 8'd1), .q(q_dsp));
unit u_npu (.clk(clk), .rst_n(rst_n), .en(en), .d(d + 8'd2), .q(q_npu));
// Always on: the OR of the three results, registered.
always_ff @(posedge clk or negedge rst_n)
if (!rst_n) seen <= '0;
else seen <= q_cpu | q_dsp | q_npu;
endmodule
unit.sv
// unit: an 8-bit accumulator. Power-unaware RTL.
module unit (
input logic clk,
input logic rst_n,
input logic en,
input logic [7:0] d,
output logic [7:0] q
);
logic [7:0] acc;
always_ff @(posedge clk or negedge rst_n)
if (!rst_n) acc <= '0;
else if (en) acc <= acc + d;
assign q = acc;
endmodule
Given UPF Files
Your file may load these with load_upf. The grader uses the same text.
hub_iso.upf
# hub_iso.upf: isolation of the three units (given).
set_isolation ISO_CPU -domain PD_CPU -applies_to outputs -clamp_value 0 \
-isolation_power_net VDD_N -isolation_ground_net VSS_N \
-isolation_signal iso_cpu -isolation_sense high -location parent
set_isolation ISO_DSP -domain PD_DSP -applies_to outputs -clamp_value 0 \
-isolation_power_net VDD_N -isolation_ground_net VSS_N \
-isolation_signal iso_dsp -isolation_sense high -location parent
set_isolation ISO_NPU -domain PD_NPU -applies_to outputs -clamp_value 0 \
-isolation_power_net VDD_N -isolation_ground_net VSS_N \
-isolation_signal iso_npu_n -isolation_sense low -location parent
The Public Scenario
Hand the CPU rail from its switch to the regulator. 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;
logic pwr_cpu = 1, pwr_dsp = 1, pwr_npu = 1, iso_cpu = 0, iso_dsp = 0, iso_npu_n = 1;
logic [7:0] d = 0;
wire [7:0] q_cpu, q_dsp, q_npu, seen;
hub 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 cpu_rail=%-17s mon=%-17s cpu=%0h dsp=%0h npu=%0h seen=%0h", what,
rail("VDD_CPU"), rail("VCPU_MON"), dut.u_cpu.acc, dut.u_dsp.acc, dut.u_npu.acc, seen);
endtask
task beat(input logic [7:0] x); en = 1; d = x; @(posedge clk); #1 en = 0; endtask
initial begin
void'(supply_on("VDD", 1.0));
void'(supply_on("VSS", 0.0));
@(posedge clk); #1 rst_n = 1;
beat(8'h10); show("switch");
iso_cpu = 1; #1 pwr_cpu = 0; #1 show("gap");
void'(supply_on("VRET", 1.0)); #1 rst_n = 0; #1 rst_n = 1; iso_cpu = 0; #1;
beat(8'h02); show("regulator");
#20 $finish;
end
endmodule
Examples
Example 1
The Starter- Input
The starter, with the given hub_iso.upf
- OpenPA says (recorded)
Refused: answer.upf:12: create_power_switch SW_CPU -output_supply_port: no supply net, supply port or supply set function "VDD_CPU"
A switch names nets that the file has not made yet. Declare the ports and nets first.
Example 2
Two Sources on a Plain Net- Input
connect_supply_net VDD_N -ports {VDD VRET} (a wrong idea, for the message)- OpenPA says (recorded)
Refused: answer.upf:12: supply net VDD_N has 2 sources: port VDD (answer.upf:10), port VRET (answer.upf:12); an unresolved net takes one (use create_supply_net -resolve one_hot or parallel for several)
A net without -resolve takes one source. OpenPA names both sources and the lines that made them.
Example 3
The Sample Run: Hand the CPU Rail from Its Switch to the Regulator- Input
The reference file, run on the public scenario
- The bench prints (recorded)
switch cpu_rail=FULL_ON 1000 mV mon=FULL_ON 1000 mV cpu=10 dsp=11 npu=12 seen=0 gap cpu_rail=OFF 0 mV mon=OFF 0 mV cpu=xx dsp=11 npu=12 seen=0 regulator cpu_rail=FULL_ON 1000 mV mon=FULL_ON 1000 mV cpu=2 dsp=3 npu=4 seen=0
The CPU runs from its switch, then the switch opens and the rail is OFF for a moment. VRET comes on, the CPU is reset and runs from the regulator. The test pin follows the rail.
Constraints and Contract
- Submit the whole UPF file for hub. Keep the domain and switch lines, and the line that loads hub_iso.upf.
- Declare each net before a switch or a connection uses it.
- The bench drives the ports VDD, VSS and VRET, the switch controls and the isolation enables, and reads VDD_CPU and VCPU_MON.
Hints
Hint 1
A net with several sources needs a resolution. Which one allows sources that come from different supplies?
Hint 2
Direction says which way the supply state flows through the port: into the chip, or out of it.
Hint 3
Run the starter after each group of lines. OpenPA names the first net or port it cannot find.
What the grader checks: OpenPA reads your file and hub_iso.upf. The grader checks the static report for missing primary nets and for the test pin as a source. It also checks domains, port directions, wiring, switches, primary supplies and isolation placement. Then it runs a public and two hidden supply sequences, with expected rail states and 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