# upflint

> Lint UPF (IEEE 1801) power intent: evaluates the UPF like a power-intent tool and checks supplies, domains, switches, power states, isolation, level shifting and retention against a rule catalogue, optionally against the RTL.

- Catalog id: `Upflint`; bundle: `upflint`; latest version 20261018
- Keywords: UPF lint, power intent checker, IEEE 1801, low power verification
- Terms: as stated on edautils.com, EDAUtils tools are free for commercial and academic use, with no license server. The bundle's own metadata says: "Free to evaluate with the bundled licence; commercial licences from help@edautils.com". Licence prerequisites per tool are under "How an agent runs it".
- This file: https://edautils.com/capabilities/upflint.md

## Downloads

- EDAUtils download site: https://edautils.ai/download/Upflint (latest file `upflint-20261018.tar.gz`)
- SourceForge: https://sourceforge.net/projects/edautils-free-utilities/files/upflint/
- GitHub Releases: https://github.com/edautils/releases/releases/download/RELEASE_20261018/upflint-20261018.tar.gz (release `RELEASE_20261018`; all releases: https://github.com/edautils/releases/releases)

## How an agent runs it

The following is the AGENTS.md shipped at the root of the bundle.

UPF (IEEE 1801 power intent) lint checker. Reads one or more UPF files, **evaluates** them in a
private Tcl interpreter (JTcl) the way a power-intent tool does -- `set`, `expr`, `foreach`, `proc`,
`if` and `$variables` work, `source` and `load_upf` are followed (`load_upf -scope` moves the scope),
`set_scope` moves it -- builds its own power-intent model (domains and their extents, supply ports,
nets and sets with their functions and handles, associations, switches, isolation / level-shifter /
retention / repeater strategies, power states, state groups, legacy PSTs, port attributes, power
models; every object with the statement that created it and the `-update`s that changed it, each
with file and line) and checks it against the catalogue of lint rules.

Two levels:

- **Level 1 -- the UPF alone** (`upflint`). Design-independent. Rules the catalogue marks [N]
  (exact only with a design) run at intent level here and say so in their message (UPF-027, 092,
  098, 128, 148, 193, 225, 290, 291, 293); UPF-247 cannot be decided without a design and never fires.
- **Level 2 -- the UPF against the elaborated RTL**, through `elabvl`, `elabvh` or `elabmixed`
  `-upf <file.upf> -lint_upf [-lint_report <file>]`. The same engine runs Level 1, then the [N]
  rules exactly (their intent-level Level 1 findings are replaced by the exact ones) and the
  design-only rules UPF-301..312 (domain crossings found from RTL connectivity, control signals
  traced to their drivers, ...). See "Level 2" below.

Main class: `com.eu.miscedautils.upflint.upflint` (jar `lib/designplayer.jar`; the `.bat` launcher
uses the same class). Source: `designplayershell/src/com/eu/miscedautils/upflint/` (`UpfSchema.java`
the per-command option table, `UpfLoader.java` the Tcl evaluation and the per-statement rules,
`UpfModel.java` the model, `PowerStates.java` the supply/state analysis, `UpfChecks.java` the Level 1
rules, `UpfDesignRules.java` the Level 2 rules, `UpfRules.java` the catalogue, `UpfLintEngine.java`
the engine shared with elab). The elab hook is `com.eu.miscedautils.elab.UpfLint`.

### Where it ships

Its own bundle, `upflint.tar.gz` (flow `upflint` in `bundle_jar_files.csh`; release tree
`release_scripts/upflint/1.0`), and as a point tool in the **upf-shell** and **designplayer-shell**
bundles (`bin/upflint`; this guide as `tools/upflint/AGENTS.md`, examples under
`tools/upflint/examples/`). Level 2 ships with the elab tools (`elabvl`, `elabvh`, `elabmixed`
in their own bundles). The regression harness runs it through `tools/regress/bin/upflint`.

### Prerequisites

