1
0

fixes slight bug for non-power of 2 number of ras entries

This commit is contained in:
Scott Beamer 2015-01-29 15:29:25 -08:00
parent a98127c09e
commit 00e074cdd9

View File

@ -23,7 +23,7 @@ abstract trait BTBParameters extends UsesParameters {
class RAS(nras: Int) {
def push(addr: UInt): Unit = {
when (count < nras) { count := count + 1 }
val nextPos = Mux(Bool(isPow2(nras)) || pos > 0, pos+1, UInt(0))
val nextPos = Mux(Bool(isPow2(nras)) || pos < nras-1, pos+1, UInt(0))
stack(nextPos) := addr
pos := nextPos
}