GD32W51x User Manual
124
However, according to hit-under-miss feature, if address is not present in TAG memory
which belongs to the current refill burst, also means cache hit. Even if cache line is refilling,
only if the data is available at its master interface, ICACHE is able to fetch the requested
data quickly, so as to avid a miss.
Cache miss: If address is not present in its TAG memory, means cache miss, the data is
read from main memory, and refill the cache line. The critical-word-first policy optimize
wait periods for the processor, the policy allow processor to read the requested data
firstly, and then, cache still perform cache line refilling. If an address remap happen, the
kind of burst, which is generated on master port, is configured by the OBT bit in its
ICACHE_CFGx register.
Considering cache refilling, ICACHE determine cache line index. In 2-way set associative
mode, the line is pointed by the address index in each way, according to pLRU
replacement algorithm, the way is selected for use, and the other one is for the next refill.
In the 2-way set associative cache mode, if the cache line is selected to be written by the
refill data, and the line is already valid, the targeted cache line must be invalidated firstly.
Comparing to fetching instructions from main memory, processor get lower power
consumption in fetching instructions from internal ICACHE. If the cached memory is
external, power saving is more obvious.
4.3.6.
ICACHE performance monitoring
For analyzing cache performance, ICACHE support two monitors: a 32-bit hit monitor
and a 16-bit miss monitor, they are disabled by default
Hit monitor counts the AHB-transactions on ICACHE input port, which do not generate a
transaction on output master0 or master1 port. It is necessary to consider the access
whose address is present in the TAG memory or in the refill buffer.
Miss monitor counts the AHB-transactions on ICACHE input port, which generate a
transaction on output master0 or master1 port. It is necessary to consider the access
whose address is not present in the TAG memory and the refill buffer.
Hit and miss monitors can be enabled and reset by software as following:
•
Enable / switch off the hit monitor through the HMEN bit in ICACHE_CTL.
•
Reset the hit monitor by setting the HMRST bit in ICACHE_CTL.
•
Enable / switch off the miss monitor through the MMEN bit in ICACHE_CTL.
•
Reset the miss monitor by setting the MMRST bit in ICACHE_CTL.
4.3.7.
ICACHE interrupts
If there is an unsupported cacheable write request detected, an error is generated by
setting ERR bit in ICACHE_STAT. meanwhile, if the corresponding interrupt enable bit is
set, error interrupt is triggered.
If a cache invalidation operation is finished, an end flag is generated by setting END bit