Visible to Intel only — GUID: mwh1416946933246
Ixiasoft
Visible to Intel only — GUID: mwh1416946933246
Ixiasoft
9.3.1. Assembly Code to Initialize the Instruction Cache
Example 9–2. Assembly Code to Initialize the Instruction Cache
mov r4, r0
movhi r5, %hi(NIOS2_ICACHE_SIZE)
ori r5, r5, %lo(NIOS2_ICACHE_SIZE)
icache_init_loop:
initi r4
addi r4, r4, NIOS2_ICACHE_LINE_SIZE
bltu r4, r5, icache_init_loop
After the instruction cache is initialized, the data cache must also be initialized. The Nios II initd instruction initializes a single data cache line. Do not use the flushd instruction for this purpose, because it writes dirty lines back to memory. The data cache is undefined after reset, including the cache line tags. Using flushd can cause unexpected writes of random data to random addresses. The initd instruction does not write back dirty data.