CACHE — Instruction/data cache

The cache is two-way set associative with a least recently used (LRU) replacement policy. Both instruction and data accesses towards NVM memory are cached.

The cache has the following features:

The cache must be enabled by the ENABLE register.

Architecture

The following figure shows the cache architecture.

Figure 1. Cache overview
Cache Overview
BitNameDescription
VValidIndicates if a cache entry is valid. All V fields are cleared when enabling the cache, invalidating the cache, or when changing CACHE mode.
MRUMost Recently UsedUpdated on each fetch from the cache to indicate which Way was used most recently. Used to drive the cache replacement policy.

Profiling

The cache provides a scoreboard that tracks the hits and misses within the cache.

The results are available through a set of registers that can be used to indicate how well the cache is performing.

Profiling is enabled using PROFILING.ENABLE. All profiling counters can be cleared at any time using PROFILING.CLEAR. After being cleared, the counters will increment, according to the rules in the table below, at the next instruction- or data fetch.

Table 1. Profiling counters
Profiling counterDescription
HITIncremented on a cache hit
MISSIncremented on a cache miss (not counting write misses)
LMISSIncremented when accessing different line than was accessed last time
READSIncremented on a CPU read
WRITESIncremented on a CPU write

Debug

The CPU is able to read internal cache memories and tags for debug purposes.

The content of data and tag RAM's are accessible through registers SET[n].WAY[o].INFO (n=0..127) (o=0..1) and SET[n].WAY[o].DU[p].DATA[q] (n=0..127) (o=0..1) (p=0..3) (q=0..1).

Debug access is prevented by using register DEBUGLOCK.

Registers

Instances

InstanceDomainBase addressTrustZoneSplit accessDescription
MapAttDMA
ICACHEAPPLICATION0xE0082000HFSNANoInstruction cache

Configuration

InstanceDomainConfiguration
ICACHEAPPLICATION

Cache size: 8 KB. Sets: 128. Data unit: 64 bits. Line width = 4 data units.

Supports line invalidation

Supports cache erase

Supports cache line maintain

Supports extended profiling registers (LMISS / READS / WRITES)

Supports debug lock

Supports write lock

Data bus width : 0..63

Register overview

RegisterOffsetTZDescription
TASKS_INVALIDATECACHE0x008Invalidate the cache.
TASKS_INVALIDATELINE0x014Invalidate the line.
TASKS_ERASE0x020Erase the cache.
STATUS0x400Status of the cache activities.
ENABLE0x404Enable cache.
LINEADDR0x410Memory address covered by the line to be maintained.
PROFILING.ENABLE0x414Enable the profiling counters.
PROFILING.CLEAR0x418Clear the profiling counters.
PROFILING.HIT0x41CThe cache hit counter for cache region.
PROFILING.MISS0x420The cache miss counter for cache region.
PROFILING.LMISS0x424The cache line miss counter for cache region.
PROFILING.READS0x428Number of reads for cache region.
PROFILING.WRITES0x42CNumber of writes for cache region.
DEBUGLOCK0x430Lock debug mode.
WRITELOCK0x434Lock cache updates.

TASKS_INVALIDATECACHE

Address offset: 0x008

Invalidate the cache.

The STATUS is updated for this task. This task can be triggered only when the STATUS is ready.

Bit number313029282726252423222120191817161514131211109876543210
IDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
AWTASKS_INVALIDATECACHE

Invalidate the cache.

The STATUS is updated for this task. This task can be triggered only when the STATUS is ready.

Trigger1Trigger task

TASKS_INVALIDATELINE

Address offset: 0x014

Invalidate the line.

The STATUS is updated for this task. This task can be triggered only when the STATUS is ready.

Bit number313029282726252423222120191817161514131211109876543210
IDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
AWTASKS_INVALIDATELINE

Invalidate the line.

The STATUS is updated for this task. This task can be triggered only when the STATUS is ready.

Trigger1Trigger task

TASKS_ERASE

Address offset: 0x020

Erase the cache.

The STATUS is updated for this task. This task can be triggered only when the STATUS is ready.

Bit number313029282726252423222120191817161514131211109876543210
IDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
AWTASKS_ERASE

Erase the cache.

The STATUS is updated for this task. This task can be triggered only when the STATUS is ready.

Trigger1Trigger task

STATUS

Address offset: 0x400

Status of the cache activities.

Indicates status of the activities initiated using respective tasks.

Bit number313029282726252423222120191817161514131211109876543210
IDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARREADYReady status.
Ready0Activity is done and ready for the next activity.
Busy1Activity is in progress.

ENABLE

Address offset: 0x404

Enable cache.

Bit number313029282726252423222120191817161514131211109876543210
IDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWENABLEEnable cache
Disabled0Disable cache
Enabled1Enable cache

