Logic Ports, Logic Nets and Port Attributes

Give a transmitter an isolation control without changing its RTL. Then describe the same interface when the circuitry inside is hidden.

You Will Be Able To

  • Create a control port, route it on a logic net and use it as an isolation enable.
  • Identify the driving and receiving supplies of an opaque port.
  • Draw clamp, feedthrough and legacy pin relationships from an interface drawing.
  • Separate a recorded design annotation from behavior you can observe in a run.
Lesson
W4.14
Time
34 min
Runs on
Your browser
Check
5 questions
Give the Macro a Guard That Stays AwakeThe macro output and the guard take different paths to a powered receiver.
  • Control / FSM
  • Data
  • Control
CallValueReturnWaiting
Give the Macro a Guard That Stays AwakeThe macro output and the guard take different paths to a powered receiver. component u_tx/a driver on TX control park new top input control guard new logic net component MASK powered by AON component a host receiver on AON beforeraw dataprotected dataconnect_logic_netclamp enable
  1. component u_tx/adriver on TX
    • before → a
    • raw data → MASK
  2. component ahost receiver on AON
  3. control parknew top input
    • connect_logic_net → guard
  4. control guardnew logic net
    • clamp enable → MASK
  5. component MASKpowered by AON
    • protected data → a
  1. Before isolation

    A high raw bit reaches the host directly. The macro has no way to tell its receiver that sleep is coming.

  2. Trace the control

    Follow park through guard. This path carries a Boolean request while TX is still powered.

    Follow the calls, values and waits
    1. call park: park → guard
    2. call guard: guard → MASK
  3. Read the protected data

    MASK now selects between the raw bit and zero. Its supply comes from the powered side.

    Follow the calls, values and waits
    1. data raw bit: u_tx/a → MASK
    2. data safe bit: MASK → a
Read the diagram as text
  • u_tx/a: driver on TX
  • park: new top input
  • guard: new logic net
  • MASK: powered by AON
  • a: host receiver on AON
  • u_tx/a → a: before
  • u_tx/a → MASK: raw data
  • MASK → a: protected data
  • park → guard: connect_logic_net
  • guard → MASK: clamp enable

Drawn control and data paths.

Recorded control sequence.
passing park=0 guard=0 raw=1 a=1 b=1
guarded park=1 guard=1 raw=1 a=0 b=1
sleep park=1 guard=1 raw=1 a=0 b=x

Watch two neighbors on the same transmitter. Both are high before the host asks for sleep.

In sleep, a stays 0 while b becomes x. Follow guard to see why only a has a safe value.

Bring the Request in with create_logic_port

The host needs a sleep input named park.

Add the control in the power intent so the transmitter RTL stays reusable.

Before

# boundary_soc has ordinary RTL inputs d, iso and iso_n.

There is no integration point named park.

After

create_logic_port park -direction in

The UPF declares park as an input.

create_logic_port creates a logic port at the current scope (6.20). Direction follows the flow of the control into the design.

You can omit -direction here because its default is in (6.20).

Recorded control sequence.
passing park=0 guard=0 raw=1 a=1 b=1
guarded park=1 guard=1 raw=1 a=0 b=1

In guarded, park reads 1 because the bench drives the new top control before cutting TX.

The editable bench drives OpenPA’s top-level variable.
dut.park=0; sample("passing");
dut.park=1; sample("guarded");
Recorded OpenPA 0.3.0 declaration inside boundary_soc.
logic park;   // logic port (boundary_soc.upf:18); a bench drives it as dut.park

Clause 6.20 creates a port. OpenPA instead declares park inside boundary_soc, so the bench drives dut.park.

How does park reach MASK?

Route the Enable with create_logic_net and connect_logic_net

Inside boundary_soc, MASK needs to see park change.

Before

create_logic_port park -direction in

The port can receive the request.

After

create_logic_port park -direction in
create_logic_net guard
connect_logic_net guard -ports {park}

The net now takes its value from park.

CommandObject beforeWhat you can trace afterward
create_logic_portNo top object called parkAn input that the bench can drive
create_logic_netNo internal object called guardA logic net with its own name
connect_logic_netpark and guard are separateA driver path from park to guard

Use create_logic_net to declare guard (6.19). Then connect_logic_net gives it a path to park (6.13).

Recorded experimentAt the guarded sample
Omit the connectionguarded park=1 guard=x raw=1 a=x b=1
Connect park to guardguarded park=1 guard=1 raw=1 a=0 b=1

With the connection omitted, park reaches 1 but guard stays x. The control declaration alone cannot protect a.

The live strategy takes its enable from guard.
set_isolation MASK -domain PD_TX -elements {u_tx/a} -applies_to outputs -clamp_value 0 -isolation_signal guard -isolation_supply AON -location parent
Recorded control sequence.
passing park=0 guard=0 raw=1 a=1 b=1
guarded park=1 guard=1 raw=1 a=0 b=1
wake park=1 guard=1 raw=1 a=0 b=1
released park=0 guard=0 raw=1 a=1 b=1

In released, park and guard both return to 0 and a passes 1 again.

How would you trace that path through an opaque macro?

Identify the Driver and Receiver Supplies

