Nios® II Software Developer Handbook

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

10.3.2. Assembly Code to Initialize the Data Cache

Example 9–3. Assembly Code to Initialize the Data Cache

mov r4, r0
movhi r5, %hi(NIOS2_DCACHE_SIZE)
ori r5, r5, %lo(NIOS2_DCACHE_SIZE)
dcache_init_loop:
initd 0(r4)
addi r4, r4, NIOS2_DCACHE_LINE_SIZE
bltu r4, r5, dcache_init_loop
Note: Place the initd instruction in a loop that executes initd for each data cache line address.

It is legal to execute instruction and data cache initialization code on Nios® II cores that do not implement one or both of the caches. The initi and initd instructions are simply treated as nop instructions if there is no cache of the corresponding type present.