# removeassignments

> Remove continuous assignments from Verilog RTL by connecting the driving expression directly, cleaning up wrapper-style assign chains.

- Catalog id: `Removeassignments`; bundle: `removeassignments`; latest version 20261018
- Documentation page: https://edautils.com/DownloadLinks.html
- Keywords: remove assign, Verilog cleanup, continuous assignment, RTL simplification
- 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/removeassignments.md

## Downloads

- EDAUtils download site: https://edautils.ai/download/Removeassignments (latest file `removeassignments-20261018.tar.gz`)
- SourceForge: https://sourceforge.net/projects/edautils-free-utilities/files/removeassignments/
- GitHub Releases: https://github.com/edautils/releases/releases/download/RELEASE_20261018/removeassignments-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 and optimises the continuous assignments of the module
given with `-top`: cascaded/redundant `assign` statements are collapsed (optionally using
expression pattern matching), sub-modules are processed too unless told otherwise, and
declarations left unused are removed. Output is a single Verilog file (default
`output.removeassignments.v`) holding only the optimised top module. Main class:
`com.eu.miscedautils.verilogparser.RemoveAssignments` (jar `lib/verilogparser.jar`).

### Where it ships

Its own bundle, `removeassignments.tar.gz` (flow `removeassignments`; release tree
`release_scripts/removeassignments/1.0`), and as a point tool in the **designplayer-shell** bundle
(`bin/removeassignments` running the shell's jar; this guide as
`tools/removeassignments/AGENTS.md`, examples under `tools/removeassignments/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 `REMOVEASSIGNMENTS`. The licence file is searched in this order:
  `$EDAUTILS_LICENSE_FILE`, `./edautils.lic` (run directory), `$HOME/edautils.lic`,
  `$EDAUTILS_ROOT/edautils.lic`. No licence for the feature: exit status 10 **with no
  message** (the check runs before anything is printed).
- 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

```
removeassignments -in <file.v> | -f <filelist>  -top <module>  [-out <file>]  [options]
```

Tool-specific options:

| Option | Meaning |
|---|---|
| `-top <module>` | Module to optimise (mandatory; missing -> usage only, no error message) |
| `-out <file>` | Output Verilog file (default `output.removeassignments.v`; parent directory must exist) |
| `-ignore_submodules` | Do not optimise the sub-modules instantiated in the top |
| `-no_pattern_matching` | Disable pattern-matching based optimisation |
| `-no_braced_expr` | Drop redundant `()` around binary expressions |
| `-help`, `-h` | Print usage and return |

The code does not check that `-in` or `-f` was given; without either nothing is parsed and
the top module is reported as not found.

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 7044 "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.removeassignments.v` in the current directory)
  with the optimised top module only. The file is opened before the top module is looked
  up, so a run whose top is not found leaves an empty output file behind.
- Log: `removeassignments.log` in the current directory (override with `-l`/`-la` or
  `EDAUTILS_LOG_FILE`). `myEdaUtilsWork/` is created in the current directory.

### Exit status and messages

- 0 on a normal finish, **including runs that reported errors** (top module not found =
  error 3606, parse errors). 10 = licence feature missing. 1 = `EDAUTILS_ROOT`
  missing/invalid, or out of memory (Fatal Error 3092, JVM halted).
- Message format: `removeassignments: <Severity>: <id>: <text>`, severity one of `Error`,
  `Fatal Error`, `Warning`, `Note`; usage lines have no severity or id.
- The run ends with `removeassignments: Note: <id>: Found N error(s) and M warning(s) ...`;
  N is the number of Error/Fatal messages. This summary is **not printed with `-nobanner`**.

### Examples

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

```
cd $EDAUTILS_ROOT/examples/example1
removeassignments -in example1.v -top example1 -out output.v
```

From the regression suite (reference:
`tests.edautilscommandline/tests/removeassignments/bitsel_in_portmap/runme.csh` via
`../runme_common.csh`):

```
removeassignments -in bitsel_in_portmap.v -top bitsel_in_portmap -out output.v
```

### Integration notes

- Non-interactive; does not read stdin. Run with `</dev/null`.
- Writes the log, default output and `myEdaUtilsWork/` into the current directory: give each
  parallel run its own working directory (or distinct `-out` and `-l`).
- A silent exit 10 means the licence lacks `REMOVEASSIGNMENTS` (or no licence was found).
- Set `EDAUTILS_DISABLE_USAGE_TRACKING=true` to stop usage registration.
- Success test: exit status 0 **and** the log contains `Found 0 error(s)` (do not use
  `-nobanner` if you rely on that line) **and** the `-out` file is non-empty.

### See also

flattenverilog, flatteninstances (both can merge assignments after flattening), removehierarchy.