The host sees u_tx/a, but an opaque macro delivery may hide the transistor or register driving that pin.

Draw the endpoints before you write the attributes. Follow the wire from driver to receiver.

Before

# Drawn opaque view
u_radio/ready  ->  u_host/sample

The wire connects two pins. The supplies are hidden.

After

set_port_attributes -model radio_ip -ports {ready} -driver_supply RADIO
set_port_attributes -model host_ip -ports {sample} -receiver_supply HOST

The drawn driver uses RADIO. The drawn receiving logic uses HOST.

Drawn supply labels for the hidden logic.
             radio_ip                          host_ip
       ┌────────────────┐                ┌─────────────────┐
RADIO ─┤ driver → ready ├──── signal ────┤ sample → reader ├─ HOST
       └────────────────┘                └─────────────────┘
                ↑                                 ↑
         driver_supply                      receiver_supply

At a macro output, -driver_supply identifies the supply of the internal driver. At a macro input, -receiver_supply identifies the internal receiver (6.51).

Use the opposite viewpoint at a primary input with an external driver. Port direction alone cannot tell you which end is missing.

Question at the boundaryPort to labelSupply to name
What drives ready inside radio_ip?Output readyRADIO, the local driver supply
What samples ready inside host_ip?Input sampleHOST, the local receiver supply
Who drives a chip input from outside?Primary inputThe external driver supply
Recorded control sequence.
guarded park=1 guard=1 raw=1 a=0 b=1
sleep park=1 guard=1 raw=1 a=0 b=x

In sleep, the visible witness gives a=0 and b=x because only a crosses through MASK.

OpenPA 0.3.0 follows the visible RTL. In the drawing, RADIO and HOST name supply sets inside their respective models (6.51).

Before

Crossings

Recorded with all RTL in PD_TOP.

After

Crossings
  u_tx/a [PD_TX] -> boundary_soc output a [PD_TOP]: isolation MASK
  u_tx/b [PD_TX] -> boundary_soc output b [PD_TOP]: no isolation

Recorded after giving u_tx its own domain and guard.

Recorded OpenPA refusal. The drawn macro labels above never enter this simulation.
contract.upf:1: set_port_attributes is not supported (IEEE 1801-2024 6.51): port attributes (clamp value, driver and receiver supplies, feedthrough, ...) change isolation and corruption

On the opaque drawing, adding RADIO and HOST reveals the supply crossing. OpenPA cannot produce an attributed black-box crossing report.

The supplies identify the endpoints. The host interface still has to say which value is safe.

Request a Safe Value with -clamp_value

Our host interprets a high radio request as work. A sleeping radio must therefore leave the host request low.

Write that requirement on the radio output so an isolation strategy can use it. A pin attribute alone inserts no cell.

Before

# Drawn radio_ip output request has no clamp requirement.

Only the direction is known.

After

set_port_attributes -model radio_ip -ports {request} -clamp_value 0

The pin now requests zero.

When a strategy omits its clamp, it needs a specific clamp value on the port (6.48, 6.51).

OpenPA needs a strategy value. The runnable MASK strategy supplies it directly.

Recorded control sequence.
passing park=0 guard=0 raw=1 a=1 b=1
guarded park=1 guard=1 raw=1 a=0 b=1
sleep park=1 guard=1 raw=1 a=0 b=x

In guarded, raw stays 1 while a falls to 0, so the clamp acts before TX loses power.

Recorded Icarus run of the drawn pin model.
online macro=1 host=1 held=1 service=0
isolated macro=x host=0 held=0 service=0
host_off macro=x host=x held=1 service=1

At host_off, host becomes x because the witness removes the receiver-side supply too.

What if the host needs a held bit and a service preset?

Reset a Held Clamp with -async_clamp_value

The radio’s history bit must hold its last value during isolation. A service preset must still be able to set that bit.

First specify latch isolation. Then give its asynchronous control a value that makes sense even after the driver sleeps (6.48, 6.51, 9.8).

Before

set_port_attributes -model radio_ip -ports {history} -clamp_value latch

The drawn interface remembers the last transparent value.

After

set_port_attributes -model radio_ip -ports {history} -async_clamp_value 1

This additional attribute supplies the value for the strategy’s asynchronous set/reset.

What the interface needsPin requirementOther information the strategy needs
Inactive request while the source sleepsA fixed low clampWhich ports to isolate and which signal asserts isolation
Keep the history from just before sleepA latch clampA supply that stays usable while the cell holds a bit
Set held history during a service presetAsynchronous value oneAn asynchronous set/reset signal for the latch strategy

Keep both attributes on history. The isolation strategy names the preset signal with -async_set_reset (6.48).

Recorded Icarus run of the drawn pin model.
last macro=0 host=0 held=0 service=0
isolated macro=x host=0 held=0 service=0
preset macro=x host=0 held=1 service=1

At preset, held changes from 0 to 1 while macro remains x.

In the witness, preset has priority over the hold. Run the quiz model with preset held low to see the captured zero survive.

That experiment uses a latch equation. OpenPA declines the attribute and the asynchronous strategy option.

Next, trace two pins joined by a wire.

Trace a Direct Connection with -feedthrough

