Skip to content

Commit

Permalink
fix replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
sequencer committed Jul 31, 2024
1 parent 57a9a83 commit cb9acc5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rocketv/src/Replacement.scala
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class PseudoLRU(n_ways: Int) extends ReplacementPolicy {
val right_nways: Int = 1 << (log2Ceil(tree_nways) - 1) // number of ways in the right sub-tree
val left_nways: Int = tree_nways - right_nways // number of ways in the left sub-tree
val set_left_older = !touch_way(log2Ceil(tree_nways)-1)
val left_subtree_state = state(tree_nways-3, right_nways-1)
val left_subtree_state = if(tree_nways - 1 == right_nways) 0.U else state(tree_nways-3, right_nways-1)
val right_subtree_state = state(right_nways-2, 0)

if (left_nways > 1) {
Expand Down Expand Up @@ -265,7 +265,7 @@ class PseudoLRU(n_ways: Int) extends ReplacementPolicy {
val right_nways: Int = 1 << (log2Ceil(tree_nways) - 1) // number of ways in the right sub-tree
val left_nways: Int = tree_nways - right_nways // number of ways in the left sub-tree
val left_subtree_older = state(tree_nways-2)
val left_subtree_state = state(tree_nways-3, right_nways-1)
val left_subtree_state = if(tree_nways - 1 == right_nways) 0.U else state(tree_nways-3, right_nways-1)
val right_subtree_state = state(right_nways-2, 0)

if (left_nways > 1) {
Expand Down

0 comments on commit cb9acc5

Please sign in to comment.