Crates.io | rvemu |
lib.rs | rvemu |
version | 0.0.11 |
source | src |
created_at | 2020-03-03 09:24:43.226105 |
updated_at | 2021-03-30 12:25:58.997609 |
description | RISC-V emulator core implementation. |
homepage | |
repository | https://github.com/d0iasm/rvemu |
max_upload_size | |
id | 214836 |
size | 293,638 |
NOTE: This project is currently under intensely development. The source code might be changed dramatically.
Create an Emulator
object, place a binary data in DRAM and set the program counter to
DRAM_BASE
. The binary data must contain no headers for now. The example is here:
use rvemu::bus::DRAM_BASE;
use rvemu::emulator::Emulator;
fn main() {
// Create a dummy binary data.
let data = vec![
0x93, 0x0f, 0xa0, 0x02, // addi x31, x0, 42
];
// Create an emulator object.
let mut emu = Emulator::new();
// Place the binary data in the beginning of DRAM.
emu.set_dram(data);
// Set the program counter to 0x8000_0000, which is the address DRAM starts.
emu.set_pc(DRAM_BASE);
// Start the emulator.
emu.start();
// `IllegalInstruction` is raised for now because of the termination condition of the emulator,
// but the register is successfully updated.
assert_eq!(42, emu.cpu.xregs.read(31));
}
See the example usage in rvemu/lib/rvemu-cli/src/main.rs.
Now, supports the following features (will be added in the future):