Nios® V Processor Reference Manual

ID 683632
Date 7/26/2024
Public
Document Table of Contents

4.3.9.3.2. Data Cache

The data cache memory has the following characteristics:

  • Direct-mapped cache implementation
  • 32 bytes (8 words) per cache line
  • Configurable size of 1, 2, 4, 8, and 16 KBytes
  • The data manager 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)
  • Burst length of 8

The data byte address size is 32 bit. The size of the tag and index field depends only on the size of the cache memory. The offset field is always five bits (i.e., a 32-byte line).

The Nios® V/g processor instruction set provides cache block management instructions for the data cache.

Table 73.  RISC-V Zicbom Cache Block Management
Instruction Name Operation Encoding
cbo.clean <rs1> 6 7 Clean Data Cache Address
  • Identifies the cache line with tag and index field.
  • If there is a cache hit, performs the following operations:
    • Clear the cache line’s dirty state.
    • If the cache line is valid and dirty, data is written back to the memory.
Refer to RISC-V Base Cache Management Operation ISA Extension.
cbo.flush <rs1> 6 7 Flush Data Cache Address
  • Identifies the cache line with tag and index field.
  • If there is a cache hit, performs the following operations:
    • Invalidate the cache line.
    • Write the data back to the memory if the cache line is valid and dirty; otherwise, ignore the data.
cbo.inval <rs1> 6 7 Invalidate Data Cache Address
  • Identifies the cache line with tag and index field.
  • If there is a cache hit, performs the following operations:
    • Invalidate the cache line.
    • Do not write the data back to the memory.
Table 74.  Custom Cache Block Management Instructions
Instruction Operation Encoding
cbo.clean.ix <rs1>[ 8
  • Identifies the cache line with index field,
  • Clears the cache line’s dirty state.
  • Keeps the cache line’s valid state.
  • If the cache line is valid and dirty, data is written back to the memory.
Refer to Encoding for cbo.clean.ix
cbo.flush.ix <rs1> 8
  • Identifies the cache line with index
  • Invalidates the cache line.
  • If the cache line is valid and dirty, data is written back to the memory.
  • If the cache line is not dirty, data is not written back to the memory field,
Refer to Encoding for cbo.flush.ix
cbo.inval.ix <rs1>[ 8
  • Identifies the cache line with index field,
  • Invalidates the cache line.
  • Data is not written back to the memory.
Refer to Encoding for cbo.inval.ix
Table 75.  Encoding for cbo.clean.ix
Bit Field
31:20 19:15 14:12 11:7 6:0
imm rs1 cbo Reserved misc-mem
000010000001 rs1 010 00000 0001111
Table 76.  Encoding for cbo.flush.ix
Bit Field
31:20 19:15 14:12 11:7 6:0
imm rs1 cbo Reserved misc-mem
000010000010 rs1 010 00000 0001111
Table 77.  Encoding for cbo.inval.ix
Bit Field
31:20 19:15 14:12 11:7 6:0
imm rs1 cbo Reserved misc-mem
000010000000 rs1 010 00000 0001111
6 Source register 1 (rs1) holds the 32-bit cache line address (tag, index, and offset).
7 If the specified cache line address is not found (cache miss), these instruction are implemented as nop, and does no changes to any cache lines.
8 Source register 1 (rs1) holds the cache line index, which can be 5 to 9-bits depending on the cache size.