Skip to content

Commit

Permalink
PLRU: multiple access update
Browse files Browse the repository at this point in the history
  • Loading branch information
ingallsj committed Feb 4, 2020
1 parent 36d87ef commit 9057b3c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/scala/util/Replacement.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ class PseudoLRU(n: Int)
def access(way: UInt) {
state_reg := get_next_state(state_reg,way)
}
def access(ways: Seq[ValidIO[UInt]]) {
state_reg := ways.fold(state_reg) { case (prev: UInt, way: ValidIO[UInt]) =>
Mux(way.valid, get_next_state(prev, way.bits), prev) }
}
def get_next_state(state: UInt, way: UInt) = {
var next_state = state << 1
var idx = UInt(1,1)
Expand Down

0 comments on commit 9057b3c

Please sign in to comment.