Library Cells and Implementation Commands
The receiver survives a shutdown. Can the library part on the handoff sheet actually do that job? Follow its signal and power pins.
You Will Be Able To
- Match an interface strategy to a cell class, a logic function and named supply pins.
- Distinguish a library definition, a mapping request and a measured receiver value.
- Trace the surviving supply through a repeater and a retained register.
- Read a legacy interface map alongside its current replacement.
- Lesson
- W4.15
- Time
- 36 min
- Runs on
- Your browser
- Check
- 5 questions
- Read the original wire
Before PARK, a follows the transmitter. Nothing at the receiver can choose a safe value.
- Add the receiver requirement
PARK selects one while iso is asserted. An independent supply keeps the guard alive.
- Find pins for the drawing
Trace A through the candidate to X. Follow SLEEP and VPWR separately before accepting the part.
Follow the calls, values and waits
- data bit: u_tx/a → PARK
- call sleep: iso → PARK
- data one: PARK → a
Read the diagram as text
- u_tx/a: TX supply
- iso: host sleep request
- PARK: A and SLEEP feed X
- AON: survives the cut
- a: host receiver
- u_tx/a → a: original wire
- u_tx/a → PARK: A
- iso → PARK: SLEEP
- AON → PARK: VPWR
- PARK → a: X
Drawn candidate implementation. The runnable board uses an abstract isolation cell.
live request=0 raw=0 receiver=0 neighbor=1
guard request=1 raw=0 receiver=1 neighbor=1
sleep request=1 raw=0 receiver=1 neighbor=xIn guard, raw stays zero while receiver becomes one.
In sleep, receiver stays one while neighbor becomes x.
Which library part can do that job? The pin tables come from the SKY130 high-density library at its typical 25 °C, 1.80 V corner.
Read the Power and Ground Pins
The host still needs a valid a when VT falls. Look at the candidate’s power pins first.
| Liberty group | Attribute | Recorded value |
|---|---|---|
| pg_pin VGND | pg_type | primary_ground |
| pg_pin VNB | pg_type | nwell |
| pg_pin VPB | pg_type | pwell |
| pg_pin VPWR | pg_type | primary_power |
| pin X | power_down_function | (!VPWR+VGND) |
| pin X | related_power_pin | VPWR |
The X row names VPWR, and the VPWR row calls it primary_power. Together they identify the rail that must survive.
Each pg_pin group describes one rail pin. Its pg_type distinguishes power, ground and wells.
At X, ! means inversion and + means OR.
When VPWR falls or VGND rises, power_down_function becomes true. X loses its valid powered function.
Before
PARK needs surviving power
X belongs to an unknown rail
Drawn requirement.
After
PARK on AON
AON.power -> VPWR -> X
AON.ground -> VGND
Drawn pin connections.
With power intact, what happens when iso rises?
Identify the Isolation Function
PARK must pass a low bit while TX is awake and drive one before the transmitter sleeps.
| Liberty group | Attribute | Recorded value |
|---|---|---|
| cell | is_isolation_cell | true |
| pin A | isolation_cell_data_pin | true |
| pin SLEEP | isolation_cell_enable_pin | true |
| pin X | function | (A) | (SLEEP) |
At X, the function is (A) | (SLEEP), so asserting SLEEP forces one even with A low.
Before
define_isolation_cell -cells sky130_fd_sc_hd__lpflow_inputiso1p_1 -enable SLEEP -power VPWR -ground VGND
Drawn UPF pin assignment.
After
cell is_isolation_cell true
pin SLEEP isolation_cell_enable_pin true
pin SLEEP related_power_pin VPWR
Recorded SLEEP group.
- Control / FSM
- Control
- Power
- Trace the control
SLEEP selects the clamp.
- Trace the supplies
VPWR and VGND power the cell.
Read the diagram as text
- -enable
- SLEEP: enable pin
- -power
- VPWR: primary power
- -ground
- VGND: primary ground
- -enable → SLEEP: control
- -power → VPWR: power
- -ground → VGND: return
Drawn pin match for inputiso1p_1.
| UPF role | Trace in this cell | Connection on the drawn board |
|---|---|---|
| Cell identified by -cells | sky130_fd_sc_hd__lpflow_inputiso1p_1 | Candidate for PARK |
| -enable | SLEEP, marked as the enable | iso from the powered host |
| -power and -ground | VPWR and VGND | AON.power and AON.ground |
| Data path | A through the OR function to X | u_tx/a to the host receiver |
Load the cell library first, then process its UPF definitions before the board uses those cells (7.1).
Here define_isolation_cell identifies the part (7.4). OpenPA 0.3.0 records that line and simulates the abstract PARK strategy.
define_isolation_cell -cells sky130_fd_sc_hd__lpflow_inputiso1p_1 -enable SLEEP -power VPWR -ground VGNDNow try another part with pins named A and X.
Identify the Level Shifter
The next candidate, lsbuf_lh_isowell_4, also passes data from A to X.
| Liberty group | Attribute | Recorded value |
|---|---|---|
| cell | is_level_shifter | true |
| cell | level_shifter_type | LH |
| pin A | related_power_pin | LOWLVPWR |
| pin X | function | (A) |
| pin X | power_down_function | (!LOWLVPWR+!VPWR+VGND) |
| pin X | related_power_pin | VPWR |
In the A row, related_power_pin is LOWLVPWR. At X it is VPWR, so the two sides use different positive rails.
The LH row says a lower input swing can drive a higher output swing. Data still travels from A to X.
define_level_shifter_cell -cells sky130_fd_sc_hd__lpflow_lsbuf_lh_isowell_4 -direction low_to_high -input_voltage_range {1.2 1.4} -output_voltage_range {1.6 1.8} -input_power_pin LOWLVPWR -output_power_pin VPWR -ground VGNDSuppose the input can range from 1.2 to 1.4 V and the output from 1.6 to 1.8 V.
These are drawn operating limits. The recorded TT pin table gives no characterized range.
In the definition, each input range needs its matching output range (7.5). OpenPA records the proposal without checking either limit.
Before
u_tx/a -> A X -> receiver
Which rail sets each end?
Drawn crossing.
After
LOWLVPWR -> input stage A
VPWR -> output stage X
Drawn supply assignment.
X passes A without a sleep control.
| Candidate for PARK | Worksheet decision | Reason from the Liberty reader |
|---|---|---|
| inputiso1p_1 | accept | is_isolation_cell true |
| lsbuf_lh_isowell_4 | reject | is_isolation_cell absent |
The script rejects lsbuf_lh_isowell_4 because its group lacks the isolation marker. This is a plain Liberty lookup.
Once a part meets the requirement, how do you assign it to PARK?
Map the Interface Strategy
PARK needs an implementation candidate. Older files use separate maps for isolation and level shifting.
map_isolation_cell PARK -domain PD_TX -lib_cells sky130_fd_sc_hd__lpflow_inputiso1p_1map_level_shifter_cell LIFT -domain PD_TX -lib_cells sky130_fd_sc_hd__lpflow_lsbuf_lh_isowell_4The PARK record names inputiso1p_1, while the drawn LIFT strategy names lsbuf_lh_isowell_4.
These older maps select candidates separately. With use_interface_cell, one implementation can serve both strategies (6.62).
Before
set_isolation PARK ...
# No technology candidate selected
Drawn strategy with an open implementation choice.
After
use_interface_cell HOST_PAD -strategy PARK -domain PD_TX \
-lib_cells sky130_fd_sc_hd__lpflow_inputiso1p_1
Drawn current handoff. HOST_PAD names the implementation choice.
Here HOST_PAD proposes a physical part. Adding -force_function would also make the first candidate supply the isolation function.
experiment.upf:1: use_interface_cell is not supported (IEEE 1801-2024 6.62): it replaces the simulation model of isolation and level-shifter cells (9.8, 9.9)OpenPA 0.3.0 refuses even the candidate-only form. Read guard in the trace below to see what actually ran.
live request=0 raw=0 receiver=0 neighbor=1
guard request=1 raw=0 receiver=1 neighbor=1At guard, PARK drives receiver=1 with raw=0. What connects power through a mapped switch?
Map a Power Switch to a Header
When BAY_SW opens, BAY must lose power while FEED stays live.
Before
FEED --------?-------- BAY
GO requests power
Drawn switch path.
After
FEED -> [BAY_GATE] -> BAY
^
GO
Drawn header and enable.
define_power_switch_cell -cells BAY_GATE -type header -stage_1_enable GO -power FEED -power_switchable BAYmap_power_switch BAY_SW -lib_cells BAY_GATE -port_map {FEED src} {BAY dst} {GO en}In the BAY_GATE record, FEED is power and BAY is power_switchable. Reversing them would put the source on the switched side.
The drawn BAY_SW ports are src, dst and en. Its library pins are FEED, BAY and GO, so their names cannot match.
Read each -port_map pair from cell pin to switch port. Without that list, all port names must match (6.37).
A header switches power. A footer switches ground (7.6).
| Question in the handoff | Look here | What the answer settles |
|---|---|---|
| Which abstract switch needs a part? | BAY_SW | The switch instance being implemented |
| Which part can implement it? | BAY_GATE in -lib_cells | The candidate model |
| Which pin stays upstream? | FEED in the cell definition | The unswitched positive supply |
| What requests conduction? | GO in -stage_1_enable | The enable expression for the first stage |
OpenROAD 26Q2-1164 recognized map_power_switch, use_interface_cell and set_isolation in a separate recorded experiment.
It accepted domain -elements and rejected -include_scope. Reading UPF and initializing the floorplan added no cells there.
What if a register must remember its old value when BAY falls?
Keep the Retention Supply Alive
When BAY_SW opens, BAY_FF must remember the transmitter’s last request. Which pin can still power that bit?
Before
BAY -> ordinary storage
BAY off -> previous bit lost
Drawn register with one power path.
After
BAY -> ordinary storage
KEEP -> saved state -> restored bit
Drawn retention cell with a surviving storage path.
define_retention_cell -cells BAY_FF -power KEEP -ground VSS -power_switchable VDDmap_retention_cell LAST -domain PD_TX -lib_cells BAY_FFThe BAY_FF row assigns KEEP to -power and VDD to -power_switchable. The saved bit needs KEEP throughout the outage.
The definition can also describe the cell’s save and restore controls (7.7).
The LAST mapping selects BAY_FF for retention (6.39).
| If the board changes | What to revisit | Reason |
|---|---|---|
| A different register needs saving | The elements of the retention strategy | A cell definition does not select design registers |
| The replacement part uses another backup pin | The cell definition | The board must connect the pin the part really uses |
| The implementation offers another compatible cell | The mapping candidate list | A retention requirement can have several implementations |
Now trace the clock and reset reaching that saved register.
Map the Clamps Around Retained State
BAY_FF still has power during sleep. A stray clock edge or reset on the saved register could still change its state.
Before
LAST -> BAY_FF
clock -> ?
clear -> ?
Drawn retention paths.
After
clock -> CLOCK_GUARD -> clock path
clear -> CLEAR_GUARD -> async path
LAST -> BAY_FF
Drawn clock and clear guards.
map_retention_clamp_cell LAST -domain PD_TX -clock_clamp_lib_cells CLOCK_GUARD -async_clamp_lib_cells CLEAR_GUARDIn the LAST record, CLOCK_GUARD occupies the clock list and CLEAR_GUARD occupies the asynchronous list.
Each list accepts isolation cells or enabled level shifters (6.40).
If reset and clock need different safe levels, one candidate might fail on the other path.
Next, follow a wire that must change during sleep.
Carry a Wake Request Through a Sleeping Island
The host changes wake after BAY goes dark. The far receiver needs that transition.
A fixed clamp cannot carry a changing request, so power the feedthrough separately.
Before
host wake -> buffer on BAY -> receiver
Drawn local buffer.
After
host wake -> buffer on KEEP -> receiver
Drawn keep-alive buffer.
set_repeater PASS_WAKE -domain PD_TX -elements {u_tx/a} -repeater_supply AONThe repeater’s -repeater_supply identifies its supply set (6.52, 9.10).
experiment.upf:1: set_repeater is not supported (IEEE 1801-2024 6.52, 9.10): a repeater corrupts its output when its supply is off, so it cannot be skippedquiet switched=0 keep=1 wake=0 kept=0 local_copy=x
request switched=0 keep=1 wake=1 kept=1 local_copy=x
lost switched=0 keep=0 wake=1 kept=x local_copy=xIn request, kept rises to one while local_copy stays x because only the keep-alive buffer can forward wake.
In lost, KEEP also fails and both outputs become unknown.
Which library pin needs that surviving rail?
Find the Backup Pin on an Always-On Cell
The wake buffer has two positive pins. Follow X to decide which one must survive.
| Liberty group | Attribute | Recorded value |
|---|---|---|
| cell | always_on | true |
| pg_pin KAPWR | pg_type | backup_power |
| pg_pin VGND | pg_type | primary_ground |
| pg_pin VPWR | pg_type | primary_power |
| pin X | function | (A) |
| pin X | power_down_function | (!KAPWR+VGND) |
| pin X | related_power_pin | KAPWR |
At X, related_power_pin names KAPWR, and the KAPWR row calls it backup_power. That is the path you need during sleep.
The cell row says always_on. At X, the power-down expression names KAPWR and VGND, so even this buffer can lose power.
define_always_on_cell -cells sky130_fd_sc_hd__lpflow_clkbufkapwr_1 -power KAPWR -power_switchable VPWR -ground VGNDName the surviving pins and any switchable supply separately (7.2).
| Board event | Keep-alive pin | Local primary pin | Expected buffer role |
|---|---|---|---|
| Normal work | Powered | Powered | Pass changes on A |
| Local island sleeps | Powered | Off | Keep passing changes on A |
| Keep-alive source also fails | Off | Off | No valid driven result |
At request in the hand model, kept=1 matches the middle row. At lost, kept=x matches the last row.
Follow wake upstream to the protected pad next.
Recognize a Diode Clamp at a Pad
A spike at BAY_PAD reaches RX before it reaches the wake buffer. Which rail gives that charge a path out?
Because a protection diode conducts toward a rail, it needs no sleep enable.
Before
RX -> input circuitry
Protection path unspecified
Drawn pad before annotating protection.
After
RX -> input circuitry
RX -> protection diode -> VIO
Drawn power-side diode. There is no sleep input on this path.
define_diode_clamp -cells BAY_PAD -data_pins RX -type power -power VIOThe BAY_PAD row names RX under -data_pins and VIO under -power. The type power identifies the protected side.
Ground-side protection needs its return pin. Protection on both sides needs both rails (7.3).
| Requirement at the same interface | Evidence to take to review |
|---|---|
| Hold a safe Boolean during shutdown | Isolation function, enable sense and a surviving cell supply |
| Carry a wake transition during shutdown | A buffer supply and a library output related to its keep-alive pin |
| Describe protection on an exposed input | The diode-protected data pin, protection type and corresponding rail |
| Remember a value inside the island | A retention strategy, the storage mapping and its backup connection |
In W4.15.2, trace the protected pin to the rail named on its pad card.
Try It
Run the sequence, then change d so its low bit is one. Explain why the guard becomes harder to see.
Find PARK in the generated map and compare receiver with neighbor during sleep. D9 identifies the unprotected outputs.
Find the cell definition in the UPF panel. The generated design runs the abstract strategy. The Liberty comparison is a separate worksheet.
OPENPA-INFO corruption=x seed=1 live request=0 raw=0 receiver=0 neighbor=1 guard request=1 raw=0 receiver=1 neighbor=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 request=1 raw=0 receiver=1 neighbor=x wake request=0 raw=0 receiver=0 neighbor=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 PARK: PD_TX isolated before power-down 1 OPENPA-COVER sequence D2 PARK: isolation released only after PD_TX was back 1 OPENPA-COVER-SUMMARY states=0/0 declared_transitions=0/0 sequences=2/2Read the power intent: boundary.upf
upf_version 4.0
define_isolation_cell -cells sky130_fd_sc_hd__lpflow_inputiso1p_1 -enable SLEEP -power VPWR -ground VGND
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
set_isolation PARK -domain PD_TX -elements {u_tx/a} -clamp_value 1 -isolation_signal iso -isolation_supply AON -location parent
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: 24 objects
3 supply port, 3 supply net, 6 output corruption, 1 isolation cell, 2 supply set, 9 dynamic check.
| Object | Where | Detail | Rule | UPF line |
|---|---|---|---|---|
| Supply port | VA | boundary.upf:6 | ||
| Supply port | VT | boundary.upf:7 | ||
| Supply port | VG | boundary.upf:8 | ||
| Supply net | NA | boundary.upf:6 | ||
| Supply net | NT | boundary.upf:7 | ||
| Supply net | NG | boundary.upf:8 | ||
| Output corruption | u_tx/a | C2 | boundary.upf:5 | |
| Isolation cell | u_tx/a | PARK · clamp 1 | I1-I5 | boundary.upf:19 |
| Output corruption | u_tx/b | C2 | boundary.upf:5 | |
| Output corruption | u_tx/c | C2 | boundary.upf:5 | |
| Output corruption | u_tx/spare | C2 | boundary.upf:5 | |
| Output corruption | u_tx/z | C2 | boundary.upf:5 | |
| Output corruption | u_tx/d | C2 | boundary.upf:4 | |
| Supply set | AON | boundary.upf:15 | ||
| Supply set | TX | boundary.upf:16 | ||
| Dynamic check | D1/D2/D6 PARK | D1, D2, D6 | boundary.upf:19 | |
| Dynamic check | D9 crossing 1 | D9 | boundary.upf:5 | |
| Dynamic check | D9 crossing 2 | D9 | boundary.upf:5 | |
| Dynamic check | D9 crossing 3 | D9 | boundary.upf:5 | |
| Dynamic check | D9 crossing 4 | D9 | boundary.upf:5 | |
| Dynamic check | D9 crossing 5 | D9 | boundary.upf:5 | |
| Dynamic check | D9 crossing 6 | D9 | boundary.upf:4 | |
| Dynamic check | D11 PD_TX->PD_TOP | D11 | boundary.upf:5 | |
| Dynamic check | D11 PD_TOP->PD_TX | D11 | boundary.upf:4 |
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.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.upf:6)
supply_net_type openpa_port_VT; // supply port VT (boundary.upf:7)
supply_net_type openpa_port_VG; // supply port VG (boundary.upf:8)
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.upf:4)
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.upf:5)
// 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; // copy of iso (isolation PARK)
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(1), .SENSE(1'b1), .ID(268435457)) openpa_u_tx_a_iso (.d(openpa_u_tx_a_s1), .q(a), .en(UPF::openpa_ctl_0_iso), .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.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;
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
// ---- copies of the design signals the UPF names (4-state, so X is visible)
always @(iso or openpa_kick) openpa_ctl_0_iso = iso;
// ---- 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.upf:4): 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.upf:5): 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 PARK (boundary.upf:19): 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_iso or negedge UPF::openpa_ctl_0_iso or posedge openpa_kick) begin
if (openpa_ig1_act && !(UPF::openpa_ctl_0_iso === 1'b1))
begin openpa_sp[2] = 1'b1; openpa_sreq = 1'b1; end
if (openpa_ig1_act != (UPF::openpa_ctl_0_iso === 1'b1)) openpa_t({"PARK enable ", (UPF::openpa_ctl_0_iso === 1'b1) ? "active" : "inactive"});
openpa_ig1_act = (UPF::openpa_ctl_0_iso === 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 PARK
bit openpa_x1_t;
always @(UPF::openpa_dom_PD_TX_ok or UPF::openpa_dom_PD_TOP_ok or UPF::openpa_ctl_0_iso 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_iso === 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 PARK: PD_TX isolated before power-down %0d", openpa_seq[1]);
$display("OPENPA-COVER sequence D2 PARK: 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_iso === 1'b1)) openpa_check(1, "set_isolation PARK (boundary.upf:19): PD_TX went off while the isolation enable iso was inactive");
else if (!UPF::openpa_dom_PD_TX_ok && (UPF::openpa_dom_PD_TOP_ok) && (UPF::openpa_ctl_0_iso === 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 PARK (boundary.upf:19): 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_iso === 1'b1) && !UPF::openpa_dom_PD_TX_ok && (UPF::openpa_dom_PD_TOP_ok)) openpa_check(6, "set_isolation PARK (boundary.upf:19): 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, "iso (isolation PARK) 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
Common Mistakes
Wrong Pass a mapping because the abstract sleep test passed.
The simulator can use a strategy while only recording the library choice.
Fix Check the candidate class and each pin against the library view.
Wrong Wire every positive pin of a keep-alive buffer to the local rail.
The output may depend on a separate backup pin.
Fix Start at the output and follow its related power pin.
Wrong Use a pad protection diode as a logic clamp.
The diode gives charge a path to a rail. It has no sleep control.
Fix Choose isolation from the required receiver value and control.
Remember
- Trace the output function and its power relationship before selecting a cell.
- A cell definition describes a part. A mapping connects it to a design requirement.
- A feedthrough needs power throughout the interval when a request must propagate.
- Compare the abstract simulation with a separate cell-class and pin review.