RvCore

Struct RvCore 

Source
pub struct RvCore {
    pub memory: Memory,
    pub instructions: Vec<Instruction>,
    pub registers: Registers,
    pub vec_engine: VectorEngine,
}

Fields§

§memory: Memory§instructions: Vec<Instruction>§registers: Registers§vec_engine: VectorEngine

Implementations§

Source§

impl RvCore

Source

pub fn step(&mut self) -> Option<Result<(), String>>

Source

pub fn run(&mut self) -> RunningRvCore<'_>

Examples found in repository?
examples/memcpy/main.rs (line 76)
18fn main() {
19    // Important note: eeric as low-level back-end abstraction layer does not support pseudo-instructions
20    // Burden of decoding pseudo-instructions is on the front-end layer
21    // E.G: ret == I::Jalr (F::I { rd: ZERO, rs1: RA, imm: 0 }),
22
23    use alias::*;
24
25    let mut core = RvCoreBuilder::default()
26        .instructions(vec![
27            I::Vsetvli(F::Vsetvli {
28                rd: T0,
29                rs1: A2,
30                vtypei: vtype!(e8, m8, ta, ma),
31            }),
32            I::Vlv {
33                eew: BaseSew::E8,
34                data: F::Vl {
35                    vd: 0,
36                    rs1: A1,
37                    vm: false,
38                },
39            },
40            I::Add(F::R {
41                rd: A1,
42                rs1: A1,
43                rs2: T0,
44            }),
45            I::Sub(F::R {
46                rd: A2,
47                rs1: A2,
48                rs2: T0,
49            }),
50            I::Vsv {
51                eew: BaseSew::E8,
52                data: F::Vs {
53                    vs3: 0,
54                    rs1: A3,
55                    vm: false,
56                },
57            },
58            I::Add(F::R {
59                rd: A3,
60                rs1: A3,
61                rs2: T0,
62            }),
63            I::Bne(F::S {
64                rs1: A2,
65                rs2: ZERO,
66                imm12: -24,
67            }),
68            I::Jalr(F::I {
69                rd: ZERO,
70                rs1: RA,
71                imm12: 0,
72            }),
73        ])
74        .build();
75
76    for machine_state in core.run() {
77        println!("{:?}", machine_state);
78    }
79}

Trait Implementations§

Source§

impl Clone for RvCore

Source§

fn clone(&self) -> RvCore

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RvCore

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RvCore

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for RvCore

Source§

fn eq(&self, other: &RvCore) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for RvCore

Auto Trait Implementations§

§

impl Freeze for RvCore

§

impl RefUnwindSafe for RvCore

§

impl Send for RvCore

§

impl Sync for RvCore

§

impl Unpin for RvCore

§

impl UnwindSafe for RvCore

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.