# findinstsornets

> Find instances or nets by name or pattern across a Verilog design hierarchy and print their full hierarchical paths.

- Catalog id: `Findinstsornets`; bundle: `findinstsornets`; latest version 20261018
- Documentation page: https://edautils.com/DownloadLinks.html
- Keywords: find instance, find net, hierarchical path, Verilog search, design query
- 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/findinstsornets.md

## Downloads

- EDAUtils download site: https://edautils.ai/download/Findinstsornets (latest file `findinstsornets-20261018.tar.gz`)
- SourceForge: https://sourceforge.net/projects/edautils-free-utilities/files/findinstsornets/
- GitHub Releases: https://github.com/edautils/releases/releases/download/RELEASE_20261018/findinstsornets-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.

Reads a Verilog/SystemVerilog design, links the module given with `-top`, and lists the nets
and/or module instances whose names match Java regular expressions. Output is a plain text
file (default `output.txt`) with a `Nets:` section and/or an `Instances:` section, one
hierarchical name (`top/inst1/net`) per line; the same lists are echoed to the log. Main
class: `com.eu.miscedautils.verilogparser.FindNetsOrInstances` (jar `lib/verilogparser.jar`).

### Where it ships

Its own bundle, `findinstsornets.tar.gz` (flow `findinstsornets`; release tree
`release_scripts/findinstsornets/1.0`), and as a point tool in the **designplayer-shell** bundle
(`bin/findinstsornets` running the shell's jar; this guide as `tools/findinstsornets/AGENTS.md`,
examples under `tools/findinstsornets/examples/`).

### 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`,
  `EDAUTILS_LICENSE_FILE=$EDAUTILS_ROOT/edautils.lic`, `CLASSPATH` and prepends `bin/` to `PATH`.
- Licence feature `FINDDESIGNOBJECTS`. The licence file is searched in this order:
  `$EDAUTILS_LICENSE_FILE`, `./edautils.lic` (run directory), `$HOME/edautils.lic`,
  `$EDAUTILS_ROOT/edautils.lic`. No valid licence or no feature: error 6404
  `Failed to checkout LICENSE for the feature : FINDDESIGNOBJECTS`, then exit status **11**.
  (The shipped `README.txt` mentions `EDAUTILS_LICENSE_KEY`; the code does not read it.)
- Optional environment: `JAVA_FLAGS` (passed to the JVM, e.g. `-Xmx8g`; 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_DISABLE_USAGE_TRACKING=true`, `EDAUTILS_PRINT_STACK_TRACE` (stack traces on
  internal exceptions), `EDAUTILS_ENABLE_DEBUG_ENVIRONMENT=1` (debug messages),
  `EDAUTILS_LIBRARY_MAP_FILE` (default for `-mapfile`, used with `-dump`/`-restore`).
- No external tools needed.

### Invocation

```
findinstsornets -in <file.v> | -f <filelist>  -top <module>
                [-regexpr_net_name <re>] [-regexpr_inst_name <re> [-regexpr_mod_name <re>]]
                [-hier] [-out <file>] [options]
```

Tool-specific options:

| Option | Meaning |
|---|---|
| `-top <module>` | Module to search in (mandatory; missing -> usage only) |
| `-regexpr_net_name <re>` | List nets whose hierarchical name contains a match (`find()`, unanchored) |
| `-regexpr_inst_name <re>` | List instances whose name matches `<re>` entirely (`matches()`); with `-hier` the hierarchical name is matched |
| `-regexpr_mod_name <re>` | Only with `-regexpr_inst_name`: keep instances whose master module name contains a match |
| `-hier` | Search the whole hierarchy below `-top`, not only `-top` itself |
| `-unroll_generate` | Unroll IF/FOR generate blocks; instances then have mangled names `<GENBLK>_<GENBLK>_<INDEX>_<inst>`; each unrolled copy is connected with the loop index substituted (`in1[i]` becomes `in1[0]`, `in1[1]`, ...) |
| `-out <file>` | Output text file (default `output.txt`) |
| `-help`, `-h` | Print usage and return |

The usage text calls the module filter `-regexpr_inst_of_mod_name`; the code only accepts
`-regexpr_mod_name` (the other spelling is "Unrecognized option"). `-hier` is accepted but not
listed in the usage. With neither `-regexpr_net_name` nor `-regexpr_inst_name` the output file
is created empty.

Common Verilog-reader options (shared parser, `FVPProcessCmdLineArgs`): `-in <file>` (wildcards
expanded unless `-nowildcard`), `-f <filelist>` (repeatable; one file per line, `#`/`// `
comments, `+incdir+`/`+define+` and option lines allowed, `$VAR` resolved),
`-excludefilelist <file>`, `+incdir+<p1>+<p2>`, `+define+A+B=1`, `-v95`, `-nowildcard`,
`-nokeywords a:b`, `-blackbox`, `-declare_wires_for_undefined_obects`, `-dump`,
`-restore <units>`, `-work <lib>`, `-mapfile <ini>`, `-l <log>` / `-la <log>` (log file /
append), `-quiet`, `-nobanner`, `-dbg`, `-suppress <id1:id2>`, `-user <email>`,
`-encryption_key`, `-encryption_algorithm`, `-private_key_file`, `-public_key_file`.
An unrecognised option is error 7037 "Unrecognized option : <opt>" followed by the usage.

