8000
Skip to content

Repository files navigation

Bonsai

Pytest

bonsai is a RISC-V CPU designed using Amaranth HDL.

Features

TODO:

Getting Started

This project is managed with uv.

Local Python Environment Setup

# install uv
$ pip install --upgrade pip
$ pip install uv
# Create a Python environment for the bonsai project
$ uv python install
$ uv venv

# Synchronize packages
$ uv sync --all-extras --dev

Run

# Available tasks
$ uv run task -l
run    python bonsai/main.py
test   pytest -v --ff -rfs
cov    pytest --cov bonsai --cov-report term --cov-report xml
check  ruff check --fix
format ruff format
mypy   mypy bonsai

# Run the bonsai project
task run -h
usage: main.py [-h] [--log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}] {build} ...

positional arguments:
  {build}               Select the action to perform
    build               build the project

options:
  -h, --help            show this help message and exit
  --log-level {DEBUG,INFO,WARNING,ERROR,CRITICAL}
                        Set the logging level


# Run simulation
task test
============================================================ test session starts ============================================================
platform win32 -- Python 3.10.14[pypy-7.3.17-final], pytest-8.3.4, pluggy-1.5.0 -- E:\repos\bonsai\.venv\Scripts\python.exe
cachedir: .pytest_cache
metadata: {'Python': '3.10.14', 'Platform': 'Windows-10-10.0.26100-SP0', 'Packages': {'pytest': '8.3.4', 'pluggy': '1.5.0'}, 'Plugins': {'cov': '6.0.0', 'html': '4.1.1', 'metadata': '3.1.1', 'mock': '3.14.0'}, 'JAVA_HOME': 'C:\\Program Files\\Microsoft\\jdk-17.0.14.7-hotspot\\'}
rootdir: E:\repos\bonsai
configfile: pyproject.toml
plugins: cov-6.0.0, html-4.1.1, metadata-3.1.1, mock-3.14.0
...

Test binary

misc/riscv-tests-isa

The isa tests built from riscv-software-src/riscv-tests. You can generate them using the following steps:

$ docker compose run build-riscv-tests
$ find ./riscv-tests/isa/rv32*-*-* -type f | xargs -I {}  cp {} ./misc/riscv-tests-isa/

License

This project is licensed under the MIT License. See the LICENSE file for more information.

Contact

For any inquiries or questions, you can reach out to the project maintainer at wipeseals@gmail.com.

About

Bonsai is a RISC-V CPU designed using Amaranth HDL. (wip)

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages

0