Nios® II Processor Reference Guide

ID 683836
Date 10/22/2020
Public
Document Table of Contents

5.2.3.2.2. Data Cache

  • Direct-mapped cache implementation
  • Line size of 32-bytes
  • The data master port reads an entire cache line at a time from memory, and issues one read per clock cycle.
  • Write-back
  • Write-allocate (i.e., on a store instruction, a cache miss allocates the line for that address)
  • Virtually-indexed, physically-tagged, when MMU present

The size of the tag field depends on the size of the cache memory and the physical address size. The size of the line field depends only on the size of the cache memory. The size of the offset field depends on the line size. Line sizes of 32 bytes have offset widths of 5-bits. The maximum data byte address size is 31 bits in systems without an MMU present. In systems with an MMU, the maximum data byte address size is 32 bits and the tag field always includes all the bits of the PFN.

The data cache is optional. If the data cache is excluded from the core, the data master port can also be excluded.

The Nios II instruction set provides several different instructions to clear the data cache. There are two important questions to answer when determining the instruction to use. Do you need to consider the tag field when looking for a cache match? Do you need to write dirty cache lines back to memory before clearing? Below the table lists the most appropriate instruction to use for each case.

Table 63.  Data Cache Clearing Instructions
Instruction Ignore Tag Field Consider Tag Field
Write Dirty Lines flushd flushda
Do Not Write Dirty Lines initd initda

For more information regarding the Nios II instruction set, refer to the Instruction Set Reference chapter of the Nios® II Processor Reference Handbook.

The Nios II/f core implements all the data cache bypass methods.

For information regarding the data cache bypass methods, refer to the Processor Architecture chapter of the Nios® II Processor Reference Handbook

Mixing cached and uncached accesses to the same cache line can result in invalid data reads. For example, the following sequence of events causes cache incoherency.

  1. The Nios II core writes data to cache, creating a dirty data cache line.
  2. The Nios II core reads data from the same address, but bypasses the cache.
Note: Avoid mixing cached and uncached accesses to the same cache line, regardless whether you are reading from or writing to the cache line. If it is necessary to mix cached and uncached data accesses, flush the corresponding line of the data cache after completing the cached accesses and before performing the uncached accesses.

Did you find the information on this page useful?

Characters remaining:

Feedback Message