LINEADDR

Address offset: 0x410

Memory address covered by the line to be maintained.

The line maintain activities are line invalidate, line clean and line flush.

Bit number313029282726252423222120191817161514131211109876543210
IDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWADDRAddress.

PROFILING.ENABLE

Address offset: 0x414

Enable the profiling counters.

Bit number313029282726252423222120191817161514131211109876543210
IDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWENABLEEnable the profiling counters
Disable0Disable profiling
Enable1Enable profiling

PROFILING.CLEAR

Address offset: 0x418

Clear the profiling counters.

The profiling counters can be cleared at any time. When cleared, all profiling counters will be set to zero, and will increment at the next instruction- or data fetch.

Bit number313029282726252423222120191817161514131211109876543210
IDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
AWCLEARClearing the profiling counters
Clear1Clear the profiling counters

PROFILING.HIT

Address offset: 0x41C

The cache hit counter for cache region.

Bit number313029282726252423222120191817161514131211109876543210
IDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARHITSNumber of cache hits

PROFILING.MISS

Address offset: 0x420

The cache miss counter for cache region.

Bit number313029282726252423222120191817161514131211109876543210
IDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARMISSESNumber of cache misses

PROFILING.LMISS

Address offset: 0x424

The cache line miss counter for cache region.

Bit number313029282726252423222120191817161514131211109876543210
IDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARLMISSESNumber of cache line misses

PROFILING.READS

Address offset: 0x428

Number of reads for cache region.

Bit number313029282726252423222120191817161514131211109876543210
IDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARREADSNumber of reads for cache region.

PROFILING.WRITES

Address offset: 0x42C

Number of writes for cache region.

Bit number313029282726252423222120191817161514131211109876543210
IDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWRITESNumber of writes for cache region.

DEBUGLOCK

Address offset: 0x430

Lock debug mode.

Note: Debug mode can only be unlocked by a reset
Bit number313029282726252423222120191817161514131211109876543210
IDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARW1DEBUGLOCKLock debug mode
Unlocked0Debug mode unlocked
Locked1Debug mode locked. Ignores any other value written.

WRITELOCK

Address offset: 0x434

Lock cache updates.

Prevents updating of cache content on cache misses, but will continue to lookup instruction/data fetches in content already present in the cache. The write lock is applied to whole cache.

Bit number313029282726252423222120191817161514131211109876543210
IDA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARWWRITELOCKLock cache updates
Unlocked0Cache updates unlocked
Locked1Cache updates locked

Registers

Instances

InstanceDomainBase addressTrustZoneSplit accessDescription
MapAttDMA
ICACHEINFOAPPLICATION0x02F10000HFSNANoInstruction cache info

Configuration

InstanceDomainConfiguration
ICACHEINFOAPPLICATION

Number of sets : 0..127

Number of ways : 0..1

Number of data units : 0..3

Data width of a data unit : 0..1 words

TAG width : 0..19

Register overview

RegisterOffsetTZDescription
SET[n].WAY[o].INFO0x0Cache information for SET[n], WAY[o].

SET[n].WAY[o].INFO

Address offset: 0x0 + (n × 0x8) + (o × 0x4)

Cache information for SET[n], WAY[o].

Bit number313029282726252423222120191817161514131211109876543210
IDGFEDCBAAAAAAAAAAAAAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARTAGCache tag.
B-ERDUV[i] (i=0..3)

Data unit valid info.

One info bit for each data unit in a line, LSB is the first data unit.

Invalid0Invalid data unit
Valid1Valid data unit
FRVLine valid bit.
Invalid0Invalid cache line
Valid1Valid cache line
GRMRUMost recently used way.
Way00Way0 was most recently used
Way11Way1 was most recently used

Registers

Instances

InstanceDomainBase addressTrustZoneSplit accessDescription
MapAttDMA
ICACHEDATAAPPLICATION0x02F00000HFSNANoInstruction cache data

Configuration

InstanceDomainConfiguration
ICACHEDATAAPPLICATION

Number of sets : 0..127

Number of ways : 0..1

Number of data units : 0..3

Data width of a data unit : 0..1 words

Register overview

RegisterOffsetTZDescription
SET[n].WAY[o].DU[p].DATA[q]0x0Cache data bits for DATA[q] in DU[p] (DataUnit) of SET[n], WAY[o].

SET[n].WAY[o].DU[p].DATA[q]

Address offset: 0x0 + (n × 0x40) + (o × 0x20) + (p × 0x8) + (q × 0x4)

Cache data bits for DATA[q] in DU[p] (DataUnit) of SET[n], WAY[o].

Bit number313029282726252423222120191817161514131211109876543210
IDAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Reset 0x0000000000000000000000000000000000000000
IDR/WFieldValue IDValueDescription
ARDataData