A board test signal enters the radio package on service_in and leaves on service_out. The package drawing shows uninterrupted metal between them.

There is no storage or powered driver in that segment. Mark the connected scalar ports as a feedthrough so the path continues through the macro (6.51).

Before

service_in       [opaque radio]       service_out

The two pins end at the shell in the drawing.

After

set_port_attributes -model radio_ip -ports {service_in service_out} -feedthrough SERVICE

Both pins now belong to the same named direct connection.

Inside the shellWhat the signal can doFeedthrough on these pins?
Two ends of uninterrupted metalA change propagates across the connection.Yes, for these scalar pins.
A powered bufferThe output depends on its local driver supply.No, identify that driver.
A latch controlled by service modeThe output can keep an earlier input.No, trace the stored value.
Only a matching test resultThe observed value says nothing about internal connectivity.Consult the macro pin drawing.

If a later drawing adds a third pin on the same wire, give it the same feedthrough name (6.51).

A buffer or latch breaks the direct path, even when both pins read one.

Recorded Icarus run of the drawn pin model.
isolated macro=x host=0 held=0 service=0
test_pin macro=x host=0 held=0 service=1
preset macro=x host=0 held=1 service=1

In test_pin, service rises to 1 while macro stays x because the drawn wire bypasses the sleeping driver.

Older library sheets also name the local power pins.

Read a Legacy Pin Supply Pair

The radio library sheet names VPAD and VRET_G as the supply pins for its alarm driver. Neither name is a SoC supply set.

Before

RF_PAD/alarm     power pin ?     ground pin ?

The supply pair of the drawn leaf driver is missing.

After

set_pin_related_supply rf_lib/RF_PAD -pins {alarm} -related_power_pin VPAD -related_ground_pin VRET_G

The legacy card relates alarm to its two local supply pins.

This library-cell command appears in UPF 1.0 clause 6.28. With 6.51, use -related_power_port and -related_ground_port to name local supply ports on the drawn output.

File on your deskRead the related supply asEvidence available here
UPF 1.0 library card (6.28)A local power pin and a local ground pin on a library cell.The drawing identifies both pins. OpenPA refuses the command.
IEEE 1801-2024 macro interface (6.51)A driver or receiver supply for the attributed signal pin.The drawing joins the two endpoints. The trace uses visible RTL.
IEEE 1801-2024 design annotation (6.44)A property on the selected design object.OpenPA records a project-defined attribute in the report.

To interpret alarm on the integrated chip, follow VPAD and VRET_G outward to their actual supply connections.

Recorded OpenPA refusal for the legacy library card.
contract.upf:1: set_pin_related_supply is not supported (UPF 1.0 6.28, absent from IEEE 1801-2024): related supplies of pins change corruption at macro boundaries

The refusal identifies a pin supply that affects corruption. Compare the drawn driver with the separate RTL witness.

Recorded Icarus run of the drawn pin model.
last macro=0 host=0 held=0 service=0
isolated macro=x host=0 held=0 service=0

In isolated, macro becomes x when tx_on falls. That is the hand model of losing the related driver supply.

Next, inspect the revision tag on that delivery.

Attach Project Metadata with set_design_attributes

The pin list for u_tx changed. Which revision did you integrate?

Before

# No project revision on u_tx.

The revision lives only on the delivery sheet.

After

set_design_attributes -elements {u_tx} -attribute {interface_rev B}

The intent now carries the project attribute interface_rev with value B.

set_design_attributes attaches attributes to selected design objects (6.44). A user-defined attribute gets its meaning from the project.

Recorded OpenPA note for interface_rev.
set_design_attributes is recorded with no effect in simulation: a user-defined attribute: the standard gives it no meaning (IEEE 1801-2024 6.44)

The note records the command. What actually sets a?

Recorded control sequence.
guarded park=1 guard=1 raw=1 a=0 b=1

In guarded, guard=1 forces a=0 while raw=1. Changing the delivery revision leaves that path intact.

A predefined UPF attribute can carry simulation semantics. OpenPA refuses predefined attributes it cannot honor.

In Attributes for a Black Box, attach the delivery revision to the instance and put its pin requirements on the model.

Try It

Run the sequence once. Watch the control travel from dut.park to dut.guard while the raw bit stays high.

Change the initial d so its low bit starts at zero. A silent value change can still conceal a working guard.

Move the release before the power-up. Sample a while TX is off and compare it with b.

The quiz runs the pin witness separately. Edit its preset or service input to test the opaque drawing.

