Which Crossings Get Cells: -source, -sink, -diff_supply_only and Precedence
One output can feed receivers on different supplies. Select and resolve isolation separately for each path.
You Will Be Able To
- Filter paths by source supply, sink supply and supply differences.
- Resolve strategy overlap using granularity and option precedence.
- Read lower-boundary crossings and recognize unsupported port attributes.
- Lesson
- W4.8
- Time
- 30 min
- Runs on
- Your browser
- Check
- 5 questions
In fan_soc, u_src/q feeds three receivers: one always on, one on its own rail, one sharing the source rail. Each path needs its own decision.
- I/O
- Power
- Data
- Before strategies
The three receivers see one producer. Supply wiring alone adds no isolation.
- After selection
Each different-supply path gets its own isolation behavior. The same-supply path stays raw.
Read the diagram as text
- u_src/q: SRC supply
- u_a/d: AON supply
- u_b/d: B supply
- u_same/d: SRC supply
- CAMERA: clamp 0 / iso_a
- DSP: clamp 1 / iso_b
- u_src/q → u_a/d: raw
- u_src/q → u_b/d: raw
- u_src/q → u_same/d: same supply
- u_src/q → CAMERA: data
- CAMERA → u_a/d: isolated
- u_src/q → DSP: data
- DSP → u_b/d: isolated
Drawn from the measured crossing report. OpenPA rewrites per-sink branches; this is not physical placement.
Before
Crossings
u_b/q [PD_B] -> fan_soc output b [PD_TOP]: no isolation
u_same/q [PD_SAME] -> fan_soc output same [PD_TOP]: no isolation
u_src/q [PD_SRC] -> u_a/d [PD_TOP]: no isolation
u_src/q [PD_SRC] -> u_b/d [PD_B]: no isolation
u_src/q [PD_SRC] -> u_same/d [PD_SAME]: no isolation
fan_soc input d [PD_TOP] -> u_src/d [PD_SRC]: no isolation
No isolation strategies yet.
After
Crossings
u_b/q [PD_B] -> fan_soc output b [PD_TOP]: no isolation
u_same/q [PD_SAME] -> fan_soc output same [PD_TOP]: no isolation
u_src/q [PD_SRC] -> u_a/d [PD_TOP]: isolation CAMERA
u_src/q [PD_SRC] -> u_b/d [PD_B]: isolation DSP
u_src/q [PD_SRC] -> u_same/d [PD_SAME]: no isolation
fan_soc input d [PD_TOP] -> u_src/d [PD_SRC]: no isolation
Each receiving path has its own decision.
Recorded OpenPA 0.3.0 crossing reports.
Filter by -source and -sink
The B receiver needs its own clamp and control, so it needs its own rule.
The source filter names the driving supply, and the sink filter names the receiving supply. Both must match when both are specified (6.48).
A domain name in either filter means its primary supply. Supply sets and handles can identify the supplies directly.
| Driver | Receiver | Lab strategy | Why |
|---|---|---|---|
| SRC | AON | CAMERA | Source matches; the supplies differ |
| SRC | B | DSP | Source and sink match |
| SRC | SRC | LOCAL bypass | Direct same-supply bypass |
set_isolation CAMERA -domain PD_SRC -source SRC -diff_supply_only TRUE -applies_to outputs -clamp_value 0 -isolation_signal iso_a -isolation_supply AON -location fanout
set_isolation DSP -domain PD_SRC -source SRC -applies_to outputs -clamp_value 1 -isolation_signal iso_b -isolation_supply AON -location fanout
set_isolation DSP -domain PD_SRC -update -sink B
set_isolation LOCAL -domain PD_SRC -sink SRC -diff_supply_only FALSE -no_isolation
DSP matches only the B path. CAMERA matches it too, and a later section picks the winner.
The filters describe supplies, not current voltages. A one-volt switched rail and a one-volt always-on rail remain different supplies.
Practice W4.8.1 chooses filters for different output requirements.
Use -diff_supply_only
u_same shares SRC with the driver, so it sleeps whenever the source sleeps. A clamp there protects nothing.
-diff_supply_only TRUE excludes such same-supply paths. TRUE is the default; FALSE removes this restriction (6.48).
The comparison includes supply equivalence under the selected rule. OpenPA compares the power and ground nets; it does not implement set_equivalent.
The next recorded run removes the direct bypass and sets CAMERA to FALSE. Look at the u_same/d row: it now reads isolation CAMERA.
Crossings
u_b/q [PD_B] -> fan_soc output b [PD_TOP]: no isolation
u_same/q [PD_SAME] -> fan_soc output same [PD_TOP]: no isolation
u_src/q [PD_SRC] -> u_a/d [PD_TOP]: isolation CAMERA
u_src/q [PD_SRC] -> u_b/d [PD_B]: isolation CAMERA
u_src/q [PD_SRC] -> u_same/d [PD_SAME]: isolation CAMERA
fan_soc input d [PD_TOP] -> u_src/d [PD_SRC]: no isolationThe main lab keeps the same-supply path raw. Change d while both enables are high and watch same follow it.
Practice W4.8.1 rejects blanket isolation and checks the cell budget. A changed voltage alone must not decide where cells appear.
Keep Per-Sink Cells Separate
One shared cell on u_src/q looks simpler. But the AON and B paths need different control signals and clamp values.
live a=1 b=1 same=1
first a=0 b=1 same=1
both a=0 b=1 same=0
released a=1 b=1 same=1Read first: only iso_a is asserted, so a drops to 0 while b still passes 1.
Read both: both controls are asserted and d falls to 0. b holds its clamp of 1, while same follows d.
The extra domain, PD_SAME, shares SRC so the shared-supply crossing is visible.
Practice W4.8.1 uses separate controls and hidden data sequences to reject a shared-cell shortcut.
Resolve Granularity Before Options
On the SRC to B path, CAMERA and DSP both match. The tie-break must not depend on file order.
| Worked path | Candidates | Winner and reason |
|---|---|---|
| SRC to B | CAMERA: source SRC; DSP: source SRC and sink B | DSP: both filters beat one |
| SRC to AON | CAMERA matches; DSP fails its sink filter | CAMERA: only matching insertion strategy |
| SRC to SRC | LOCAL bypass matches; CAMERA and DSP fail filters | LOCAL: no cell |
IEEE 1801-2024 resolves isolation precedence in two stages (5.7.4). First compare how directly each strategy selects the port.
1. Granularity
Direct port bits rank above the whole port. A whole port ranks above an instance, then a domain-wide selection.
2. Options
At equal granularity, no_isolation ranks first. Then both supply filters, one supply filter, and finally neither filter.
3. Remaining tie
A remaining tie is an error. Reordering the file does not resolve it.
In the B row, both strategies are domain-wide, so stage 1 ties. Stage 2 picks DSP because it has both supply filters.
Crossings
u_b/q [PD_B] -> fan_soc output b [PD_TOP]: no isolation
u_same/q [PD_SAME] -> fan_soc output same [PD_TOP]: no isolation
u_src/q [PD_SRC] -> u_a/d [PD_TOP]: isolation CAMERA
u_src/q [PD_SRC] -> u_b/d [PD_B]: isolation DSP
u_src/q [PD_SRC] -> u_same/d [PD_SAME]: no isolation
fan_soc input d [PD_TOP] -> u_src/d [PD_SRC]: no isolationThe report agrees: u_b/d reads isolation DSP.
The older “closest ancestor wins” shorthand is not the isolation hierarchy in 2024. Use the direct granularity list in 5.7.4.
OpenPA follows direct-port, instance and domain-wide precedence here. This lesson does not exercise bit-select strategy insertion.
Practice W4.8.2 asks you to name the winner for five ports and repair an ambiguous selection.
Make a Direct Exception with -no_isolation
Sometimes a path must stay raw even where a broad rule would clamp it.
| Drawn before/after | SRC to AON | SRC to B |
|---|---|---|
| Before: CAMERA and DSP | CAMERA cell | DSP cell |
| After: add domain-wide BYPASS -no_isolation | No cell | No cell |
-no_isolation prevents insertion where its strategy wins. At equal granularity it outranks both source and sink filters (5.7.4).
set_isolation LOCAL -domain PD_SRC -sink SRC -diff_supply_only FALSE -no_isolationThe next run replaces LOCAL with a domain-wide output bypass without a sink filter. Every row of its report reads no isolation.
Crossings
u_b/q [PD_B] -> fan_soc output b [PD_TOP]: no isolation
u_same/q [PD_SAME] -> fan_soc output same [PD_TOP]: no isolation
u_src/q [PD_SRC] -> u_a/d [PD_TOP]: no isolation
u_src/q [PD_SRC] -> u_b/d [PD_B]: no isolation
u_src/q [PD_SRC] -> u_same/d [PD_SAME]: no isolation
fan_soc input d [PD_TOP] -> u_src/d [PD_SRC]: no isolationA more specific port strategy can still outrank a domain-wide bypass. Granularity is resolved before options.
Do not combine no_isolation with a location, enable or isolation supply. Those combinations are errors (6.48).
Practice W4.8.2 includes a direct-port bypass competing with another direct-port strategy.
Add Information with -update
DSP starts with only a source filter. A second command narrows it to sink B.
Before refinement
set_isolation DSP -domain PD_SRC -source SRC -clamp_value 1
Drawn selection: all sinks of SRC remain candidates.
After refinement
set_isolation DSP -domain PD_SRC -update -sink B
Drawn selection: only receivers powered by B remain.
-update adds information to an existing strategy in the same domain and scope. It is not a last-write-wins replacement (6.48).
set_isolation DSP -domain PD_SRC -update -sink BElement lists accumulate. An update naming a second port keeps the first port selected.
Crossings
u_tx/a [PD_TX] -> boundary_soc output a [PD_TOP]: isolation I
u_tx/b [PD_TX] -> boundary_soc output b [PD_TOP]: isolation I
u_tx/c [PD_TX] -> boundary_soc output c [PD_TOP]: no isolation
u_tx/spare [PD_TX] -> boundary_soc output spare [PD_TOP]: no isolation
u_tx/z [PD_TX] -> boundary_soc output z [PD_TOP]: no isolation
boundary_soc input d [PD_TOP] -> u_tx/d [PD_TX]: no isolationThe recorded example first selects u_tx/a, then adds u_tx/b. In the report, a and b read isolation I, while c, spare and z stay raw.
Practice W4.8.2 extends PAIR through an additive update. Removing the update loses one required port.
Diagnose Ambiguity
Two equally specific strategies may still select the same path. If option precedence cannot choose one, the file is ambiguous (6.48).
Here a second rule duplicates DSP’s source and sink selection. OpenPA refuses it:
Refused: answer.upf:30: port u_src/q is selected by 2 isolation strategies of equal precedence (DSP at answer.upf:27: domain-wide, -source and -sink; OTHER at answer.upf:30: domain-wide, -source and -sink); it is an error if precedence does not single out one strategy (IEEE 1801-2024 5.7.4, 5.7.10)The message names both rules and why they tie.
Fix the intended selection: remove an accidental overlap, or add a genuinely narrower port selection.
Changing the order hides no ambiguity. Giving both strategies the same clamp also leaves two equal-precedence strategies.
Practice W4.8.2 starts with a collision. Preserve the stated winning strategies while repairing it.
Read Lower-Boundary Crossings
So far each strategy looked out from a child. A parent domain surrounds its children, and its lower boundary lies at their ports.
| From the parent’s viewpoint | Child port | Parent filter |
|---|---|---|
| Data leaves the parent and enters the child | Child input | -applies_to outputs |
| Data leaves the child and enters the parent | Child output | -applies_to inputs |
This is why “outputs” cannot always be read as an RTL output declaration. Direction is relative to the strategy’s domain (6.48).
Crossings
u_tx/a [PD_TX] -> boundary_soc output a [PD_TOP]: no isolation
u_tx/b [PD_TX] -> boundary_soc output b [PD_TOP]: no isolation
u_tx/c [PD_TX] -> boundary_soc output c [PD_TOP]: no isolation
u_tx/spare [PD_TX] -> boundary_soc output spare [PD_TOP]: no isolation
u_tx/z [PD_TX] -> boundary_soc output z [PD_TOP]: no isolation
boundary_soc input d [PD_TOP] -> u_tx/d [PD_TX]: isolation IThe recorded run puts an output strategy on PD_TOP. Look at the last row: the path into u_tx/d, a child input, reads isolation I.
Use the domain boundary first, then read the port direction. A parent location request is invalid on that lower boundary.
Port Attributes: Drawn Fallback
A sink filter needs the receiver’s supply, but a hard macro hides the logic behind its pins. set_port_attributes can describe its hidden supplies at the terminal interface (6.51).
| Drawn command, not simulated | Meaning |
|---|---|
set_port_attributes -ports {macro/out} -driver_supply INTERNAL | The hidden output driver uses INTERNAL |
set_port_attributes -ports {macro/in} -receiver_supply AON | The hidden input receiver uses AON |
set_port_attributes -ports {macro/in} -clamp_value 0 | Any applicable isolation must satisfy that clamp requirement |
set_port_attributes -ports {macro/in macro/out} -feedthrough route | These ports share a feedthrough connection |
Before the annotation
The macro drawing hides the receiving logic. A reviewer cannot infer its supply from the outer domain alone.
After the annotation
The drawing labels the receiving supply AON. A supporting tool can use that supply when selecting a sink-filtered strategy.
Driver and receiver supply attributes apply at terminal or design-top boundaries. These supply annotations are ignored on ordinary hierarchical ports (6.51).
That boundary restriction does not apply to every port attribute. A clamp requirement constrains a strategy; it does not insert a cell.
set_port_attributes -ports {macro/in} -related_power_port VP -related_ground_port VG| Drawn before/after | Supply interpretation |
|---|---|
| Before: macro/in has no related-port annotation | Its hidden receiving supply is unspecified by this annotation |
| After: related power VP and ground VG | An implicit supply set uses the nets connected to VP and VG |
Specify related power and ground together. Related bias ports also require both, and their pg_type identifies each bias function (6.51).
Related ports describe internal logic: receiver supply on inputs, driver supply on outputs, and both on inouts.
OpenPA refuses set_port_attributes. The refusal below is real; the macro interpretation above is drawn, not an OpenPA result.
Refused: answer.upf:30: set_port_attributes is not supported (IEEE 1801-2024 6.51): port attributes (clamp value, driver and receiver supplies, feedthrough, ...) change isolation and corruptionPort attributes are not graded in these problems.
Version strip: this lesson uses the 2024 rules in 5.7.4, 6.48 and 6.51.
Try It
Run the lab. Compare each output row with its receiver path in the crossing report.
Change d while iso_a and iso_b are both active. Predict which output follows it.
Swap the order of enable changes in the bench. The two isolated branches respond separately.
Open the UPF source to locate the DSP update and LOCAL bypass. The generated map shows the resulting inserted cells.
OPENPA-INFO corruption=x seed=1 live a=1 b=1 same=1 first a=0 b=1 same=1 both a=0 b=1 same=0 released a=1 b=1 same=1 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 CAMERA: PD_SRC isolated before power-down 0 OPENPA-COVER sequence D2 CAMERA: isolation released only after PD_SRC was back 0 OPENPA-COVER sequence D1 DSP: PD_SRC isolated before power-down 0 OPENPA-COVER sequence D2 DSP: isolation released only after PD_SRC was back 0 OPENPA-COVER-SUMMARY states=0/0 declared_transitions=0/0 sequences=0/4Read the power intent: crossings.upf
upf_version 4.0
set_design_top fan_soc
create_power_domain PD_TOP -include_scope
create_power_domain PD_SRC -elements {u_src}
create_power_domain PD_B -elements {u_b}
create_power_domain PD_SAME -elements {u_same}
create_supply_port VA -direction in
create_supply_port VT -direction in
create_supply_port VB -direction in
create_supply_port VG -direction in
create_supply_net NA
create_supply_net NT
create_supply_net NB
create_supply_net NG
connect_supply_net NA -ports {VA}
connect_supply_net NT -ports {VT}
connect_supply_net NB -ports {VB}
connect_supply_net NG -ports {VG}
create_supply_set AON -function {power NA} -function {ground NG}
create_supply_set SRC -function {power NT} -function {ground NG}
create_supply_set B -function {power NB} -function {ground NG}
associate_supply_set AON -handle PD_TOP.primary
associate_supply_set SRC -handle PD_SRC.primary
associate_supply_set B -handle PD_B.primary
associate_supply_set SRC -handle PD_SAME.primary
set_isolation CAMERA -domain PD_SRC -source SRC -diff_supply_only TRUE -applies_to outputs -clamp_value 0 -isolation_signal iso_a -isolation_supply AON -location fanout
set_isolation DSP -domain PD_SRC -source SRC -applies_to outputs -clamp_value 1 -isolation_signal iso_b -isolation_supply AON -location fanout
set_isolation DSP -domain PD_SRC -update -sink B
set_isolation LOCAL -domain PD_SRC -sink SRC -diff_supply_only FALSE -no_isolation
Read the power-unaware RTL: fan.sv
module producer(input logic d, output wire q); assign q=d; endmodule
module receiver(input logic d, output wire q); assign q=d; endmodule
module fan_soc(input logic d, iso_a, iso_b, output wire a,b,same);
wire link;
producer u_src(.d(d),.q(link));
receiver u_a(.d(link),.q(a));
receiver u_b(.d(link),.q(b));
receiver u_same(.d(link),.q(same));
endmodule
What UPF added: 31 objects
4 supply port, 4 supply net, 4 output corruption, 2 isolation cell, 3 supply set, 14 dynamic check.
| Object | Where | Detail | Rule | UPF line |
|---|---|---|---|---|
| Supply port | VA | crossings.upf:7 | ||
| Supply port | VT | crossings.upf:8 | ||
| Supply port | VB | crossings.upf:9 | ||
| Supply port | VG | crossings.upf:10 | ||
| Supply net | NA | crossings.upf:7 | ||
| Supply net | NT | crossings.upf:8 | ||
| Supply net | NB | crossings.upf:9 | ||
| Supply net | NG | crossings.upf:10 | ||
| Output corruption | u_b/q | C2 | crossings.upf:5 | |
| Output corruption | u_same/q | C2 | crossings.upf:6 | |
| Output corruption | u_src/q | C2 | crossings.upf:4 | |
| Isolation cell | u_src/q | CAMERA · clamp 0 | I1-I5 | crossings.upf:26 |
| Isolation cell | u_src/q | DSP · clamp 1 | I1-I5 | crossings.upf:27 |
| Output corruption | u_src/d | C2 | crossings.upf:3 | |
| Supply set | AON | crossings.upf:19 | ||
| Supply set | SRC | crossings.upf:20 | ||
| Supply set | B | crossings.upf:21 | ||
| Dynamic check | D1/D2/D6 CAMERA | D1, D2, D6 | crossings.upf:26 | |
| Dynamic check | D1/D2/D6 DSP | D1, D2, D6 | crossings.upf:27 | |
| Dynamic check | D9 crossing 1 | D9 | crossings.upf:5 | |
| Dynamic check | D9 crossing 2 | D9 | crossings.upf:6 | |
| Dynamic check | D9 crossing 3 | D9 | crossings.upf:4 | |
| Dynamic check | D9 crossing 4 | D9 | crossings.upf:4 | |
| Dynamic check | D9 crossing 5 | D9 | crossings.upf:4 | |
| Dynamic check | D9 crossing 6 | D9 | crossings.upf:3 | |
| Dynamic check | D11 PD_B->PD_TOP | D11 | crossings.upf:5 | |
| Dynamic check | D11 PD_SAME->PD_TOP | D11 | crossings.upf:6 | |
| Dynamic check | D11 PD_SRC->PD_TOP | D11 | crossings.upf:4 | |
| Dynamic check | D11 PD_SRC->PD_B | D11 | crossings.upf:4 | |
| Dynamic check | D11 PD_SRC->PD_SAME | D11 | crossings.upf:4 | |
| Dynamic check | D11 PD_TOP->PD_SRC | D11 | crossings.upf:3 |
OpenPA warnings:
- D7 does not check PD_SRC for reset before isolation release: no asynchronous reset found on its registers
- 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_fan_soc.sv
// pa_fan_soc.sv: power-aware copy of fan_soc, generated by OpenPA from crossings.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_VA; // supply port VA (crossings.upf:7)
supply_net_type openpa_port_VT; // supply port VT (crossings.upf:8)
supply_net_type openpa_port_VB; // supply port VB (crossings.upf:9)
supply_net_type openpa_port_VG; // supply port VG (crossings.upf:10)
supply_net_type openpa_net_NA; // supply net NA
supply_net_type openpa_net_NT; // supply net NT
supply_net_type openpa_net_NB; // supply net NB
supply_net_type openpa_net_NG; // supply net NG
bit openpa_ss_AON_ok; int unsigned openpa_ss_AON_ep; int openpa_ss_AON_st = -1; bit openpa_ss_AON_multi; int openpa_ss_AON_sim = 5; // supply set AON
bit openpa_ss_SRC_ok; int unsigned openpa_ss_SRC_ep; int openpa_ss_SRC_st = -1; bit openpa_ss_SRC_multi; int openpa_ss_SRC_sim = 5; // supply set SRC
bit openpa_ss_B_ok; int unsigned openpa_ss_B_ep; int openpa_ss_B_st = -1; bit openpa_ss_B_multi; int openpa_ss_B_sim = 5; // supply set B
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 (crossings.upf:3)
bit openpa_dom_PD_SRC_ok; int unsigned openpa_dom_PD_SRC_ep; int openpa_dom_PD_SRC_sim = 5; // power domain PD_SRC: ok = powered (simstate not CORRUPT); sim = simstate code (crossings.upf:4)
bit openpa_dom_PD_B_ok; int unsigned openpa_dom_PD_B_ep; int openpa_dom_PD_B_sim = 5; // power domain PD_B: ok = powered (simstate not CORRUPT); sim = simstate code (crossings.upf:5)
bit openpa_dom_PD_SAME_ok; int unsigned openpa_dom_PD_SAME_ep; int openpa_dom_PD_SAME_sim = 5; // power domain PD_SAME: ok = powered (simstate not CORRUPT); sim = simstate code (crossings.upf:6)
// 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_iso_a; // copy of iso_a (isolation CAMERA)
logic openpa_ctl_1_iso_b; // copy of iso_b (isolation DSP)
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 == "VA") begin openpa_port_VA.state = FULL_ON; openpa_port_VA.voltage = openpa_uv(value); return 1; end
if (pad_name == "VT") begin openpa_port_VT.state = FULL_ON; openpa_port_VT.voltage = openpa_uv(value); return 1; end
if (pad_name == "VB") begin openpa_port_VB.state = FULL_ON; openpa_port_VB.voltage = openpa_uv(value); return 1; end
if (pad_name == "VG") begin openpa_port_VG.state = FULL_ON; openpa_port_VG.voltage = openpa_uv(value); return 1; end
if (pad_name == "NA") begin $display("OPENPA-ERROR supply_on(\"%s\"): NA already has a driver (port VA); drive its root supply instead", pad_name); return 0; end
if (pad_name == "AON.power") begin $display("OPENPA-ERROR supply_on(\"%s\"): AON.power already has a driver (port VA); 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 VA); drive its root supply instead", pad_name); return 0; end
if (pad_name == "NT") begin $display("OPENPA-ERROR supply_on(\"%s\"): NT already has a driver (port VT); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SRC.power") begin $display("OPENPA-ERROR supply_on(\"%s\"): SRC.power already has a driver (port VT); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_SRC.primary.power") begin $display("OPENPA-ERROR supply_on(\"%s\"): PD_SRC.primary.power already has a driver (port VT); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_SAME.primary.power") begin $display("OPENPA-ERROR supply_on(\"%s\"): PD_SAME.primary.power already has a driver (port VT); drive its root supply instead", pad_name); return 0; end
if (pad_name == "NB") begin $display("OPENPA-ERROR supply_on(\"%s\"): NB already has a driver (port VB); drive its root supply instead", pad_name); return 0; end
if (pad_name == "B.power") begin $display("OPENPA-ERROR supply_on(\"%s\"): B.power already has a driver (port VB); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_B.primary.power") begin $display("OPENPA-ERROR supply_on(\"%s\"): PD_B.primary.power already has a driver (port VB); drive its root supply instead", pad_name); return 0; end
if (pad_name == "NG") begin $display("OPENPA-ERROR supply_on(\"%s\"): NG already has a driver (port VG); drive its root supply instead", pad_name); return 0; end
if (pad_name == "AON.ground") begin $display("OPENPA-ERROR supply_on(\"%s\"): AON.ground already has a driver (port VG); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SRC.ground") begin $display("OPENPA-ERROR supply_on(\"%s\"): SRC.ground already has a driver (port VG); drive its root supply instead", pad_name); return 0; end
if (pad_name == "B.ground") begin $display("OPENPA-ERROR supply_on(\"%s\"): B.ground already has a driver (port VG); 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 VG); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_SRC.primary.ground") begin $display("OPENPA-ERROR supply_on(\"%s\"): PD_SRC.primary.ground already has a driver (port VG); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_B.primary.ground") begin $display("OPENPA-ERROR supply_on(\"%s\"): PD_B.primary.ground already has a driver (port VG); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_SAME.primary.ground") begin $display("OPENPA-ERROR supply_on(\"%s\"): PD_SAME.primary.ground already has a driver (port VG); 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: VA VT VB VG)", 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 == "VA") begin openpa_port_VA.state = OFF; return 1; end
if (pad_name == "VT") begin openpa_port_VT.state = OFF; return 1; end
if (pad_name == "VB") begin openpa_port_VB.state = OFF; return 1; end
if (pad_name == "VG") begin openpa_port_VG.state = OFF; return 1; end
if (pad_name == "NA") begin $display("OPENPA-ERROR supply_off(\"%s\"): NA already has a driver (port VA); drive its root supply instead", pad_name); return 0; end
if (pad_name == "AON.power") begin $display("OPENPA-ERROR supply_off(\"%s\"): AON.power already has a driver (port VA); 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 VA); drive its root supply instead", pad_name); return 0; end
if (pad_name == "NT") begin $display("OPENPA-ERROR supply_off(\"%s\"): NT already has a driver (port VT); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SRC.power") begin $display("OPENPA-ERROR supply_off(\"%s\"): SRC.power already has a driver (port VT); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_SRC.primary.power") begin $display("OPENPA-ERROR supply_off(\"%s\"): PD_SRC.primary.power already has a driver (port VT); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_SAME.primary.power") begin $display("OPENPA-ERROR supply_off(\"%s\"): PD_SAME.primary.power already has a driver (port VT); drive its root supply instead", pad_name); return 0; end
if (pad_name == "NB") begin $display("OPENPA-ERROR supply_off(\"%s\"): NB already has a driver (port VB); drive its root supply instead", pad_name); return 0; end
if (pad_name == "B.power") begin $display("OPENPA-ERROR supply_off(\"%s\"): B.power already has a driver (port VB); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_B.primary.power") begin $display("OPENPA-ERROR supply_off(\"%s\"): PD_B.primary.power already has a driver (port VB); drive its root supply instead", pad_name); return 0; end
if (pad_name == "NG") begin $display("OPENPA-ERROR supply_off(\"%s\"): NG already has a driver (port VG); drive its root supply instead", pad_name); return 0; end
if (pad_name == "AON.ground") begin $display("OPENPA-ERROR supply_off(\"%s\"): AON.ground already has a driver (port VG); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SRC.ground") begin $display("OPENPA-ERROR supply_off(\"%s\"): SRC.ground already has a driver (port VG); drive its root supply instead", pad_name); return 0; end
if (pad_name == "B.ground") begin $display("OPENPA-ERROR supply_off(\"%s\"): B.ground already has a driver (port VG); 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 VG); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_SRC.primary.ground") begin $display("OPENPA-ERROR supply_off(\"%s\"): PD_SRC.primary.ground already has a driver (port VG); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_B.primary.ground") begin $display("OPENPA-ERROR supply_off(\"%s\"): PD_B.primary.ground already has a driver (port VG); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_SAME.primary.ground") begin $display("OPENPA-ERROR supply_off(\"%s\"): PD_SAME.primary.ground already has a driver (port VG); 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: VA VT VB VG)", 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 == "VA") begin openpa_port_VA.state = PARTIAL_ON; openpa_port_VA.voltage = openpa_uv(value); return 1; end
if (pad_name == "VT") begin openpa_port_VT.state = PARTIAL_ON; openpa_port_VT.voltage = openpa_uv(value); return 1; end
if (pad_name == "VB") begin openpa_port_VB.state = PARTIAL_ON; openpa_port_VB.voltage = openpa_uv(value); return 1; end
if (pad_name == "VG") begin openpa_port_VG.state = PARTIAL_ON; openpa_port_VG.voltage = openpa_uv(value); return 1; end
if (pad_name == "NA") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): NA already has a driver (port VA); drive its root supply instead", pad_name); return 0; end
if (pad_name == "AON.power") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): AON.power already has a driver (port VA); 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 VA); drive its root supply instead", pad_name); return 0; end
if (pad_name == "NT") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): NT already has a driver (port VT); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SRC.power") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): SRC.power already has a driver (port VT); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_SRC.primary.power") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): PD_SRC.primary.power already has a driver (port VT); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_SAME.primary.power") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): PD_SAME.primary.power already has a driver (port VT); drive its root supply instead", pad_name); return 0; end
if (pad_name == "NB") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): NB already has a driver (port VB); drive its root supply instead", pad_name); return 0; end
if (pad_name == "B.power") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): B.power already has a driver (port VB); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_B.primary.power") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): PD_B.primary.power already has a driver (port VB); drive its root supply instead", pad_name); return 0; end
if (pad_name == "NG") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): NG already has a driver (port VG); drive its root supply instead", pad_name); return 0; end
if (pad_name == "AON.ground") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): AON.ground already has a driver (port VG); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SRC.ground") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): SRC.ground already has a driver (port VG); drive its root supply instead", pad_name); return 0; end
if (pad_name == "B.ground") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): B.ground already has a driver (port VG); 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 VG); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_SRC.primary.ground") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): PD_SRC.primary.ground already has a driver (port VG); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_B.primary.ground") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): PD_B.primary.ground already has a driver (port VG); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_SAME.primary.ground") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): PD_SAME.primary.ground already has a driver (port VG); 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: VA VT VB VG)", 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 == "VA") begin openpa_port_VA.state = supply_state; return 1; end
if (pad_name == "VT") begin openpa_port_VT.state = supply_state; return 1; end
if (pad_name == "VB") begin openpa_port_VB.state = supply_state; return 1; end
if (pad_name == "VG") begin openpa_port_VG.state = supply_state; return 1; end
if (pad_name == "NA") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): NA already has a driver (port VA); drive its root supply instead", pad_name); return 0; end
if (pad_name == "AON.power") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): AON.power already has a driver (port VA); 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 VA); drive its root supply instead", pad_name); return 0; end
if (pad_name == "NT") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): NT already has a driver (port VT); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SRC.power") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): SRC.power already has a driver (port VT); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_SRC.primary.power") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): PD_SRC.primary.power already has a driver (port VT); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_SAME.primary.power") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): PD_SAME.primary.power already has a driver (port VT); drive its root supply instead", pad_name); return 0; end
if (pad_name == "NB") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): NB already has a driver (port VB); drive its root supply instead", pad_name); return 0; end
if (pad_name == "B.power") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): B.power already has a driver (port VB); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_B.primary.power") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): PD_B.primary.power already has a driver (port VB); drive its root supply instead", pad_name); return 0; end
if (pad_name == "NG") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): NG already has a driver (port VG); drive its root supply instead", pad_name); return 0; end
if (pad_name == "AON.ground") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): AON.ground already has a driver (port VG); drive its root supply instead", pad_name); return 0; end
if (pad_name == "SRC.ground") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): SRC.ground already has a driver (port VG); drive its root supply instead", pad_name); return 0; end
if (pad_name == "B.ground") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): B.ground already has a driver (port VG); 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 VG); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_SRC.primary.ground") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): PD_SRC.primary.ground already has a driver (port VG); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_B.primary.ground") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): PD_B.primary.ground already has a driver (port VG); drive its root supply instead", pad_name); return 0; end
if (pad_name == "PD_SAME.primary.ground") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): PD_SAME.primary.ground already has a driver (port VG); 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: VA VT VB VG)", 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 == "VA" || name == "NA" || name == "AON.power" || name == "PD_TOP.primary.power") return openpa_net_NA;
if (name == "VT" || name == "NT" || name == "SRC.power" || name == "PD_SRC.primary.power" || name == "PD_SAME.primary.power") return openpa_net_NT;
if (name == "VB" || name == "NB" || name == "B.power" || name == "PD_B.primary.power") return openpa_net_NB;
if (name == "VG" || name == "NG" || name == "AON.ground" || name == "SRC.ground" || name == "B.ground" || name == "PD_TOP.primary.ground" || name == "PD_SRC.primary.ground" || name == "PD_B.primary.ground" || name == "PD_SAME.primary.ground") return openpa_net_NG;
$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 "fan.sv" 0
module producer(input logic d, output wire q); assign q=d; endmodule
module receiver(input logic d, output wire q); assign q=d; endmodule
module fan_soc(input logic d, iso_a, iso_b, output wire a,b,same);
wire link;
wire [0:0] openpa_u_src_q_raw, openpa_u_src_q_s1; wire [0:0] openpa_u_src_q_b1_s1; wire [0:0] openpa_u_src_d_s1; producer u_src(.d(openpa_u_src_d_s1),.q(openpa_u_src_q_raw)); openpa_corrupt #(.W(1), .ID(268435472)) openpa_u_src_q_cor (.d(openpa_u_src_q_raw), .q(openpa_u_src_q_s1), .ok(UPF::openpa_dom_PD_SRC_ok), .ep(UPF::openpa_dom_PD_SRC_ep)); openpa_iso #(.W(1), .CLAMP(0), .SENSE(1'b1), .ID(268435473)) openpa_u_src_q_iso (.d(openpa_u_src_q_s1), .q(link), .en(UPF::openpa_ctl_0_iso_a), .sup_ok((UPF::openpa_ss_AON_sim == 0)), .sup_ep(UPF::openpa_ss_AON_ep)); openpa_iso #(.W(1), .CLAMP(1), .SENSE(1'b1), .ID(268435480)) openpa_u_src_q_b1_iso (.d(openpa_u_src_q_s1), .q(openpa_u_src_q_b1_s1), .en(UPF::openpa_ctl_1_iso_b), .sup_ok((UPF::openpa_ss_AON_sim == 0)), .sup_ep(UPF::openpa_ss_AON_ep)); openpa_corrupt #(.W(1), .ID(268435496)) openpa_u_src_d_cor (.d(d), .q(openpa_u_src_d_s1), .ok(UPF::openpa_dom_PD_TOP_ok), .ep(UPF::openpa_dom_PD_TOP_ep));
receiver u_a(.d(link),.q(a));
wire [0:0] openpa_u_b_q_raw; receiver u_b(.d(openpa_u_src_q_b1_s1),.q(openpa_u_b_q_raw)); openpa_corrupt #(.W(1), .ID(268435456)) openpa_u_b_q_cor (.d(openpa_u_b_q_raw), .q(b), .ok(UPF::openpa_dom_PD_B_ok), .ep(UPF::openpa_dom_PD_B_ep));
wire [0:0] openpa_u_same_q_raw; receiver u_same(.d(openpa_u_src_q_s1),.q(openpa_u_same_q_raw)); openpa_corrupt #(.W(1), .ID(268435464)) openpa_u_same_q_cor (.d(openpa_u_same_q_raw), .q(same), .ok(UPF::openpa_dom_PD_SAME_ok), .ep(UPF::openpa_dom_PD_SAME_ep));
`line 1 "openpa_overlay.sv" 0
// ===================================================================================
// OpenPA overlay for fan_soc: generated from crossings.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_iso_a;
import UPF::openpa_ctl_1_iso_b;
import UPF::openpa_dom_PD_B_ep;
import UPF::openpa_dom_PD_B_ok;
import UPF::openpa_dom_PD_B_sim;
import UPF::openpa_dom_PD_SAME_ep;
import UPF::openpa_dom_PD_SAME_ok;
import UPF::openpa_dom_PD_SAME_sim;
import UPF::openpa_dom_PD_SRC_ep;
import UPF::openpa_dom_PD_SRC_ok;
import UPF::openpa_dom_PD_SRC_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_NA;
import UPF::openpa_net_NB;
import UPF::openpa_net_NG;
import UPF::openpa_net_NT;
import UPF::openpa_seed;
import UPF::openpa_ss_AON_ep;
import UPF::openpa_ss_AON_multi;
import UPF::openpa_ss_AON_ok;
import UPF::openpa_ss_AON_sim;
import UPF::openpa_ss_AON_st;
import UPF::openpa_ss_B_ep;
import UPF::openpa_ss_B_multi;
import UPF::openpa_ss_B_ok;
import UPF::openpa_ss_B_sim;
import UPF::openpa_ss_B_st;
import UPF::openpa_ss_SRC_ep;
import UPF::openpa_ss_SRC_multi;
import UPF::openpa_ss_SRC_ok;
import UPF::openpa_ss_SRC_sim;
import UPF::openpa_ss_SRC_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:20]; // 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 @(iso_a or openpa_kick) openpa_ctl_0_iso_a = iso_a;
always @(iso_b or openpa_kick) openpa_ctl_1_iso_b = iso_b;
// ---- supply network, switches, supply sets, simstates, power states (one block, evaluated in order)
always @(openpa_kick or UPF::openpa_port_VA or UPF::openpa_port_VT or UPF::openpa_port_VB or UPF::openpa_port_VG) begin : openpa_network
openpa_net_NA = UPF::openpa_port_VA; // NA <- port VA
openpa_net_NT = UPF::openpa_port_VT; // NT <- port VT
openpa_net_NB = UPF::openpa_port_VB; // NB <- port VB
openpa_net_NG = UPF::openpa_port_VG; // NG <- port VG
// supply set 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_AON
bit nx; int sm;
sm = (UPF::openpa_net_NA.state == UPF::FULL_ON && UPF::openpa_net_NG.state == UPF::FULL_ON) ? 0 : 5; // predefined ON (NORMAL) or OFF (CORRUPT), IEEE 1801-2024 4.7.4
openpa_ss_AON_sim = sm;
nx = sm < 5;
if (openpa_ss_AON_ok && !nx) openpa_ss_AON_ep = openpa_ss_AON_ep + 1;
openpa_ss_AON_ok = nx;
end
// supply set SRC (also PD_SRC.primary, PD_SAME.primary): IEEE 1801-2024 4.7.3, 4.7.4, 6.5.6, 9.3.2, 5.7.8
begin : openpa_ss_SRC
bit nx; int sm;
sm = (UPF::openpa_net_NT.state == UPF::FULL_ON && UPF::openpa_net_NG.state == UPF::FULL_ON) ? 0 : 5; // predefined ON (NORMAL) or OFF (CORRUPT), IEEE 1801-2024 4.7.4
openpa_ss_SRC_sim = sm;
nx = sm < 5;
if (openpa_ss_SRC_ok && !nx) openpa_ss_SRC_ep = openpa_ss_SRC_ep + 1;
openpa_ss_SRC_ok = nx;
end
// supply set B (also PD_B.primary): IEEE 1801-2024 4.7.3, 4.7.4, 6.5.6, 9.3.2, 5.7.8
begin : openpa_ss_B
bit nx; int sm;
sm = (UPF::openpa_net_NB.state == UPF::FULL_ON && UPF::openpa_net_NG.state == UPF::FULL_ON) ? 0 : 5; // predefined ON (NORMAL) or OFF (CORRUPT), IEEE 1801-2024 4.7.4
openpa_ss_B_sim = sm;
nx = sm < 5;
if (openpa_ss_B_ok && !nx) openpa_ss_B_ep = openpa_ss_B_ep + 1;
openpa_ss_B_ok = nx;
end
// domain PD_TOP: simstate of its primary supply set AON
if (openpa_dom_PD_TOP_ok && !UPF::openpa_ss_AON_ok) openpa_dom_PD_TOP_ep = openpa_dom_PD_TOP_ep + 1;
openpa_dom_PD_TOP_ok = UPF::openpa_ss_AON_ok;
openpa_dom_PD_TOP_sim = openpa_ss_AON_sim;
// domain PD_SRC: simstate of its primary supply set SRC
if (openpa_dom_PD_SRC_ok && !UPF::openpa_ss_SRC_ok) openpa_dom_PD_SRC_ep = openpa_dom_PD_SRC_ep + 1;
openpa_dom_PD_SRC_ok = UPF::openpa_ss_SRC_ok;
openpa_dom_PD_SRC_sim = openpa_ss_SRC_sim;
// domain PD_B: simstate of its primary supply set B
if (openpa_dom_PD_B_ok && !UPF::openpa_ss_B_ok) openpa_dom_PD_B_ep = openpa_dom_PD_B_ep + 1;
openpa_dom_PD_B_ok = UPF::openpa_ss_B_ok;
openpa_dom_PD_B_sim = openpa_ss_B_sim;
// domain PD_SAME: simstate of its primary supply set SRC
if (openpa_dom_PD_SAME_ok && !UPF::openpa_ss_SRC_ok) openpa_dom_PD_SAME_ep = openpa_dom_PD_SAME_ep + 1;
openpa_dom_PD_SAME_ok = UPF::openpa_ss_SRC_ok;
openpa_dom_PD_SAME_sim = openpa_ss_SRC_sim;
end
// ---- corruption: registers forced, memories overwritten (rules C1, C3)
// domain PD_TOP (crossings.upf:3): 0 register(s), 0 memory(ies)
bit openpa_PD_TOP_applied, openpa_PD_TOP_valid;
// 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
end
if (UPF::openpa_dom_PD_TOP_ok) begin
end
openpa_PD_TOP_valid = 1'b1; openpa_PD_TOP_applied = UPF::openpa_dom_PD_TOP_ok;
end
// domain PD_SRC (crossings.upf:4): 0 register(s), 0 memory(ies)
bit openpa_PD_SRC_applied, openpa_PD_SRC_valid;
// 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_SRC_ok or openpa_kick) if (!openpa_PD_SRC_valid || openpa_PD_SRC_applied != UPF::openpa_dom_PD_SRC_ok) begin
openpa_t({"PD_SRC ", UPF::openpa_dom_PD_SRC_ok ? "NORMAL" : "CORRUPT"});
if (!UPF::openpa_dom_PD_SRC_ok || !openpa_PD_SRC_valid) begin
end
if (UPF::openpa_dom_PD_SRC_ok) begin
end
openpa_PD_SRC_valid = 1'b1; openpa_PD_SRC_applied = UPF::openpa_dom_PD_SRC_ok;
end
// domain PD_B (crossings.upf:5): 0 register(s), 0 memory(ies)
bit openpa_PD_B_applied, openpa_PD_B_valid;
// 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_B_ok or openpa_kick) if (!openpa_PD_B_valid || openpa_PD_B_applied != UPF::openpa_dom_PD_B_ok) begin
openpa_t({"PD_B ", UPF::openpa_dom_PD_B_ok ? "NORMAL" : "CORRUPT"});
if (!UPF::openpa_dom_PD_B_ok || !openpa_PD_B_valid) begin
end
if (UPF::openpa_dom_PD_B_ok) begin
end
openpa_PD_B_valid = 1'b1; openpa_PD_B_applied = UPF::openpa_dom_PD_B_ok;
end
// domain PD_SAME (crossings.upf:6): 0 register(s), 0 memory(ies)
bit openpa_PD_SAME_applied, openpa_PD_SAME_valid;
// 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_SAME_ok or openpa_kick) if (!openpa_PD_SAME_valid || openpa_PD_SAME_applied != UPF::openpa_dom_PD_SAME_ok) begin
openpa_t({"PD_SAME ", UPF::openpa_dom_PD_SAME_ok ? "NORMAL" : "CORRUPT"});
if (!UPF::openpa_dom_PD_SAME_ok || !openpa_PD_SAME_valid) begin
end
if (UPF::openpa_dom_PD_SAME_ok) begin
end
openpa_PD_SAME_valid = 1'b1; openpa_PD_SAME_applied = UPF::openpa_dom_PD_SAME_ok;
end
// ---- checks for set_isolation CAMERA (crossings.upf:26): PD_SRC -> PD_TOP on 1 port(s)
bit openpa_ig1_act, openpa_ig1_cyc;
always @(negedge UPF::openpa_dom_PD_SRC_ok) if (!UPF::openpa_dom_PD_SRC_ok)
begin openpa_sp[1] = 1'b1; openpa_sreq = 1'b1; end
always @(posedge UPF::openpa_ctl_0_iso_a or negedge UPF::openpa_ctl_0_iso_a or posedge openpa_kick) begin
if (openpa_ig1_act && !(UPF::openpa_ctl_0_iso_a === 1'b1))
begin openpa_sp[2] = 1'b1; openpa_sreq = 1'b1; end
if (openpa_ig1_act != (UPF::openpa_ctl_0_iso_a === 1'b1)) openpa_t({"CAMERA enable ", (UPF::openpa_ctl_0_iso_a === 1'b1) ? "active" : "inactive"});
openpa_ig1_act = (UPF::openpa_ctl_0_iso_a === 1'b1);
end
always @(negedge UPF::openpa_ss_AON_ok) if (!UPF::openpa_ss_AON_ok)
begin openpa_sp[3] = 1'b1; openpa_sreq = 1'b1; end
// ---- checks for set_isolation DSP (crossings.upf:27): PD_SRC -> PD_B on 1 port(s)
bit openpa_ig2_act, openpa_ig2_cyc;
always @(negedge UPF::openpa_dom_PD_SRC_ok) if (!UPF::openpa_dom_PD_SRC_ok)
begin openpa_sp[4] = 1'b1; openpa_sreq = 1'b1; end
always @(posedge UPF::openpa_ctl_1_iso_b or negedge UPF::openpa_ctl_1_iso_b or posedge openpa_kick) begin
if (openpa_ig2_act && !(UPF::openpa_ctl_1_iso_b === 1'b1))
begin openpa_sp[5] = 1'b1; openpa_sreq = 1'b1; end
if (openpa_ig2_act != (UPF::openpa_ctl_1_iso_b === 1'b1)) openpa_t({"DSP enable ", (UPF::openpa_ctl_1_iso_b === 1'b1) ? "active" : "inactive"});
openpa_ig2_act = (UPF::openpa_ctl_1_iso_b === 1'b1);
end
always @(negedge UPF::openpa_ss_AON_ok) if (!UPF::openpa_ss_AON_ok)
begin openpa_sp[6] = 1'b1; openpa_sreq = 1'b1; end
// crossing 1: u_b/q (PD_B) -> fan_soc output b (PD_TOP), not isolated
bit openpa_x1_t;
always @(UPF::openpa_dom_PD_B_ok or UPF::openpa_dom_PD_TOP_ok or UPF::openpa_net_NB or UPF::openpa_net_NG) openpa_x1_t = !UPF::openpa_dom_PD_B_ok && UPF::openpa_dom_PD_TOP_ok && !(1'b0) && !(UPF::openpa_net_NB.state == UPF::UNDETERMINED || UPF::openpa_net_NG.state == UPF::UNDETERMINED);
always @(posedge openpa_x1_t)
begin openpa_sp[7] = 1'b1; openpa_sreq = 1'b1; end
// crossing 2: u_same/q (PD_SAME) -> fan_soc output same (PD_TOP), not isolated
bit openpa_x2_t;
always @(UPF::openpa_dom_PD_SAME_ok or UPF::openpa_dom_PD_TOP_ok or UPF::openpa_net_NT or UPF::openpa_net_NG) openpa_x2_t = !UPF::openpa_dom_PD_SAME_ok && UPF::openpa_dom_PD_TOP_ok && !(1'b0) && !(UPF::openpa_net_NT.state == UPF::UNDETERMINED || UPF::openpa_net_NG.state == UPF::UNDETERMINED);
always @(posedge openpa_x2_t)
begin openpa_sp[8] = 1'b1; openpa_sreq = 1'b1; end
// crossing 3: u_src/q (PD_SRC) -> u_a/d (PD_TOP), isolated by CAMERA
bit openpa_x3_t;
always @(UPF::openpa_dom_PD_SRC_ok or UPF::openpa_dom_PD_TOP_ok or UPF::openpa_ctl_0_iso_a or UPF::openpa_ss_AON_sim or UPF::openpa_net_NT or UPF::openpa_net_NG) openpa_x3_t = !UPF::openpa_dom_PD_SRC_ok && UPF::openpa_dom_PD_TOP_ok && !(((UPF::openpa_ctl_0_iso_a === 1'b1) && (UPF::openpa_ss_AON_sim == 0))) && !(UPF::openpa_net_NT.state == UPF::UNDETERMINED || UPF::openpa_net_NG.state == UPF::UNDETERMINED);
always @(posedge openpa_x3_t)
begin openpa_sp[9] = 1'b1; openpa_sreq = 1'b1; end
// crossing 4: u_src/q (PD_SRC) -> u_b/d (PD_B), isolated by DSP
bit openpa_x4_t;
always @(UPF::openpa_dom_PD_SRC_ok or UPF::openpa_dom_PD_B_ok or UPF::openpa_ctl_1_iso_b or UPF::openpa_ss_AON_sim or UPF::openpa_net_NT or UPF::openpa_net_NG) openpa_x4_t = !UPF::openpa_dom_PD_SRC_ok && UPF::openpa_dom_PD_B_ok && !(((UPF::openpa_ctl_1_iso_b === 1'b1) && (UPF::openpa_ss_AON_sim == 0))) && !(UPF::openpa_net_NT.state == UPF::UNDETERMINED || UPF::openpa_net_NG.state == UPF::UNDETERMINED);
always @(posedge openpa_x4_t)
begin openpa_sp[10] = 1'b1; openpa_sreq = 1'b1; end
// crossing 5: u_src/q (PD_SRC) -> u_same/d (PD_SAME), not isolated
bit openpa_x5_t;
always @(UPF::openpa_dom_PD_SRC_ok or UPF::openpa_dom_PD_SAME_ok or UPF::openpa_net_NT or UPF::openpa_net_NG) openpa_x5_t = !UPF::openpa_dom_PD_SRC_ok && UPF::openpa_dom_PD_SAME_ok && !(1'b0) && !(UPF::openpa_net_NT.state == UPF::UNDETERMINED || UPF::openpa_net_NG.state == UPF::UNDETERMINED);
always @(posedge openpa_x5_t)
begin openpa_sp[11] = 1'b1; openpa_sreq = 1'b1; end
// crossing 6: fan_soc input d (PD_TOP) -> u_src/d (PD_SRC), not isolated
bit openpa_x6_t;
always @(UPF::openpa_dom_PD_TOP_ok or UPF::openpa_dom_PD_SRC_ok or UPF::openpa_net_NA or UPF::openpa_net_NG) openpa_x6_t = !UPF::openpa_dom_PD_TOP_ok && UPF::openpa_dom_PD_SRC_ok && !(1'b0) && !(UPF::openpa_net_NA.state == UPF::UNDETERMINED || UPF::openpa_net_NG.state == UPF::UNDETERMINED);
always @(posedge openpa_x6_t)
begin openpa_sp[12] = 1'b1; openpa_sreq = 1'b1; end
// level shifter check 1: PD_B -> PD_TOP (no level shifter strategy, threshold 0)
bit openpa_l1_t;
always @(UPF::openpa_dom_PD_B_ok or UPF::openpa_dom_PD_TOP_ok or UPF::openpa_net_NB or UPF::openpa_net_NA) openpa_l1_t = UPF::openpa_dom_PD_B_ok && UPF::openpa_dom_PD_TOP_ok && (UPF::openpa_net_NB.voltage - UPF::openpa_net_NA.voltage > 0 || UPF::openpa_net_NA.voltage - UPF::openpa_net_NB.voltage > 0) && !1'b0;
always @(posedge openpa_l1_t)
begin openpa_sp[13] = 1'b1; openpa_sreq = 1'b1; end
// level shifter check 2: PD_SAME -> PD_TOP (no level shifter strategy, threshold 0)
bit openpa_l2_t;
always @(UPF::openpa_dom_PD_SAME_ok or UPF::openpa_dom_PD_TOP_ok or UPF::openpa_net_NT or UPF::openpa_net_NA) openpa_l2_t = UPF::openpa_dom_PD_SAME_ok && UPF::openpa_dom_PD_TOP_ok && (UPF::openpa_net_NT.voltage - UPF::openpa_net_NA.voltage > 0 || UPF::openpa_net_NA.voltage - UPF::openpa_net_NT.voltage > 0) && !1'b0;
always @(posedge openpa_l2_t)
begin openpa_sp[14] = 1'b1; openpa_sreq = 1'b1; end
// level shifter check 3: PD_SRC -> PD_TOP (no level shifter strategy, threshold 0)
bit openpa_l3_t;
always @(UPF::openpa_dom_PD_SRC_ok or UPF::openpa_dom_PD_TOP_ok or UPF::openpa_net_NT or UPF::openpa_net_NA) openpa_l3_t = UPF::openpa_dom_PD_SRC_ok && UPF::openpa_dom_PD_TOP_ok && (UPF::openpa_net_NT.voltage - UPF::openpa_net_NA.voltage > 0 || UPF::openpa_net_NA.voltage - UPF::openpa_net_NT.voltage > 0) && !1'b0;
always @(posedge openpa_l3_t)
begin openpa_sp[15] = 1'b1; openpa_sreq = 1'b1; end
// level shifter check 4: PD_SRC -> PD_B (no level shifter strategy, threshold 0)
bit openpa_l4_t;
always @(UPF::openpa_dom_PD_SRC_ok or UPF::openpa_dom_PD_B_ok or UPF::openpa_net_NT or UPF::openpa_net_NB) openpa_l4_t = UPF::openpa_dom_PD_SRC_ok && UPF::openpa_dom_PD_B_ok && (UPF::openpa_net_NT.voltage - UPF::openpa_net_NB.voltage > 0 || UPF::openpa_net_NB.voltage - UPF::openpa_net_NT.voltage > 0) && !1'b0;
always @(posedge openpa_l4_t)
begin openpa_sp[16] = 1'b1; openpa_sreq = 1'b1; end
// level shifter check 5: PD_SRC -> PD_SAME (no level shifter strategy, threshold 0)
bit openpa_l5_t;
always @(UPF::openpa_dom_PD_SRC_ok or UPF::openpa_dom_PD_SAME_ok or UPF::openpa_net_NT or UPF::openpa_net_NT) openpa_l5_t = UPF::openpa_dom_PD_SRC_ok && UPF::openpa_dom_PD_SAME_ok && (UPF::openpa_net_NT.voltage - UPF::openpa_net_NT.voltage > 0 || UPF::openpa_net_NT.voltage - UPF::openpa_net_NT.voltage > 0) && !1'b0;
always @(posedge openpa_l5_t)
begin openpa_sp[17] = 1'b1; openpa_sreq = 1'b1; end
// level shifter check 6: PD_TOP -> PD_SRC (no level shifter strategy, threshold 0)
bit openpa_l6_t;
always @(UPF::openpa_dom_PD_TOP_ok or UPF::openpa_dom_PD_SRC_ok or UPF::openpa_net_NA or UPF::openpa_net_NT) openpa_l6_t = UPF::openpa_dom_PD_TOP_ok && UPF::openpa_dom_PD_SRC_ok && (UPF::openpa_net_NA.voltage - UPF::openpa_net_NT.voltage > 0 || UPF::openpa_net_NT.voltage - UPF::openpa_net_NA.voltage > 0) && !1'b0;
always @(posedge openpa_l6_t)
begin openpa_sp[18] = 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[19] = 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[20] = 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 @(a) if (openpa_obs && UPF::openpa_dom_PD_TOP_ok && $time >= openpa_obs_after) $display("OPENPA-OBS @ %0t: a=%h", $time, a);
always @(b) if (openpa_obs && UPF::openpa_dom_PD_TOP_ok && $time >= openpa_obs_after) $display("OPENPA-OBS @ %0t: b=%h", $time, b);
always @(same) if (openpa_obs && UPF::openpa_dom_PD_TOP_ok && $time >= openpa_obs_after) $display("OPENPA-OBS @ %0t: same=%h", $time, same);
`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 CAMERA: PD_SRC isolated before power-down %0d", openpa_seq[1]);
$display("OPENPA-COVER sequence D2 CAMERA: isolation released only after PD_SRC was back %0d", openpa_seq[2]);
$display("OPENPA-COVER sequence D1 DSP: PD_SRC isolated before power-down %0d", openpa_seq[3]);
$display("OPENPA-COVER sequence D2 DSP: isolation released only after PD_SRC was back %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: 20 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_SRC_ok && (UPF::openpa_dom_PD_TOP_ok) && !(UPF::openpa_ctl_0_iso_a === 1'b1)) openpa_check(1, "set_isolation CAMERA (crossings.upf:26): PD_SRC went off while the isolation enable iso_a was inactive");
else if (!UPF::openpa_dom_PD_SRC_ok && (UPF::openpa_dom_PD_TOP_ok) && (UPF::openpa_ctl_0_iso_a === 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_SRC_ok && (UPF::openpa_dom_PD_TOP_ok)) openpa_check(2, "set_isolation CAMERA (crossings.upf:26): isolation released while PD_SRC is still off");
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_0_iso_a === 1'b1) && !UPF::openpa_dom_PD_SRC_ok && (UPF::openpa_dom_PD_TOP_ok)) openpa_check(6, "set_isolation CAMERA (crossings.upf:26): isolation supply AON lost while clamping");
end
if (openpa_sp[4]) begin
openpa_sp[4] = 1'b0;
if (!UPF::openpa_dom_PD_SRC_ok && (UPF::openpa_dom_PD_B_ok) && !(UPF::openpa_ctl_1_iso_b === 1'b1)) openpa_check(1, "set_isolation DSP (crossings.upf:27): PD_SRC went off while the isolation enable iso_b was inactive");
else if (!UPF::openpa_dom_PD_SRC_ok && (UPF::openpa_dom_PD_B_ok) && (UPF::openpa_ctl_1_iso_b === 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_SRC_ok && (UPF::openpa_dom_PD_B_ok)) openpa_check(2, "set_isolation DSP (crossings.upf:27): isolation released while PD_SRC is still off");
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_1_iso_b === 1'b1) && !UPF::openpa_dom_PD_SRC_ok && (UPF::openpa_dom_PD_B_ok)) openpa_check(6, "set_isolation DSP (crossings.upf:27): isolation supply AON lost while clamping");
end
if (openpa_sp[7]) begin
openpa_sp[7] = 1'b0;
if (openpa_x1_t) openpa_check(9, "u_b/q of PD_B (off) is read by fan_soc output b 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_same/q of PD_SAME (off) is read by fan_soc output same 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_src/q of PD_SRC (off) is read by u_a/d 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_src/q of PD_SRC (off) is read by u_b/d in PD_B (on) with no active isolation");
end
if (openpa_sp[11]) begin
openpa_sp[11] = 1'b0;
if (openpa_x5_t) openpa_check(9, "u_src/q of PD_SRC (off) is read by u_same/d in PD_SAME (on) with no active isolation");
end
if (openpa_sp[12]) begin
openpa_sp[12] = 1'b0;
if (openpa_x6_t) openpa_check(9, "fan_soc input d of PD_TOP (off) is read by u_src/d in PD_SRC (on) with no active isolation");
end
if (openpa_sp[13]) begin
openpa_sp[13] = 1'b0;
if (openpa_l1_t) openpa_check(11, $sformatf("PD_B (%0d uV) drives PD_TOP (%0d uV) on 1 port(s) with no level shifter for this direction", UPF::openpa_net_NB.voltage, UPF::openpa_net_NA.voltage));
end
if (openpa_sp[14]) begin
openpa_sp[14] = 1'b0;
if (openpa_l2_t) openpa_check(11, $sformatf("PD_SAME (%0d uV) drives PD_TOP (%0d uV) on 1 port(s) with no level shifter for this direction", UPF::openpa_net_NT.voltage, UPF::openpa_net_NA.voltage));
end
if (openpa_sp[15]) begin
openpa_sp[15] = 1'b0;
if (openpa_l3_t) openpa_check(11, $sformatf("PD_SRC (%0d uV) drives PD_TOP (%0d uV) on 1 port(s) with no level shifter for this direction", UPF::openpa_net_NT.voltage, UPF::openpa_net_NA.voltage));
end
if (openpa_sp[16]) begin
openpa_sp[16] = 1'b0;
if (openpa_l4_t) openpa_check(11, $sformatf("PD_SRC (%0d uV) drives PD_B (%0d uV) on 1 port(s) with no level shifter for this direction", UPF::openpa_net_NT.voltage, UPF::openpa_net_NB.voltage));
end
if (openpa_sp[17]) begin
openpa_sp[17] = 1'b0;
if (openpa_l5_t) openpa_check(11, $sformatf("PD_SRC (%0d uV) drives PD_SAME (%0d uV) on 1 port(s) with no level shifter for this direction", UPF::openpa_net_NT.voltage, UPF::openpa_net_NT.voltage));
end
if (openpa_sp[18]) begin
openpa_sp[18] = 1'b0;
if (openpa_l6_t) openpa_check(11, $sformatf("PD_TOP (%0d uV) drives PD_SRC (%0d uV) on 1 port(s) with no level shifter for this direction", UPF::openpa_net_NA.voltage, UPF::openpa_net_NT.voltage));
end
if (openpa_sp[19]) begin
openpa_sp[19] = 1'b0;
if (!UPF::openpa_dom_PD_TOP_ok && (UPF::openpa_dom_PD_SRC_ok || UPF::openpa_dom_PD_B_ok || UPF::openpa_dom_PD_SAME_ok)) openpa_check(12, "iso_a (isolation CAMERA) comes from PD_TOP, which is off while other domains are on");
end
if (openpa_sp[20]) begin
openpa_sp[20] = 1'b0;
if (!UPF::openpa_dom_PD_TOP_ok && (UPF::openpa_dom_PD_SRC_ok || UPF::openpa_dom_PD_B_ok || UPF::openpa_dom_PD_SAME_ok)) openpa_check(12, "iso_b (isolation DSP) 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");
end
// verilator lint_on MULTIDRIVEN
`line 9 "fan.sv" 0
endmodule
Check Yourself
Common Mistakes
Wrong Give every receiver the same cell because the driver has one output.
The receivers can need different clamps, controls or bypasses.
Fix Inspect each driver-to-receiver path.
Wrong Let the later strategy replace an earlier strategy.
Strategy precedence uses selection granularity and options. Command order does not break a tie.
Fix Resolve the selection overlap or make the intended precedence direct.
Wrong Treat equal voltage as the same supply.
Independent rails can have equal voltage now and different states later.
Fix Compare supply identity and equivalence, not the current voltage.
Remember
- Select isolation per driver-to-receiver path.
- Supply identity matters even when current voltages match.
- Resolve granularity first, then option precedence; a remaining tie is an error.
- Updates add information, and a winning no_isolation rule suppresses insertion.
- Port attributes remain a drawn fallback in OpenPA.