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.tar.gz
(659.1 kB
view hashes)
Built Distribution
Close
Hashes for voyager_cpu-0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0542402de9eb0dc1c4be788ee37f863b8d5d6d12c62cd9f426e86a922db8a478 |
|
MD5 | aa12ebab70a0b9521d62cf8582a20523 |
|
BLAKE2b-256 | ead4eb1312d399a24c28c407c254f78ee991bee2e64d77c3769f25811b31090d |