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§
Sourcefn read_csr(&self, csr_index: u16) -> Result<Reg::Type, CsrError<CustomError>>
fn read_csr(&self, csr_index: u16) -> Result<Reg::Type, CsrError<CustomError>>
Reads register value
Sourcefn write_csr(
&mut self,
csr_index: u16,
value: Reg::Type,
) -> Result<(), CsrError<CustomError>>
fn write_csr( &mut self, csr_index: u16, value: Reg::Type, ) -> Result<(), CsrError<CustomError>>
Writes register value
Sourcefn process_csr_read(
&self,
csr_index: u16,
raw_value: Reg::Type,
) -> Result<Reg::Type, CsrError<CustomError>>
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.
Sourcefn process_csr_write(
&mut self,
csr_index: u16,
write_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>>
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§
Sourcefn privilege_level(&self) -> PrivilegeLevel
fn privilege_level(&self) -> PrivilegeLevel
Current privilege level