RUNIcarus Verilog · in your browser
Edit the code, then run it
Expected: OPENPA-INFO corruption=x seed=1 passing park=0 guard=0 raw=1 a=1 b=1 guarded park=1 guard=1 raw=1 a=0 b=1 OPENPA-CHECK D9 @ 4000: u_tx/b of PD_TX (off) is read by boundary_soc output b in PD_TOP (on) with no active isolation OPENPA-CHECK D9 @ 4000: u_tx/c of PD_TX (off) is read by boundary_soc output c in PD_TOP (on) with no active isolation OPENPA-CHECK D9 @ 4000: u_tx/spare of PD_TX (off) is read by boundary_soc output spare in PD_TOP (on) with no active isolation OPENPA-CHECK D9 @ 4000: u_tx/z of PD_TX (off) is read by boundary_soc output z in PD_TOP (on) with no active isolation sleep park=1 guard=1 raw=1 a=0 b=x wake park=1 guard=1 raw=1 a=0 b=1 released park=0 guard=0 raw=1 a=1 b=1 OPENPA-SUMMARY D1=0 D2=0 D3=0 D4=0 D5=0 D6=0 D7=0 D8=0 D9=4 D10=0 D11=0 D12=0 D13=0 D14=0 OPENPA-COVER sequence D1 MASK: PD_TX isolated before power-down 1 OPENPA-COVER sequence D2 MASK: isolation released only after PD_TX was back 1 OPENPA-COVER-SUMMARY states=0/0 declared_transitions=0/0 sequences=2/2
Read the power intent: boundary_soc.upf
upf_version 4.0
set_design_top boundary_soc
create_power_domain PD_TOP -include_scope
create_power_domain PD_TX -elements {u_tx}
create_supply_port VA -direction in
create_supply_port VT -direction in
create_supply_port VG -direction in
create_supply_net NA
create_supply_net NT
create_supply_net NG
connect_supply_net NA -ports {VA}
connect_supply_net NT -ports {VT}
connect_supply_net NG -ports {VG}
create_supply_set AON -function {power NA} -function {ground NG}
create_supply_set TX -function {power NT} -function {ground NG}
associate_supply_set AON -handle PD_TOP.primary
associate_supply_set TX -handle PD_TX.primary
create_logic_port park -direction in
create_logic_net guard
connect_logic_net guard -ports {park}
set_isolation MASK -domain PD_TX -elements {u_tx/a} -applies_to outputs -clamp_value 0 -isolation_signal guard -isolation_supply AON -location parent
set_design_attributes -elements {u_tx} -attribute {interface_rev B}
Read the power-unaware RTL: island.sv
module island(input logic [4:0] d, output wire a, b, c, z, spare);
  assign a=d[0]; assign b=d[1]; assign c=d[2]; assign z=d[3]; assign spare=d[4];
endmodule
module boundary_soc(input logic [4:0] d, input logic iso, iso_n,
  output wire a,b,c,z,spare);
  island u_tx(.d(d),.a(a),.b(b),.c(c),.z(z),.spare(spare));
endmodule
What UPF added: 26 objects

3 supply port, 3 supply net, 6 output corruption, 1 isolation cell, 1 logic_port, 1 logic_net, 2 supply set, 9 dynamic check.

ObjectWhereDetailRuleUPF line
Supply portVAboundary_soc.upf:5
Supply portVTboundary_soc.upf:6
Supply portVGboundary_soc.upf:7
Supply netNAboundary_soc.upf:5
Supply netNTboundary_soc.upf:6
Supply netNGboundary_soc.upf:7
Output corruptionu_tx/aC2boundary_soc.upf:4
Isolation cellu_tx/aMASK · clamp 0I1-I5boundary_soc.upf:21
Output corruptionu_tx/bC2boundary_soc.upf:4
Output corruptionu_tx/cC2boundary_soc.upf:4
Output corruptionu_tx/spareC2boundary_soc.upf:4
Output corruptionu_tx/zC2boundary_soc.upf:4
Output corruptionu_tx/dC2boundary_soc.upf:3
logic_portparkboundary_soc.upf:18
logic_netguardboundary_soc.upf:19
Supply setAONboundary_soc.upf:14
Supply setTXboundary_soc.upf:15
Dynamic checkD1/D2/D6 MASKD1, D2, D6boundary_soc.upf:21
Dynamic checkD9 crossing 1D9boundary_soc.upf:4
Dynamic checkD9 crossing 2D9boundary_soc.upf:4
Dynamic checkD9 crossing 3D9boundary_soc.upf:4
Dynamic checkD9 crossing 4D9boundary_soc.upf:4
Dynamic checkD9 crossing 5D9boundary_soc.upf:4
Dynamic checkD9 crossing 6D9boundary_soc.upf:3
Dynamic checkD11 PD_TX->PD_TOPD11boundary_soc.upf:4
Dynamic checkD11 PD_TOP->PD_TXD11boundary_soc.upf:3

OpenPA warnings:

  • D7 does not check PD_TX for reset before isolation release: no asynchronous reset found on its registers
