A Nios II processor core might include one, both, or neither of the cache memories.
Furthermore, for cores that provide data and/or instruction cache, the sizes of the
cache memories are user-configurable. The inclusion of cache memory does not affect
the functionality of programs, but it does affect the speed at which the processor
fetches instructions and reads/writes data.
2.6.2.2. Effective Use of Cache Memory
The effectiveness of cache memory to improve performance is based on the following
premises:
•
Regular memory is located off-chip, and access time is long compared to on-chip
memory
•
The largest, performance-critical instruction loop is smaller than the instruction
cache
•
The largest block of performance-critical data is smaller than the data cache
Optimal cache configuration is application specific, although you can make decisions
that are effective across a range of applications. For example, if a Nios II processor
system includes only fast, on-chip memory (i.e., it never accesses slow, off-chip
memory), an instruction or data cache is unlikely to offer any performance gain. As
another example, if the critical loop of a program is 2 KB, but the size of the
instruction cache is 1 KB, an instruction cache does not improve execution speed. In
fact, an instruction cache may degrade performance in this situation.
If an application always requires certain data or sections of code to be located in cache
memory for performance reasons, the tightly-coupled memory feature might provide a
more appropriate solution. Refer to the "Tightly-Coupled Memory" section for details.
2.6.2.3. Cache Bypass Methods
The Nios II architecture provides the following methods for bypassing the data cache:
•
I/O load and store instructions
•
Bit-31 cache bypass
•
Peripheral Region
Note:
By default the Bit-31 cache bypass is turned on.
2.6.2.3.1. I/O Load and Store Instructions Method
The load and store I/O instructions such as
ldwio
and
stwio
bypass the data cache
and force an Avalon-MM data transfer to a specified address.
2.6.2.3.2. The Bit-31 Cache Bypass Method
The bit-31 cache bypass method on the data master port uses bit 31 of the address as
a tag that indicates whether the processor should transfer data to/from cache, or
bypass it. This is a convenience for software, which might need to cache certain
addresses and bypass others. Software can pass addresses as parameters between
functions, without having to specify any further information about whether the
addressed data is cached or not.
To determine which cores implement which cache bypass methods, refer to the Nios II
Core Implementation Details chapter of the Nios II Processor Reference Handbook.
2. Processor Architecture
NII-PRG | 2018.04.18
Nios II Processor Reference Guide
28