Skip to main content

Csr

Type Alias Csr 

Source
pub type Csr<Encoding, Layout> = Register<Layout, <Encoding as ControlAndStatusRegisterEncoding>::Access, CsrIo<Encoding>>;
Expand description

Models a riscv64 CSR with a given layout.

It takes a CSR encoding as a generic parameter, all of which have been stamped out in the regio::riscv64::encoding submodule with names equal to their official mnemonics.

Example usage:

use regio::riscv64::{Csr, encoding};

const TIME: Csr<encoding::time, u64> = Csr::new();

println!("TIME: {:#x}", TIME.read());

Aliased Type§

pub struct Csr<Encoding, Layout> { /* private fields */ }

Implementations§

Source§

impl<Encoding, Layout> Csr<Encoding, Layout>
where Encoding: ControlAndStatusRegisterEncoding, Layout: LayoutOver<u64>,

Source

pub const fn new() -> Self

Constructs a new CSR instance.