Skip to content

Commit

Permalink
prefetch: tp-meta supports hartid-tagged hit comparison (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
wakafa1 authored Oct 26, 2023
1 parent b317d0c commit fe18821
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 0 additions & 2 deletions src/main/scala/huancun/Common.scala
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,9 @@ class TPmetaReq extends Bundle {
val way = UInt(8.W)
val wmode = Bool()
val rawData = Vec(16, UInt((36-6).W))
val mode = UInt(3.W)
}

class TPmetaResp extends Bundle {
val hartid = UInt(4.W)
val rawData = Vec(16, UInt((36-6).W))
val mode = UInt(3.W)
}
7 changes: 3 additions & 4 deletions src/main/scala/huancun/prefetch/TPmeta.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class TPmetaIO(implicit p: Parameters) extends TPmetaBundle {

class metaEntry(implicit p:Parameters) extends TPmetaBundle {
val rawData = Vec(16, UInt((36-6).W))
val mode = UInt(3.W)
val hartid = UInt(4.W)
// TODO: val compressedData = UInt(512.W)
}

Expand All @@ -50,7 +50,7 @@ class TPmeta(implicit p: Parameters) extends TPmetaModule

val wdata = Wire(new metaEntry())
wdata.rawData := io.req.bits.rawData
wdata.mode := io.req.bits.mode
wdata.hartid := io.req.bits.hartid
tpDataTable.io.w.apply(
valid = writeReqValid,
data = wdata,
Expand All @@ -66,9 +66,8 @@ class TPmeta(implicit p: Parameters) extends TPmetaModule
rdata := tpDataTable.io.r.resp.data(readReqReg.way)
}

io.resp.valid := RegNext(readReqValidReg)
io.resp.valid := RegNext(readReqValidReg) && (rdata.hartid === RegNext(readReqReg).hartid)
io.resp.bits.rawData := rdata.rawData
io.resp.bits.mode := rdata.mode
io.resp.bits.hartid := RegNext(readReqReg).hartid
io.req.ready := true.B
}

0 comments on commit fe18821

Please sign in to comment.