Trait ckb_vm::machine::CoreMachine

source ·
pub trait CoreMachine {
    type REG: Register;
    type MEM: Memory<REG = Self::REG>;

    // Required methods
    fn pc(&self) -> &Self::REG;
    fn update_pc(&mut self, pc: Self::REG);
    fn commit_pc(&mut self);
    fn memory(&self) -> &Self::MEM;
    fn memory_mut(&mut self) -> &mut Self::MEM;
    fn registers(&self) -> &[Self::REG];
    fn set_register(&mut self, idx: usize, value: Self::REG);
    fn version(&self) -> u32;
    fn isa(&self) -> u8;
}
Expand description

This is the core part of RISC-V that only deals with data part, it is extracted from Machine so we can handle lifetime logic in dynamic syscall support.

Required Associated Types§

source

type REG: Register

source

type MEM: Memory<REG = Self::REG>

Required Methods§

source

fn pc(&self) -> &Self::REG

source

fn update_pc(&mut self, pc: Self::REG)

source

fn commit_pc(&mut self)

source

fn memory(&self) -> &Self::MEM

source

fn memory_mut(&mut self) -> &mut Self::MEM

source

fn registers(&self) -> &[Self::REG]

source

fn set_register(&mut self, idx: usize, value: Self::REG)

source

fn version(&self) -> u32

source

fn isa(&self) -> u8

Implementors§

source§

impl<Inner: CoreMachine> CoreMachine for DefaultMachine<Inner>

§

type REG = <Inner as CoreMachine>::REG

§

type MEM = <Inner as CoreMachine>::MEM

source§

impl<Inner: SupportMachine> CoreMachine for TraceMachine<Inner>

§

type REG = <Inner as CoreMachine>::REG

§

type MEM = <Inner as CoreMachine>::MEM

source§

impl<R: Register, M: Memory<REG = R>> CoreMachine for DefaultCoreMachine<R, M>

§

type REG = R

§

type MEM = M