Jacob Lifshay found a couple of issues with the PLRU implementation:
- The tree array is one bit too long. This is harmless as this bit is never
accessed and thus should be optimized out
- The PLRU read is using the wrong nodes when going down the tree, which leads
to incorrect results.
This fixes it and improves the test bench a bit. I have verified the expected
output using a hand-written tree states, observed the mismatch with the
current implementation and verified the fix.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
This adds support for set associativity to the icache. It can still
be direct mapped by setting NUM_WAYS to 1.
The replacement policy uses a simple tree-PLRU for each set.
This is only lightly tested, tests pass but I have to double check
that we are using the ways effectively and not creating duplicates.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>