eeric-core

Crates.ioeeric-core
lib.rseeric-core
version0.1.2
sourcesrc
created_at2023-10-29 23:14:59.50047
updated_at2023-11-02 23:13:40.498113
descriptionAn easily embeddable RV64I core with MFDV extensions
homepage
repositoryhttps://github.com/pawelperek/eeric
max_upload_size
id1017843
size363,680
Paweł Perek (PawelPerek)

documentation

README

eeric

An Easily Embeddable RISC-V Core

Overview

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).

Example

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);
    }
}
Commit count: 11

cargo fmt