Nios® II Processor Reference Guide

ID 683836
Date 8/28/2023
Public
Document Table of Contents

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.