# verilog2vhdl

> Convert Verilog to VHDL while maintaining structure and function

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

## Downloads

- EDAUtils download site: https://edautils.ai/download/Verilog2Vhdl (latest file `verilog2vhdl-20261018.tar.gz`)
- SourceForge: https://sourceforge.net/projects/edautils-converters/files/verilog2vhdl/
- GitHub Releases: https://github.com/edautils/releases/releases/download/RELEASE_20261018/verilog2vhdl-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 Verilog/SystemVerilog design, starting at one top module (`-top`), into VHDL:
an entity + architecture per converted module, plus the helper package
`vl2vh_common_pack` (and its body) when needed. Mixed designs can pull in VHDL entities
from a sorted `-vhdlfilelist`. Output is one VHDL file (default `output.v2vh.vhd`).
Main class for all three launchers: `com.eu.miscedautils.verilog2vhdl.verilog2vhdl`
(jar `lib/verilog2vhdl.jar`).

### Where it ships

Its own bundle, `verilog2vhdl.tar.gz` (flow `verilog2vhdl`; release tree
`release_scripts/verilog2vhdl/1.0`), and as a point tool in the **designplayer-shell** bundle
(`bin/verilog2vhdl`, `bin/verilog2vhdlcomponent`, `bin/verilog2vhdlentity` running the shell's
jar; this guide as `tools/verilog2vhdl/AGENTS.md`, examples under `tools/verilog2vhdl/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 the `.bat` launchers do not set `CLASSPATH`; run `setup_env.bat` first.
- VHDL standard packages: `$EDAUTILS_ROOT/vhdl_pkgs/` (added to the bundle at release build
  time). With `-vhdlfilelist` the tool reads `$EDAUTILS_ROOT/vhdl_pkgs/qtmap.ini`
  (`qtmap2019.ini` when `EDAUTILS_VHDL_LIBSET=2019`).
- Licence feature `VERILOG2VHDL`. 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` (Verilog library map for `-dump`/`-restore`),
  `EDAUTILS_VHDL_LIBSET`.
- No external tools needed.

### Invocation

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

Launchers (all run the same main class; Unix and `.bat` agree):

- `bin/verilog2vhdl` -- full conversion.
- `bin/verilog2vhdlentity` -- prepends `-only_entity`: entity declarations only.
- `bin/verilog2vhdlcomponent` -- prepends `-only_component`: a VHDL component declaration
  for the top module only.

Tool-specific options:

| Option | Meaning |
|---|---|
| `-top <module>` | Top module to convert (mandatory unless `-dump`) |
| `-out <file>` | Output VHDL file (default `output.v2vh.vhd`) |
| `-vhdlfilelist <list>` | Sorted list of VHDL files defining entities/items used by the Verilog (mixed design) |
| `-only_entity` | Print entities only, no architectures |
| `-only_component` | Print only the component declaration of the top |
| `-infer_ff` | Convert flip-flops wherever possible |
| `-use_std_logic_unsigned` | Use `ieee.std_logic_unsigned.all` instead of `ieee.numeric_std.all` |
| `-replace_xz_with_zero` | Replace `x`/`z` with 0 when evaluating constants |
| `-ignore_undefined_modules` | Do not print VHDL for undefined (dummy) modules |
| `-fix_range` | Fix ranges in declared signals |
| `-elaborate` | Elaborate the top before conversion |
| `-exclude_modules m1:m2` | Leave the colon-separated modules out of the output |
| `-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 7033 "Unrecognized option") followed by the
usage. The usage line lists `[-sort]`, but the code does not accept `-sort` (it is
rejected as unrecognised).

### Inputs / Outputs

- Reads: the Verilog files from `-in` / `-f` (and `` `include`` files), the VHDL files in
  `-vhdlfilelist`, `libmap.ini` (or `-mapfile`) when `-dump`/`-restore` is used.
- Writes: the `-out` file (default `output.v2vh.vhd` in the current directory). If the
  file cannot be opened, the VHDL is printed to the console and Error 5465 is reported.
  Also creates the work directories `myEdaUtilsWork/` and `vl2vh_work/` in the current
  directory.
- Parameters become unconstrained generics (`INTEGER`, or `String` for a string value):
  a Verilog `[msb:lsb]` on a parameter is the value's width, not a VHDL range, so
  `parameter [3:0] P = 2` is written `P : INTEGER := 2`.
- Log: `verilog2vhdl.log` in the current directory for all three launchers (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 all return 0). 10 = licence checkout failed.
  1 = `EDAUTILS_ROOT` missing/invalid.
- Message format: `verilog2vhdl: <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. Top not found: Error 3292 "The top module named <top>
  not found ...". Missing `-top` or input prints the usage only.
- The run ends with `verilog2vhdl: Note: <id>: Found N error(s) and M warning(s) ...`.
  This summary is **not printed with `-nobanner`**.
- `-help` output golden: `tests.edautilscommandline/tests/verilog2vhdl/help_msg/verilog2vhdl.log.gld`.

### Examples

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

```
cd $EDAUTILS_ROOT/examples/simple_and
verilog2vhdl -in simple_and.v -top simple_and -out simple_and.vhd

cd $EDAUTILS_ROOT/examples/mixedlanguage
verilog2vhdl -nowildcard -in mixedlanguage.v -top mixedlanguage -out decompiled.vhd \
    -vhdlfilelist vhdlfiles.list
```

`examples/simple_and/` also carries a stale `verilog2vhdl.log`, `simple_and.vhd` and a
`vl2vh_work/` tree from an earlier run; a new run overwrites them.

From the regression suite (reference:
`tests.edautilscommandline/tests/verilog2vhdl/infer_ff_simple_posedge/runme.csh` via
`../runme_common_infer_ff.csh`, and
`tests.edautilscommandline/tests/verilog2vhdlentity/simple_and/runme.csh`):

```
verilog2vhdl -nowildcard -in infer_ff_simple_posedge.v -top infer_ff_simple_posedge \
    -out decompiled.vhd -infer_ff
verilog2vhdlentity -in simple_and.v -top simple_and -out simple_and_entity.vhd
```

### Integration notes

- Non-interactive; does not read stdin. Run with `</dev/null`.
- Writes the log, work directories and 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.
- VHDL reserved words used as Verilog names get a `_v` suffix in the output (see the
  comment in `tests/verilog2vhdl/runme_common.csh`).

### See also

vhdl2verilog, genwrappervhdl, verilog2systemc, parseverilog.
