Nios® V Processor Reference Manual

ID 683632
Date 5/26/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

3.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)

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 52.  RISC-V Zicbom Cache Block Management
Instruction Name Operation Encoding
cbo.clean <rs1> 1 2 Clean Data Cache Address
  • Identifies the cache line with tag and index field.
  • If there is a cache hit, proceeds to the following operations:
    • 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 RISC-V Base Cache Management Operation ISA Extension.
cbo.flush <rs1> 1 2 Flush Data Cache Address
  • Identifies the cache line with tag and index field.
  • If there is a cache hit, proceeds to the following operations:
    • Invalidates the cache line.
    • Writes the data back to the memory if the cache line is valid and dirty; otherwise, ignores the data.
cbo.inval <rs1> 1 2 Invalidate Data Cache Address
  • Identifies the cache line with tag and index field.
  • If there is a cache hit, proceeds to the following operations:
    • Invalidates the cache line.
    • Does not write the data back to the memory.
Table 53.  Custom Cache Block Management Instructions
Instruction Operation Encoding
cbo.clean.ix <rs1>[ 3
  • 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> 3
  • 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>[ 3
  • 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 54.  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 55.  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 56.  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
1 Source register 1 (rs1) holds the 32-bit cache line address (tag, index, and offset).
2 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.
3 Source register 1 (rs1) holds the cache line index, which can be 5 to 9-bits depending on the cache size.