Supply Sets and Domain Handles
A supply set bundles the nets of one supply by function. Domains and strategies then name one set instead of loose nets.
You Will Be Able To
- Create supply sets with power, ground and bias functions, and refine a set later with -update.
- Give a domain its primary supply through its handle: with -supply on create_power_domain, or with associate_supply_set.
- Translate UPF 1.0 net forms into supply sets, and check with OpenPA that the intent stays the same.
- Lesson
- W4.5
- Time
- 30 min
- Runs on
- Your browser
- Check
- 5 questions
The W4.4 file wires radio net by net; a second file uses supply sets. OpenPA reads both and compares what they mean:
W4.4: loose nets
set_domain_supply_net PD_RF -primary_power_net VDD_RF -primary_ground_net VSS_N
set_isolation ISO_RF -domain PD_RF -applies_to outputs -clamp_value 0 \
-isolation_power_net VDD_N -isolation_ground_net VSS_N \
Each user names two nets.
W4.5: one supply set
create_supply_set SS_RF -function {power VDD_RF} -function {ground VSS_N}
create_power_domain PD_RF -elements {u_rf} -supply {primary SS_RF}
set_isolation ISO_RF -domain PD_RF -applies_to outputs -clamp_value 0 \
-isolation_supply SS_AON -isolation_signal iso_rf -isolation_sense high -location parent
Each user names one set.
The same domain and clamp, written two ways.
identicalThe meaning did not change, but the second file names each supply only once.
From Loose Nets to One Cable
In UPF 1.0, every user of a supply named its nets one by one. A supply set groups them once, by function (IEEE 1801-2024 6.27).
- Power
- Power
- UPF 1.0
set_domain_supply_net names two nets for the domain. The clamp names two more nets in its own command.
- Make the set
A new set, SS_RF, gives each net a function: power and ground.
- Hand it to the domain
-supply {primary SS_RF} ties the set to the domain's primary handle. One name now carries both nets.
- Add the bias later
create_supply_set SS_RF -update adds the n-well bias. Every user of SS_RF sees it.
- Strategies name sets too
The clamp names SS_AON, not VDD_N and VSS_N.
Read the diagram as text
- VDD_RF: supply net
- VSS_N: supply net
- VNW_N: bias net
- SS_RF: power, ground, nwell
- PD_RF.primary: domain handle
- SS_AON: power VDD_N, ground VSS_N
- ISO_RF clamps: isolation supply
- VDD_RF → PD_RF.primary: power net
- VSS_N → PD_RF.primary: ground net
- VDD_RF → SS_RF: power
- VSS_N → SS_RF: ground
- VNW_N → SS_RF: nwell
- SS_RF → PD_RF.primary: -supply
- SS_AON → ISO_RF clamps: -isolation_supply
Drawn from the lab file radio_sets.upf. Every report on this page is a recorded OpenPA run of it.
# Supply sets: each groups the nets of one supply by function
create_supply_set SS_AON -function {power VDD_N} -function {ground VSS_N}
create_supply_set SS_RF -function {power VDD_RF} -function {ground VSS_N}
create_supply_set SS_BB -function {power VDD_BB} -function {ground VSS_N}Why the change? A set is one name for one supply. When a net changes, one line changes. Tools also check that a domain's power and ground belong together.
create_supply_set: Functions and Bias
Each -function option gives one function and the net that provides it (6.27). A set may have six functions.
| Function | What the net is | In OpenPA |
|---|---|---|
power | the supply voltage | decides the domain's state |
ground | the return | decides the domain's state |
nwell, pwell | the n-well and p-well bias of the transistors | recorded and reported, not simulated |
deepnwell, deeppwell | the deep-well bias | recorded and reported, not simulated |
Functions from IEEE 1801-2024 6.27. One function maps to one net: naming two different nets for it is an error.
Power domains
PD_TOP (radio_sets.upf:30): radio
primary supply SS_AON: power VDD_N, ground VSS_N
1 register(s): total; 0 memory(ies)
PD_RF (radio_sets.upf:31): u_rf
primary supply SS_RF: power VDD_RF, ground VSS_N
bias: nwell VNW_N (recorded with no effect in simulation, limit L6)
1 register(s): u_rf.q; 0 memory(ies)
PD_BB (radio_sets.upf:32): u_bb
primary supply SS_BB: power VDD_BB, ground VSS_N [switchable]
1 register(s): u_bb.q; 0 memory(ies)OpenPA refuses a wrong function name, or a second net for one function.
radio_sets.upf:41: create_supply_set -function: "bias" is not power, ground, nwell, pwell, deepnwell or deeppwell
radio_sets.upf:47: create_supply_set SS_RF: function power is already VDD_RFWhat if a set lacks a function the design uses? In verification, IEEE 1801-2024 makes an implicit net for it (6.27.2). OpenPA 0.3.0 departs from this rule. It gives a set with no nets at all its own implicit power and ground. For a set with power but no ground, it warns:
Warnings (2)
radio_sets.upf:32: power domain PD_BB: the primary supply has no ground net; only power decides its stateHandles: Primary, -supply and associate_supply_set
A handle is a named slot for a supply set. Every power domain has one called primary (6.21). Strategies and switches have handles too.
create_power_domain PD_BB -elements {u_bb}
Makes the domain, and its empty handle PD_BB.primary.
handle PD_BB.primaryfunctions none yetcreate_supply_set SS_BB -function {power VDD_BB} -function {ground VSS_N}
Makes a set with two functions. No domain uses it yet.
set SS_BBpower VDD_BBground VSS_Nassociate_supply_set SS_BB -handle PD_BB.primary
Ties the set to the handle. Both names now mean the same nets (6.10).
PD_BB.primary.power VDD_BBPD_BB.primary.ground VSS_N
-supply {primary SS_RF} on create_power_domain does the last two steps' tying in one line. It implies the same associate_supply_set (6.21).
# Domains: -supply names the handle and the set in one line
create_power_domain PD_TOP -elements {.} -supply {primary SS_AON}
create_power_domain PD_RF -elements {u_rf} -supply {primary SS_RF}
create_power_domain PD_BB -elements {u_bb}
associate_supply_set SS_BB -handle PD_BB.primary| Predefined handle (6.10) | Belongs to |
|---|---|
PD.primary | a power domain |
SW.switch_supply | a power switch |
PD.ISO.isolation_supply | an isolation strategy |
PD.LS.input_supply, output_supply, internal_supply | a level-shifter strategy |
PD.RET.retention_supply | a retention strategy |
PD.REP.repeater_supply | a repeater strategy |
A domain may also declare handles of its own with -supply {name}. The lab uses only primary.
A handle can also be filled in place, with -update. And associate_supply_set needs two names:
Power domains
PD_BB (radio_sets.upf:32): u_bb
primary supply PD_BB.primary: power VDD_BB, ground VSS_N [switchable]radio_sets.upf:33: create_supply_set PD_BB.primary: a domain handle can only be refined with -update
radio_sets.upf:33: associate_supply_set: name two or more supply sets, or one with -handle (IEEE 1801-2024 6.10)Refining a Set with -update
Power intent grows in steps. A front-end file names power and ground; an implementation file adds the bias later. -update adds functions to a set that exists (6.27.1).
# Later, the implementation team adds the RF block's n-well bias
create_supply_set SS_RF -update -function {nwell VNW_N}Both mistakes are errors in IEEE 1801-2024 6.27.1. OpenPA refuses them.
radio_sets.upf:41: create_supply_set SS_RF: already created at line 26; use -update
radio_sets.upf:41: create_supply_set SS_RX -update: no such supply setThe lab bench drives supplies by port. Then it reads the domains' sets by name.
buck on PD_RF.primary.power=FULL_ON 1000 mV SS_BB.power=OFF 0 mV rf=0 bb=xx
bb on PD_RF.primary.power=FULL_ON 1000 mV SS_BB.power=FULL_ON 1000 mV rf=0 bb=xx
one beat PD_RF.primary.power=FULL_ON 1000 mV SS_BB.power=FULL_ON 1000 mV rf=10 bb=11
bb off PD_RF.primary.power=FULL_ON 1000 mV SS_BB.power=OFF 0 mV rf=10 bb=xxStrategy Supplies and the Old Default Handles
IEEE 1801-2024 keeps the UPF 1.0 net forms as legacy (Annex D.2.3). Its Table D.1 names the replacement for each:
| Legacy form | Replacement (Table D.1) |
|---|---|
set_domain_supply_net PD -primary_power_net ... -primary_ground_net ... | associate_supply_set SET -handle PD.primary |
set_isolation -isolation_power_net ... -isolation_ground_net ... | set_isolation -isolation_supply SET |
set_retention -retention_power_net ... -retention_ground_net ... | set_retention -retention_supply SET |
set_isolation_control and set_retention_control are UPF 1.0 commands with no place in IEEE 1801-2024. Their options belong in set_isolation and set_retention (6.48, 6.53).
Translation must keep the meaning. OpenPA's intent comparison catches a slip. Here the clamp of PD_BB was given SS_BB instead of SS_AON:
isolation: missing u_bb/q: clamp 0, iso_bb active high, supply VDD_N/VSS_N
isolation: not expected u_bb/q: clamp 0, iso_bb active high, supply VDD_BB/VSS_NOlder UPF 2.0 files use two more handles: PD.default_isolation and PD.default_retention. A strategy with no supply used them. IEEE 1801-2024 does not define them; its list in 6.10 has no default handles.
Strategies
set_isolation ISO_BB (radio_sets.upf:46): clamp 0, enable iso_bb active high, supply SS_AON, location parent
Notes (4)
radio_sets.upf:46: set_isolation ISO_BB (domain PD_BB): -diff_supply_only is not given; the default is TRUE (IEEE 1801-2024 6.48): a port whose driver and receiver have the same supply is not isolated
radio_sets.upf:46: set_isolation ISO_BB (domain PD_BB): no isolation supply; uses PD_BB.default_isolation (SS_AON), a UPF 2.0 handle that IEEE 1801-2024 no longer definesStrategies
set_isolation ISO_BB (radio_sets.upf:45): clamp 0, enable iso_bb active high, supply none (corrupted only through its control, IEEE 1801-2024 6.48), location parent
Notes (4)
radio_sets.upf:45: set_isolation ISO_BB (domain PD_BB): -diff_supply_only is not given; the default is TRUE (IEEE 1801-2024 6.48): a port whose driver and receiver have the same supply is not isolated
radio_sets.upf:45: set_isolation ISO_BB (domain PD_BB): no -isolation_supply; in verification the cell is corrupted only when its isolation signal is (IEEE 1801-2024 6.48). An implementation tool needs the supplyconnect_supply_set (Drawn)
A domain's primary set normally powers its RTL instances. UPF-inserted cells and explicit connections can use other sets (6.21). connect_supply_set overrides that for chosen elements (6.15). Its explicit connection wins over the implicit and automatic ones (5.7.6).
OpenPA does not run it, so this part is drawn:
radio_sets.upf:47: connect_supply_set is not supported (IEEE 1801-2024 6.15): explicit supply connections to instance pins change which supply powers an element, and OpenPA powers every element from its domain primary| A drawn example (not run) | Meaning (6.15) |
|---|---|
connect_supply_set SS_AON -elements {u_bb/u_keep} | u_bb/u_keep is powered by SS_AON, not by PD_BB's primary set |
connect_supply_set SS_RF -elements {u_rf} -connect {nwell nwell} | SS_RF's nwell net goes to u_rf ports whose pg_type is nwell |
-transitive FALSE | the connection stops at the named elements; the default is TRUE |
Drawn from IEEE 1801-2024 6.15. Nothing here is graded.
Asked in interviews
Why did UPF move from supply nets to supply sets?
A set names a whole supply once, by function. Domains, strategies and switches then refer to one name, and a tool can check that power and ground belong together.
What is a supply set handle?
A named slot for a set, such as PD.primary or a strategy's isolation_supply. associate_supply_set or -supply fills it with a real set.
How do you add a bias rail to an existing supply set?
create_supply_set SET -update -function {nwell NET}. Without -update, a second create_supply_set of the same set is an error.
Try It
Run it. The bench drives the same ports as in W4.4, but reads the domains through their sets.
Read bb on PD_RF.primary.power=FULL_ON 1000 mV SS_BB.power=FULL_ON 1000 mV rf=0 bb=xx. PD_RF.primary.power is a handle; SS_BB.power is a set. Both read real nets.
In the rail call, change "SS_BB.power" to "PD_BB.primary.power". Predict the output, then run.
Now read "SS_RF.nwell" instead of "PD_RF.primary.power". Nothing drives VNW, so predict OFF, then run.
OPENPA-INFO corruption=x seed=1 buck on PD_RF.primary.power=FULL_ON 1000 mV SS_BB.power=OFF 0 mV rf=0 bb=xx bb on PD_RF.primary.power=FULL_ON 1000 mV SS_BB.power=FULL_ON 1000 mV rf=0 bb=xx one beat PD_RF.primary.power=FULL_ON 1000 mV SS_BB.power=FULL_ON 1000 mV rf=10 bb=11 bb off PD_RF.primary.power=FULL_ON 1000 mV SS_BB.power=OFF 0 mV rf=10 bb=xx OPENPA-SUMMARY D1=0 D2=0 D3=0 D4=0 D5=0 D6=0 D7=0 D8=0 D9=0 D10=0 D11=0 D12=0 D13=0 D14=0 OPENPA-COVER sequence D1 ISO_BB: PD_BB isolated before power-down 1 OPENPA-COVER sequence D2/D7 ISO_BB: isolation released only after PD_BB was back and reset 0 OPENPA-COVER sequence D1 ISO_RF: PD_RF isolated before power-down 0 OPENPA-COVER sequence D2/D7 ISO_RF: isolation released only after PD_RF was back and reset 0 OPENPA-COVER-SUMMARY states=0/0 declared_transitions=0/0 sequences=1/4Read the power intent: radio_sets.upf
upf_version 4.0
set_design_top radio
# Supply ports: where supplies enter (in) or leave (out) the design top
create_supply_port VDD -direction in
create_supply_port VSS -direction in
create_supply_port VBUCK -direction in
create_supply_port VLDO -direction in
create_supply_port VRF_MON -direction out
create_supply_port VNW -direction in
# Supply nets carry a state and a voltage
create_supply_net VDD_N
create_supply_net VSS_N
create_supply_net VDD_RF -resolve one_hot
create_supply_net VDD_BB -resolve parallel
create_supply_net VNW_N
connect_supply_net VDD_N -ports {VDD}
connect_supply_net VSS_N -ports {VSS}
connect_supply_net VDD_RF -ports {VBUCK VLDO VRF_MON}
connect_supply_net VNW_N -ports {VNW}
# Supply sets: each groups the nets of one supply by function
create_supply_set SS_AON -function {power VDD_N} -function {ground VSS_N}
create_supply_set SS_RF -function {power VDD_RF} -function {ground VSS_N}
create_supply_set SS_BB -function {power VDD_BB} -function {ground VSS_N}
# Domains: -supply names the handle and the set in one line
create_power_domain PD_TOP -elements {.} -supply {primary SS_AON}
create_power_domain PD_RF -elements {u_rf} -supply {primary SS_RF}
create_power_domain PD_BB -elements {u_bb}
associate_supply_set SS_BB -handle PD_BB.primary
create_power_switch SW_WEAK -domain PD_TOP -input_supply_port {i VDD_N} -output_supply_port {o VDD_BB} \
-control_port {c pwr_weak} -on_state {on i {c}} -off_state {off {!c}}
create_power_switch SW_MAIN -domain PD_TOP -input_supply_port {i VDD_N} -output_supply_port {o VDD_BB} \
-control_port {c pwr_main} -on_state {on i {c}} -off_state {off {!c}}
# Later, the implementation team adds the RF block's n-well bias
create_supply_set SS_RF -update -function {nwell VNW_N}
set_isolation ISO_RF -domain PD_RF -applies_to outputs -clamp_value 0 \
-isolation_supply SS_AON -isolation_signal iso_rf -isolation_sense high -location parent
set_isolation ISO_BB -domain PD_BB -applies_to outputs -clamp_value 0 \
-isolation_supply SS_AON -isolation_signal iso_bb -isolation_sense high -location parent
Read the power-unaware RTL: radio.sv
// radio: an always-on top with an RF block and a baseband block. Power-unaware RTL.
module radio (
input logic clk,
input logic rst_n,
input logic en,
input logic [7:0] d,
input logic pwr_weak,
input logic pwr_main,
input logic iso_rf,
input logic iso_bb,
output logic [7:0] q_rf,
output logic [7:0] q_bb,
output logic [7:0] total
);
acc u_rf (.clk(clk), .rst_n(rst_n), .en(en), .d(d), .q(q_rf));
acc u_bb (.clk(clk), .rst_n(rst_n), .en(en), .d(d + 8'd1), .q(q_bb));
always_ff @(posedge clk or negedge rst_n)
if (!rst_n) total <= '0;
else total <= q_rf + q_bb;
endmodule
Read the power-unaware RTL: 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
What UPF added: 48 objects
5 supply port, 5 supply net, 10 output corruption, 2 isolation cell, 2 power switch, 3 supply set, 3 register corruption, 18 dynamic check.
| Object | Where | Detail | Rule | UPF line |
|---|---|---|---|---|
| Supply port | VDD | radio_sets.upf:5 | ||
| Supply port | VSS | radio_sets.upf:6 | ||
| Supply port | VBUCK | radio_sets.upf:7 | ||
| Supply port | VLDO | radio_sets.upf:8 | ||
| Supply port | VNW | radio_sets.upf:10 | ||
| Supply net | VDD_N | radio_sets.upf:5 | ||
| Supply net | VSS_N | radio_sets.upf:6 | ||
| Supply net | VDD_RF | radio_sets.upf:7 | ||
| Supply net | VNW_N | radio_sets.upf:10 | ||
| Supply net | VDD_BB | radio_sets.upf:35 | ||
| Output corruption | u_bb/q | C2 | radio_sets.upf:32 | |
| Isolation cell | u_bb/q | ISO_BB · clamp 0 | I1-I5 | radio_sets.upf:45 |
| Output corruption | u_rf/q | C2 | radio_sets.upf:31 | |
| Isolation cell | u_rf/q | ISO_RF · clamp 0 | I1-I5 | radio_sets.upf:43 |
| Output corruption | u_bb/clk | C2 | radio_sets.upf:30 | |
| Output corruption | u_bb/d | C2 | radio_sets.upf:30 | |
| Output corruption | u_bb/en | C2 | radio_sets.upf:30 | |
| Output corruption | u_bb/rst_n | C2 | radio_sets.upf:30 | |
| Output corruption | u_rf/clk | C2 | radio_sets.upf:30 | |
| Output corruption | u_rf/d | C2 | radio_sets.upf:30 | |
| Output corruption | u_rf/en | C2 | radio_sets.upf:30 | |
| Output corruption | u_rf/rst_n | C2 | radio_sets.upf:30 | |
| Power switch | SW_WEAK | S3 (IEEE 1801-2024 6.23) | radio_sets.upf:35 | |
| Power switch | SW_MAIN | S3 (IEEE 1801-2024 6.23) | radio_sets.upf:37 | |
| Supply set | SS_AON | radio_sets.upf:25 | ||
| Supply set | SS_RF | radio_sets.upf:26 | ||
| Supply set | SS_BB | radio_sets.upf:27 | ||
| Register corruption | total | C1 | radio_sets.upf:30 | |
| Register corruption | u_rf.q | C1 | radio_sets.upf:31 | |
| Register corruption | u_bb.q | C1 | radio_sets.upf:32 | |
| Dynamic check | D1/D2/D7/D6 ISO_BB | D1, D2, D7, D6 | radio_sets.upf:45 | |
| Dynamic check | D1/D2/D7/D6 ISO_RF | D1, D2, D7, D6 | radio_sets.upf:43 | |
| Dynamic check | D9 crossing 1 | D9 | radio_sets.upf:32 | |
| Dynamic check | D9 crossing 2 | D9 | radio_sets.upf:32 | |
| Dynamic check | D9 crossing 3 | D9 | radio_sets.upf:31 | |
| Dynamic check | D9 crossing 4 | D9 | radio_sets.upf:31 | |
| Dynamic check | D9 crossing 5 | D9 | radio_sets.upf:30 | |
| Dynamic check | D9 crossing 6 | D9 | radio_sets.upf:30 | |
| Dynamic check | D9 crossing 7 | D9 | radio_sets.upf:30 | |
| Dynamic check | D9 crossing 8 | D9 | radio_sets.upf:30 | |
| Dynamic check | D9 crossing 9 | D9 | radio_sets.upf:30 | |
| Dynamic check | D9 crossing 10 | D9 | radio_sets.upf:30 | |
| Dynamic check | D9 crossing 11 | D9 | radio_sets.upf:30 | |
| Dynamic check | D9 crossing 12 | D9 | radio_sets.upf:30 | |
| Dynamic check | D11 PD_BB->PD_TOP | D11 | radio_sets.upf:32 | |
| Dynamic check | D11 PD_RF->PD_TOP | D11 | radio_sets.upf:31 | |
| Dynamic check | D11 PD_TOP->PD_BB | D11 | radio_sets.upf:30 | |
| Dynamic check | D11 PD_TOP->PD_RF | D11 | radio_sets.upf:30 |
OpenPA warnings:
- no `timescale in the design and no --timescale: OpenPA messages print time in the design top's default unit
Read the power-aware copy that runs (generated by OpenPA 0.3.0): pa_radio.sv
// pa_radio.sv: power-aware copy of radio, generated by OpenPA from radio_sets.upf.
// Do not edit: regenerate. Simulators: Icarus 12 (4-state, X corruption) or Verilator 5 with --timing (2-state).
// Build with -Wno-fatal on Verilator: forced registers raise MULTIDRIVEN warnings.
// ---------------------------------------------------------------------------
// package UPF: generated by OpenPA. Supply types, supply_on/supply_off and the power
// state of the design. Names starting with openpa_ are internal.
// ---------------------------------------------------------------------------
package UPF;
typedef string upfStringT; typedef int upfIntegerT; typedef bit upfBooleanT; typedef logic upfLogicT; typedef real upfRealT; typedef int upfHandleT;
typedef enum { OFF, FULL_ON, PARTIAL_ON, UNDETERMINED } upfSupplyStateE;
typedef struct packed { upfSupplyStateE state; int voltage; } upfSupplyTypeT; // voltage in microvolts
typedef upfSupplyTypeT supply_net_type;
bit openpa_armed; // set by the first call that drives a supply
bit openpa_kick; // pulsed once at time 0 to evaluate everything
bit openpa_xmode; // 1: corrupt to X; 0: seeded 2-state values
int unsigned openpa_seed = 1;
int openpa_cmode; // 2-state corruption: 0 random, 1 all zero, 2 all one
supply_net_type openpa_port_VDD; // supply port VDD (radio_sets.upf:5)
supply_net_type openpa_port_VSS; // supply port VSS (radio_sets.upf:6)
supply_net_type openpa_port_VBUCK; // supply port VBUCK (radio_sets.upf:7)
supply_net_type openpa_port_VLDO; // supply port VLDO (radio_sets.upf:8)
supply_net_type openpa_port_VNW; // supply port VNW (radio_sets.upf:10)
supply_net_type openpa_net_VDD_N; // supply net VDD_N
supply_net_type openpa_net_VSS_N; // supply net VSS_N
supply_net_type openpa_net_VDD_RF; // supply net VDD_RF
supply_net_type openpa_net_VNW_N; // supply net VNW_N
supply_net_type openpa_net_VDD_BB; // supply net VDD_BB
int openpa_sw_SW_WEAK_st = -1; // switch SW_WEAK: -1 undetermined, 0 off, k on-state k (radio_sets.upf:35)
int openpa_sw_SW_MAIN_st = -1; // switch SW_MAIN: -1 undetermined, 0 off, k on-state k (radio_sets.upf:37)
bit openpa_ss_SS_AON_ok; int unsigned openpa_ss_SS_AON_ep; int openpa_ss_SS_AON_st = -1; bit openpa_ss_SS_AON_multi; int openpa_ss_SS_AON_sim = 5; // supply set SS_AON
bit openpa_ss_SS_RF_ok; int unsigned openpa_ss_SS_RF_ep; int openpa_ss_SS_RF_st = -1; bit openpa_ss_SS_RF_multi; int openpa_ss_SS_RF_sim = 5; // supply set SS_RF
bit openpa_ss_SS_BB_ok; int unsigned openpa_ss_SS_BB_ep; int openpa_ss_SS_BB_st = -1; bit openpa_ss_SS_BB_multi; int openpa_ss_SS_BB_sim = 5; // supply set SS_BB
bit openpa_dom_PD_TOP_ok; int unsigned openpa_dom_PD_TOP_ep; int openpa_dom_PD_TOP_sim = 5; // power domain PD_TOP: ok = powered (simstate not CORRUPT); sim = simstate code (radio_sets.upf:30)
bit openpa_dom_PD_RF_ok; int unsigned openpa_dom_PD_RF_ep; int openpa_dom_PD_RF_sim = 5; // power domain PD_RF: ok = powered (simstate not CORRUPT); sim = simstate code (radio_sets.upf:31)
bit openpa_dom_PD_BB_ok; int unsigned openpa_dom_PD_BB_ep; int openpa_dom_PD_BB_sim = 5; // power domain PD_BB: ok = powered (simstate not CORRUPT); sim = simstate code (radio_sets.upf:32)
// simstate codes, by IEEE 1801-2024 4.8 precedence: 0 NORMAL, 1 CORRUPT_STATE_ON_CHANGE, 2 CORRUPT_STATE_ON_ACTIVITY,
// 3 CORRUPT_ON_CHANGE, 4 CORRUPT_ON_ACTIVITY, 5 CORRUPT (and NOT_NORMAL, 9.5.8); README "Simstates"
logic openpa_ctl_0_pwr_weak; // copy of pwr_weak (switch SW_WEAK)
logic openpa_ctl_1_pwr_main; // copy of pwr_main (switch SW_MAIN)
logic openpa_ctl_2_iso_rf; // copy of iso_rf (isolation ISO_RF)
logic openpa_ctl_3_iso_bb; // copy of iso_bb (isolation ISO_BB)
function automatic logic [63:0] openpa_mix(int unsigned id, int unsigned ep, int unsigned lane);
logic [63:0] z;
if (openpa_cmode == 1) return 64'd0;
if (openpa_cmode == 2) return ~64'd0;
z = {32'd0, openpa_seed} * 64'h9E3779B97F4A7C15 + {32'd0, id} * 64'hC2B2AE3D27D4EB4F + {32'd0, ep} * 64'h165667B19E3779F9 + {32'd0, lane} * 64'hD6E8FEB86659FD93;
z = (z ^ (z >> 30)) * 64'hBF58476D1CE4E5B9;
z = (z ^ (z >> 27)) * 64'h94D049BB133111EB;
return z ^ (z >> 31);
endfunction
function automatic bit openpa_bit(int unsigned id, int unsigned ep); logic [63:0] z; z = openpa_mix(id, ep, 0); return z[0]; endfunction
function automatic int openpa_uv(real v); return $rtoi(v * 1.0e6 + (v < 0.0 ? -0.5 : 0.5)); endfunction
// supply_on: FULL_ON at the given voltage (11.2.4; default 1.0 V)
function automatic upfBooleanT supply_on(string pad_name, real value = 1.0);
openpa_armed = 1;
if (pad_name == "VDD") begin openpa_port_VDD.state = FULL_ON; openpa_port_VDD.voltage = openpa_uv(value); return 1; end
if (pad_name == "VSS") begin openpa_port_VSS.state = FULL_ON; openpa_port_VSS.voltage = openpa_uv(value); return 1; end
if (pad_name == "VBUCK") begin openpa_port_VBUCK.state = FULL_ON; openpa_port_VBUCK.voltage = openpa_uv(value); return 1; end
if (pad_name == "VLDO") begin openpa_port_VLDO.state = FULL_ON; openpa_port_VLDO.voltage = openpa_uv(value); return 1; end
if (pad_name == "VNW") begin openpa_port_VNW.state = FULL_ON; openpa_port_VNW.voltage = openpa_uv(value); return 1; end
if (pad_name == "VDD_N") begin $display("OPENPA-ERROR supply_on(\"%s\"): VDD_N already has a driver (port VDD); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_AON.power") begin $display("OPENPA-ERROR supply_on(\"%s\"): SS_AON.power already has a driver (port VDD); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_TOP.primary.power") begin $display("OPENPA-ERROR supply_on(\"%s\"): PD_TOP.primary.power already has a driver (port VDD); drive its root supply instead", pad_name); return 0; end
if (pad_name == "VSS_N") begin $display("OPENPA-ERROR supply_on(\"%s\"): VSS_N already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_AON.ground") begin $display("OPENPA-ERROR supply_on(\"%s\"): SS_AON.ground already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_RF.ground") begin $display("OPENPA-ERROR supply_on(\"%s\"): SS_RF.ground already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_BB.ground") begin $display("OPENPA-ERROR supply_on(\"%s\"): SS_BB.ground already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_TOP.primary.ground") begin $display("OPENPA-ERROR supply_on(\"%s\"): PD_TOP.primary.ground already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_RF.primary.ground") begin $display("OPENPA-ERROR supply_on(\"%s\"): PD_RF.primary.ground already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_BB.primary.ground") begin $display("OPENPA-ERROR supply_on(\"%s\"): PD_BB.primary.ground already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "VRF_MON") begin $display("OPENPA-ERROR supply_on(\"%s\"): VRF_MON already has a driver (port VBUCK); drive its root supply instead", pad_name); return 0; end
if (pad_name == "VDD_RF") begin $display("OPENPA-ERROR supply_on(\"%s\"): VDD_RF already has a driver (port VBUCK); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_RF.power") begin $display("OPENPA-ERROR supply_on(\"%s\"): SS_RF.power already has a driver (port VBUCK); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_RF.primary.power") begin $display("OPENPA-ERROR supply_on(\"%s\"): PD_RF.primary.power already has a driver (port VBUCK); drive its root supply instead", pad_name); return 0; end
if (pad_name == "VNW_N") begin $display("OPENPA-ERROR supply_on(\"%s\"): VNW_N already has a driver (port VNW); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_RF.nwell") begin $display("OPENPA-ERROR supply_on(\"%s\"): SS_RF.nwell already has a driver (port VNW); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_RF.primary.nwell") begin $display("OPENPA-ERROR supply_on(\"%s\"): PD_RF.primary.nwell already has a driver (port VNW); drive its root supply instead", pad_name); return 0; end
if (pad_name == "VDD_BB") begin $display("OPENPA-ERROR supply_on(\"%s\"): VDD_BB already has a driver (switch SW_WEAK); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_BB.power") begin $display("OPENPA-ERROR supply_on(\"%s\"): SS_BB.power already has a driver (switch SW_WEAK); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_BB.primary.power") begin $display("OPENPA-ERROR supply_on(\"%s\"): PD_BB.primary.power already has a driver (switch SW_WEAK); drive its root supply instead", pad_name); return 0; end
$display("OPENPA-ERROR supply_on(\"%s\"): no supply port or root supply net of that name (writable: VDD VSS VBUCK VLDO VNW)", pad_name);
return 0;
endfunction
// supply_off: OFF, voltage unchanged (9.3.1); a second argument is accepted and ignored
function automatic upfBooleanT supply_off(string pad_name, real value = 0.0);
openpa_armed = 1;
if (pad_name == "VDD") begin openpa_port_VDD.state = OFF; return 1; end
if (pad_name == "VSS") begin openpa_port_VSS.state = OFF; return 1; end
if (pad_name == "VBUCK") begin openpa_port_VBUCK.state = OFF; return 1; end
if (pad_name == "VLDO") begin openpa_port_VLDO.state = OFF; return 1; end
if (pad_name == "VNW") begin openpa_port_VNW.state = OFF; return 1; end
if (pad_name == "VDD_N") begin $display("OPENPA-ERROR supply_off(\"%s\"): VDD_N already has a driver (port VDD); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_AON.power") begin $display("OPENPA-ERROR supply_off(\"%s\"): SS_AON.power already has a driver (port VDD); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_TOP.primary.power") begin $display("OPENPA-ERROR supply_off(\"%s\"): PD_TOP.primary.power already has a driver (port VDD); drive its root supply instead", pad_name); return 0; end
if (pad_name == "VSS_N") begin $display("OPENPA-ERROR supply_off(\"%s\"): VSS_N already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_AON.ground") begin $display("OPENPA-ERROR supply_off(\"%s\"): SS_AON.ground already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_RF.ground") begin $display("OPENPA-ERROR supply_off(\"%s\"): SS_RF.ground already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_BB.ground") begin $display("OPENPA-ERROR supply_off(\"%s\"): SS_BB.ground already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_TOP.primary.ground") begin $display("OPENPA-ERROR supply_off(\"%s\"): PD_TOP.primary.ground already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_RF.primary.ground") begin $display("OPENPA-ERROR supply_off(\"%s\"): PD_RF.primary.ground already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_BB.primary.ground") begin $display("OPENPA-ERROR supply_off(\"%s\"): PD_BB.primary.ground already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "VRF_MON") begin $display("OPENPA-ERROR supply_off(\"%s\"): VRF_MON already has a driver (port VBUCK); drive its root supply instead", pad_name); return 0; end
if (pad_name == "VDD_RF") begin $display("OPENPA-ERROR supply_off(\"%s\"): VDD_RF already has a driver (port VBUCK); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_RF.power") begin $display("OPENPA-ERROR supply_off(\"%s\"): SS_RF.power already has a driver (port VBUCK); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_RF.primary.power") begin $display("OPENPA-ERROR supply_off(\"%s\"): PD_RF.primary.power already has a driver (port VBUCK); drive its root supply instead", pad_name); return 0; end
if (pad_name == "VNW_N") begin $display("OPENPA-ERROR supply_off(\"%s\"): VNW_N already has a driver (port VNW); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_RF.nwell") begin $display("OPENPA-ERROR supply_off(\"%s\"): SS_RF.nwell already has a driver (port VNW); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_RF.primary.nwell") begin $display("OPENPA-ERROR supply_off(\"%s\"): PD_RF.primary.nwell already has a driver (port VNW); drive its root supply instead", pad_name); return 0; end
if (pad_name == "VDD_BB") begin $display("OPENPA-ERROR supply_off(\"%s\"): VDD_BB already has a driver (switch SW_WEAK); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_BB.power") begin $display("OPENPA-ERROR supply_off(\"%s\"): SS_BB.power already has a driver (switch SW_WEAK); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_BB.primary.power") begin $display("OPENPA-ERROR supply_off(\"%s\"): PD_BB.primary.power already has a driver (switch SW_WEAK); drive its root supply instead", pad_name); return 0; end
$display("OPENPA-ERROR supply_off(\"%s\"): no supply port or root supply net of that name (writable: VDD VSS VBUCK VLDO VNW)", pad_name);
return 0;
endfunction
// supply_partial_on: PARTIAL_ON at the given voltage (11.2.4)
function automatic upfBooleanT supply_partial_on(string pad_name, real value = 1.0);
openpa_armed = 1;
if (pad_name == "VDD") begin openpa_port_VDD.state = PARTIAL_ON; openpa_port_VDD.voltage = openpa_uv(value); return 1; end
if (pad_name == "VSS") begin openpa_port_VSS.state = PARTIAL_ON; openpa_port_VSS.voltage = openpa_uv(value); return 1; end
if (pad_name == "VBUCK") begin openpa_port_VBUCK.state = PARTIAL_ON; openpa_port_VBUCK.voltage = openpa_uv(value); return 1; end
if (pad_name == "VLDO") begin openpa_port_VLDO.state = PARTIAL_ON; openpa_port_VLDO.voltage = openpa_uv(value); return 1; end
if (pad_name == "VNW") begin openpa_port_VNW.state = PARTIAL_ON; openpa_port_VNW.voltage = openpa_uv(value); return 1; end
if (pad_name == "VDD_N") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): VDD_N already has a driver (port VDD); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_AON.power") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): SS_AON.power already has a driver (port VDD); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_TOP.primary.power") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): PD_TOP.primary.power already has a driver (port VDD); drive its root supply instead", pad_name); return 0; end
if (pad_name == "VSS_N") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): VSS_N already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_AON.ground") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): SS_AON.ground already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_RF.ground") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): SS_RF.ground already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_BB.ground") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): SS_BB.ground already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_TOP.primary.ground") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): PD_TOP.primary.ground already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_RF.primary.ground") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): PD_RF.primary.ground already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_BB.primary.ground") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): PD_BB.primary.ground already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "VRF_MON") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): VRF_MON already has a driver (port VBUCK); drive its root supply instead", pad_name); return 0; end
if (pad_name == "VDD_RF") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): VDD_RF already has a driver (port VBUCK); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_RF.power") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): SS_RF.power already has a driver (port VBUCK); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_RF.primary.power") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): PD_RF.primary.power already has a driver (port VBUCK); drive its root supply instead", pad_name); return 0; end
if (pad_name == "VNW_N") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): VNW_N already has a driver (port VNW); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_RF.nwell") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): SS_RF.nwell already has a driver (port VNW); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_RF.primary.nwell") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): PD_RF.primary.nwell already has a driver (port VNW); drive its root supply instead", pad_name); return 0; end
if (pad_name == "VDD_BB") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): VDD_BB already has a driver (switch SW_WEAK); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_BB.power") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): SS_BB.power already has a driver (switch SW_WEAK); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_BB.primary.power") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): PD_BB.primary.power already has a driver (switch SW_WEAK); drive its root supply instead", pad_name); return 0; end
$display("OPENPA-ERROR supply_partial_on(\"%s\"): no supply port or root supply net of that name (writable: VDD VSS VBUCK VLDO VNW)", pad_name);
return 0;
endfunction
// set_supply_state: the state only, voltage unchanged (9.3.1)
function automatic upfBooleanT set_supply_state(string pad_name, upfSupplyStateE supply_state);
openpa_armed = 1;
if (pad_name == "VDD") begin openpa_port_VDD.state = supply_state; return 1; end
if (pad_name == "VSS") begin openpa_port_VSS.state = supply_state; return 1; end
if (pad_name == "VBUCK") begin openpa_port_VBUCK.state = supply_state; return 1; end
if (pad_name == "VLDO") begin openpa_port_VLDO.state = supply_state; return 1; end
if (pad_name == "VNW") begin openpa_port_VNW.state = supply_state; return 1; end
if (pad_name == "VDD_N") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): VDD_N already has a driver (port VDD); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_AON.power") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): SS_AON.power already has a driver (port VDD); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_TOP.primary.power") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): PD_TOP.primary.power already has a driver (port VDD); drive its root supply instead", pad_name); return 0; end
if (pad_name == "VSS_N") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): VSS_N already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_AON.ground") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): SS_AON.ground already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_RF.ground") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): SS_RF.ground already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_BB.ground") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): SS_BB.ground already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_TOP.primary.ground") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): PD_TOP.primary.ground already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_RF.primary.ground") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): PD_RF.primary.ground already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_BB.primary.ground") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): PD_BB.primary.ground already has a driver (port VSS); drive its root supply instead", pad_name); return 0; end
if (pad_name == "VRF_MON") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): VRF_MON already has a driver (port VBUCK); drive its root supply instead", pad_name); return 0; end
if (pad_name == "VDD_RF") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): VDD_RF already has a driver (port VBUCK); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_RF.power") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): SS_RF.power already has a driver (port VBUCK); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_RF.primary.power") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): PD_RF.primary.power already has a driver (port VBUCK); drive its root supply instead", pad_name); return 0; end
if (pad_name == "VNW_N") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): VNW_N already has a driver (port VNW); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_RF.nwell") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): SS_RF.nwell already has a driver (port VNW); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_RF.primary.nwell") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): PD_RF.primary.nwell already has a driver (port VNW); drive its root supply instead", pad_name); return 0; end
if (pad_name == "VDD_BB") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): VDD_BB already has a driver (switch SW_WEAK); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SS_BB.power") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): SS_BB.power already has a driver (switch SW_WEAK); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_BB.primary.power") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): PD_BB.primary.power already has a driver (switch SW_WEAK); drive its root supply instead", pad_name); return 0; end
$display("OPENPA-ERROR set_supply_state(\"%s\"): no supply port or root supply net of that name (writable: VDD VSS VBUCK VLDO VNW)", pad_name);
return 0;
endfunction
// set_power_state (9.3.1) is not supported: OpenPA has no deferred power states. A call is reported, never ignored.
function automatic upfBooleanT set_power_state(string object_name, string power_state);
$display("OPENPA-ERROR set_power_state(\"%s\", \"%s\"): not supported by OpenPA; drive the supplies with supply_on, supply_off or set_supply_state", object_name, power_state);
return 0;
endfunction
// Supply queries (11.2.4). Names: supply ports, supply nets and supply set functions as the UPF wrote them.
function automatic upfSupplyTypeT get_supply_value(string name);
if (name == "VDD" || name == "VDD_N" || name == "SS_AON.power" || name == "PD_TOP.primary.power") return openpa_net_VDD_N;
if (name == "VSS" || name == "VSS_N" || name == "SS_AON.ground" || name == "SS_RF.ground" || name == "SS_BB.ground" || name == "PD_TOP.primary.ground" || name == "PD_RF.primary.ground" || name == "PD_BB.primary.ground") return openpa_net_VSS_N;
if (name == "VBUCK" || name == "VLDO" || name == "VRF_MON" || name == "VDD_RF" || name == "SS_RF.power" || name == "PD_RF.primary.power") return openpa_net_VDD_RF;
if (name == "VNW" || name == "VNW_N" || name == "SS_RF.nwell" || name == "PD_RF.primary.nwell") return openpa_net_VNW_N;
if (name == "VDD_BB" || name == "SS_BB.power" || name == "PD_BB.primary.power") return openpa_net_VDD_BB;
$display("OPENPA-ERROR get_supply_value(\"%s\"): no supply net, port or supply set function of that name", name);
return 0;
endfunction
function automatic upfRealT get_supply_voltage(upfSupplyTypeT arg); return arg.voltage / 1.0e6; endfunction
// 11.2.4: 1 for FULL_ON; 0 otherwise.
function automatic upfBooleanT get_supply_on_state(upfSupplyTypeT arg); return arg.state == FULL_ON; endfunction
function automatic upfSupplyStateE get_supply_state(upfSupplyTypeT arg); return arg.state; endfunction
endpackage
// ---------------------------------------------------------------------------
// OpenPA cells (generated; do not edit)
// ---------------------------------------------------------------------------
// openpa_corrupt: rule C2. Passes d while the driving domain is NORMAL; otherwise drives X (4-state)
// or a seeded value (2-state). The value is computed ahead for the episode the next power-down starts
// (ep + 1 while ok), so at power-down the output goes straight from d to the new value: no delta glitch
// through the previous episode's value (Icarus would turn one into a clock edge).
module openpa_corrupt #(parameter int W = 1, parameter int unsigned ID = 0) (
input logic [W-1:0] d,
output logic [W-1:0] q,
input bit ok,
input int unsigned ep
);
localparam int L = (W + 63) / 64;
logic [L*64-1:0] cv;
always @(ep or ok or UPF::openpa_kick)
for (int i = 0; i < L; i++) cv[i*64 +: 64] = UPF::openpa_mix(ID, ok ? ep + 1 : ep, i);
assign q = ok ? d : (UPF::openpa_xmode ? {W{1'bx}} : cv[W-1:0]);
endmodule
// openpa_corrupt_sim: rule C2 for a domain that has intermediate simstates (IEEE 1801-2024 9.5). As
// openpa_corrupt, and also corrupt while lhit is set (CORRUPT_ON_ACTIVITY after input activity), or after d
// changed while coc is set (CORRUPT_ON_CHANGE); leaving CORRUPT_ON_CHANGE clears that.
module openpa_corrupt_sim #(parameter int W = 1, parameter int unsigned ID = 0) (
input logic [W-1:0] d,
output logic [W-1:0] q,
input bit ok,
input int unsigned ep,
input bit lhit,
input bit coc
);
localparam int L = (W + 63) / 64;
logic [L*64-1:0] cv;
bit chg;
always @(ep or ok or UPF::openpa_kick)
for (int i = 0; i < L; i++) cv[i*64 +: 64] = UPF::openpa_mix(ID, ok ? ep + 1 : ep, i);
// verilator lint_off MULTIDRIVEN
for (genvar i = 0; i < W; i++) begin : g_chg
always @(posedge d[i] or negedge d[i]) if (coc && ok) chg = 1'b1;
end
always @(negedge coc) chg = 1'b0;
// verilator lint_on MULTIDRIVEN
assign q = (ok && !lhit && !chg) ? d : (UPF::openpa_xmode ? {W{1'bx}} : cv[W-1:0]);
endmodule
// openpa_iso: rules I1-I4 (IEEE 1801-2024 9.8). CLAMP 0, 1, 2 (latch: the value the input had while the enable
// was inactive) or 3 (Z: high impedance on 4-state; 0 on 2-state backends, which cannot represent Z).
// sup_ok is 1 while the isolation supply is NORMAL (always, for a strategy with no supply); otherwise the output,
// and a latched value, are corrupt. An enable at X or Z corrupts the output and the latched value.
module openpa_iso #(parameter int W = 1, parameter int CLAMP = 0, parameter bit SENSE = 1'b1, parameter int unsigned ID = 0) (
input logic [W-1:0] d,
output logic [W-1:0] q,
input logic en,
input bit sup_ok,
input int unsigned sup_ep
);
localparam int L = (W + 63) / 64;
logic [L*64-1:0] cv;
logic [W-1:0] held;
always @(sup_ep or sup_ok or UPF::openpa_kick)
for (int i = 0; i < L; i++) cv[i*64 +: 64] = UPF::openpa_mix(ID + 32'h4000_0000, sup_ok ? sup_ep + 1 : sup_ep, i);
wire active = (en === SENSE);
wire inactive = (en === !SENSE);
wire [W-1:0] bad = UPF::openpa_xmode ? {W{1'bx}} : cv[W-1:0];
if (CLAMP == 2) begin : g_latch
always @(d or en or sup_ok or bad) if (!sup_ok || !(active || inactive)) held = bad; else if (inactive) held = d;
end
wire [W-1:0] clampv = (CLAMP == 3) ? (UPF::openpa_xmode ? {W{1'bz}} : {W{1'b0}}) : (CLAMP == 2) ? held : (CLAMP == 1) ? {W{1'b1}} : {W{1'b0}};
assign q = !sup_ok ? bad : active ? clampv : inactive ? d : bad;
endmodule
// openpa_ls: rule L1 (IEEE 1801-2024 9.9). Passes d while every supply set of the cell is NORMAL; otherwise corrupt.
module openpa_ls #(parameter int W = 1, parameter int unsigned ID = 0) (
input logic [W-1:0] d,
output logic [W-1:0] q,
input bit src_ok,
input bit dst_ok,
input int unsigned ep
);
localparam int L = (W + 63) / 64;
logic [L*64-1:0] cv;
always @(ep or src_ok or dst_ok or UPF::openpa_kick)
for (int i = 0; i < L; i++) cv[i*64 +: 64] = UPF::openpa_mix(ID + 32'h8000_0000, (src_ok && dst_ok) ? ep + 1 : ep, i);
assign q = (src_ok && dst_ok) ? d : (UPF::openpa_xmode ? {W{1'bx}} : cv[W-1:0]);
endmodule
`line 1 "radio.sv" 0
// radio: an always-on top with an RF block and a baseband block. Power-unaware RTL.
module radio (
input logic clk,
input logic rst_n,
input logic en,
input logic [7:0] d,
input logic pwr_weak,
input logic pwr_main,
input logic iso_rf,
input logic iso_bb,
output logic [7:0] q_rf,
output logic [7:0] q_bb,
output logic [7:0] total
);
wire [7:0] openpa_u_rf_q_raw, openpa_u_rf_q_s1; wire [0:0] openpa_u_rf_clk_s1; wire [7:0] openpa_u_rf_d_s1; wire [0:0] openpa_u_rf_en_s1; wire [0:0] openpa_u_rf_rst_n_s1; acc u_rf (.clk(openpa_u_rf_clk_s1), .rst_n(openpa_u_rf_rst_n_s1), .en(openpa_u_rf_en_s1), .d(openpa_u_rf_d_s1), .q(openpa_u_rf_q_raw)); openpa_corrupt #(.W(8), .ID(268435464)) openpa_u_rf_q_cor (.d(openpa_u_rf_q_raw), .q(openpa_u_rf_q_s1), .ok(UPF::openpa_dom_PD_RF_ok), .ep(UPF::openpa_dom_PD_RF_ep)); openpa_iso #(.W(8), .CLAMP(0), .SENSE(1'b1), .ID(268435465)) openpa_u_rf_q_iso (.d(openpa_u_rf_q_s1), .q(q_rf), .en(UPF::openpa_ctl_2_iso_rf), .sup_ok((UPF::openpa_ss_SS_AON_sim == 0)), .sup_ep(UPF::openpa_ss_SS_AON_ep)); openpa_corrupt #(.W(1), .ID(268435504)) openpa_u_rf_clk_cor (.d(clk), .q(openpa_u_rf_clk_s1), .ok(UPF::openpa_dom_PD_TOP_ok), .ep(UPF::openpa_dom_PD_TOP_ep)); openpa_corrupt #(.W(8), .ID(268435512)) openpa_u_rf_d_cor (.d(d), .q(openpa_u_rf_d_s1), .ok(UPF::openpa_dom_PD_TOP_ok), .ep(UPF::openpa_dom_PD_TOP_ep)); openpa_corrupt #(.W(1), .ID(268435520)) openpa_u_rf_en_cor (.d(en), .q(openpa_u_rf_en_s1), .ok(UPF::openpa_dom_PD_TOP_ok), .ep(UPF::openpa_dom_PD_TOP_ep)); openpa_corrupt #(.W(1), .ID(268435528)) openpa_u_rf_rst_n_cor (.d(rst_n), .q(openpa_u_rf_rst_n_s1), .ok(UPF::openpa_dom_PD_TOP_ok), .ep(UPF::openpa_dom_PD_TOP_ep));
wire [7:0] openpa_u_bb_q_raw, openpa_u_bb_q_s1; wire [0:0] openpa_u_bb_clk_s1; wire [7:0] openpa_u_bb_d_s1; wire [0:0] openpa_u_bb_en_s1; wire [0:0] openpa_u_bb_rst_n_s1; acc u_bb (.clk(openpa_u_bb_clk_s1), .rst_n(openpa_u_bb_rst_n_s1), .en(openpa_u_bb_en_s1), .d(openpa_u_bb_d_s1), .q(openpa_u_bb_q_raw)); openpa_corrupt #(.W(8), .ID(268435456)) openpa_u_bb_q_cor (.d(openpa_u_bb_q_raw), .q(openpa_u_bb_q_s1), .ok(UPF::openpa_dom_PD_BB_ok), .ep(UPF::openpa_dom_PD_BB_ep)); openpa_iso #(.W(8), .CLAMP(0), .SENSE(1'b1), .ID(268435457)) openpa_u_bb_q_iso (.d(openpa_u_bb_q_s1), .q(q_bb), .en(UPF::openpa_ctl_3_iso_bb), .sup_ok((UPF::openpa_ss_SS_AON_sim == 0)), .sup_ep(UPF::openpa_ss_SS_AON_ep)); openpa_corrupt #(.W(1), .ID(268435472)) openpa_u_bb_clk_cor (.d(clk), .q(openpa_u_bb_clk_s1), .ok(UPF::openpa_dom_PD_TOP_ok), .ep(UPF::openpa_dom_PD_TOP_ep)); openpa_corrupt #(.W(8), .ID(268435480)) openpa_u_bb_d_cor (.d(d + 8'd1), .q(openpa_u_bb_d_s1), .ok(UPF::openpa_dom_PD_TOP_ok), .ep(UPF::openpa_dom_PD_TOP_ep)); openpa_corrupt #(.W(1), .ID(268435488)) openpa_u_bb_en_cor (.d(en), .q(openpa_u_bb_en_s1), .ok(UPF::openpa_dom_PD_TOP_ok), .ep(UPF::openpa_dom_PD_TOP_ep)); openpa_corrupt #(.W(1), .ID(268435496)) openpa_u_bb_rst_n_cor (.d(rst_n), .q(openpa_u_bb_rst_n_s1), .ok(UPF::openpa_dom_PD_TOP_ok), .ep(UPF::openpa_dom_PD_TOP_ep));
always_ff @(posedge clk or negedge rst_n)
if (!rst_n) total <= '0;
else total <= q_rf + q_bb;
`line 1 "openpa_overlay.sv" 0
// ===================================================================================
// OpenPA overlay for radio: generated from radio_sets.upf. Do not edit.
// ===================================================================================
// verilator lint_off MULTIDRIVEN
// verilator lint_off ENUMVALUE
// verilator lint_off WIDTHTRUNC
// verilator lint_off WIDTHEXPAND
// verilator lint_off BLKSEQ
// verilator lint_off IGNOREDRETURN
import UPF::openpa_cmode;
import UPF::openpa_ctl_0_pwr_weak;
import UPF::openpa_ctl_1_pwr_main;
import UPF::openpa_ctl_2_iso_rf;
import UPF::openpa_ctl_3_iso_bb;
import UPF::openpa_dom_PD_BB_ep;
import UPF::openpa_dom_PD_BB_ok;
import UPF::openpa_dom_PD_BB_sim;
import UPF::openpa_dom_PD_RF_ep;
import UPF::openpa_dom_PD_RF_ok;
import UPF::openpa_dom_PD_RF_sim;
import UPF::openpa_dom_PD_TOP_ep;
import UPF::openpa_dom_PD_TOP_ok;
import UPF::openpa_dom_PD_TOP_sim;
import UPF::openpa_kick;
import UPF::openpa_net_VDD_BB;
import UPF::openpa_net_VDD_N;
import UPF::openpa_net_VDD_RF;
import UPF::openpa_net_VNW_N;
import UPF::openpa_net_VSS_N;
import UPF::openpa_seed;
import UPF::openpa_ss_SS_AON_ep;
import UPF::openpa_ss_SS_AON_multi;
import UPF::openpa_ss_SS_AON_ok;
import UPF::openpa_ss_SS_AON_sim;
import UPF::openpa_ss_SS_AON_st;
import UPF::openpa_ss_SS_BB_ep;
import UPF::openpa_ss_SS_BB_multi;
import UPF::openpa_ss_SS_BB_ok;
import UPF::openpa_ss_SS_BB_sim;
import UPF::openpa_ss_SS_BB_st;
import UPF::openpa_ss_SS_RF_ep;
import UPF::openpa_ss_SS_RF_multi;
import UPF::openpa_ss_SS_RF_ok;
import UPF::openpa_ss_SS_RF_sim;
import UPF::openpa_ss_SS_RF_st;
import UPF::openpa_sw_SW_MAIN_st;
import UPF::openpa_sw_SW_WEAK_st;
import UPF::openpa_xmode;
// ---- mode, seed, trace
bit openpa_tr, openpa_obs;
int openpa_n [1:14];
int openpa_seq [1:4]; // good-form sequence bins (coverage)
bit openpa_sreq; bit openpa_sp [1:28]; // deferred checks: request and pending flags
string openpa_mode_arg;
initial begin
`ifdef VERILATOR
openpa_xmode = 1'b0;
`else
openpa_xmode = 1'b1;
`endif
openpa_cmode = 0;
if ($value$plusargs("openpa_corrupt=%s", openpa_mode_arg)) begin
if (openpa_mode_arg == "x") openpa_xmode = 1'b1;
else if (openpa_mode_arg == "random") openpa_xmode = 1'b0;
else if (openpa_mode_arg == "zero") begin openpa_xmode = 1'b0; openpa_cmode = 1; end
else if (openpa_mode_arg == "one") begin openpa_xmode = 1'b0; openpa_cmode = 2; end
else $display("OPENPA-ERROR +openpa_corrupt=%s: use x, random, zero or one", openpa_mode_arg);
end
if (!$value$plusargs("openpa_seed=%d", openpa_seed)) openpa_seed = 1;
openpa_tr = $test$plusargs("openpa_trace");
openpa_obs = $test$plusargs("openpa_obs");
$display("OPENPA-INFO corruption=%0s seed=%0d", openpa_xmode ? "x" : (openpa_cmode == 1 ? "zero" : openpa_cmode == 2 ? "one" : "random"), openpa_seed);
#0 openpa_kick = 1'b1;
end
task automatic openpa_check(input int id, input string msg);
openpa_n[id] = openpa_n[id] + 1;
$display("OPENPA-CHECK D%0d @ %0t: %s", id, $time, msg);
endtask
task automatic openpa_t(input string msg);
if (openpa_tr) $display("OPENPA-TRACE @ %0t: %s", $time, msg);
endtask
// ---- copies of the design signals the UPF names (4-state, so X is visible)
always @(pwr_weak or openpa_kick) openpa_ctl_0_pwr_weak = pwr_weak;
always @(pwr_main or openpa_kick) openpa_ctl_1_pwr_main = pwr_main;
always @(iso_rf or openpa_kick) openpa_ctl_2_iso_rf = iso_rf;
always @(iso_bb or openpa_kick) openpa_ctl_3_iso_bb = iso_bb;
// ---- supply network, switches, supply sets, simstates, power states (one block, evaluated in order)
bit openpa_tg_sw_SW_WEAK_st; int openpa_pv_sw_SW_WEAK_st = -2;
bit openpa_tg_sw_SW_MAIN_st; int openpa_pv_sw_SW_MAIN_st = -2;
UPF::supply_net_type openpa_rv_VDD_RF_0;
UPF::supply_net_type openpa_rv_VDD_RF_1;
bit openpa_rc_VDD_RF; // VDD_RF: resolution conflict (D13)
UPF::supply_net_type openpa_rv_VDD_BB_0;
UPF::supply_net_type openpa_swv_SW_WEAK_f, openpa_swv_SW_WEAK_p; bit openpa_swv_SW_WEAK_u, openpa_swv_SW_WEAK_hf, openpa_swv_SW_WEAK_hp, openpa_swv_SW_WEAK_vd, openpa_swv_SW_WEAK_on, openpa_swv_SW_WEAK_pt; int openpa_swv_SW_WEAK_k; // switch SW_WEAK
UPF::supply_net_type openpa_rv_VDD_BB_1;
UPF::supply_net_type openpa_swv_SW_MAIN_f, openpa_swv_SW_MAIN_p; bit openpa_swv_SW_MAIN_u, openpa_swv_SW_MAIN_hf, openpa_swv_SW_MAIN_hp, openpa_swv_SW_MAIN_vd, openpa_swv_SW_MAIN_on, openpa_swv_SW_MAIN_pt; int openpa_swv_SW_MAIN_k; // switch SW_MAIN
bit openpa_rc_VDD_BB; // VDD_BB: resolution conflict (D13)
always @(openpa_kick or UPF::openpa_port_VDD or UPF::openpa_port_VSS or UPF::openpa_port_VBUCK or UPF::openpa_port_VLDO or UPF::openpa_port_VNW or UPF::openpa_ctl_0_pwr_weak or UPF::openpa_ctl_1_pwr_main) begin : openpa_network
openpa_net_VDD_N = UPF::openpa_port_VDD; // VDD_N <- port VDD
openpa_net_VSS_N = UPF::openpa_port_VSS; // VSS_N <- port VSS
openpa_rv_VDD_RF_0 = UPF::openpa_port_VBUCK; // VDD_RF <- port VBUCK
openpa_rv_VDD_RF_1 = UPF::openpa_port_VLDO; // VDD_RF <- port VLDO
// supply net VDD_RF: -resolve one_hot over port VBUCK, port VLDO (IEEE 1801-2024 6.25.3)
openpa_rc_VDD_RF = 1'b0; openpa_net_VDD_RF.state = UPF::OFF; openpa_net_VDD_RF.voltage = 0;
begin
int n, nf, np; int uv; bit vd; n = 0; nf = 0; np = 0; uv = 0; vd = 1'b0;
if ((openpa_rv_VDD_RF_0.state == UPF::FULL_ON || openpa_rv_VDD_RF_0.state == UPF::PARTIAL_ON)) begin if (n > 0 && openpa_rv_VDD_RF_0.voltage != uv) vd = 1'b1; uv = openpa_rv_VDD_RF_0.voltage; n = n + 1; if (openpa_rv_VDD_RF_0.state == UPF::FULL_ON) nf = nf + 1; else np = np + 1; end
if ((openpa_rv_VDD_RF_1.state == UPF::FULL_ON || openpa_rv_VDD_RF_1.state == UPF::PARTIAL_ON)) begin if (n > 0 && openpa_rv_VDD_RF_1.voltage != uv) vd = 1'b1; uv = openpa_rv_VDD_RF_1.voltage; n = n + 1; if (openpa_rv_VDD_RF_1.state == UPF::FULL_ON) nf = nf + 1; else np = np + 1; end
if (openpa_rv_VDD_RF_0.state == UPF::UNDETERMINED || openpa_rv_VDD_RF_1.state == UPF::UNDETERMINED) openpa_net_VDD_RF.state = UPF::UNDETERMINED;
else if (n > 1) begin openpa_net_VDD_RF.state = UPF::UNDETERMINED; openpa_rc_VDD_RF = 1'b1; end // more than one source not OFF
else if (n == 1) begin openpa_net_VDD_RF.state = nf ? UPF::FULL_ON : UPF::PARTIAL_ON; openpa_net_VDD_RF.voltage = uv; end
end
openpa_net_VNW_N = UPF::openpa_port_VNW; // VNW_N <- port VNW
// switch SW_WEAK (radio_sets.upf:35): IEEE 1801-2024 6.23
openpa_swv_SW_WEAK_u = 1'b0; openpa_swv_SW_WEAK_hf = 1'b0; openpa_swv_SW_WEAK_hp = 1'b0; openpa_swv_SW_WEAK_vd = 1'b0; openpa_swv_SW_WEAK_on = 1'b0; openpa_swv_SW_WEAK_pt = 1'b0; openpa_swv_SW_WEAK_k = 0;
if (($isunknown(openpa_ctl_0_pwr_weak)) && UPF::openpa_net_VDD_N.state != UPF::OFF) openpa_swv_SW_WEAK_u = 1'b1; // on state on: a control is X or Z
else if ((openpa_ctl_0_pwr_weak === 1'b1)) begin
if (!openpa_swv_SW_WEAK_on) openpa_swv_SW_WEAK_k = 1;
openpa_swv_SW_WEAK_on = 1'b1;
if (UPF::openpa_net_VDD_N.state == UPF::UNDETERMINED) openpa_swv_SW_WEAK_u = 1'b1;
else if (UPF::openpa_net_VDD_N.state == UPF::FULL_ON) begin
if ((openpa_swv_SW_WEAK_hf && openpa_swv_SW_WEAK_f.voltage != UPF::openpa_net_VDD_N.voltage) || (openpa_swv_SW_WEAK_hp && openpa_swv_SW_WEAK_p.voltage != UPF::openpa_net_VDD_N.voltage)) openpa_swv_SW_WEAK_vd = 1'b1;
openpa_swv_SW_WEAK_f = UPF::openpa_net_VDD_N; openpa_swv_SW_WEAK_hf = 1'b1;
end
else if (UPF::openpa_net_VDD_N.state == UPF::PARTIAL_ON) begin
if ((openpa_swv_SW_WEAK_hf && openpa_swv_SW_WEAK_f.voltage != UPF::openpa_net_VDD_N.voltage) || (openpa_swv_SW_WEAK_hp && openpa_swv_SW_WEAK_p.voltage != UPF::openpa_net_VDD_N.voltage)) openpa_swv_SW_WEAK_vd = 1'b1;
openpa_swv_SW_WEAK_p = UPF::openpa_net_VDD_N; openpa_swv_SW_WEAK_hp = 1'b1;
end
end
if ((1'b0) || (((!((openpa_ctl_0_pwr_weak === 1'b1)))) && (openpa_swv_SW_WEAK_on || openpa_swv_SW_WEAK_pt)) || openpa_swv_SW_WEAK_u || openpa_swv_SW_WEAK_vd || (!($isunknown(openpa_ctl_0_pwr_weak)) && !openpa_swv_SW_WEAK_on && !openpa_swv_SW_WEAK_pt && !((!((openpa_ctl_0_pwr_weak === 1'b1)))) && !(1'b0))) begin openpa_sw_SW_WEAK_st = -1; openpa_rv_VDD_BB_0.state = UPF::UNDETERMINED; openpa_rv_VDD_BB_0.voltage = 0; end
else begin openpa_sw_SW_WEAK_st = openpa_swv_SW_WEAK_k; if (openpa_swv_SW_WEAK_hf) openpa_rv_VDD_BB_0 = openpa_swv_SW_WEAK_f; else if (openpa_swv_SW_WEAK_hp) openpa_rv_VDD_BB_0 = openpa_swv_SW_WEAK_p; else begin openpa_rv_VDD_BB_0.state = UPF::OFF; openpa_rv_VDD_BB_0.voltage = 0; end end
// switch SW_MAIN (radio_sets.upf:37): IEEE 1801-2024 6.23
openpa_swv_SW_MAIN_u = 1'b0; openpa_swv_SW_MAIN_hf = 1'b0; openpa_swv_SW_MAIN_hp = 1'b0; openpa_swv_SW_MAIN_vd = 1'b0; openpa_swv_SW_MAIN_on = 1'b0; openpa_swv_SW_MAIN_pt = 1'b0; openpa_swv_SW_MAIN_k = 0;
if (($isunknown(openpa_ctl_1_pwr_main)) && UPF::openpa_net_VDD_N.state != UPF::OFF) openpa_swv_SW_MAIN_u = 1'b1; // on state on: a control is X or Z
else if ((openpa_ctl_1_pwr_main === 1'b1)) begin
if (!openpa_swv_SW_MAIN_on) openpa_swv_SW_MAIN_k = 1;
openpa_swv_SW_MAIN_on = 1'b1;
if (UPF::openpa_net_VDD_N.state == UPF::UNDETERMINED) openpa_swv_SW_MAIN_u = 1'b1;
else if (UPF::openpa_net_VDD_N.state == UPF::FULL_ON) begin
if ((openpa_swv_SW_MAIN_hf && openpa_swv_SW_MAIN_f.voltage != UPF::openpa_net_VDD_N.voltage) || (openpa_swv_SW_MAIN_hp && openpa_swv_SW_MAIN_p.voltage != UPF::openpa_net_VDD_N.voltage)) openpa_swv_SW_MAIN_vd = 1'b1;
openpa_swv_SW_MAIN_f = UPF::openpa_net_VDD_N; openpa_swv_SW_MAIN_hf = 1'b1;
end
else if (UPF::openpa_net_VDD_N.state == UPF::PARTIAL_ON) begin
if ((openpa_swv_SW_MAIN_hf && openpa_swv_SW_MAIN_f.voltage != UPF::openpa_net_VDD_N.voltage) || (openpa_swv_SW_MAIN_hp && openpa_swv_SW_MAIN_p.voltage != UPF::openpa_net_VDD_N.voltage)) openpa_swv_SW_MAIN_vd = 1'b1;
openpa_swv_SW_MAIN_p = UPF::openpa_net_VDD_N; openpa_swv_SW_MAIN_hp = 1'b1;
end
end
if ((1'b0) || (((!((openpa_ctl_1_pwr_main === 1'b1)))) && (openpa_swv_SW_MAIN_on || openpa_swv_SW_MAIN_pt)) || openpa_swv_SW_MAIN_u || openpa_swv_SW_MAIN_vd || (!($isunknown(openpa_ctl_1_pwr_main)) && !openpa_swv_SW_MAIN_on && !openpa_swv_SW_MAIN_pt && !((!((openpa_ctl_1_pwr_main === 1'b1)))) && !(1'b0))) begin openpa_sw_SW_MAIN_st = -1; openpa_rv_VDD_BB_1.state = UPF::UNDETERMINED; openpa_rv_VDD_BB_1.voltage = 0; end
else begin openpa_sw_SW_MAIN_st = openpa_swv_SW_MAIN_k; if (openpa_swv_SW_MAIN_hf) openpa_rv_VDD_BB_1 = openpa_swv_SW_MAIN_f; else if (openpa_swv_SW_MAIN_hp) openpa_rv_VDD_BB_1 = openpa_swv_SW_MAIN_p; else begin openpa_rv_VDD_BB_1.state = UPF::OFF; openpa_rv_VDD_BB_1.voltage = 0; end end
// supply net VDD_BB: -resolve parallel over switch SW_WEAK, switch SW_MAIN (IEEE 1801-2024 6.25.3)
openpa_rc_VDD_BB = 1'b0; openpa_net_VDD_BB.state = UPF::OFF; openpa_net_VDD_BB.voltage = 0;
begin
int n, nf, np; int uv; bit vd; n = 0; nf = 0; np = 0; uv = 0; vd = 1'b0;
if ((openpa_rv_VDD_BB_0.state == UPF::FULL_ON || openpa_rv_VDD_BB_0.state == UPF::PARTIAL_ON)) begin if (n > 0 && openpa_rv_VDD_BB_0.voltage != uv) vd = 1'b1; uv = openpa_rv_VDD_BB_0.voltage; n = n + 1; if (openpa_rv_VDD_BB_0.state == UPF::FULL_ON) nf = nf + 1; else np = np + 1; end
if ((openpa_rv_VDD_BB_1.state == UPF::FULL_ON || openpa_rv_VDD_BB_1.state == UPF::PARTIAL_ON)) begin if (n > 0 && openpa_rv_VDD_BB_1.voltage != uv) vd = 1'b1; uv = openpa_rv_VDD_BB_1.voltage; n = n + 1; if (openpa_rv_VDD_BB_1.state == UPF::FULL_ON) nf = nf + 1; else np = np + 1; end
if (openpa_rv_VDD_BB_0.state == UPF::UNDETERMINED || openpa_rv_VDD_BB_1.state == UPF::UNDETERMINED) openpa_net_VDD_BB.state = UPF::UNDETERMINED;
else if (vd) begin openpa_net_VDD_BB.state = UPF::UNDETERMINED; openpa_rc_VDD_BB = 1'b1; end // ON sources at different voltages: more than one root supply
else if (nf == 2) begin openpa_net_VDD_BB.state = UPF::FULL_ON; openpa_net_VDD_BB.voltage = uv; end
else if (n > 0) begin openpa_net_VDD_BB.state = UPF::PARTIAL_ON; openpa_net_VDD_BB.voltage = uv; end // a PARTIAL_ON source, or some sources OFF
end
// supply set SS_AON (also PD_TOP.primary): IEEE 1801-2024 4.7.3, 4.7.4, 6.5.6, 9.3.2, 5.7.8
begin : openpa_ss_SS_AON
bit nx; int sm;
sm = (UPF::openpa_net_VDD_N.state == UPF::FULL_ON && UPF::openpa_net_VSS_N.state == UPF::FULL_ON) ? 0 : 5; // predefined ON (NORMAL) or OFF (CORRUPT), IEEE 1801-2024 4.7.4
openpa_ss_SS_AON_sim = sm;
nx = sm < 5;
if (openpa_ss_SS_AON_ok && !nx) openpa_ss_SS_AON_ep = openpa_ss_SS_AON_ep + 1;
openpa_ss_SS_AON_ok = nx;
end
// supply set SS_RF (also PD_RF.primary): IEEE 1801-2024 4.7.3, 4.7.4, 6.5.6, 9.3.2, 5.7.8
begin : openpa_ss_SS_RF
bit nx; int sm;
sm = (UPF::openpa_net_VDD_RF.state == UPF::FULL_ON && UPF::openpa_net_VSS_N.state == UPF::FULL_ON) ? 0 : 5; // predefined ON (NORMAL) or OFF (CORRUPT), IEEE 1801-2024 4.7.4
openpa_ss_SS_RF_sim = sm;
nx = sm < 5;
if (openpa_ss_SS_RF_ok && !nx) openpa_ss_SS_RF_ep = openpa_ss_SS_RF_ep + 1;
openpa_ss_SS_RF_ok = nx;
end
// supply set SS_BB (also PD_BB.primary): IEEE 1801-2024 4.7.3, 4.7.4, 6.5.6, 9.3.2, 5.7.8
begin : openpa_ss_SS_BB
bit nx; int sm;
sm = (UPF::openpa_net_VDD_BB.state == UPF::FULL_ON && UPF::openpa_net_VSS_N.state == UPF::FULL_ON) ? 0 : 5; // predefined ON (NORMAL) or OFF (CORRUPT), IEEE 1801-2024 4.7.4
openpa_ss_SS_BB_sim = sm;
nx = sm < 5;
if (openpa_ss_SS_BB_ok && !nx) openpa_ss_SS_BB_ep = openpa_ss_SS_BB_ep + 1;
openpa_ss_SS_BB_ok = nx;
end
// domain PD_TOP: simstate of its primary supply set SS_AON
if (openpa_dom_PD_TOP_ok && !UPF::openpa_ss_SS_AON_ok) openpa_dom_PD_TOP_ep = openpa_dom_PD_TOP_ep + 1;
openpa_dom_PD_TOP_ok = UPF::openpa_ss_SS_AON_ok;
openpa_dom_PD_TOP_sim = openpa_ss_SS_AON_sim;
// domain PD_RF: simstate of its primary supply set SS_RF
if (openpa_dom_PD_RF_ok && !UPF::openpa_ss_SS_RF_ok) openpa_dom_PD_RF_ep = openpa_dom_PD_RF_ep + 1;
openpa_dom_PD_RF_ok = UPF::openpa_ss_SS_RF_ok;
openpa_dom_PD_RF_sim = openpa_ss_SS_RF_sim;
// domain PD_BB: simstate of its primary supply set SS_BB
if (openpa_dom_PD_BB_ok && !UPF::openpa_ss_SS_BB_ok) openpa_dom_PD_BB_ep = openpa_dom_PD_BB_ep + 1;
openpa_dom_PD_BB_ok = UPF::openpa_ss_SS_BB_ok;
openpa_dom_PD_BB_sim = openpa_ss_SS_BB_sim;
if (openpa_sw_SW_WEAK_st != openpa_pv_sw_SW_WEAK_st) begin openpa_tg_sw_SW_WEAK_st = ~openpa_tg_sw_SW_WEAK_st; openpa_pv_sw_SW_WEAK_st = openpa_sw_SW_WEAK_st; end
if (openpa_sw_SW_MAIN_st != openpa_pv_sw_SW_MAIN_st) begin openpa_tg_sw_SW_MAIN_st = ~openpa_tg_sw_SW_MAIN_st; openpa_pv_sw_SW_MAIN_st = openpa_sw_SW_MAIN_st; end
end
always @(posedge openpa_rc_VDD_RF) openpa_check(13, "supply net VDD_RF (-resolve one_hot): more than one source is ON; the net is UNDETERMINED (IEEE 1801-2024 6.25.3)");
always @(posedge openpa_rc_VDD_BB) openpa_check(13, "supply net VDD_BB (-resolve parallel): ON sources drive different voltages; the net is UNDETERMINED (IEEE 1801-2024 6.25.3)");
// ---- corruption: registers forced, memories overwritten (rules C1, C3)
// domain PD_TOP (radio_sets.upf:30): 1 register(s), 0 memory(ies)
bit openpa_PD_TOP_applied, openpa_PD_TOP_valid;
logic [7:0] openpa_cv1; // corruption value for total
// The first evaluation counts as a power-up from OFF: registers take the corruption value even when the
// supplies are already on at time 0 (rule C3), so 4-state and 2-state runs start alike.
always @(UPF::openpa_dom_PD_TOP_ok or openpa_kick) if (!openpa_PD_TOP_valid || openpa_PD_TOP_applied != UPF::openpa_dom_PD_TOP_ok) begin
openpa_t({"PD_TOP ", UPF::openpa_dom_PD_TOP_ok ? "NORMAL" : "CORRUPT"});
if (!UPF::openpa_dom_PD_TOP_ok || !openpa_PD_TOP_valid) begin
if (openpa_xmode) openpa_cv1 = 'x; else openpa_cv1 = UPF::openpa_mix(1, UPF::openpa_dom_PD_TOP_ep, 0);
force total = openpa_cv1;
end
if (UPF::openpa_dom_PD_TOP_ok) begin
release total;
end
openpa_PD_TOP_valid = 1'b1; openpa_PD_TOP_applied = UPF::openpa_dom_PD_TOP_ok;
end
// domain PD_RF (radio_sets.upf:31): 1 register(s), 0 memory(ies)
bit openpa_PD_RF_applied, openpa_PD_RF_valid;
logic [7:0] openpa_cv2; // corruption value for u_rf.q
// The first evaluation counts as a power-up from OFF: registers take the corruption value even when the
// supplies are already on at time 0 (rule C3), so 4-state and 2-state runs start alike.
always @(UPF::openpa_dom_PD_RF_ok or openpa_kick) if (!openpa_PD_RF_valid || openpa_PD_RF_applied != UPF::openpa_dom_PD_RF_ok) begin
openpa_t({"PD_RF ", UPF::openpa_dom_PD_RF_ok ? "NORMAL" : "CORRUPT"});
if (!UPF::openpa_dom_PD_RF_ok || !openpa_PD_RF_valid) begin
if (openpa_xmode) openpa_cv2 = 'x; else openpa_cv2 = UPF::openpa_mix(2, UPF::openpa_dom_PD_RF_ep, 0);
force u_rf.q = openpa_cv2;
end
if (UPF::openpa_dom_PD_RF_ok) begin
release u_rf.q;
end
openpa_PD_RF_valid = 1'b1; openpa_PD_RF_applied = UPF::openpa_dom_PD_RF_ok;
end
// domain PD_BB (radio_sets.upf:32): 1 register(s), 0 memory(ies)
bit openpa_PD_BB_applied, openpa_PD_BB_valid;
logic [7:0] openpa_cv3; // corruption value for u_bb.q
// The first evaluation counts as a power-up from OFF: registers take the corruption value even when the
// supplies are already on at time 0 (rule C3), so 4-state and 2-state runs start alike.
always @(UPF::openpa_dom_PD_BB_ok or openpa_kick) if (!openpa_PD_BB_valid || openpa_PD_BB_applied != UPF::openpa_dom_PD_BB_ok) begin
openpa_t({"PD_BB ", UPF::openpa_dom_PD_BB_ok ? "NORMAL" : "CORRUPT"});
if (!UPF::openpa_dom_PD_BB_ok || !openpa_PD_BB_valid) begin
if (openpa_xmode) openpa_cv3 = 'x; else openpa_cv3 = UPF::openpa_mix(3, UPF::openpa_dom_PD_BB_ep, 0);
force u_bb.q = openpa_cv3;
end
if (UPF::openpa_dom_PD_BB_ok) begin
release u_bb.q;
end
openpa_PD_BB_valid = 1'b1; openpa_PD_BB_applied = UPF::openpa_dom_PD_BB_ok;
end
// D7 reset check for PD_BB: resets u_bb.rst_n active 0
bit openpa_PD_BB_rprev, openpa_PD_BB_rp0;
always @(posedge UPF::openpa_dom_PD_BB_ok or negedge UPF::openpa_dom_PD_BB_ok or posedge u_bb.rst_n or negedge u_bb.rst_n) begin
if (UPF::openpa_dom_PD_BB_ok && !openpa_PD_BB_rprev) openpa_PD_BB_rp0 = 1'b1;
if (!UPF::openpa_dom_PD_BB_ok || u_bb.rst_n === 1'b0) openpa_PD_BB_rp0 = 1'b0;
openpa_PD_BB_rprev = UPF::openpa_dom_PD_BB_ok;
end
// D7 reset check for PD_RF: resets u_rf.rst_n active 0
bit openpa_PD_RF_rprev, openpa_PD_RF_rp0;
always @(posedge UPF::openpa_dom_PD_RF_ok or negedge UPF::openpa_dom_PD_RF_ok or posedge u_rf.rst_n or negedge u_rf.rst_n) begin
if (UPF::openpa_dom_PD_RF_ok && !openpa_PD_RF_rprev) openpa_PD_RF_rp0 = 1'b1;
if (!UPF::openpa_dom_PD_RF_ok || u_rf.rst_n === 1'b0) openpa_PD_RF_rp0 = 1'b0;
openpa_PD_RF_rprev = UPF::openpa_dom_PD_RF_ok;
end
// ---- checks for set_isolation ISO_BB (radio_sets.upf:45): PD_BB -> PD_TOP on 1 port(s)
bit openpa_ig1_act, openpa_ig1_cyc;
always @(negedge UPF::openpa_dom_PD_BB_ok) if (!UPF::openpa_dom_PD_BB_ok)
begin openpa_sp[1] = 1'b1; openpa_sreq = 1'b1; end
always @(posedge UPF::openpa_ctl_3_iso_bb or negedge UPF::openpa_ctl_3_iso_bb or posedge openpa_kick) begin
if (openpa_ig1_act && !(UPF::openpa_ctl_3_iso_bb === 1'b1))
begin openpa_sp[2] = 1'b1; openpa_sreq = 1'b1; end
if (openpa_ig1_act != (UPF::openpa_ctl_3_iso_bb === 1'b1)) openpa_t({"ISO_BB enable ", (UPF::openpa_ctl_3_iso_bb === 1'b1) ? "active" : "inactive"});
openpa_ig1_act = (UPF::openpa_ctl_3_iso_bb === 1'b1);
end
always @(negedge UPF::openpa_ss_SS_AON_ok) if (!UPF::openpa_ss_SS_AON_ok)
begin openpa_sp[3] = 1'b1; openpa_sreq = 1'b1; end
// ---- checks for set_isolation ISO_RF (radio_sets.upf:43): PD_RF -> PD_TOP on 1 port(s)
bit openpa_ig2_act, openpa_ig2_cyc;
always @(negedge UPF::openpa_dom_PD_RF_ok) if (!UPF::openpa_dom_PD_RF_ok)
begin openpa_sp[4] = 1'b1; openpa_sreq = 1'b1; end
always @(posedge UPF::openpa_ctl_2_iso_rf or negedge UPF::openpa_ctl_2_iso_rf or posedge openpa_kick) begin
if (openpa_ig2_act && !(UPF::openpa_ctl_2_iso_rf === 1'b1))
begin openpa_sp[5] = 1'b1; openpa_sreq = 1'b1; end
if (openpa_ig2_act != (UPF::openpa_ctl_2_iso_rf === 1'b1)) openpa_t({"ISO_RF enable ", (UPF::openpa_ctl_2_iso_rf === 1'b1) ? "active" : "inactive"});
openpa_ig2_act = (UPF::openpa_ctl_2_iso_rf === 1'b1);
end
always @(negedge UPF::openpa_ss_SS_AON_ok) if (!UPF::openpa_ss_SS_AON_ok)
begin openpa_sp[6] = 1'b1; openpa_sreq = 1'b1; end
// crossing 1: u_bb/q (PD_BB) -> logic in radio (PD_TOP), isolated by ISO_BB
bit openpa_x1_t;
always @(UPF::openpa_dom_PD_BB_ok or UPF::openpa_dom_PD_TOP_ok or UPF::openpa_ctl_3_iso_bb or UPF::openpa_ss_SS_AON_sim or UPF::openpa_net_VDD_BB or UPF::openpa_net_VSS_N) openpa_x1_t = !UPF::openpa_dom_PD_BB_ok && UPF::openpa_dom_PD_TOP_ok && !(((UPF::openpa_ctl_3_iso_bb === 1'b1) && (UPF::openpa_ss_SS_AON_sim == 0))) && !(UPF::openpa_net_VDD_BB.state == UPF::UNDETERMINED || UPF::openpa_net_VSS_N.state == UPF::UNDETERMINED);
always @(posedge openpa_x1_t)
begin openpa_sp[7] = 1'b1; openpa_sreq = 1'b1; end
// crossing 2: u_bb/q (PD_BB) -> radio output q_bb (PD_TOP), isolated by ISO_BB
bit openpa_x2_t;
always @(UPF::openpa_dom_PD_BB_ok or UPF::openpa_dom_PD_TOP_ok or UPF::openpa_ctl_3_iso_bb or UPF::openpa_ss_SS_AON_sim or UPF::openpa_net_VDD_BB or UPF::openpa_net_VSS_N) openpa_x2_t = !UPF::openpa_dom_PD_BB_ok && UPF::openpa_dom_PD_TOP_ok && !(((UPF::openpa_ctl_3_iso_bb === 1'b1) && (UPF::openpa_ss_SS_AON_sim == 0))) && !(UPF::openpa_net_VDD_BB.state == UPF::UNDETERMINED || UPF::openpa_net_VSS_N.state == UPF::UNDETERMINED);
always @(posedge openpa_x2_t)
begin openpa_sp[8] = 1'b1; openpa_sreq = 1'b1; end
// crossing 3: u_rf/q (PD_RF) -> logic in radio (PD_TOP), isolated by ISO_RF
bit openpa_x3_t;
always @(UPF::openpa_dom_PD_RF_ok or UPF::openpa_dom_PD_TOP_ok or UPF::openpa_ctl_2_iso_rf or UPF::openpa_ss_SS_AON_sim or UPF::openpa_net_VDD_RF or UPF::openpa_net_VSS_N) openpa_x3_t = !UPF::openpa_dom_PD_RF_ok && UPF::openpa_dom_PD_TOP_ok && !(((UPF::openpa_ctl_2_iso_rf === 1'b1) && (UPF::openpa_ss_SS_AON_sim == 0))) && !(UPF::openpa_net_VDD_RF.state == UPF::UNDETERMINED || UPF::openpa_net_VSS_N.state == UPF::UNDETERMINED);
always @(posedge openpa_x3_t)
begin openpa_sp[9] = 1'b1; openpa_sreq = 1'b1; end
// crossing 4: u_rf/q (PD_RF) -> radio output q_rf (PD_TOP), isolated by ISO_RF
bit openpa_x4_t;
always @(UPF::openpa_dom_PD_RF_ok or UPF::openpa_dom_PD_TOP_ok or UPF::openpa_ctl_2_iso_rf or UPF::openpa_ss_SS_AON_sim or UPF::openpa_net_VDD_RF or UPF::openpa_net_VSS_N) openpa_x4_t = !UPF::openpa_dom_PD_RF_ok && UPF::openpa_dom_PD_TOP_ok && !(((UPF::openpa_ctl_2_iso_rf === 1'b1) && (UPF::openpa_ss_SS_AON_sim == 0))) && !(UPF::openpa_net_VDD_RF.state == UPF::UNDETERMINED || UPF::openpa_net_VSS_N.state == UPF::UNDETERMINED);
always @(posedge openpa_x4_t)
begin openpa_sp[10] = 1'b1; openpa_sreq = 1'b1; end
// crossing 5: radio input clk (PD_TOP) -> u_bb/clk (PD_BB), not isolated
bit openpa_x5_t;
always @(UPF::openpa_dom_PD_TOP_ok or UPF::openpa_dom_PD_BB_ok or UPF::openpa_net_VDD_N or UPF::openpa_net_VSS_N) openpa_x5_t = !UPF::openpa_dom_PD_TOP_ok && UPF::openpa_dom_PD_BB_ok && !(1'b0) && !(UPF::openpa_net_VDD_N.state == UPF::UNDETERMINED || UPF::openpa_net_VSS_N.state == UPF::UNDETERMINED);
always @(posedge openpa_x5_t)
begin openpa_sp[11] = 1'b1; openpa_sreq = 1'b1; end
// crossing 6: logic in radio (PD_TOP) -> u_bb/d (PD_BB), not isolated
bit openpa_x6_t;
always @(UPF::openpa_dom_PD_TOP_ok or UPF::openpa_dom_PD_BB_ok or UPF::openpa_net_VDD_N or UPF::openpa_net_VSS_N) openpa_x6_t = !UPF::openpa_dom_PD_TOP_ok && UPF::openpa_dom_PD_BB_ok && !(1'b0) && !(UPF::openpa_net_VDD_N.state == UPF::UNDETERMINED || UPF::openpa_net_VSS_N.state == UPF::UNDETERMINED);
always @(posedge openpa_x6_t)
begin openpa_sp[12] = 1'b1; openpa_sreq = 1'b1; end
// crossing 7: radio input en (PD_TOP) -> u_bb/en (PD_BB), not isolated
bit openpa_x7_t;
always @(UPF::openpa_dom_PD_TOP_ok or UPF::openpa_dom_PD_BB_ok or UPF::openpa_net_VDD_N or UPF::openpa_net_VSS_N) openpa_x7_t = !UPF::openpa_dom_PD_TOP_ok && UPF::openpa_dom_PD_BB_ok && !(1'b0) && !(UPF::openpa_net_VDD_N.state == UPF::UNDETERMINED || UPF::openpa_net_VSS_N.state == UPF::UNDETERMINED);
always @(posedge openpa_x7_t)
begin openpa_sp[13] = 1'b1; openpa_sreq = 1'b1; end
// crossing 8: radio input rst_n (PD_TOP) -> u_bb/rst_n (PD_BB), not isolated
bit openpa_x8_t;
always @(UPF::openpa_dom_PD_TOP_ok or UPF::openpa_dom_PD_BB_ok or UPF::openpa_net_VDD_N or UPF::openpa_net_VSS_N) openpa_x8_t = !UPF::openpa_dom_PD_TOP_ok && UPF::openpa_dom_PD_BB_ok && !(1'b0) && !(UPF::openpa_net_VDD_N.state == UPF::UNDETERMINED || UPF::openpa_net_VSS_N.state == UPF::UNDETERMINED);
always @(posedge openpa_x8_t)
begin openpa_sp[14] = 1'b1; openpa_sreq = 1'b1; end
// crossing 9: radio input clk (PD_TOP) -> u_rf/clk (PD_RF), not isolated
bit openpa_x9_t;
always @(UPF::openpa_dom_PD_TOP_ok or UPF::openpa_dom_PD_RF_ok or UPF::openpa_net_VDD_N or UPF::openpa_net_VSS_N) openpa_x9_t = !UPF::openpa_dom_PD_TOP_ok && UPF::openpa_dom_PD_RF_ok && !(1'b0) && !(UPF::openpa_net_VDD_N.state == UPF::UNDETERMINED || UPF::openpa_net_VSS_N.state == UPF::UNDETERMINED);
always @(posedge openpa_x9_t)
begin openpa_sp[15] = 1'b1; openpa_sreq = 1'b1; end
// crossing 10: radio input d (PD_TOP) -> u_rf/d (PD_RF), not isolated
bit openpa_x10_t;
always @(UPF::openpa_dom_PD_TOP_ok or UPF::openpa_dom_PD_RF_ok or UPF::openpa_net_VDD_N or UPF::openpa_net_VSS_N) openpa_x10_t = !UPF::openpa_dom_PD_TOP_ok && UPF::openpa_dom_PD_RF_ok && !(1'b0) && !(UPF::openpa_net_VDD_N.state == UPF::UNDETERMINED || UPF::openpa_net_VSS_N.state == UPF::UNDETERMINED);
always @(posedge openpa_x10_t)
begin openpa_sp[16] = 1'b1; openpa_sreq = 1'b1; end
// crossing 11: radio input en (PD_TOP) -> u_rf/en (PD_RF), not isolated
bit openpa_x11_t;
always @(UPF::openpa_dom_PD_TOP_ok or UPF::openpa_dom_PD_RF_ok or UPF::openpa_net_VDD_N or UPF::openpa_net_VSS_N) openpa_x11_t = !UPF::openpa_dom_PD_TOP_ok && UPF::openpa_dom_PD_RF_ok && !(1'b0) && !(UPF::openpa_net_VDD_N.state == UPF::UNDETERMINED || UPF::openpa_net_VSS_N.state == UPF::UNDETERMINED);
always @(posedge openpa_x11_t)
begin openpa_sp[17] = 1'b1; openpa_sreq = 1'b1; end
// crossing 12: radio input rst_n (PD_TOP) -> u_rf/rst_n (PD_RF), not isolated
bit openpa_x12_t;
always @(UPF::openpa_dom_PD_TOP_ok or UPF::openpa_dom_PD_RF_ok or UPF::openpa_net_VDD_N or UPF::openpa_net_VSS_N) openpa_x12_t = !UPF::openpa_dom_PD_TOP_ok && UPF::openpa_dom_PD_RF_ok && !(1'b0) && !(UPF::openpa_net_VDD_N.state == UPF::UNDETERMINED || UPF::openpa_net_VSS_N.state == UPF::UNDETERMINED);
always @(posedge openpa_x12_t)
begin openpa_sp[18] = 1'b1; openpa_sreq = 1'b1; end
// level shifter check 1: PD_BB -> PD_TOP (no level shifter strategy, threshold 0)
bit openpa_l1_t;
always @(UPF::openpa_dom_PD_BB_ok or UPF::openpa_dom_PD_TOP_ok or UPF::openpa_net_VDD_BB or UPF::openpa_net_VDD_N) openpa_l1_t = UPF::openpa_dom_PD_BB_ok && UPF::openpa_dom_PD_TOP_ok && (UPF::openpa_net_VDD_BB.voltage - UPF::openpa_net_VDD_N.voltage > 0 || UPF::openpa_net_VDD_N.voltage - UPF::openpa_net_VDD_BB.voltage > 0) && !1'b0;
always @(posedge openpa_l1_t)
begin openpa_sp[19] = 1'b1; openpa_sreq = 1'b1; end
// level shifter check 2: PD_RF -> PD_TOP (no level shifter strategy, threshold 0)
bit openpa_l2_t;
always @(UPF::openpa_dom_PD_RF_ok or UPF::openpa_dom_PD_TOP_ok or UPF::openpa_net_VDD_RF or UPF::openpa_net_VDD_N) openpa_l2_t = UPF::openpa_dom_PD_RF_ok && UPF::openpa_dom_PD_TOP_ok && (UPF::openpa_net_VDD_RF.voltage - UPF::openpa_net_VDD_N.voltage > 0 || UPF::openpa_net_VDD_N.voltage - UPF::openpa_net_VDD_RF.voltage > 0) && !1'b0;
always @(posedge openpa_l2_t)
begin openpa_sp[20] = 1'b1; openpa_sreq = 1'b1; end
// level shifter check 3: PD_TOP -> PD_BB (no level shifter strategy, threshold 0)
bit openpa_l3_t;
always @(UPF::openpa_dom_PD_TOP_ok or UPF::openpa_dom_PD_BB_ok or UPF::openpa_net_VDD_N or UPF::openpa_net_VDD_BB) openpa_l3_t = UPF::openpa_dom_PD_TOP_ok && UPF::openpa_dom_PD_BB_ok && (UPF::openpa_net_VDD_N.voltage - UPF::openpa_net_VDD_BB.voltage > 0 || UPF::openpa_net_VDD_BB.voltage - UPF::openpa_net_VDD_N.voltage > 0) && !1'b0;
always @(posedge openpa_l3_t)
begin openpa_sp[21] = 1'b1; openpa_sreq = 1'b1; end
// level shifter check 4: PD_TOP -> PD_RF (no level shifter strategy, threshold 0)
bit openpa_l4_t;
always @(UPF::openpa_dom_PD_TOP_ok or UPF::openpa_dom_PD_RF_ok or UPF::openpa_net_VDD_N or UPF::openpa_net_VDD_RF) openpa_l4_t = UPF::openpa_dom_PD_TOP_ok && UPF::openpa_dom_PD_RF_ok && (UPF::openpa_net_VDD_N.voltage - UPF::openpa_net_VDD_RF.voltage > 0 || UPF::openpa_net_VDD_RF.voltage - UPF::openpa_net_VDD_N.voltage > 0) && !1'b0;
always @(posedge openpa_l4_t)
begin openpa_sp[22] = 1'b1; openpa_sreq = 1'b1; end
bit openpa_SW_WEAK_def;
always @(posedge openpa_tg_sw_SW_WEAK_st or negedge openpa_tg_sw_SW_WEAK_st)
begin openpa_sp[23] = 1'b1; openpa_sreq = 1'b1; end
bit openpa_SW_MAIN_def;
always @(posedge openpa_tg_sw_SW_MAIN_st or negedge openpa_tg_sw_SW_MAIN_st)
begin openpa_sp[24] = 1'b1; openpa_sreq = 1'b1; end
always @(negedge UPF::openpa_dom_PD_TOP_ok) if (!UPF::openpa_dom_PD_TOP_ok)
begin openpa_sp[25] = 1'b1; openpa_sreq = 1'b1; end
always @(negedge UPF::openpa_dom_PD_TOP_ok) if (!UPF::openpa_dom_PD_TOP_ok)
begin openpa_sp[26] = 1'b1; openpa_sreq = 1'b1; end
always @(negedge UPF::openpa_dom_PD_TOP_ok) if (!UPF::openpa_dom_PD_TOP_ok)
begin openpa_sp[27] = 1'b1; openpa_sreq = 1'b1; end
always @(negedge UPF::openpa_dom_PD_TOP_ok) if (!UPF::openpa_dom_PD_TOP_ok)
begin openpa_sp[28] = 1'b1; openpa_sreq = 1'b1; end
// ---- observation for differential corruption (+openpa_obs): design-top outputs while the top domain is on
`ifdef OPENPA_OBS
longint openpa_obs_after;
initial if (!$value$plusargs("openpa_obs_after=%d", openpa_obs_after)) openpa_obs_after = 0;
always @(q_rf) if (openpa_obs && UPF::openpa_dom_PD_TOP_ok && $time >= openpa_obs_after) $display("OPENPA-OBS @ %0t: q_rf=%h", $time, q_rf);
always @(q_bb) if (openpa_obs && UPF::openpa_dom_PD_TOP_ok && $time >= openpa_obs_after) $display("OPENPA-OBS @ %0t: q_bb=%h", $time, q_bb);
always @(total) if (openpa_obs && UPF::openpa_dom_PD_TOP_ok && $time >= openpa_obs_after) $display("OPENPA-OBS @ %0t: total=%h", $time, total);
`else
initial if ($test$plusargs("openpa_obs")) $display("OPENPA-ERROR +openpa_obs needs the copy compiled with OPENPA_OBS defined (-DOPENPA_OBS or +define+OPENPA_OBS)");
`endif
// Icarus 12 runs no named block inside a final block, so the report is a function.
function automatic void openpa_cover_report();
int hs, ht, hq;
hs = 0; ht = 0; hq = 0;
$display("OPENPA-COVER sequence D1 ISO_BB: PD_BB isolated before power-down %0d", openpa_seq[1]);
$display("OPENPA-COVER sequence D2/D7 ISO_BB: isolation released only after PD_BB was back and reset %0d", openpa_seq[2]);
$display("OPENPA-COVER sequence D1 ISO_RF: PD_RF isolated before power-down %0d", openpa_seq[3]);
$display("OPENPA-COVER sequence D2/D7 ISO_RF: isolation released only after PD_RF was back and reset %0d", openpa_seq[4]);
if (openpa_seq[1]) hq = hq + 1;
if (openpa_seq[2]) hq = hq + 1;
if (openpa_seq[3]) hq = hq + 1;
if (openpa_seq[4]) hq = hq + 1;
$display("OPENPA-COVER-SUMMARY states=%0d/0 declared_transitions=%0d/0 sequences=%0d/4", hs, ht, hq);
endfunction
// ---- settle process: 28 deferred check(s), run after one #0 in a fixed order
initial forever begin
wait (openpa_sreq && openpa_kick);
#0;
openpa_sreq = 1'b0;
if (openpa_sp[1]) begin
openpa_sp[1] = 1'b0;
if (!UPF::openpa_dom_PD_BB_ok && (UPF::openpa_dom_PD_TOP_ok) && !(UPF::openpa_ctl_3_iso_bb === 1'b1)) openpa_check(1, "set_isolation ISO_BB (radio_sets.upf:45): PD_BB went off while the isolation enable iso_bb was inactive");
else if (!UPF::openpa_dom_PD_BB_ok && (UPF::openpa_dom_PD_TOP_ok) && (UPF::openpa_ctl_3_iso_bb === 1'b1)) begin openpa_seq[1] = openpa_seq[1] + 1; openpa_ig1_cyc = 1'b1; end
end
if (openpa_sp[2]) begin
openpa_sp[2] = 1'b0;
if (!UPF::openpa_dom_PD_BB_ok && (UPF::openpa_dom_PD_TOP_ok)) openpa_check(2, "set_isolation ISO_BB (radio_sets.upf:45): isolation released while PD_BB is still off");
else if (openpa_PD_BB_rp0) openpa_check(7, "set_isolation ISO_BB (radio_sets.upf:45): isolation released after PD_BB powered up but before its reset u_bb.rst_n was asserted");
else if (openpa_ig1_cyc) openpa_seq[2] = openpa_seq[2] + 1;
openpa_ig1_cyc = 1'b0;
end
if (openpa_sp[3]) begin
openpa_sp[3] = 1'b0;
if ((UPF::openpa_ctl_3_iso_bb === 1'b1) && !UPF::openpa_dom_PD_BB_ok && (UPF::openpa_dom_PD_TOP_ok)) openpa_check(6, "set_isolation ISO_BB (radio_sets.upf:45): isolation supply SS_AON lost while clamping");
end
if (openpa_sp[4]) begin
openpa_sp[4] = 1'b0;
if (!UPF::openpa_dom_PD_RF_ok && (UPF::openpa_dom_PD_TOP_ok) && !(UPF::openpa_ctl_2_iso_rf === 1'b1)) openpa_check(1, "set_isolation ISO_RF (radio_sets.upf:43): PD_RF went off while the isolation enable iso_rf was inactive");
else if (!UPF::openpa_dom_PD_RF_ok && (UPF::openpa_dom_PD_TOP_ok) && (UPF::openpa_ctl_2_iso_rf === 1'b1)) begin openpa_seq[3] = openpa_seq[3] + 1; openpa_ig2_cyc = 1'b1; end
end
if (openpa_sp[5]) begin
openpa_sp[5] = 1'b0;
if (!UPF::openpa_dom_PD_RF_ok && (UPF::openpa_dom_PD_TOP_ok)) openpa_check(2, "set_isolation ISO_RF (radio_sets.upf:43): isolation released while PD_RF is still off");
else if (openpa_PD_RF_rp0) openpa_check(7, "set_isolation ISO_RF (radio_sets.upf:43): isolation released after PD_RF powered up but before its reset u_rf.rst_n was asserted");
else if (openpa_ig2_cyc) openpa_seq[4] = openpa_seq[4] + 1;
openpa_ig2_cyc = 1'b0;
end
if (openpa_sp[6]) begin
openpa_sp[6] = 1'b0;
if ((UPF::openpa_ctl_2_iso_rf === 1'b1) && !UPF::openpa_dom_PD_RF_ok && (UPF::openpa_dom_PD_TOP_ok)) openpa_check(6, "set_isolation ISO_RF (radio_sets.upf:43): isolation supply SS_AON lost while clamping");
end
if (openpa_sp[7]) begin
openpa_sp[7] = 1'b0;
if (openpa_x1_t) openpa_check(9, "u_bb/q of PD_BB (off) is read by logic in radio in PD_TOP (on) with no active isolation");
end
if (openpa_sp[8]) begin
openpa_sp[8] = 1'b0;
if (openpa_x2_t) openpa_check(9, "u_bb/q of PD_BB (off) is read by radio output q_bb in PD_TOP (on) with no active isolation");
end
if (openpa_sp[9]) begin
openpa_sp[9] = 1'b0;
if (openpa_x3_t) openpa_check(9, "u_rf/q of PD_RF (off) is read by logic in radio in PD_TOP (on) with no active isolation");
end
if (openpa_sp[10]) begin
openpa_sp[10] = 1'b0;
if (openpa_x4_t) openpa_check(9, "u_rf/q of PD_RF (off) is read by radio output q_rf in PD_TOP (on) with no active isolation");
end
if (openpa_sp[11]) begin
openpa_sp[11] = 1'b0;
if (openpa_x5_t) openpa_check(9, "radio input clk of PD_TOP (off) is read by u_bb/clk in PD_BB (on) with no active isolation");
end
if (openpa_sp[12]) begin
openpa_sp[12] = 1'b0;
if (openpa_x6_t) openpa_check(9, "logic in radio of PD_TOP (off) is read by u_bb/d in PD_BB (on) with no active isolation");
end
if (openpa_sp[13]) begin
openpa_sp[13] = 1'b0;
if (openpa_x7_t) openpa_check(9, "radio input en of PD_TOP (off) is read by u_bb/en in PD_BB (on) with no active isolation");
end
if (openpa_sp[14]) begin
openpa_sp[14] = 1'b0;
if (openpa_x8_t) openpa_check(9, "radio input rst_n of PD_TOP (off) is read by u_bb/rst_n in PD_BB (on) with no active isolation");
end
if (openpa_sp[15]) begin
openpa_sp[15] = 1'b0;
if (openpa_x9_t) openpa_check(9, "radio input clk of PD_TOP (off) is read by u_rf/clk in PD_RF (on) with no active isolation");
end
if (openpa_sp[16]) begin
openpa_sp[16] = 1'b0;
if (openpa_x10_t) openpa_check(9, "radio input d of PD_TOP (off) is read by u_rf/d in PD_RF (on) with no active isolation");
end
if (openpa_sp[17]) begin
openpa_sp[17] = 1'b0;
if (openpa_x11_t) openpa_check(9, "radio input en of PD_TOP (off) is read by u_rf/en in PD_RF (on) with no active isolation");
end
if (openpa_sp[18]) begin
openpa_sp[18] = 1'b0;
if (openpa_x12_t) openpa_check(9, "radio input rst_n of PD_TOP (off) is read by u_rf/rst_n in PD_RF (on) with no active isolation");
end
if (openpa_sp[19]) begin
openpa_sp[19] = 1'b0;
if (openpa_l1_t) openpa_check(11, $sformatf("PD_BB (%0d uV) drives PD_TOP (%0d uV) on 2 port(s) with no level shifter for this direction", UPF::openpa_net_VDD_BB.voltage, UPF::openpa_net_VDD_N.voltage));
end
if (openpa_sp[20]) begin
openpa_sp[20] = 1'b0;
if (openpa_l2_t) openpa_check(11, $sformatf("PD_RF (%0d uV) drives PD_TOP (%0d uV) on 2 port(s) with no level shifter for this direction", UPF::openpa_net_VDD_RF.voltage, UPF::openpa_net_VDD_N.voltage));
end
if (openpa_sp[21]) begin
openpa_sp[21] = 1'b0;
if (openpa_l3_t) openpa_check(11, $sformatf("PD_TOP (%0d uV) drives PD_BB (%0d uV) on 4 port(s) with no level shifter for this direction", UPF::openpa_net_VDD_N.voltage, UPF::openpa_net_VDD_BB.voltage));
end
if (openpa_sp[22]) begin
openpa_sp[22] = 1'b0;
if (openpa_l4_t) openpa_check(11, $sformatf("PD_TOP (%0d uV) drives PD_RF (%0d uV) on 4 port(s) with no level shifter for this direction", UPF::openpa_net_VDD_N.voltage, UPF::openpa_net_VDD_RF.voltage));
end
if (openpa_sp[23]) begin
openpa_sp[23] = 1'b0;
if (UPF::openpa_sw_SW_WEAK_st != -1) openpa_SW_WEAK_def = 1'b1; else if (openpa_SW_WEAK_def) openpa_check(10, "power switch SW_WEAK is undetermined: a control is X, or no state (or more than one) holds (radio_sets.upf:35)");
end
if (openpa_sp[24]) begin
openpa_sp[24] = 1'b0;
if (UPF::openpa_sw_SW_MAIN_st != -1) openpa_SW_MAIN_def = 1'b1; else if (openpa_SW_MAIN_def) openpa_check(10, "power switch SW_MAIN is undetermined: a control is X, or no state (or more than one) holds (radio_sets.upf:37)");
end
if (openpa_sp[25]) begin
openpa_sp[25] = 1'b0;
if (!UPF::openpa_dom_PD_TOP_ok && (UPF::openpa_dom_PD_RF_ok || UPF::openpa_dom_PD_BB_ok)) openpa_check(12, "pwr_weak (switch SW_WEAK) comes from PD_TOP, which is off while other domains are on");
end
if (openpa_sp[26]) begin
openpa_sp[26] = 1'b0;
if (!UPF::openpa_dom_PD_TOP_ok && (UPF::openpa_dom_PD_RF_ok || UPF::openpa_dom_PD_BB_ok)) openpa_check(12, "pwr_main (switch SW_MAIN) comes from PD_TOP, which is off while other domains are on");
end
if (openpa_sp[27]) begin
openpa_sp[27] = 1'b0;
if (!UPF::openpa_dom_PD_TOP_ok && (UPF::openpa_dom_PD_RF_ok || UPF::openpa_dom_PD_BB_ok)) openpa_check(12, "iso_rf (isolation ISO_RF) comes from PD_TOP, which is off while other domains are on");
end
if (openpa_sp[28]) begin
openpa_sp[28] = 1'b0;
if (!UPF::openpa_dom_PD_TOP_ok && (UPF::openpa_dom_PD_RF_ok || UPF::openpa_dom_PD_BB_ok)) openpa_check(12, "iso_bb (isolation ISO_BB) comes from PD_TOP, which is off while other domains are on");
end
end
final begin
$display("OPENPA-SUMMARY D1=%0d D2=%0d D3=%0d D4=%0d D5=%0d D6=%0d D7=%0d D8=%0d D9=%0d D10=%0d D11=%0d D12=%0d D13=%0d D14=%0d", openpa_n[1], openpa_n[2], openpa_n[3], openpa_n[4], openpa_n[5], openpa_n[6], openpa_n[7], openpa_n[8], openpa_n[9], openpa_n[10], openpa_n[11], openpa_n[12], openpa_n[13], openpa_n[14]);
openpa_cover_report();
if (!UPF::openpa_armed) $display("OPENPA-WARNING no supply was driven (supply_on/supply_off never called): every domain stayed CORRUPT");
if (!openpa_SW_WEAK_def) $display("OPENPA-WARNING power switch SW_WEAK never reached a defined state");
if (!openpa_SW_MAIN_def) $display("OPENPA-WARNING power switch SW_MAIN never reached a defined state");
end
// verilator lint_on MULTIDRIVEN
`line 20 "radio.sv" 0
endmodule
`line 1 "acc.sv" 0
// 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
Check Yourself
Common Mistakes
Wrong Write create_supply_set a second time to add a function to a set.
A set that exists can be changed only with -update (IEEE 1801-2024 6.27.1). OpenPA refuses the second line.
Fix Write create_supply_set SS_RF -update -function {nwell VNW_N}.
Wrong Leave the ground function out of a domain's set.
Then the set no longer names the real ground. OpenPA warns that only power decides the domain's state.
Fix Give every set both a power and a ground function.
Wrong Use PD.default_isolation in a new 1801-2024 file.
IEEE 1801-2024 does not define that handle. Only some tools still read it.
Fix Name the set in the strategy with -isolation_supply or -retention_supply.
Remember
- A supply set groups the nets of one supply by function: power, ground, and the four bias functions.
- Every domain has a primary handle; -supply or associate_supply_set ties a set to it.
- A set that exists changes only with create_supply_set -update.
- Table D.1 replaces UPF 1.0 net forms with sets: associate_supply_set, -isolation_supply, -retention_supply.
- default_isolation and default_retention are UPF 2.0 handles; IEEE 1801-2024 does not define them.