Skip to content

Commit

Permalink
feat(btb): add index hash (#3563)
Browse files Browse the repository at this point in the history
this avoids btb conflict in some special pattern
  • Loading branch information
eastonman committed Sep 25, 2024
1 parent c6a44c3 commit d4885a3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/scala/xiangshan/frontend/FTB.scala
Original file line number Diff line number Diff line change
Expand Up @@ -452,11 +452,18 @@ object FTBMeta {
// }
// }


class FTBTableAddr(val idxBits: Int, val banks: Int, val skewedBits: Int)(implicit p: Parameters) extends XSBundle {
val addr = new TableAddr(idxBits, banks)
def getIdx(x: UInt) = addr.getIdx(x) ^ Cat(addr.getTag(x), addr.getIdx(x))(idxBits + skewedBits - 1, skewedBits)
def getTag(x: UInt) = addr.getTag(x)
}

class FTB(implicit p: Parameters) extends BasePredictor with FTBParams with BPUUtils
with HasCircularQueuePtrHelper with HasPerfEvents {
override val meta_size = WireInit(0.U.asTypeOf(new FTBMeta)).getWidth

val ftbAddr = new TableAddr(log2Up(numSets), 1)
val ftbAddr = new FTBTableAddr(log2Up(numSets), 1, 3)

class FTBBank(val numSets: Int, val nWays: Int) extends XSModule with BPUUtils {
val io = IO(new Bundle {
Expand Down

0 comments on commit d4885a3

Please sign in to comment.