# genwrapperverilog

> Generate Verilog wrapper with simple Verilog-95 ports by flattening complex ports

- Catalog id: `Genwrapperverilog`; bundle: `genwrapperverilog`; latest version 20261018
- Documentation page: https://edautils.com/RTLUtils.html
- Keywords: Verilog wrapper generator, port flattening, Verilog-95 wrapper, SystemVerilog to Verilog ports
- 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/genwrapperverilog.md

## Downloads

- EDAUtils download site: https://edautils.ai/download/Genwrapperverilog (latest file `genwrapperverilog-20261018.tar.gz`)
- SourceForge: https://sourceforge.net/projects/edautils-free-utilities/files/genwrapperverilog/
- GitHub Releases: https://github.com/edautils/releases/releases/download/RELEASE_20261018/genwrapperverilog-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 writes a wrapper module around one module (`-top`).
The wrapper (default name `<top>_wrapper`) repeats the top's parameters and ports and
instantiates the top as `u_<top>`. SystemVerilog multi-dimensional ports are flattened by
default (`-no_flatten` keeps them); `` `include`` directives of the input are copied into
the wrapper unless `-no_includes`. Output is one Verilog file (default `output.v`).
Main class: `com.eu.miscedautils.genwrapper.verilog.GenWrapperVerilog`
(jar `lib/genwrapper.jar`).

### Where it ships

Its own bundle, `genwrapperverilog.tar.gz` (flow `genwrapperverilog`; release tree
`release_scripts/genwrapperverilog/1.0`), and as a point tool in the **designplayer-shell** bundle
(`bin/genwrapperverilog` running the shell's jar; this guide as
`tools/genwrapperverilog/AGENTS.md`, examples under `tools/genwrapperverilog/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` and prepends `bin/` to `PATH`.
  On Windows, `bin/genwrapperverilog.bat` does not set `CLASSPATH` itself; run
  `setup_env.bat` first (it sets `CLASSPATH=%EDAUTILS_ROOT%\lib\genwrapper.jar`).
- Licence feature `VERILOGWRAPPERGEN`. 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.
- 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` (library map file for `-dump`/`-restore`; default `libmap.ini`).
- No external tools needed.

### Invocation

```
genwrapperverilog -in <file.v> | -f <filelist>  -top <module>  [-out <file>]
                  [-wrapper <name>]  [-no_flatten]  [-no_includes]  [options]
```

Tool-specific options:

| Option | Meaning |
|---|---|
| `-top <module>` | Module to wrap (mandatory; missing -> usage printed, nothing written) |
| `-out <file>` | Output Verilog file (default `output.v`) |
| `-wrapper <name>` | Wrapper module name (default `<top>_wrapper`) |
| `-no_flatten` | Keep SystemVerilog multi-dimensional ports as they are |
| `-no_includes` | Do not copy the input's `` `include`` directives into the wrapper |
| `-verilogout` | Accepted and echoed in the options note; has no other effect |
| `-help`, `-h` | Print usage and exit |

Common Verilog-reader options (shared parser, `FVPProcessCmdLineArgs`): `-in <file>`,
`-f <filelist>`, `-excludefilelist <file>`, `+incdir+<p1>+<p2>`, `+define+A+B=1`, `-v95`
(no SystemVerilog keywords), `-nowildcard`, `-nokeywords a:b`, `-blackbox` (blackbox
undefined modules), `-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 an error (message 7015 "Unrecognized option") followed by the usage.

### Inputs / Outputs

- Reads: the Verilog files from `-in` / `-f` and their `` `include`` files.
- Writes: the `-out` file (default `output.v` in the current directory). The parser also
  creates the work directory `myEdaUtilsWork/` in the current directory.
- Log: `GenWrapperVerilog.log` in the current directory (the tool prefix is
  `GenWrapperVerilog`, not the launcher name; override with `-l`/`-la` or
  `EDAUTILS_LOG_FILE`). Every console line is also written to the log.

### Exit status and messages

- 0 on a normal finish, **including runs that reported errors** (missing `-top`, top module
  not found, parse errors, unwritable output all return 0). 10 = licence checkout failed.
  1 = `EDAUTILS_ROOT` missing/invalid.
- Message format: `GenWrapperVerilog: <Severity>: <id>: <text>`, severity one of `Error`,
  `Fatal Error`, `Warning`, `Note`, `Programming Error`; `<id>` is a 5-digit message number.
  Banner and usage lines have no severity or id.
- Progress notes: "Writing wrapper file <out> ..." and "Finished writing the wrapper file
  <out> ...". Top not found: Error 3195 "Top '<top>' not found in the input file ...".
- The run ends with `GenWrapperVerilog: Note: <id>: Found N error(s) and M warning(s) ...`.
  This summary is **not printed with `-nobanner`** on a normal finish (it is printed after
  the "top not found" error regardless).

### Examples

Shipped: `examples/verilogaroundverilog/{memtype_flatten,nonmemtype_2d_flatten,
simple_interface_5,simple_test_2d_memtype}/` (each has `runme.csh` and `<case>.v`; no `.bat`):

```
cd $EDAUTILS_ROOT/examples/verilogaroundverilog/memtype_flatten
genwrapperverilog -top memtype_flatten -in memtype_flatten.v -out memtype_flatten_wrapper.v
```

From the regression suite (reference:
`tests.edautilscommandline/tests/genwrapper/veriloginverilog/simple_test/runme.csh` via
`../runme_common.csh`):

```
genwrapperverilog -nowildcard -top simple_test -in simple_test.v -out simple_test_wrapper.v -no_flatten
```

The `tests/genwrapper/vhdlinverilog/` cases first convert VHDL with `vhdl2verilog`, then
wrap the result with `genwrapperverilog` (`vhdl2verilog` is not in this bundle).

### Integration notes

- Non-interactive; does not read stdin. Run with `</dev/null`.
- Writes the log, `myEdaUtilsWork/` and the default output 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)` (do not use
  `-nobanner` if you rely on that line) **and** the `-out` file exists.
- The usage text spells the include switch `-no_includess`; the switch the code accepts is
  `-no_includes`.
- (2026-10-03) A port of modport type (`mem_if.memory mif`) gets an instance of the interface
  (`mem_if mif();`), not of the modport.

### See also

genwrappervhdl, vhdl2verilog, verilog2vhdl, parseverilog.
