Skip to main content

Csrs

Trait Csrs 

Source
pub trait Csrs<Reg, CustomError = CustomErrorPlaceholder>
where Reg: Register,
{ // Required methods fn read_csr( &self, csr_index: u16, ) -> Result<Reg::Type, CsrError<CustomError>>; fn write_csr( &mut self, csr_index: u16, value: Reg::Type, ) -> Result<(), CsrError<CustomError>>; fn process_csr_read( &self, csr_index: u16, raw_value: Reg::Type, ) -> Result<Reg::Type, CsrError<CustomError>>; fn process_csr_write( &mut self, csr_index: u16, write_value: Reg::Type, ) -> Result<Reg::Type, CsrError<CustomError>>; // Provided method fn privilege_level(&self) -> PrivilegeLevel { ... } }
Expand description

CSRs (Control and Status Registers)

Required Methods§

Source

fn read_csr(&self, csr_index: u16) -> Result<Reg::Type, CsrError<CustomError>>

Reads register value

Source

fn write_csr( &mut self, csr_index: u16, value: Reg::Type, ) -> Result<(), CsrError<CustomError>>

Writes register value

Source

fn process_csr_read( &self, csr_index: u16, raw_value: Reg::Type, ) -> Result<Reg::Type, CsrError<CustomError>>

Process CSR read.

Must proxy calls to ExecutableInstruction::prepare_csr_read() of the root instruction and return the output value on success. The method is present on Csrs to break cycles in the type system.

Source

fn process_csr_write( &mut self, csr_index: u16, write_value: Reg::Type, ) -> Result<Reg::Type, CsrError<CustomError>>

Process CSR write.

Must proxy calls to ExecutableInstruction::prepare_csr_write() of the root instruction and return the output value on success. The method is present on Csrs to break cycles in the type system.

Provided Methods§

Source

fn privilege_level(&self) -> PrivilegeLevel

Current privilege level

Implementors§