1
0
Fork 0

NBcache works with associativities other than powers of 2

This commit is contained in:
Henry Cook 2012-02-13 21:43:49 -08:00
parent 6d36168183
commit 0671a99712
1 changed files with 7 additions and 1 deletions

View File

@ -14,7 +14,13 @@ class ioReplacementWayGen extends Bundle {
class RandomReplacementWayGen extends Component {
val io = new ioReplacementWayGen()
//TODO: Actually limit selection based on which ways are allowed (io.ways_en)
if(NWAYS > 1) io.way_id := LFSR16(io.pick_new_way)(log2up(NWAYS)-1,0)
if(NWAYS > 1)
{
val rand_way_id = UFix(width = log2up(NWAYS))
rand_way_id := LFSR16(io.pick_new_way)(log2up(NWAYS)-1,0)
when (rand_way_id >= UFix(NWAYS, width = log2up(NWAYS))) { io.way_id := UFix(0, width = log2up(NWAYS)) }
.otherwise { io.way_id := rand_way_id }
}
else io.way_id := UFix(0)
}