Crates.io | eeric-core |
lib.rs | eeric-core |
version | 0.1.2 |
source | src |
created_at | 2023-10-29 23:14:59.50047 |
updated_at | 2023-11-02 23:13:40.498113 |
description | An easily embeddable RV64I core with MFDV extensions |
homepage | |
repository | https://github.com/pawelperek/eeric |
max_upload_size | |
id | 1017843 |
size | 363,680 |
An Easily Embeddable RISC-V Core
eeric is a RV64I core supporting Zicsr, M, F, D, and V extensions, designed primarily for WASM compilation, although it works with any cdylib target. It acts as an abstract back-end machine requiring a front-end compiler or interpreter (see libs/eeric-interpreter).
The vectorized memcpy algorithm from RISCV Vector Spec examples is represented in eeric_core
as shown below:
use eeric_core::prelude::*;
fn main() {
let mut core = RvCore::with_instructions(vec![
I::Vsetvli(F::Vsetvli {
rd: T0,
rs1: A2,
vtypei: 0b_1_1_000_011,
}),
I::Vlv {
eew: 8,
data: F::Vl {
vd: 0,
rs1: A1,
vm: false,
},
},
I::Add(F::R {
rd: A1,
rs1: A1,
rs2: T0,
}),
I::Sub(F::R {
rd: A2,
rs1: A2,
rs2: T0,
}),
I::Vsv {
eew: 8,
data: F::Vs {
vs3: 0,
rs1: A3,
vm: false,
},
},
I::Add(F::R {
rd: A3,
rs1: A3,
rs2: T0,
}),
I::Bne(F::S {
rs1: A2,
rs2: ZERO,
imm12: -24,
}),
I::Jalr(F::I {
rd: ZERO,
rs1: RA,
imm12: 0,
}),
]);
for machine_state in core.run() {
println!("{:?}", machine_state);
}
}