mortbopet / Ripes

A graphical processor simulator and assembly editor for the RISC-V ISA
https://ripes.me/
MIT License
2.49k stars 270 forks source link

Add Cache Replacement Policy #334

Open tinhanho opened 8 months ago

tinhanho commented 8 months ago

Hi @mortbopet, I find that contributing to the cache replacement policy is a good way to work with. The replacement policy which possesses from now on are Random and LRU. Intuitively, FIFO can be added and it has been done through few lines of code. What I am doing now is trying to add policy like least frequently used. However, I cannot find out where the code is to expand the slot just like LRU doing. For example, when 2 ways cache used, you click Repl. policy LRU and the LRU slots show up. image

I guess that it might be the UI problem but I do not know how to modify it. Could you help me?

HotMercury commented 8 months ago

You can review line 440 in the incachegraphic.cpp file within issue #335, and you'll discover the relevant information there.

if (m_cache.getReplacementPolicy() == ReplPolicy::LRU && m_cache.getWays() > 1)