A Python-based RISC-V assembler, emulator, disassembler, and debugger
Project description
🖥️ RISC-V Emulator
A simple RISC-V assembler, emulator, and disassembler written in Python.
It can be used both as a command-line tool and as a Python library.
✨ Features
- Assemble
.sRISC-V assembly files into binary machine code - Run binary files on a simple RISC-V CPU emulator
- Disassemble binary files back into readable assembly
- One-step assemble-and-run mode
- Works as both CLI tool and importable Python package
📦 Installation
From PyPI:
pip install riscv-emulator
From source:
git clone https://github.com/yourusername/riscv_emulator.git
cd riscv_emulator
pip install .
🚀 Usage
CLI Commands
# Assemble a file
riscv assemble program.s -o program.bin
# Run a binary
riscv run program.bin
# Assemble and run in one step
riscv full program.s
# Disassemble a binary
riscv disassemble program.bin
Python API
from riscv_emulator import assemble, emulator, disassemble
# Assemble
assemble("program.s", "program.bin")
# Run
emu = emulator()
emu.load_program("program.bin")
emu.run()
# Disassemble
disassemble("program.bin")
📂 Project Structure
riscv_emulator/
├── riscv_emulator/
│ ├── __init__.py
│ ├── assembler.py
│ ├── debugger.py
│ ├── disassembler.py
│ ├── emulator.py
│ ├── main.py
├── README.md
├── pyproject.toml
├── LICENSE
📝 License
This project is licensed under the terms of the MIT License.
See the LICENSE file for details.
💡 Example
Example assembly file (program.s):
addi x1, zero, 3
addi x2, zero, 4
add x3, x1, x2
Run it:
riscv full program.s
🤝 Contributing
Pull requests are welcome!
If you find a bug or have a feature request, please open an issue on GitHub.
🛠 Requirements
- Python 3.8+
- No external dependencies
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file riscv_emulator-0.1.0.tar.gz.
File metadata
- Download URL: riscv_emulator-0.1.0.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1dc91728c8d05c8e67196ab163052fcd9602073a5815d678728bde96a2233fab
|
|
| MD5 |
f33b674c433fd3eb6d6f54868249384a
|
|
| BLAKE2b-256 |
aed44209579dd4d6c41de5ef4027381b857ccabfd85255d7bc4f8e6c8d43cf1b
|
Provenance
The following attestation bundles were made for riscv_emulator-0.1.0.tar.gz:
Publisher:
publish.yml on sadaveek/riscv-emulator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
riscv_emulator-0.1.0.tar.gz -
Subject digest:
1dc91728c8d05c8e67196ab163052fcd9602073a5815d678728bde96a2233fab - Sigstore transparency entry: 375071226
- Sigstore integration time:
-
Permalink:
sadaveek/riscv-emulator@30a04443027df63c7afe6b2a5ae05ed5c45fc78b -
Branch / Tag:
refs/heads/master - Owner: https://github.com/sadaveek
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@30a04443027df63c7afe6b2a5ae05ed5c45fc78b -
Trigger Event:
push
-
Statement type:
File details
Details for the file riscv_emulator-0.1.0-py3-none-any.whl.
File metadata
- Download URL: riscv_emulator-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b78a9fde4a76f7da194dce45cff38fb5f84eb3b6627c48d4b9b571f86479417a
|
|
| MD5 |
5ecd547d2d4fecf0e3d9822227a9b287
|
|
| BLAKE2b-256 |
368c8f1200a374f76151ad09af2b47e116221698bd3c3b3de50b28f0ed1dcf00
|
Provenance
The following attestation bundles were made for riscv_emulator-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on sadaveek/riscv-emulator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
riscv_emulator-0.1.0-py3-none-any.whl -
Subject digest:
b78a9fde4a76f7da194dce45cff38fb5f84eb3b6627c48d4b9b571f86479417a - Sigstore transparency entry: 375071280
- Sigstore integration time:
-
Permalink:
sadaveek/riscv-emulator@30a04443027df63c7afe6b2a5ae05ed5c45fc78b -
Branch / Tag:
refs/heads/master - Owner: https://github.com/sadaveek
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@30a04443027df63c7afe6b2a5ae05ed5c45fc78b -
Trigger Event:
push
-
Statement type: