Skip to main content

Memory

Trait Memory 

Source
pub trait Memory: Sized {
    type Memwidth: RegInt;
    type Access: Access;
    type Endian: Endian;

    // Required methods
    fn first_entry_ptr(&self) -> *mut Self::Memwidth;
    fn num_entries(&self) -> usize;
    fn width(&self) -> usize;

    // Provided methods
    fn index(&self, idx: usize) -> MemEntry<Self> { ... }
    fn slice(&self, range: impl RangeBounds<usize>) -> MemEntryIter<Self>  { ... }
    fn iter(&self) -> MemEntryIter<Self>  { ... }
}
Expand description

Behaviors common to all SystemRDL memories

Required Associated Types§

Source

type Memwidth: RegInt

Primitive integer type used to represented a memory entry

Source

type Access: Access

Source

type Endian: Endian

Required Methods§

Source

fn first_entry_ptr(&self) -> *mut Self::Memwidth

Source

fn num_entries(&self) -> usize

Number of memory entries

Source

fn width(&self) -> usize

Bit width of each memory entry

Provided Methods§

Source

fn index(&self, idx: usize) -> MemEntry<Self>

Access the memory entry at a specific index. Panics if out of bounds.

Source

fn slice(&self, range: impl RangeBounds<usize>) -> MemEntryIter<Self>

Iterate over a range of memory entries

Source

fn iter(&self) -> MemEntryIter<Self>

Iterate over all memory entries

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§