VIPT Cache Replacement Policy

Implement the LRU Policy

In this module, we would be designing a Least Recently Used (LRU) module for a N-way set associative cache. The LRU module will keep track of the usage of each way in the cache and determine which way should be evicted when a new entry needs to be inserted. The number of ways for the cache will be parameterized, but it will always be a power of 2.

In order to make things interesting, we would be implementing a generic LRU module that can be used for any N-way set associative cache. The module will have a simple interface that allows it to be easily integrated into a larger cache design.

The module would also support three types of operations: read, write, and invalidate. The read and invalidate operations will require the way information to be provided as input, while the write operation will not require any way information since it will be used to update the LRU state based on the accessed way. The invalidate operation will be used to mark a way as invalid, which will affect the LRU state accordingly.

Design the Least Recently Used module for a N-way set associative cache. The number of ways for the cache are parameterized but will always be a power of 2.

All the flops (if any) should be positive edge triggered with asynchronous resets.

Loading the interactive workspace...