I am programming CPU cache simulator and I am supposed to implement removing of entries. I will not use LRU but just random.
I am not really clear, when should I call the removing function? When cache (2 or 4 caches) are full and CPU wants to write into cache where all (data and tag) of specific indexes are same? Are there some other possible situations, or maybe I am completely wrong?
Hope you understand my question, if no, please tell me and I will edit my question. Thank you in advance.