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.3.tar.gz
(659.3 kB
view hashes)
Built Distribution
Close
Hashes for voyager_cpu-0.2.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35c1553fc2e0d47ec33ceb39b071cb53a8567c4dbdfc5dbb622a1c72bfbf103b |
|
MD5 | 41185d6d3c552e73cd3e3c12b255e5d4 |
|
BLAKE2b-256 | 509d52f2640cf9ed826e04099c24297ce3d920382fbd2efde246fea09b0b92dd |