- Java on `PATH` (the launcher runs plain `java`). Use Java 11 or newer (Java 21 recommended: the
  release is built and regression-tested with OpenJDK 21); the bundled JAXB and Eclipse libraries
  are class-file version 55, so a Java 8 runtime fails with `UnsupportedClassVersionError`.
- `EDAUTILS_ROOT` = the unpacked bundle directory (must contain `bin/` and `lib/`). The launcher
  exits 1 with "Environment variable EDAUTILS_ROOT is not set" otherwise. `source setup_env.sh`
  (or `setup_env.csh`) from the bundle root sets `EDAUTILS_ROOT`, prepends `bin/` to `PATH` and sets `CLASSPATH=$EDAUTILS_ROOT/lib/designplayer.jar`. It does
  **not** set `EDAUTILS_LICENSE_FILE`; set it yourself.
- Licence: licence feature `UPFLINT` (also granted by `UPFBACKBONE` and, through it,
  `DESIGNPLAYERBACKBONE`). No valid licence: exit status 10 (messages 6037/6405, "License Checkout
  Failed"); a valid licence without the feature: exit status 10 (message 6404 "Failed to checkout
  LICENSE for the feature : UPFLINT"). The licence file is searched in this order:
  `$EDAUTILS_LICENSE_FILE`, `./edautils.lic`, `$HOME/edautils.lic`, `$EDAUTILS_ROOT/edautils.lic`.
  Level 2 runs under the elab tool's own licence.
- Optional environment: `JAVA_FLAGS` (passed to the JVM; with no heap option in it the launcher adds `-Xmx` sized to the machine (`bin/eu_heap.sh`: the largest of 64/32/16/12/8/4 GB within 3/4 of physical or cgroup memory, else 2 GB; `EDAUTILS_MAX_HEAP_GB` caps it)), `EDAUTILS_LOG_FILE` /
  `EDAUTILS_APPEND_LOG_FILE` (log file name; the second appends), `EDAUTILS_PRINT_STACK_TRACE`
  (stack traces on internal exceptions). No tool-specific environment variables are read.
- No external tools needed.

### Invocation

```
upflint -in <file.upf> [-in <file.upf> ...] [-f <filelist>] [-report <file>]
        [-disable <ID,ID..>] [-enable_only <ID,ID..>] [-severity error|warning|info]
        [-list_rules] [-quiet] [-nobanner] [-user <email>] [-help]
```

| Option | Meaning |
|---|---|
| `-in <file>` | UPF file to lint; repeatable, read in the order given into one power intent (each from the design top) |
| `-f <filelist>` | File with one UPF path per line (`#` comments, blank lines skipped); a relative path that does not exist from the run directory is taken relative to the list |
| `-report <file>` | Report file (default `upflint.rpt`) |
| `-disable <IDs>` | Rules not to report (comma or blank separated, e.g. `UPF-052,UPF-079`) |
| `-enable_only <IDs>` | Report only these rules |
| `-severity <s>` | Lowest severity reported: `error`, `warning` or `info` (default `info`, i.e. everything) |
| `-list_rules` | Print the rule catalogue (ID, severity, `implemented` / `L1+L2` / `deferred`, title) on stdout and exit 0; no licence needed |
| `-quiet` | Nothing on stdout/log (the report is still written) |
| `-nobanner` | No banner |
| `-user <email>` | User id recorded for the licence/usage record |
| `-help` / `-h` | Usage, exit 0 |

An unknown rule id in `-disable`/`-enable_only`, an unknown option, a missing value, no input,
or an unreadable input/file list is a usage error: message 61200 and exit 1. Filters apply to the
report, the log and the exit status alike (a disabled error does not fail the run).

### How a UPF is read

- Each top-level statement is evaluated on its own; a Tcl error in one is reported (UPF-000) and the
  next statement still runs. An unbalanced brace/bracket/quote is reported at the line where the
  statement starts and reading resumes on the next line. Commands run inside a `proc` or a loop
  carry the line of the top-level statement that ran them.
- `source` and `load_upf` are followed (relative paths are tried from the run directory, then from
  the including file's directory); a missing file or a load cycle is UPF-029; findings in a loaded
  file carry that file's path. `load_upf -scope <inst>` reads the file in that scope and restores
  the scope after it; `set_scope` cannot leave the scope the file was given (UPF-028).
- Every IEEE 1801 command of the upf-shell catalogue is defined. Options are bound by a
  per-command table (flag vs valued, list arity, enumerations, required options, first UPF version,
  deprecated); the UPF 2.x spellings real decks still use are accepted (`-isolation_supply_set`,
  `add_power_state <obj> -state NAME {-supply_expr ...}`, `` `{FULL_ON, 1.2} ``, an
  `-output_supply_port` without a net ...). Query commands (`query_*`, `upf_*`, `get_supply_*`),
  `define_*_cell`, `set_design_attributes` and the EDAUtils extensions are known but their options
  are not checked. In a `upf_version 4.0` file an unknown command is UPF-266 (info), not UPF-001.
- `find_objects` is not evaluated on the UPF alone (its result is "unknown", UPF-290/291 info);
  under Level 2 it is evaluated against the design (`-pattern` glob or `-regexp`, `-object_type
  inst|port|net`, `-transitive`, `-leaf_only`, `-non_leaf`).
- For safety, `exec`, `open`, `socket`, `cd`, `exit`, `package`, `load`, `vwait`, `after`, `update`,
  `gets`, `read`, `puts`, `close`, `flush`, `fconfigure`, `pwd`, `glob` and the writing forms of
  `file` are **not executed**; `exec`, `cd`, `after`, `socket`, `exit`, `open ... w|a` and `file
  delete|rename|copy|mkdir` are reported (UPF-012).
- Names are per scope; a bare name not found in its scope is looked up in the enclosing scopes. A
  power model (`begin_power_model` ... `end_power_model`) has scopes of its own: nothing outside it
  is visible inside (UPF-248).
- Nothing is sent anywhere: the tool registers no usage of its own and lint findings never enter
  the tool's error record.

### Supply and state analysis (rules marked S in the catalogue)

- Each supply is identified by its power net (else the supply set itself). Nets joined by
  `connect_supply_net` to supply ports (of the scope or of an instance below) and supplies declared
  with `set_equivalent` are one supply.
- A supply-set state's `-supply_expr` gives the supply ON (FULL_ON / PARTIAL_ON, with its voltage)
  or OFF; legacy `add_port_state` values do the same for a net. ON and OFF are predefined for every
  supply set.
- A domain state's `-logic_expr` (a conjunction of `object == state`; `!=` terms and design signals
  pin nothing) pins supplies; domain and group states referenced in it are expanded.
- The legal system states are the legal (non `-illegal`) states of the top-level power state groups,
  else the legacy PST rows, else one unconstrained state. A supply a system state does not pin takes
  any value its states give it; a supply no state gives a value is **unknown**, and the rules that
  need it report "not analysable" (UPF-052, 152, 176, 303) instead of guessing.
- "The other side of a domain's boundary" without a design means the adjacent domains: the domain
  around each of its extent roots and the domains rooted directly inside its extent.
- The domain of a control signal without a design (UPF-098, 148, 193, intent level) is the domain
  of the scope it is named in; an input logic port of a scope is driven from the scope's parent.

### Level 2 (elabvl / elabvh / elabmixed -upf <file.upf> -lint_upf)

```
elabvl    -top <top> -work <lib> [-out <f>] -upf <file.upf> [-upf_report <f>] -lint_upf [-lint_report <f>]
elabvh    -top <top> -work <lib> ...        (same intent options)
elabmixed -top <top> -work <lib> ...        (same intent options)
```

- The UPF is first bound to the elaborated design (`-upf`, report `-upf_report`); `-lint_upf` then
  runs upflint's Level 1 and Level 2 on it and writes one report, `-lint_report` (default
  `<tool>.lint.rpt`):

```
## lint report: design <top>, upf <file.upf>
## <severity> <rule> <L1: intent alone | L2: against the design> <file:line> <message>
<severity> <rule-id> <L1|L2> <file>:<line> <message>
...

## summary per rule
<rule-id>  <count>
## total: <E> error(s), <W> warning(s), <I> info
```

- Exit status of the elab tool with `-upf`: **0** no error, **1** a binding/load/usage error (the
  `-upf` binder reports UPF instances the design does not have, message 61010, before linting),
  **2** lint errors only. `-lint_sdc` lints an SDC the same way; both can be given together.
- A crossing is a port of an instance whose power domain differs (with a different primary supply)
  from the domain of its parent, where the net it connects to lives; an output carries the
  instance's domain out, an input carries the parent's in. The design's own ports cross to the
  outside (UPF-304/305/310 count them).
- A control signal (switch `-control_port`/`-ack_port` net, `-isolation_signal`, `-save_signal`,
  `-restore_signal`, a design signal in a `-logic_expr`) must be a UPF logic port/net or a net or port
  of the design. Its driver is traced: an input port up through its instance's connection, a net or
  output down into the child instance whose output drives it; the driver's instance gives its domain.
- Level 2 rules (and what the [N] rules check exactly):

| Rule | Fires when |
|---|---|
| UPF-301 E | a crossing from a domain that can be OFF into one that is ON in the same legal state, with no isolation strategy (source side `-applies_to outputs/both` or sink side `inputs/both`, `-elements` covering the port; `-no_isolation` counts as a decision) |
| UPF-302 W | a crossing between domains ON together at different voltages, with no level-shifter strategy covering it |
| UPF-303 I | a crossing where either side has no voltage: level shifting not analysed |
| UPF-304 W | an isolation strategy whose `-elements` / `-applies_to` match no crossing or top-level port |
| UPF-305 W | the same for a level-shifter strategy |
| UPF-306 E | an isolation or retention control signal that is neither a UPF logic port/net nor in the design |
| UPF-307 W | a control signal driven from a domain that can be OFF while it is needed (switch: while the switched supply is OFF; isolation/retention: while the controlled domain is OFF) |
| UPF-308 W | a retention strategy covering an instance with no flip-flop or latch in it or below it (Verilog edge-triggered/FF/latch `always`, VHDL clocked process; black boxes are assumed to have state) |
| UPF-309 W | a power-switch output that is the primary of no domain holding an instance of the design |
| UPF-310 W | a top-level output of a top domain that can be OFF, with no isolation strategy covering it |
| UPF-311 E | an instance of the design in no power domain (the topmost one of an unpowered subtree) |
| UPF-312 W | a strategy `-elements` port whose direction contradicts `-applies_to` |
| UPF-027 E | `set_scope` / `load_upf -scope` to a path that is not an instance of the design |
| UPF-092 E | a switch control/ack net that is neither a UPF logic port/net nor in the design |
| UPF-098 W | a switch control driven from the domain the switch powers |
| UPF-128 E | a `-logic_expr` design signal neither declared by the UPF nor in the design |
| UPF-148 W | an isolation signal driven from the isolated domain |
| UPF-193 W | a save/restore signal driven from the retained domain |
| UPF-225 I | each top-level port of a switchable top domain without driver/receiver supply or related ports |
| UPF-247 E | `apply_power_model` on an instance whose module is not in the model's `-for` list |
| UPF-290 W | a `find_objects` feeding `-elements` that matches nothing in the design |
| UPF-291 E | a `find_objects` scope that is not an instance of the design |
| UPF-293 W | a `-transitive` `find_objects` giving a domain an instance that another domain already names |

- The `-upf` binder binds a strategy `-elements` entry that names a port to that port, and leaves
  `find_objects` results to the lint (UPF-290/291/293): neither is a binding error.

### Inputs / Outputs

- Reads: the UPF files and anything they `source` / `load_upf`.
- Writes: the report (`-report`, default `upflint.rpt`) and the log `upflint.log` (override with
  `EDAUTILS_LOG_FILE`), both in the current directory.
- Report format (stable; the regression goldens are these files):

```
## upflint report
## inputs: <the -in / -f files>
<severity> <rule-id> <file>:<line> <message>        one line per finding, in file order
...

## summary per rule
<rule-id>  <catalogue severity>  <count>  <title>
## total: <E> error(s), <W> warning(s), <I> info
```

  `<severity>` is `error`, `warning` or `info` -- the finding's own: an [N] rule at intent level
  reports below its catalogue severity (UPF-027, 092, 128, 290, 291 as info), and UPF-262 is an
  error under `upf_version 4.0`. `<file>` is the path as given (or as loaded).
- Log: the same finding lines prefixed `upflint: `, then `Written lint report into file : <f>`
  (61203) and `Lint result: <E> error(s), <W> warning(s), <I> info` (61204). The closing
  `Found N error(s) ...` line counts tool errors (usage, licence), not lint findings.

### Exit status and messages

- **0** no lint error (warnings and info never fail the run), **2** at least one lint error
  reported, **1** usage error / unreadable input / internal error, **10** no licence.
  The launcher itself exits 1 when `EDAUTILS_ROOT` is not set.
- Message ids 61200-61239 belong to this tool: 61200 usage error, 61201 options, 61202 reading a
  file, 61203 report written, 61204 lint result, 61210 a finding, 61220-61228 usage text, 61239
  internal error. Displayed ids carry the usual 50000 offset (`111204`).

### Rules

`upflint -list_rules` prints this table. Catalogue and rationale:
`BUILD-STATE/AUDIT/S56-UPF-LINT-RULES.md` (153 rules UPF-001..UPF-293, each with a failing and a
passing example). All 153 run on the UPF alone except UPF-247 (Level 2 only); the 10 [N] rules
listed above run at intent level on the UPF alone and exactly under Level 2. UPF-000 is upflint's
own (a statement Tcl cannot evaluate); UPF-301..312 are the Level 2 design rules.

Level column: `L1` the UPF alone; `L1 (intent) + L2 (exact)`; `L2 only` (elab `-lint_upf`).

| ID | Severity | Level | Title |
|---|---|---|---|
| UPF-000 | error | L1 | Statement Tcl cannot evaluate |
| UPF-001 | error | L1 | Unknown command |
| UPF-002 | error | L1 | Unknown option |
| UPF-003 | error | L1 | Required option missing |
| UPF-004 | error | L1 | Malformed option value (list arity) |
| UPF-005 | error | L1 | Bad enumerated value |
| UPF-006 | error | L1 | Mutually exclusive options |
| UPF-007 | error | L1 | Signal/sense count mismatch |
| UPF-008 | warning | L1 | Non-repeatable option given twice |
| UPF-009 | error | L1 | Boolean expression syntax |
| UPF-010 | error | L1 | Unmatched begin_power_model / end_power_model |
| UPF-011 | warning | L1 | upf_version not first |
| UPF-012 | warning | L1 | Side-effecting Tcl in power intent |
| UPF-020 | error | L1 | Reference to an undefined object |
| UPF-021 | error | L1 | Duplicate definition without -update |
| UPF-022 | warning | L1 | Name shared by different object kinds in one scope |
| UPF-023 | error | L1 | Handle not declared on its domain |
| UPF-024 | warning | L1 | User supply set named like a predefined handle |
| UPF-025 | error | L1 | Strategy name reused in a domain |
| UPF-026 | warning | L1 | Names differing only in case |
| UPF-027 | error | L1 (intent) + L2 (exact) | set_scope / load_upf -scope to a missing instance |
| UPF-028 | error | L1 | Reference above the design top |
| UPF-029 | error | L1 | load_upf file not found / loads itself |
| UPF-030 | warning | L1 | Unreferenced object |
| UPF-031 | warning | L1 | -exclude_elements not in the included set |
| UPF-032 | warning | L1 | Element listed twice |
| UPF-040 | error | L1 | Used supply net has no source |
| UPF-041 | warning | L1 | Supply port or net connected to nothing |
| UPF-042 | error | L1 | Multiple drivers on an unresolved net |
| UPF-043 | warning | L1 | Resolution declared on a single-source net |
| UPF-044 | error | L1 | Power and ground functions on the same net |
| UPF-045 | error | L1 | Used supply set has no power function |
| UPF-046 | error | L1 | Used supply set has no ground function |
| UPF-047 | error | L1 | Function rebound to a different net |
| UPF-048 | error | L1 | Conflicting associate_supply_set |
| UPF-049 | error | L1 | Supply net connected to a logic port (or logic net to a supply port) |
| UPF-050 | error | L1 | Two output supply ports on one net |
| UPF-051 | error | L1 | Equivalent supplies that differ |
| UPF-052 | info | L1 | Supply voltage unknown |
| UPF-053 | warning | L1 | Net used as power in one set and ground in another |
| UPF-054 | error | L1 | connect_supply_set to an unknown function or pg_type |
| UPF-070 | error | L1 | Element in more than one domain |
| UPF-071 | error | L1 | Design top in no domain |
| UPF-072 | warning | L1 | Domain with empty extent |
| UPF-073 | error | L1 | Domain primary has no supply |
| UPF-074 | error | L1 | Composite domain: undefined subdomain, or a subdomain in two composites |
| UPF-075 | warning | L1 | Composite subdomains with different primaries and no -supply |
| UPF-076 | error | L1 | Strategy uses a supply not available to its domain |
| UPF-077 | warning | L1 | -update adds elements to an atomic domain |
| UPF-078 | error | L1 | Primary handle bound twice |
| UPF-079 | info | L1 | Domain equivalent to its parent |
| UPF-090 | error | L1 | on_state/off_state names an undeclared input supply port |
| UPF-091 | error | L1 | State expression uses an undeclared control port |
| UPF-092 | error | L1 (intent) + L2 (exact) | Control/ack net undefined |
| UPF-093 | warning | L1 | on_state and off_state overlap |
| UPF-094 | info | L1 | Control assignments that are neither on nor off |
| UPF-095 | error | L1 | Switch powered by its own output |
| UPF-096 | warning | L1 | Switch output feeds no supply set |
| UPF-097 | warning | L1 | Switch output has no OFF state |
| UPF-098 | warning | L1 (intent) + L2 (exact) | Switch control from the switched domain |
| UPF-099 | warning | L1 | Constant switch control |
| UPF-100 | error | L1 | ack expression references a net that is not the ack net |
| UPF-110 | error | L1 | Option not allowed for the object kind |
| UPF-111 | error | L1 | supply_expr outside the object's own functions |
| UPF-112 | error | L1 | logic_expr names an undefined state |
| UPF-113 | error | L1 | logic_expr names an undefined object |
| UPF-114 | error | L1 | State redefined without -update |
| UPF-115 | error | L1 | Reserved state name |
| UPF-116 | error | L1 | State added after -complete |
| UPF-117 | warning | L1 | Supply set with states but none NORMAL |
| UPF-118 | error | L1 | Malformed supply value |
| UPF-119 | warning | L1 | Duplicate states |
| UPF-120 | warning | L1 | Overlapping states |
| UPF-121 | error | L1 | Group state references objects outside the group's scope |
| UPF-122 | warning | L1 | Domain states over supplies not of the domain |
| UPF-123 | warning | L1 | Domain never ON |
| UPF-124 | error | L1 | No legal system state |
| UPF-125 | error | L1 | State transition to/from an undefined state |
| UPF-126 | error | L1 | Legacy PST inconsistent |
| UPF-127 | warning | L1 | Legacy and 3.x states on the same supply |
| UPF-128 | warning | L1 (intent) + L2 (exact) | logic_expr on a design signal the UPF never declares |
| UPF-140 | warning | L1 | Switchable domain with no isolation |
| UPF-141 | error | L1 | Isolation without control |
| UPF-142 | error | L1 | Isolation supply is the switched primary |
| UPF-143 | error | L1 | Isolation supply off while needed |
| UPF-144 | error | L1 | Clamp value invalid |
| UPF-145 | error | L1 | Clamp needs a missing supply function |
| UPF-146 | warning | L1 | Clamp differs from the port's declared clamp |
| UPF-147 | error | L1 | -location parent at the top |
| UPF-148 | warning | L1 (intent) + L2 (exact) | Isolation control from the isolated domain |
| UPF-149 | warning | L1 | Constant isolation control |
| UPF-150 | warning | L1 | Isolation signal also the switch control, same sense |
| UPF-151 | warning | L1 | Isolation on a never-off domain |
| UPF-152 | info | L1 | Isolation not analysable |
| UPF-153 | warning | L1 | -no_isolation on a boundary that needs isolation |
| UPF-154 | warning | L1 | Overlapping isolation strategies |
| UPF-155 | error | L1 | Strategy element outside its domain |
| UPF-156 | warning | L1 | -source/-sink filter can never match |
| UPF-157 | error | L1 | use_interface_cell names an unknown or wrong-kind strategy |
| UPF-170 | warning | L1 | Different voltages, no level shifter |
| UPF-171 | warning | L1 | Level shifter where voltages never differ |
| UPF-172 | error | L1 | Rule contradicts the voltages |
| UPF-173 | warning | L1 | Threshold never exceeded |
| UPF-174 | warning | L1 | Input/output supply not the boundary's supplies |
| UPF-175 | error | L1 | Level-shifter location invalid |
| UPF-176 | info | L1 | Level shifting not analysable |
| UPF-177 | warning | L1 | Level shifter needs isolation too (enable level shifter) |
| UPF-190 | error | L1 | Retention supply is the switched primary |
| UPF-191 | warning | L1 | Retention supply off while the primary is off |
| UPF-192 | error | L1 | Save without restore (or restore without save) |
| UPF-193 | warning | L1 (intent) + L2 (exact) | Save/restore from the retained domain |
| UPF-194 | warning | L1 | Constant save/restore |
| UPF-195 | warning | L1 | Save and restore the same signal with the same sense/edge |
| UPF-196 | error | L1 | Retention element outside the domain |
| UPF-197 | warning | L1 | Element in two retention strategies |
| UPF-198 | error | L1 | set_retention_elements list undefined |
| UPF-199 | error | L1 | Retention supply without power |
| UPF-200 | warning | L1 | Retention on a never-off domain |
| UPF-201 | error | L1 | map_retention_cell names an unknown strategy |
| UPF-210 | error | L1 | Repeater supply undefined or without power |
| UPF-211 | warning | L1 | Repeater supply off while the path is live |
| UPF-212 | error | L1 | Repeater element outside its domain |
| UPF-220 | error | L1 | Driver/receiver supply undefined |
| UPF-221 | warning | L1 | Driver supply on a top output / receiver supply on a top input |
| UPF-222 | error | L1 | Conflicting attributes on one port |
| UPF-223 | error | L1 | Contradictory flags |
| UPF-224 | error | L1 | related_power_port / related_ground_port not a supply port |
| UPF-225 | info | L1 (intent) + L2 (exact) | Top port without supply attributes |
| UPF-240 | error | L1 | apply_power_model of an undefined model |
| UPF-241 | error | L1 | supply_map formal is not a supply set of the model |
| UPF-242 | error | L1 | supply_map actual undefined in the applying scope |
| UPF-243 | warning | L1 | Model supply set left unmapped |
| UPF-244 | error | L1 | Formal mapped twice |
| UPF-245 | warning | L1 | Model defined but never applied |
| UPF-246 | error | L1 | Model applied twice to one instance |
| UPF-247 | error | L2 only | Model applied to an instance of another module |
| UPF-248 | error | L1 | Model body refers outside itself |
| UPF-249 | error | L1 | Mapped supplies with incompatible states |
| UPF-260 | error | L1 | Command not in the declared version |
| UPF-261 | error | L1 | Option not in the declared version |
| UPF-262 | warning | L1 | Legacy command (E for 4.0) |
| UPF-263 | warning | L1 | Deprecated option (`set_port_attributes -repeater_supply` only from UPF 3.0, where `set_repeater` replaces it) |
| UPF-264 | error | L1 | Unknown upf_version value |
| UPF-265 | warning | L1 | Loaded file declares another version |
| UPF-266 | info | L1 | 1801-2024 constructs not checked |
| UPF-280 | error | L1 | -update of an object that does not exist |
| UPF-281 | error | L1 | -update before the create |
| UPF-282 | error | L1 | -update changes a fixed property |
| UPF-283 | warning | L1 | -update in another scope than the create |
| UPF-284 | error | L1 | -update on a command that has no -update |
| UPF-290 | warning | L1 (intent) + L2 (exact) | find_objects result is empty |
| UPF-291 | error | L1 (intent) + L2 (exact) | find_objects scope not found |
| UPF-292 | error | L1 | find_objects bad -object_type |
| UPF-293 | warning | L1 (intent) + L2 (exact) | find_objects -transitive result feeds -elements across domains |
| UPF-301 | error | L2 only | Unisolated crossing from a switchable domain |
| UPF-302 | warning | L2 only | Crossing between different voltages without a level shifter |
| UPF-303 | info | L2 only | Crossing whose supply voltages are unknown |
| UPF-304 | warning | L2 only | Isolation strategy covers no domain-boundary port |
| UPF-305 | warning | L2 only | Level-shifter strategy covers no domain-boundary port |
| UPF-306 | error | L2 only | Isolation or retention control signal not in the design |
| UPF-307 | warning | L2 only | Control signal driven from a domain that can be OFF while it is needed |
| UPF-308 | warning | L2 only | Retention on an instance with no sequential logic |
| UPF-309 | warning | L2 only | Power-switch output supplies no domain present in the design |
| UPF-310 | warning | L2 only | Top-level output of a switchable top domain without isolation |
| UPF-311 | error | L2 only | Design instance in no power domain |
| UPF-312 | warning | L2 only | Strategy element port direction contradicts -applies_to |

Notes on scope and choices:
- UPF-095 reports a switch whose own `-supply_set` is its output. The common
  `create_power_switch <sw> -domain <the switched domain>` idiom is not reported: `-domain` places
  the switch, and its control is powered from the input side.
- UPF-117 counts a supply-set state without `-simstate` as NORMAL; UPF-119/120 ignore `-illegal`
  states; UPF-120 compares conjunctions of `operand == value` (a state with `!=` is not compared).
- UPF-140, 153, 170, 177 consider the adjacent domains (see above); UPF-170 reports a pair once.
- UPF-198 takes an `-elements` word without `/` that no domain names as a `set_retention_elements`
  list name.
- UPF-052 and UPF-152/176 are info: they say what could not be analysed, not that something is wrong.

### Examples

In `examples/`, each with a `runme.csh`:

| Directory | Command | Expected |
|---|---|---|
| `soc_clean` | `upflint -in soc.upf -report upflint.rpt` | exit 0, no findings (switchable CPU with isolation and retention, low-voltage IO with level shifters, a state group) |
| `lint_findings` | `upflint -in block.upf -report upflint.rpt` | exit 2, four errors (UPF-090, 142, 192, 009); `runme.csh` exits 0 only when upflint exits 2 and names UPF-142 |
| `filelist` | `upflint -f files.lst -severity warning -report upflint.rpt` | exit 0, no findings; two files read in order into one intent |

Regression: `regression/tests/upflint/` -- one case per Level 1 rule (`UPF-<id>_<what>/input.upf`,
report golden `upflint.rpt.gld`, exit golden `exit.gld`; the case also checks that its rule is in the
report, and a `README` names any other rule it fires and why), clean cases that must report no error
(`clean_*`, including the real-world `clean_riscv_minisoc` and `clean_cdcfifo_power_intent` from
`upfcorpus`), and command-line cases (`cli_*`). Level 2: `regression/tests/elablint/UPF-3xx_*` and
`UPF-0xx_*_design` (elabvl, elabvh and elabmixed on one small chip in Verilog, VHDL and mixed form,
goldens `lint.rpt.gld`, `errors.out.gld`, `exit.gld`). Run with `tools/regress/run.sh upflint` and
`tools/regress/run.sh elablint`.
