OpenCores
no use no use 1/1 no use no use
I-cache invalidate
by river306 on Apr 12, 2012
river306
Posts: 18
Joined: Sep 27, 2008
Last seen: Apr 29, 2024
Can I-cache be invalidated when cache is enable?
RE: I-cache invalidate
by haitao73 on Apr 19, 2012
haitao73
Posts: 1
Joined: May 26, 2011
Last seen: Mar 4, 2022
cpu only reads I-cache, never wirte, so i think I-cache has no invalidate.
RE: I-cache invalidate
by rherveille on Apr 19, 2012
rherveille
Posts: 33
Joined: Sep 25, 2001
Last seen: May 31, 2018
There are many times when an instruction cache needs to be invalidated.
After power-up for example, but also in multi-CPU systems.

As far as I know you can invalidate all caches using special purpose registes.

Richard
RE: I-cache invalidate
by pekon on Apr 19, 2012
pekon
Posts: 29
Joined: Mar 6, 2009
Last seen: Dec 14, 2020
but also in multi-CPU systems.
Richard


Though invalidating of I-Cache is less frequent in a system, because you usually don't play with your instructions & code on-the-fly when system is running..

One place where i can think is at places where on-the-fly software update is required without re-booting the system. However, code-patch in such cases has to be very precise and tested well.
Please share if anyone knows about any other scenarios ?


To answer your question,
invalidating I-cache (specifically), without disabling it first, might cause some system crashes which would be very difficult to debug. I'll try to put a scenario here..
(1) you have updated your software (code).
(2) but your I-cache was enabled at that time, so it is now stale with-respect-to new code.
(3) before you could invalidate the I-cache, there was a cache-miss, due to which pieces of new code gets pre-fetched into your I-cache.
(4) this new-code may cause jump to somewhere which was not deterministic in old-code. This may cause system-crashes.
(5) Also now your I-cache is very dirty. It has bits and pieces of both old-code and new-code, which is dangerous & difficult to debug.


hope this solves your query ..

with regards, pekon
no use no use 1/1 no use no use
© copyright 1999-2026 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.