Metadata-Version: 2.4
Name: vunit-janushdl
Version: 0.1.0
Summary: A VUnit package providing support for JanusHDL.
Author-email: Lars Asplund <lars.anders.asplund@gmail.com>
License-Expression: MPL-2.0
Project-URL: homepage, https://github.com/VUnit/vunit-janushdl
Keywords: vunit,vunitpkg,verification,vhdl,fpga,asic,janushdl,simulator
Classifier: Development Status :: 3 - Alpha
Classifier: Topic :: Scientific/Engineering :: Electronic Design Automation (EDA)
Classifier: Natural Language :: English
Classifier: Intended Audience :: Developers
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: vunit_hdl>=5.0.0.dev16
Dynamic: license-file

# vunit-janushdl

A VUnit package providing support for [JanusHDL](https://que.no/janushdl).

## Overview

Adds a simulator interface for [JanusHDL](https://que.no/janushdl) (`jhdl`), selected with `VUNIT_SIMULATOR=janushdl`.

## Installation

```bash
pip install vunit-janushdl
```

## Adding vunit-janushdl to a VUnit Project

The `vunit-janushdl` package is added to a VUnit project by calling the `add_package` method from the VUnit
run script. See example below.

```python
from vunit import VUnit

vu = VUnit.from_argv()

# Note that a simulator package must be added before any method calls depending on it, for example add_vhdl_builtins.
vu.add_package("vunit-janushdl", allow_setup=True)

vu.add_vhdl_builtins()
```

## How it works

### Library Cache

JanusHDL keeps no libraries on disk. So the interface doesn't compile file by file:

- **Compile:** it writes the whole project, in compile order, to one `-f` file list with `library` lines. It then runs `jhdl --analyze-only` once, with `--cache` pointing to an analysis cache under the output path. This step always runs, even when VUnit sees no changed files: jhdl reloads an up-to-date cache in milliseconds, so jhdl alone decides whether the cache is stale.
- **Simulate:** each test runs `jhdl` with the same file list, cache and analysis flags, plus `--top lib.entity`, `-g` generics and `--stop-level`/`--exit-level` set to `vhdl_assert_stop_level`. Test runs only read the cache, so parallel tests can share it.
- **`--gui`:** records `--wave` and opens the result in `jhdlw`.
- **Options:** `janushdl.a_flags` (compile) and `janushdl.sim_flags` (sim).

### Fails early, with a clear message, on

- `--elaborate`: jhdl has no elaborate-only mode.
- Mixed VHDL standards: a `-f` list takes a single `--std`.
- Different `janushdl.a_flags` between files: everything is analyzed in one call, and a run with different flags would analyze again into the shared cache.
- External libraries and non-VHDL files.
- The Python bridge fails at setup with VUnit's existing message, since no foreign interface is supported.

### Testing (JanusHDL 0.7.0, Linux x86-64)

- All `vunit/vhdl/*/run.py` suites except `python` pass: 1323 of 1323 (check, com, data_types, dictionary, logging, path, random, run, string_ops, verification_components).
- `tests/acceptance/test_artificial.py` and `test_dependencies.py` pass, except `test_artificial_elaborate_only`, because `--elaborate` is rejected on purpose.
- The analysis cache's SHA-256 is unchanged after a `-p 8` run of the `check` suite, and again after touching a source file, so test runs never rewrite the cache.
- `--gui` not yet supported
- jhdl 0.7.0 ignores the status argument of `std.env.stop(1)`/`finish(1)` (it exits 0). VUnit still reports failures correctly from its results file.