### Inputs / Outputs

- Reads: the Verilog files from `-in` / `-f` and their `` `include`` files.
- Writes: the `-out` file (default `output.txt`, parent directory must exist). Format:
  `Nets:` then one name per line, then `Instances:` then one name per line.
- Log: `findinstsornets.log` in the current directory (override with `-l`/`-la` or
  `EDAUTILS_LOG_FILE`). The directory `myEdaUtilsWork/` is created in the current directory
  by the shared option parser.

### Exit status and messages

- 0 on a normal finish, **including runs that reported errors** (top module not found =
  error 2508, parse errors, unrecognised option). 11 = licence checkout failed.
  1 = `EDAUTILS_ROOT` missing, or out of memory (Fatal Error 3092, JVM halted).
- Message format: `findinstsornets: <Severity>: <id>: <text>`, severity one of `Error`,
  `Fatal Error`, `Warning`, `Note`; usage lines have no severity or id.
- The run ends with `findinstsornets: Note: <id>: Found N error(s) and M warning(s) ...`.
  This tool prints the summary even with `-nobanner` (only the banner is suppressed).

### Examples

Shipped: `examples/example1/` (`runme.csh`, `runme.bat`, `example1.v`):

```
cd $EDAUTILS_ROOT/examples/example1
findinstsornets -in example1.v -top example1 -out output.txt -regexpr_inst_name '.*' -hier
```

From the regression suite
(`tests.edautilscommandline/tests/findinstsornets/insts_of_mod/runme.csh`):

```
findinstsornets -in insts_of_mod.v -top insts_of_mod -out output.txt \
    -regexpr_inst_name '.*' -regexpr_mod_name bottom
```

`tests.edautilscommandline/tests/findinstsornets/both_net_n_inst/runme.csh` combines
`-regexpr_net_name '.*' -regexpr_inst_name '.*' -hier`.

### Integration notes

- Non-interactive; does not read stdin. Run with `</dev/null`.
- Quote regular expressions so the shell does not glob them (`'.*'`).
- Writes the log, `output.txt` and `myEdaUtilsWork/` into the current directory: give each
  parallel run its own working directory (or distinct `-out` and `-l`).
- Set `EDAUTILS_DISABLE_USAGE_TRACKING=true` to stop usage registration.
- Success test: exit status 0 **and** the log contains `Found 0 error(s)` **and** the `-out`
  file exists. Parse the `Nets:` / `Instances:` sections of the output file, not the log.

### See also

flatteninstances (uses the same instance search), removehierarchy, flattenverilog, parseverilog.
