Metadata-Version: 2.4
Name: avl-riscv-coverage
Version: 0.0.1
Summary: Apheleia Verification Library RISCV Coverage Framework. Collect architectural coverage from elf and trace files with no HDL intermediate
License: MIT License
         
         Copyright (c) [2025] [avl@projectapheleia.net]
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
License-File: LICENSE
Author: avl
Author-email: avl@projectapheleia.net
Maintainer: avl
Maintainer-email: avl@projectapheleia.net
Requires-Python: >=3.10
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Provides-Extra: dev
Requires-Dist: avl-core (>=0.4.1)
Requires-Dist: black (>=22.3.0) ; extra == "dev"
Requires-Dist: matplotlib (>=3.10.0) ; extra == "dev"
Requires-Dist: mypy (>=0.910) ; extra == "dev"
Requires-Dist: pytest (>=7.0) ; extra == "dev"
Requires-Dist: ruff (>=0.11.0) ; extra == "dev"
Requires-Dist: sphinx (>=8.1.3) ; extra == "dev"
Requires-Dist: sphinx_rtd_theme (>=3.0.2) ; extra == "dev"
Description-Content-Type: text/markdown

# AVL RISCV Coverage - Apheleia Verification Library RISCV Coverage Framework

[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Python](https://img.shields.io/badge/Python-3.7%2B-blue)](https://www.python.org/)


AVL  RISCV Coverage has been developed by experienced, industry professional verification engineers to provide a framework \
and library of base classes for developing functional coverage for RISCV processors in [Python](https://www.python.org/) using \
the compiled test code and trace files. Coverage can be generated from higher level models with no HDL intermediate.

- Although a default instr_dict.json is provided, it can be overridden on the commandline.

- An elf file and spike trace are required.

- Additional coverage packages can be added from the commandline.

- Output is generated in AVL coverage.json and optionally rendered into html.

```sh
usage: avl-riscv-coverage [-h] [--ref REF] [--extensions [EXTENSIONS ...]] [--packages [PACKAGES ...]] [--elf ELF] [--trace TRACE] [--output OUTPUT] [--html] [--verbose]

options:
  -h, --help            show this help message and exit
  --ref REF             Pointer to instr_dict.json (generated from https://github.com/riscv/riscv-opcodes) (default: ./avl-riscv-coverage/avl_riscv_coverage/instr_dict.json)
  --extensions [EXTENSIONS ...
                        List of extensions
  --packages [PACKAGES ...]
                        List of python packages containing covergroups
  --elf ELF             Elf file for testcase
  --trace TRACE         List of trace files
  --output OUTPUT       Output directory for report
  --html                Generate HTML report
  --verbose             Verbose messages
```

---

## 📦 Installation

### Using `pip`
```sh
# Standard build
pip install avl-riscv-coverage

# Development build
pip install avl-riscv-coverage[dev]
```

### Install from Source
```sh
git clone https://github.com/projectapheleia/avl-riscv-coverage.git
cd avl-riscv-coverage

# Standard build
pip install .

# Development build
pip install .[dev]
```

Alternatively if you want to create a [virtual environment](https://docs.python.org/3/library/venv.html) rather than install globally a script is provided. This will install, with edit privileges to local virtual environment.

This script assumes you have  [Verilator](https://www.veripool.org/verilator/), [GTKWave](https://gtkwave.sourceforge.net/) and [Graphviz](https://graphviz.org/download/) installed, so all examples and documentation will build out of the box.


```sh
git clone https://github.com/projectapheleia/avl-riscv-coverage.git
cd avl-riscv-coverage
source avl-riscv-coverage.sh
```

## 📖 Documentation

In order to build the documentation you must have installed the development build.

### Build from Source
```sh
cd docs
make html
<browser> build/html/index.html
```
## 🏃 Examples

In order to run all the examples you must have installed the development build.

To run all examples:

```sh
cd examples

# To run
make -j 8 sim

# To clean
make -j 8 clean
```

To run an individual example:

```sh
cd examples/THE EXAMPLE YOU WANT

# To run
make sim

# To clean
make clean
```

---


## 🧹 Code Style & Linting

This project uses [**Ruff**](https://docs.astral.sh/ruff/) for linting and formatting.

Check code for issues:

```sh
ruff check .
```

Automatically fix common issues:

```sh
ruff check . --fix
```

## 📧 Contact

- Email: avl@projectapheleia.net
- GitHub: [projectapheleia](https://github.com/projectapheleia)

