pub struct Dcache { /* private fields */ }Expand description
The 8 KiB write-back data cache.
Implementations§
Source§impl Dcache
impl Dcache
Sourcepub const fn miss_plan(&self, addr: u32) -> Option<Option<Writeback<16>>>
pub const fn miss_plan(&self, addr: u32) -> Option<Option<Writeback<16>>>
Prepare the line covering addr for access, reporting what the caller
must do to the bus first.
Returns the eviction that must be written back (if any). After the
caller has performed it and supplied the fill data through
Dcache::install, the line is resident.
Sourcepub fn read(&self, addr: u32, len: usize) -> u64
pub fn read(&self, addr: u32, len: usize) -> u64
Read len bytes at addr from a resident line.
The caller must have made the line resident first. An access never straddles two lines: every access reaching the cache is naturally aligned to its own width, and the widest is 8 bytes into a 16-byte line.
Sourcepub fn write(&mut self, addr: u32, len: usize, value: u64)
pub fn write(&mut self, addr: u32, len: usize, value: u64)
Write the low len bytes of value at addr into a resident line,
marking it dirty.
Sourcepub const fn load_tag(&self, addr: u32) -> u32
pub const fn load_tag(&self, addr: u32) -> u32
Index_Load_Tag: the tag at the index addr selects, in TagLo form.
A dirty line and a clean one both report PState = 3. The write-back bit
has no TagLo field on this part, so the distinction is genuinely not
visible to software — reporting it would be inventing an encoding.
Sourcepub const fn store_tag(&mut self, addr: u32, tag_lo: u32)
pub const fn store_tag(&mut self, addr: u32, tag_lo: u32)
Index_Store_Tag: overwrite the tag at the index addr selects.
Sourcepub const fn flush_index(
&mut self,
addr: u32,
invalidate: bool,
clean: bool,
) -> Option<Writeback<16>>
pub const fn flush_index( &mut self, addr: u32, invalidate: bool, clean: bool, ) -> Option<Writeback<16>>
Take the line at the index addr selects for write-back, if it is dirty.
clean clears the dirty bit (Hit_Write_Back leaves the line resident);
invalidate additionally clears the valid bit.
Sourcepub const fn create_dirty_exclusive(
&mut self,
addr: u32,
) -> Option<Writeback<16>>
pub const fn create_dirty_exclusive( &mut self, addr: u32, ) -> Option<Writeback<16>>
Create_Dirty_Exclusive: claim the line for addr without filling it.
Returns any dirty line evicted in the process. The new line’s data is whatever the old line held — the operation exists precisely so software can avoid the fill when it is about to overwrite the whole line, so leaving stale bytes is the point, not an oversight.