Read the power-aware copy that runs (generated by OpenPA 0.3.0): pa_boundary_soc.sv
// pa_boundary_soc.sv: power-aware copy of boundary_soc, generated by OpenPA from boundary_soc.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.
`timescale 1ns/1ps
// ---------------------------------------------------------------------------
// 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 (boundary_soc.upf:5)
  supply_net_type openpa_port_VT;   // supply port VT (boundary_soc.upf:6)
  supply_net_type openpa_port_VG;   // supply port VG (boundary_soc.upf:7)
  supply_net_type openpa_net_NA;   // supply net NA
  supply_net_type openpa_net_NT;   // supply net NT
  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_TX_ok; int unsigned openpa_ss_TX_ep; int openpa_ss_TX_st = -1; bit openpa_ss_TX_multi; int openpa_ss_TX_sim = 5;   // supply set TX
  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 (boundary_soc.upf:3)
  bit openpa_dom_PD_TX_ok; int unsigned openpa_dom_PD_TX_ep; int openpa_dom_PD_TX_sim = 5;   // power domain PD_TX: ok = powered (simstate not CORRUPT); sim = simstate code (boundary_soc.upf:4)
  // 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_guard;   // copy of guard (isolation MASK)
  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 == "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 == "TX.power") begin $display("OPENPA-ERROR supply_on(\"%s\"): TX.power already has a driver (port VT); drive its root supply instead", pad_name); return 0; end
    if (pad_name == "PD_TX.primary.power") begin $display("OPENPA-ERROR supply_on(\"%s\"): PD_TX.primary.power already has a driver (port VT); 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 == "TX.ground") begin $display("OPENPA-ERROR supply_on(\"%s\"): TX.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_TX.primary.ground") begin $display("OPENPA-ERROR supply_on(\"%s\"): PD_TX.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 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 == "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 == "TX.power") begin $display("OPENPA-ERROR supply_off(\"%s\"): TX.power already has a driver (port VT); drive its root supply instead", pad_name); return 0; end
    if (pad_name == "PD_TX.primary.power") begin $display("OPENPA-ERROR supply_off(\"%s\"): PD_TX.primary.power already has a driver (port VT); 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 == "TX.ground") begin $display("OPENPA-ERROR supply_off(\"%s\"): TX.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_TX.primary.ground") begin $display("OPENPA-ERROR supply_off(\"%s\"): PD_TX.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 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 == "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 == "TX.power") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): TX.power already has a driver (port VT); drive its root supply instead", pad_name); return 0; end
    if (pad_name == "PD_TX.primary.power") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): PD_TX.primary.power already has a driver (port VT); 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 == "TX.ground") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): TX.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_TX.primary.ground") begin $display("OPENPA-ERROR supply_partial_on(\"%s\"): PD_TX.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 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 == "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 == "TX.power") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): TX.power already has a driver (port VT); drive its root supply instead", pad_name); return 0; end
    if (pad_name == "PD_TX.primary.power") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): PD_TX.primary.power already has a driver (port VT); 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 == "TX.ground") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): TX.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_TX.primary.ground") begin $display("OPENPA-ERROR set_supply_state(\"%s\"): PD_TX.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 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 == "TX.power" || name == "PD_TX.primary.power") return openpa_net_NT;
    if (name == "VG" || name == "NG" || name == "AON.ground" || name == "TX.ground" || name == "PD_TOP.primary.ground" || name == "PD_TX.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 "island.sv" 0
module island(input logic [4:0] d, output wire a, b, c, z, spare);
  assign a=d[0]; assign b=d[1]; assign c=d[2]; assign z=d[3]; assign spare=d[4];
endmodule
module boundary_soc(input logic [4:0] d, input logic iso, iso_n,
  output wire a,b,c,z,spare);
  wire [0:0] openpa_u_tx_a_raw, openpa_u_tx_a_s1; wire [0:0] openpa_u_tx_b_raw; wire [0:0] openpa_u_tx_c_raw; wire [0:0] openpa_u_tx_spare_raw; wire [0:0] openpa_u_tx_z_raw; wire [4:0] openpa_u_tx_d_s1; island u_tx(.d(openpa_u_tx_d_s1),.a(openpa_u_tx_a_raw),.b(openpa_u_tx_b_raw),.c(openpa_u_tx_c_raw),.z(openpa_u_tx_z_raw),.spare(openpa_u_tx_spare_raw)); openpa_corrupt #(.W(1), .ID(268435456)) openpa_u_tx_a_cor (.d(openpa_u_tx_a_raw), .q(openpa_u_tx_a_s1), .ok(UPF::openpa_dom_PD_TX_ok), .ep(UPF::openpa_dom_PD_TX_ep)); openpa_iso #(.W(1), .CLAMP(0), .SENSE(1'b1), .ID(268435457)) openpa_u_tx_a_iso (.d(openpa_u_tx_a_s1), .q(a), .en(UPF::openpa_ctl_0_guard), .sup_ok((UPF::openpa_ss_AON_sim == 0)), .sup_ep(UPF::openpa_ss_AON_ep)); openpa_corrupt #(.W(1), .ID(268435464)) openpa_u_tx_b_cor (.d(openpa_u_tx_b_raw), .q(b), .ok(UPF::openpa_dom_PD_TX_ok), .ep(UPF::openpa_dom_PD_TX_ep)); openpa_corrupt #(.W(1), .ID(268435472)) openpa_u_tx_c_cor (.d(openpa_u_tx_c_raw), .q(c), .ok(UPF::openpa_dom_PD_TX_ok), .ep(UPF::openpa_dom_PD_TX_ep)); openpa_corrupt #(.W(1), .ID(268435480)) openpa_u_tx_spare_cor (.d(openpa_u_tx_spare_raw), .q(spare), .ok(UPF::openpa_dom_PD_TX_ok), .ep(UPF::openpa_dom_PD_TX_ep)); openpa_corrupt #(.W(1), .ID(268435488)) openpa_u_tx_z_cor (.d(openpa_u_tx_z_raw), .q(z), .ok(UPF::openpa_dom_PD_TX_ok), .ep(UPF::openpa_dom_PD_TX_ep)); openpa_corrupt #(.W(5), .ID(268435496)) openpa_u_tx_d_cor (.d(d), .q(openpa_u_tx_d_s1), .ok(UPF::openpa_dom_PD_TOP_ok), .ep(UPF::openpa_dom_PD_TOP_ep));

`line 1 "openpa_overlay.sv" 0
  // ===================================================================================
  // OpenPA overlay for boundary_soc: generated from boundary_soc.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_guard;
  import UPF::openpa_dom_PD_TOP_ep;
  import UPF::openpa_dom_PD_TOP_ok;
  import UPF::openpa_dom_PD_TOP_sim;
  import UPF::openpa_dom_PD_TX_ep;
  import UPF::openpa_dom_PD_TX_ok;
  import UPF::openpa_dom_PD_TX_sim;
  import UPF::openpa_kick;
  import UPF::openpa_net_NA;
  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_TX_ep;
  import UPF::openpa_ss_TX_multi;
  import UPF::openpa_ss_TX_ok;
  import UPF::openpa_ss_TX_sim;
  import UPF::openpa_ss_TX_st;
  import UPF::openpa_xmode;
  // ---- mode, seed, trace
  bit openpa_tr, openpa_obs;
  int openpa_n [1:14];
  int openpa_seq [1:2];   // good-form sequence bins (coverage)
  bit openpa_sreq; bit openpa_sp [1:12];   // 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

  // ---- logic ports and nets created by the UPF (create_logic_port, create_logic_net, connect_logic_net)
  logic park;   // logic port (boundary_soc.upf:18); a bench drives it as dut.park
  wire guard = park;   // logic net (boundary_soc.upf:19)

  // ---- copies of the design signals the UPF names (4-state, so X is visible)
  always @(guard or openpa_kick) openpa_ctl_0_guard = guard;

  // ---- 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_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_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 TX (also PD_TX.primary): IEEE 1801-2024 4.7.3, 4.7.4, 6.5.6, 9.3.2, 5.7.8
    begin : openpa_ss_TX
      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_TX_sim = sm;
      nx = sm < 5;
      if (openpa_ss_TX_ok && !nx) openpa_ss_TX_ep = openpa_ss_TX_ep + 1;
      openpa_ss_TX_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_TX: simstate of its primary supply set TX
    if (openpa_dom_PD_TX_ok && !UPF::openpa_ss_TX_ok) openpa_dom_PD_TX_ep = openpa_dom_PD_TX_ep + 1;
    openpa_dom_PD_TX_ok = UPF::openpa_ss_TX_ok;
    openpa_dom_PD_TX_sim = openpa_ss_TX_sim;
  end

  // ---- corruption: registers forced, memories overwritten (rules C1, C3)
  // domain PD_TOP (boundary_soc.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_TX (boundary_soc.upf:4): 0 register(s), 0 memory(ies)
  bit openpa_PD_TX_applied, openpa_PD_TX_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_TX_ok or openpa_kick) if (!openpa_PD_TX_valid || openpa_PD_TX_applied != UPF::openpa_dom_PD_TX_ok) begin
    openpa_t({"PD_TX ", UPF::openpa_dom_PD_TX_ok ? "NORMAL" : "CORRUPT"});
    if (!UPF::openpa_dom_PD_TX_ok || !openpa_PD_TX_valid) begin
    end
    if (UPF::openpa_dom_PD_TX_ok) begin
    end
    openpa_PD_TX_valid = 1'b1; openpa_PD_TX_applied = UPF::openpa_dom_PD_TX_ok;
  end

  // ---- checks for set_isolation MASK (boundary_soc.upf:21): PD_TX -> PD_TOP on 1 port(s)
  bit openpa_ig1_act, openpa_ig1_cyc;
  always @(negedge UPF::openpa_dom_PD_TX_ok) if (!UPF::openpa_dom_PD_TX_ok)
    begin openpa_sp[1] = 1'b1; openpa_sreq = 1'b1; end
  always @(posedge UPF::openpa_ctl_0_guard or negedge UPF::openpa_ctl_0_guard or posedge openpa_kick) begin
    if (openpa_ig1_act && !(UPF::openpa_ctl_0_guard === 1'b1))
      begin openpa_sp[2] = 1'b1; openpa_sreq = 1'b1; end
    if (openpa_ig1_act != (UPF::openpa_ctl_0_guard === 1'b1)) openpa_t({"MASK enable ", (UPF::openpa_ctl_0_guard === 1'b1) ? "active" : "inactive"});
    openpa_ig1_act = (UPF::openpa_ctl_0_guard === 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
  // crossing 1: u_tx/a (PD_TX) -> boundary_soc output a (PD_TOP), isolated by MASK
  bit openpa_x1_t;
  always @(UPF::openpa_dom_PD_TX_ok or UPF::openpa_dom_PD_TOP_ok or UPF::openpa_ctl_0_guard or UPF::openpa_ss_AON_sim or UPF::openpa_net_NT or UPF::openpa_net_NG) openpa_x1_t = !UPF::openpa_dom_PD_TX_ok && UPF::openpa_dom_PD_TOP_ok && !(((UPF::openpa_ctl_0_guard === 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_x1_t)
    begin openpa_sp[4] = 1'b1; openpa_sreq = 1'b1; end
  // crossing 2: u_tx/b (PD_TX) -> boundary_soc output b (PD_TOP), not isolated
  bit openpa_x2_t;
  always @(UPF::openpa_dom_PD_TX_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_TX_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[5] = 1'b1; openpa_sreq = 1'b1; end
  // crossing 3: u_tx/c (PD_TX) -> boundary_soc output c (PD_TOP), not isolated
  bit openpa_x3_t;
  always @(UPF::openpa_dom_PD_TX_ok or UPF::openpa_dom_PD_TOP_ok or UPF::openpa_net_NT or UPF::openpa_net_NG) openpa_x3_t = !UPF::openpa_dom_PD_TX_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_x3_t)
    begin openpa_sp[6] = 1'b1; openpa_sreq = 1'b1; end
  // crossing 4: u_tx/spare (PD_TX) -> boundary_soc output spare (PD_TOP), not isolated
  bit openpa_x4_t;
  always @(UPF::openpa_dom_PD_TX_ok or UPF::openpa_dom_PD_TOP_ok or UPF::openpa_net_NT or UPF::openpa_net_NG) openpa_x4_t = !UPF::openpa_dom_PD_TX_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_x4_t)
    begin openpa_sp[7] = 1'b1; openpa_sreq = 1'b1; end
  // crossing 5: u_tx/z (PD_TX) -> boundary_soc output z (PD_TOP), not isolated
  bit openpa_x5_t;
  always @(UPF::openpa_dom_PD_TX_ok or UPF::openpa_dom_PD_TOP_ok or UPF::openpa_net_NT or UPF::openpa_net_NG) openpa_x5_t = !UPF::openpa_dom_PD_TX_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_x5_t)
    begin openpa_sp[8] = 1'b1; openpa_sreq = 1'b1; end
  // crossing 6: boundary_soc input d (PD_TOP) -> u_tx/d (PD_TX), not isolated
  bit openpa_x6_t;
  always @(UPF::openpa_dom_PD_TOP_ok or UPF::openpa_dom_PD_TX_ok or UPF::openpa_net_NA or UPF::openpa_net_NG) openpa_x6_t = !UPF::openpa_dom_PD_TOP_ok && UPF::openpa_dom_PD_TX_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[9] = 1'b1; openpa_sreq = 1'b1; end
  // level shifter check 1: PD_TX -> PD_TOP (no level shifter strategy, threshold 0)
  bit openpa_l1_t;
  always @(UPF::openpa_dom_PD_TX_ok or UPF::openpa_dom_PD_TOP_ok or UPF::openpa_net_NT or UPF::openpa_net_NA) openpa_l1_t = UPF::openpa_dom_PD_TX_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_l1_t)
    begin openpa_sp[10] = 1'b1; openpa_sreq = 1'b1; end
  // level shifter check 2: PD_TOP -> PD_TX (no level shifter strategy, threshold 0)
  bit openpa_l2_t;
  always @(UPF::openpa_dom_PD_TOP_ok or UPF::openpa_dom_PD_TX_ok or UPF::openpa_net_NA or UPF::openpa_net_NT) openpa_l2_t = UPF::openpa_dom_PD_TOP_ok && UPF::openpa_dom_PD_TX_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_l2_t)
    begin openpa_sp[11] = 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[12] = 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 @(c) if (openpa_obs && UPF::openpa_dom_PD_TOP_ok && $time >= openpa_obs_after) $display("OPENPA-OBS @ %0t: c=%h", $time, c);
  always @(z) if (openpa_obs && UPF::openpa_dom_PD_TOP_ok && $time >= openpa_obs_after) $display("OPENPA-OBS @ %0t: z=%h", $time, z);
  always @(spare) if (openpa_obs && UPF::openpa_dom_PD_TOP_ok && $time >= openpa_obs_after) $display("OPENPA-OBS @ %0t: spare=%h", $time, spare);
  `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 MASK: PD_TX isolated before power-down %0d", openpa_seq[1]);
      $display("OPENPA-COVER sequence D2 MASK: isolation released only after PD_TX was back %0d", openpa_seq[2]);
      if (openpa_seq[1]) hq = hq + 1;
      if (openpa_seq[2]) hq = hq + 1;
      $display("OPENPA-COVER-SUMMARY states=%0d/0 declared_transitions=%0d/0 sequences=%0d/2", hs, ht, hq);
  endfunction

  // ---- settle process: 12 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_TX_ok && (UPF::openpa_dom_PD_TOP_ok) && !(UPF::openpa_ctl_0_guard === 1'b1)) openpa_check(1, "set_isolation MASK (boundary_soc.upf:21): PD_TX went off while the isolation enable guard was inactive");
        else if (!UPF::openpa_dom_PD_TX_ok && (UPF::openpa_dom_PD_TOP_ok) && (UPF::openpa_ctl_0_guard === 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_TX_ok && (UPF::openpa_dom_PD_TOP_ok)) openpa_check(2, "set_isolation MASK (boundary_soc.upf:21): isolation released while PD_TX 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_guard === 1'b1) && !UPF::openpa_dom_PD_TX_ok && (UPF::openpa_dom_PD_TOP_ok)) openpa_check(6, "set_isolation MASK (boundary_soc.upf:21): isolation supply AON lost while clamping");
    end
    if (openpa_sp[4]) begin
      openpa_sp[4] = 1'b0;
      if (openpa_x1_t) openpa_check(9, "u_tx/a of PD_TX (off) is read by boundary_soc output a in PD_TOP (on) with no active isolation");
    end
    if (openpa_sp[5]) begin
      openpa_sp[5] = 1'b0;
      if (openpa_x2_t) openpa_check(9, "u_tx/b of PD_TX (off) is read by boundary_soc output b in PD_TOP (on) with no active isolation");
    end
    if (openpa_sp[6]) begin
      openpa_sp[6] = 1'b0;
      if (openpa_x3_t) openpa_check(9, "u_tx/c of PD_TX (off) is read by boundary_soc output c in PD_TOP (on) with no active isolation");
    end
    if (openpa_sp[7]) begin
      openpa_sp[7] = 1'b0;
      if (openpa_x4_t) openpa_check(9, "u_tx/spare of PD_TX (off) is read by boundary_soc output spare in PD_TOP (on) with no active isolation");
    end
    if (openpa_sp[8]) begin
      openpa_sp[8] = 1'b0;
      if (openpa_x5_t) openpa_check(9, "u_tx/z of PD_TX (off) is read by boundary_soc output z in PD_TOP (on) with no active isolation");
    end
    if (openpa_sp[9]) begin
      openpa_sp[9] = 1'b0;
      if (openpa_x6_t) openpa_check(9, "boundary_soc input d of PD_TOP (off) is read by u_tx/d in PD_TX (on) with no active isolation");
    end
    if (openpa_sp[10]) begin
      openpa_sp[10] = 1'b0;
      if (openpa_l1_t) openpa_check(11, $sformatf("PD_TX (%0d uV) drives PD_TOP (%0d uV) on 5 port(s) with no level shifter for this direction", UPF::openpa_net_NT.voltage, UPF::openpa_net_NA.voltage));
    end
    if (openpa_sp[11]) begin
      openpa_sp[11] = 1'b0;
      if (openpa_l2_t) openpa_check(11, $sformatf("PD_TOP (%0d uV) drives PD_TX (%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[12]) begin
      openpa_sp[12] = 1'b0;
      if (!UPF::openpa_dom_PD_TOP_ok && (UPF::openpa_dom_PD_TX_ok)) openpa_check(12, "guard (isolation MASK) 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 7 "island.sv" 0
endmodule

Check Yourself

Predict the outputRun the drawn pin witness. What does the preset sample print?
`timescale 1ns/1ps
module tb;
 logic tx_on=1, host_on=1, payload=1, isolate=0, preset=0, service_in=0;
 wire macro_out=tx_on ? payload : 1'bx;
 wire host_pin=host_on ? (isolate ? 1'b0 : macro_out) : 1'bx;
 logic held;
 always_latch begin
   if (preset) held=1;
   else if (!isolate) held=macro_out;
 end
 wire service_out=service_in;
 task sample(input string phase);
   #1; $display("%s macro=%b host=%b held=%b service=%b",phase,macro_out,host_pin,held,service_out);
 endtask
 initial begin
   sample("online"); payload=0; sample("last");
   isolate=1; tx_on=0; sample("isolated");
   service_in=1; sample("test_pin");
   preset=1; sample("preset"); preset=0;
   host_on=0; sample("host_off"); $finish;
 end
endmodule
ConceptThe bench drives park high, but guard stays x. Both objects exist. Which command supplies the missing path?
ConceptAn opaque output drives a pad from a separate IO supply. Which fact belongs on the output?
ConceptWhich pair can share a feedthrough name?
ConceptDuring isolation, history holds zero. Which setting lets the service preset change it to one before the radio wakes?

Common Mistakes

Wrong Declare the enable net and assume it will follow the PMU.

A declaration creates an object. The connection supplies its driver.

Fix Trace the input, the net and the isolation control in that order.

Wrong Give a macro output the supply of its external receiver.

That describes the far end of the crossing. The output driver lives inside the macro.

Fix Mark each endpoint with the supply of the logic on that side.

Wrong Use feedthrough for any pair of pins that usually agree.

A gate can make two bits agree today and differ tomorrow.

Fix Check that the macro specification gives a direct internal connection.

Wrong Expect a project revision tag to protect an output.

Recording a tag supplies no driver, clamp or power source.

Fix Find the strategy and control that actually drive the receiver.

Remember

  • Create the control objects and connect their driver before using the net.
  • Name the supply for the circuitry behind each opaque pin.
  • A pin requirement and an inserted isolation cell describe different things.
  • A feedthrough describes a direct scalar connection. A revision tag describes the delivery.

Practice

Report a problem with this page