Crates.io | raki |
lib.rs | raki |
version | 1.2.0 |
source | src |
created_at | 2023-10-12 12:43:30.018796 |
updated_at | 2024-10-14 06:21:49.442628 |
description | RISC-V instruction decoder written in Rust. |
homepage | |
repository | https://github.com/Alignof/raki |
max_upload_size | |
id | 1001297 |
size | 139,811 |
RISC-V instruction decoder written in Rust.
rv32/64imac
, Zicsr
, Zifencei
extensions.Call the decode
as u16/u32 method.
use raki::{BaseIOpcode, Decode, Instruction, Isa, OpcodeKind};
fn main() {
let inst_bytes: u32 = 0b1110_1110_1100_0010_1000_0010_1001_0011;
let inst: Instruction = match inst_bytes.decode(Isa::Rv32) {
Ok(inst) => inst,
Err(e) => panic!("decoding failed due to {e:?}"),
};
assert_eq!(inst.opc, OpcodeKind::BaseI(BaseIOpcode::ADDI));
println!("{inst}");
}
// --output--
// addi t0, t0, -276
mret
, sret
, wfi
, sfence.vma
)This crate is licensed under MIT.
See LICENSE
for details.
All contributions are welcome, including issues, pull requests, questions, etc...
See CONTRIBUTING.md
for details.