A simple 32-bit RISC-V CPU emulator
Project description
Voyager CPU
Voyager is a (very) experimental Python emulator of a 32-bit RISC-V core. It's built for research and education with simplicity in mind.
Features
- Supports the RV32I ISA using a non-pipelined CPU with a single-cycle instruction fetch, decode, and execution stage.
- A simple virtual RAM into which test programs (ELF binaries) are loaded.
- The official RISC-V ISA tests can be used for this purpose (see below).
- A basic REPL for viewing register and RAM contents, and executing the next N cycles.
- MIT license.
Build and Run
- (Optional) Clone the pre-built RV32UI tests using:
git submodule init
git submodule update
The binaries will be placed under tests/riscv-tests-prebuilt-binaries/
. Alternatively, you can build the test suites from the official repo.
-
See the example in
src/voyagercpu/example.py
. You may run this directly usingpython src/voyagercpu/example.py
. -
Enjoy!
-
(Optional) Run the Voyager unit tests using
pytest
Todo
- Add more tests, particularly at the execution stage.
- Implement some ISA extensions, e.g. the M and C specifications.
- Add pipelining and privileged mode.
- Improve pretty printing.
- Etc.
Please contribute!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
voyager_cpu-0.2.4.tar.gz
(659.4 kB
view details)
Built Distribution
File details
Details for the file voyager_cpu-0.2.4.tar.gz
.
File metadata
- Download URL: voyager_cpu-0.2.4.tar.gz
- Upload date:
- Size: 659.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 264c7f522237d80f851a1f2313c5346acda3b36084a9095f800d00e03debd9ad |
|
MD5 | 9dd5b22195f132e68ae6c85aa0cea200 |
|
BLAKE2b-256 | 019272ff39665ca32027930e3d050d2d13a543a46afc536efa297a695976db64 |
File details
Details for the file voyager_cpu-0.2.4-py3-none-any.whl
.
File metadata
- Download URL: voyager_cpu-0.2.4-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7b0857ac2079e832894db35338ffc53816c5ed23fa8b7f1eebff0d8eeaa89ad |
|
MD5 | 2385d1288653665064a6306951a62768 |
|
BLAKE2b-256 | 4e6fb7790c5c729c0f9286bc8b47c3c3a4696d0dfa59ef9cf3a13fddc321de07 |