Two teams drew the image pipe as two small domains. Merge them into one, grow it to the whole pipe and the encoder, and isolate the result.
Hardware context: A media chip with a core and a DSP, and a camera chip with an image pipe and a GPU. Draw each power domain so that every instance lands where the power plan says.
The SoC file cam_top.upf makes the always-on domain PD_TOP and the rails of cam. The ISP team's file isp_blocks.upf makes two domains on the ISP rail: PD_SCALE for u_isp/u_scale and PD_STATS for u_isp/u_stats, each with its own isolation strategy.
The chip has one ISP power switch, so the ISP is one domain. Join the two into a domain named PD_ISP. Then add u_isp itself, which has a register, and the encoder u_enc.
Isolate the outputs of PD_ISP: clamp 0, enable iso_isp active high, always-on supply VDD_N and VSS_N, location parent. Do not edit the two given files.
Full specification
| Instance | Domain after your file |
|---|---|
| cam, u_sys, u_sys/u_gpu | PD_TOP |
| u_isp, u_isp/u_scale, u_isp/u_stats, u_enc | PD_ISP |
| Rule | What the grader checks |
|---|---|
| One ISP domain | PD_SCALE and PD_STATS are merged into PD_ISP. They share the ISP rail, which a merge needs (UPF 1.0 6.20). |
| Grown to the pipe | u_isp and u_enc are in PD_ISP; they are named from the top, where the file runs. |
| Strategies name the merged domain | A strategy written after the merge names PD_ISP. The old names are refused. |
| Isolation at the new boundary | The isolation of the result equals the reference's. |
| The scenarios pass | A public run, and two hidden runs. |
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 |
|---|---|
| Switch the ISP rail off for one beat | public scenario: Run shows it |
| ISP off, back on with a reset | hidden scenario |
| ISP off for four clock edges, GPU working | hidden scenario |
| Intent equals the reference | the domain of every instance; isolation cells (clamp, enable, sense, supply); supply sets and switches; the primary supply of every domain; where each isolation cell is placed; supply ports, nets and their connections |
The Design
The power-unaware RTL your UPF describes (top cam). Open a file to read it.
cam.sv
// cam: an always-on top with a system block, an image pipe and an encoder. Power-unaware RTL.
module cam (
input logic clk,
input logic rst_n,
input logic en,
input logic [7:0] d,
input logic pwr_isp,
input logic pwr_gpu,
input logic iso_isp,
input logic iso_gpu,
output logic [7:0] q_isp,
output logic [7:0] q_enc,
output logic [7:0] q_gpu,
output logic [7:0] total
);
sys u_sys (.clk(clk), .rst_n(rst_n), .en(en), .d(d), .q(q_gpu));
isp u_isp (.clk(clk), .rst_n(rst_n), .en(en), .d(d), .q(q_isp));
acc u_enc (.clk(clk), .rst_n(rst_n), .en(en), .d(d + 8'd3), .q(q_enc));
always_ff @(posedge clk or negedge rst_n)
if (!rst_n) total <= '0;
else total <= q_isp + q_enc + q_gpu;
endmodule
sys.sv
// sys: always-on glue around a GPU; it registers the GPU's result.
module sys (
input logic clk,
input logic rst_n,
input logic en,
input logic [7:0] d,
output logic [7:0] q
);
logic [7:0] g;
acc u_gpu (.clk(clk), .rst_n(rst_n), .en(en), .d(d + 8'd2), .q(g));
always_ff @(posedge clk or negedge rst_n)
if (!rst_n) q <= '0;
else q <= g;
endmodule
isp.sv
// isp: a scaler and a statistics unit, and a register that adds their results.
module isp (
input logic clk,
input logic rst_n,
input logic en,
input logic [7:0] d,
output logic [7:0] q
);
logic [7:0] s, t;
acc u_scale (.clk(clk), .rst_n(rst_n), .en(en), .d(d), .q(s));
acc u_stats (.clk(clk), .rst_n(rst_n), .en(en), .d(d + 8'd1), .q(t));
always_ff @(posedge clk or negedge rst_n)
if (!rst_n) q <= '0;
else q <= s + t;
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.
cam_top.upf
# cam_top.upf: the always-on top of cam and its rails, from the SoC power team.
create_power_domain PD_TOP -elements {.}
create_supply_port VDD -direction in
create_supply_port VSS -direction in
create_supply_net VDD_N
create_supply_net VSS_N
connect_supply_net VDD_N -ports {VDD}
connect_supply_net VSS_N -ports {VSS}
create_supply_net VDD_ISP
create_supply_net VDD_GPU
create_power_switch SW_ISP -domain PD_TOP -input_supply_port {i VDD_N} -output_supply_port {o VDD_ISP} \
-control_port {c pwr_isp} -on_state {on i {c}} -off_state {off {!c}}
create_power_switch SW_GPU -domain PD_TOP -input_supply_port {i VDD_N} -output_supply_port {o VDD_GPU} \
-control_port {c pwr_gpu} -on_state {on i {c}} -off_state {off {!c}}
set_domain_supply_net PD_TOP -primary_power_net VDD_N -primary_ground_net VSS_N
isp_blocks.upf
# isp_blocks.upf: the ISP team's file, run at the top of cam.
# One domain per ISP unit, both on the ISP rail, each with its own isolation.
create_power_domain PD_SCALE -elements {u_isp/u_scale}
create_power_domain PD_STATS -elements {u_isp/u_stats}
set_domain_supply_net PD_SCALE -primary_power_net VDD_ISP -primary_ground_net VSS_N
set_domain_supply_net PD_STATS -primary_power_net VDD_ISP -primary_ground_net VSS_N
set_isolation ISO_SCALE -domain PD_SCALE -applies_to outputs -clamp_value 0 \
-isolation_power_net VDD_N -isolation_ground_net VSS_N \
-isolation_signal iso_isp -isolation_sense high -location parent
set_isolation ISO_STATS -domain PD_STATS -applies_to outputs -clamp_value 0 \
-isolation_power_net VDD_N -isolation_ground_net VSS_N \
-isolation_signal iso_isp -isolation_sense high -location parent
The Public Scenario
Switch the ISP rail off for one beat. 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, pwr_isp = 1, pwr_gpu = 1, iso_isp = 0, iso_gpu = 0;
logic [7:0] d = 0;
wire [7:0] q_isp, q_enc, q_gpu, total;
cam dut (.*);
always #5 clk = ~clk;
task show(string what);
$display("%-9s scale=%0h stats=%0h isp=%0h enc=%0h gpu=%0h sys=%0h | q_isp=%0h q_enc=%0h total=%0h", what,
dut.u_isp.u_scale.q, dut.u_isp.u_stats.q, dut.u_isp.q, dut.u_enc.q, dut.u_sys.u_gpu.q, dut.u_sys.q, q_isp, q_enc, total);
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); @(posedge clk); #1 show("all run");
iso_isp = 1; #1 pwr_isp = 0; #1;
beat(8'h01); show("isp off");
#20 $finish;
end
endmodule
Examples
Example 1
The Starter: The ISP Team's Two Domains- Input
The starter, read by OpenPA (its domains)
- OpenPA reports (recorded)
Power domains PD_TOP (cam_top.upf:2): cam, u_enc, u_isp, u_sys, u_sys/u_gpu PD_SCALE (isp_blocks.upf:3): u_isp/u_scale PD_STATS (isp_blocks.upf:4): u_isp/u_stats
Two small domains sit on the ISP rail, and u_isp and u_enc are still in PD_TOP. Your file joins and grows them.
Example 2
A New Domain Beside the Old Ones- Input
create_power_domain PD_ISP -elements {u_isp u_enc}, with no merge (a wrong idea)- OpenPA reports (recorded)
Power domains PD_TOP (cam_top.upf:2): cam, u_sys, u_sys/u_gpu PD_SCALE (isp_blocks.upf:3): u_isp/u_scale PD_STATS (isp_blocks.upf:4): u_isp/u_stats PD_ISP (answer.upf:8): u_enc, u_isp
u_isp and u_enc move. The scaler and the statistics unit stay in the team's domains, because a child keeps the domain that claimed it. The table wants one domain.
Example 3
The Sample Run: Switch the ISP Rail off for One Beat- Input
The reference file, run on the public scenario
- The bench prints (recorded)
all run scale=10 stats=11 isp=21 enc=13 gpu=12 sys=12 | q_isp=21 q_enc=13 total=13 isp off scale=xx stats=xx isp=xx enc=xx gpu=15 sys=12 | q_isp=0 q_enc=0 total=12
The ISP rail is switched off with iso_isp raised first. Every register of the merged domain goes to X, and q_isp and q_enc read the clamp value 0.
Constraints and Contract
- Submit your top file only. Keep the two load_upf lines first; the grader gives OpenPA the same two files you see.
- The domain must be named PD_ISP. Keep its ISP power rail and ground, and keep PD_TOP on its original supplies.
- The bench drives the supply ports VDD and VSS, the switch controls and the isolation enables.
Hints
Hint 1
Two domains on one shared rail can become one: UPF 1.0 has a command that does exactly that.
Hint 2
A domain can grow after it exists. Name the instances from the top.
Hint 3
After a merge, the old domain names are gone. Which domain does the new strategy name?
What the grader checks: OpenPA reads your file with cam_top.upf and isp_blocks.upf. The grader checks each instance, primary supply, supply connection and isolation cell, including its location. 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