# vhdl2verilog

> Convert VHDL to Verilog keeping same structure for easy correlation

- Catalog id: `Vhdl2Verilog`; bundle: `vhdl2verilog`; latest version 20261018
- Documentation page: https://edautils.com/vhdl2verilog.html
- Keywords: VHDL to Verilog, RTL converter, VHDL Verilog translation, HDL conversion
- 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/vhdl2verilog.md

## Downloads

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

Converts a VHDL design, starting at one entity (`-top`), into Verilog/SystemVerilog. The
top module goes to `-out` (default `output.v`); every other converted module goes to
`components/<module>.v` in the current directory. When sub-modules exist and the design
uses VHDL types that map to SystemVerilog packages, each package is written to
`<package>.sv` next to `-out` together with a compile-order list `<top>.f`; otherwise the
packages are prepended to the top file. Mixed designs can supply Verilog modules through
`-verilogfilelist`. Main class: `com.eu.miscedautils.vhdl2verilog.vhdl2verilog`
(jar `lib/vhdl2verilog.jar`).

### Where it ships

Its own bundle, `vhdl2verilog.tar.gz` (flow `vhdl2verilog`; release tree
`release_scripts/vhdl2verilog/1.0`), and as a point tool in the **baya-shell** and
**designplayer-shell** bundles (`bin/vhdl2verilog` running the shell's jar; this guide as
`tools/vhdl2verilog/AGENTS.md`, examples under `tools/vhdl2verilog/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/vhdl2verilog.bat` does not set `CLASSPATH`; run `setup_env.bat` first.
- VHDL standard packages: `$EDAUTILS_ROOT/vhdl_pkgs/` (added to the bundle at release build
  time). The tool reads `$EDAUTILS_ROOT/vhdl_pkgs/qtmap.ini` (`qtmap.win.ini` on Windows;
  `qtmap2019.ini` when `EDAUTILS_VHDL_LIBSET=2019`).
- Licence feature `VHDL2VERILOG`. 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_VHDL_LIBSET`.
- No external tools needed.

### Invocation

```
vhdl2verilog -in <file.vhd> | -filelist <list>  -top <entity>  [-out <file.v>]  [options]
```

| Option | Meaning |
|---|---|
| `-in <file>` | VHDL input file (not together with `-filelist`) |
| `-filelist <list>` | File listing VHDL files (needs `-top`) |
| `-excludefilelist <list>` | Files to exclude from processing |
| `-top <entity>` | Top entity. Without it the input is only analysed |
| `-arch <name>` | Architecture of the top to convert |
| `-out <file>` | Output Verilog file for the top (default `output.v`) |
| `-verilogfilelist <list>` | Verilog files defining modules used by the VHDL (mixed design) |
| `-evalgenerics` | Evaluate generics (off by default; `-nogenericeval` is accepted and ignored) |
| `-assumewidth_1` | Assume width 1 when a width cannot be computed (`-noassumewidth_1` ignored) |
| `-uniquify` | Uniquify entities/modules by generic values (off by default) |
| `-unroll_generate` | Flatten FOR/IF generate statements |
| `-reset_active_high` | Treat resets as active high when turning processes into always blocks |
| `-ignore_rising_falling_edge_func_call` | Do not process `rising_edge`/`falling_edge` calls |
| `-reuseprecompiled` | Reuse already analysed data (allows a run with no `-in`/`-filelist`) |
| `-analyze` | Analyse only, no conversion |
| `-work <lib>` | Work library name (default `work`) |
| `-mapfile <ini>` | Logical=physical library map (default `qtmap.ini` in the run directory) |
| `-nowildcard` | No wildcard expansion of file names |
| `-suppress <id1:id2>` | Suppress the colon-separated message numbers |
| `-quiet`, `-nobanner` | No console messages / no banner |
| `-user <email>` | User id for usage registration |
| `-help` | Print usage and exit |

Options other than `-user` are matched case-insensitively. vhdl2verilog has its own option
parser (no `-l`). An unknown option prints the usage and exits 0 **without** an error
message. An option given last without its value ends in an internal exception message.

### Inputs / Outputs

- Reads: the VHDL file(s), `./qtmap.ini` (or `-mapfile`) if present,
  `$EDAUTILS_ROOT/vhdl_pkgs/`, and the `-verilogfilelist` files.
- Writes: `-out` (default `./output.v`); `components/<module>.v` (relative to the current
  directory) for sub-modules; `<package>.sv` and `<top>.f` beside `-out` when packages are
  split out; the map file `./qtmap.ini` (rewritten on each converting run); the work library
  directory (`myEdaUtilsWork/` unless mapped elsewhere).
- Log: `vhdl2verilog.log` in the current directory (override with `EDAUTILS_LOG_FILE`).

### Exit status and messages

- 0 on a normal finish, **including runs that reported errors** (conflicting options, top
  not found, parse errors all return 0). 10 = licence checkout failed.
  1 = `EDAUTILS_ROOT` missing/invalid.
- Message format: `vhdl2verilog: <Severity>: <id>: <text>`, severity one of `Error`,
  `Fatal Error`, `Warning`, `Note`, `Programming Error`; `<id>` is a 5-digit message number.
  Usage lines have no severity or id. Option errors: 4739 (`-analyze` without input), 4740
  (`-in` and `-filelist`), 4741 (`-filelist` without `-top`). Top missing: Error 864
  "Top design unit '<top>' is not found in the RTL file(s) ..."; not an entity: 4742.
- A converting run ends with `vhdl2verilog: Note: <id>: Found N error(s) and M warning(s)
  ...`, printed **even with `-nobanner`**. An analyse-only run (`-analyze` or no `-top`)
  ends without it.

### Examples

Shipped (`runme.csh` and `runme.bat` each):

```
cd $EDAUTILS_ROOT/examples/uart_trans
vhdl2verilog -in uart_trans.vhd -out uart_trans.v -top uart_trans

cd $EDAUTILS_ROOT/examples/uart_receiever
vhdl2verilog -in uart_receiever.vhd -out uart_receiever.v -top uart_receiever
```

From the regression suite (reference:
`tests.edautilscommandline/tests/vhdl2verilog/array_2d/runme.csh` via `../runme_common.csh`,
whose default extra switches are `-evalgenerics -assumewidth_1`):

```
vhdl2verilog -in array_2d.vhd -out array_2d.v -top array_2d -assumewidth_1
```

### Integration notes

- Non-interactive; does not read stdin. Run with `</dev/null`.
- Writes the log, `qtmap.ini`, `components/`, the work directory and the default output into
  the current directory: give each parallel run its own working directory.
- `components/` is always relative to the current directory, while `<package>.sv` and
  `<top>.f` go beside `-out`; keep `-out` in the current directory so the paths in `<top>.f`
  resolve.
- 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.

### See also

verilog2vhdl, vhdl2systemc, genwrapperverilog, parsevhdl.
