Skip to content

Commit

Permalink
Merge pull request #181 from OpenXiangShan/tp-hardcoding-tmp
Browse files Browse the repository at this point in the history
fix(TP): fix XS compiling bug in TPmetaReq/Resp
  • Loading branch information
Ma-YX authored Sep 5, 2024
2 parents fcc4278 + 369b9fa commit 3fc7e7e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/main/scala/huancun/Common.scala
Original file line number Diff line number Diff line change
Expand Up @@ -237,16 +237,16 @@ class PrefetchRecv extends Bundle {
val l2_pf_en = Bool()
}

class TPmetaReq(implicit p: Parameters) extends HuanCunBundle {
// FIXME: parameterize the hard code
class TPmetaReq(hartIdLen: Int, fullAddressBits: Int, offsetBits: Int) extends Bundle {
// TODO: rawData's width is determined by L2; when L2's offsetBits change, rawData should change accordingly
val hartid = UInt(hartIdLen.W)
val set = UInt(32.W) // determined by TP
val way = UInt(4.W)
val wmode = Bool()
val rawData = Vec(16, UInt((fullAddressBits - offsetBits).W))
val rawData = Vec(log2Floor(512 / (fullAddressBits - offsetBits)), UInt((fullAddressBits - offsetBits).W))
}

class TPmetaResp(implicit p: Parameters) extends HuanCunBundle {
class TPmetaResp(hartIdLen: Int, fullAddressBits: Int, offsetBits: Int) extends Bundle {
val hartid = UInt(hartIdLen.W)
val rawData = Vec(16, UInt((fullAddressBits - offsetBits).W))
val rawData = Vec(log2Floor(512 / (fullAddressBits - offsetBits)), UInt((fullAddressBits - offsetBits).W))
}
4 changes: 2 additions & 2 deletions src/main/scala/huancun/HuanCun.scala
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class HuanCun(implicit p: Parameters) extends LazyModule with HasHuanCunParamete
BundleBridgeNexusNode[DecoupledIO[TPmetaReq]]()
)
val tpmeta_send_node = tpmetaOpt.map(_ =>
BundleBridgeSource(() => ValidIO(new TPmetaResp))
BundleBridgeSource[ValidIO[TPmetaResp]]()
)

lazy val module = new HuanCunImp(this)
Expand Down Expand Up @@ -327,7 +327,7 @@ class HuanCun(implicit p: Parameters) extends LazyModule with HasHuanCunParamete
wrapper.tpmeta_recv_node match {
case Some(x) =>
// tpmeta.get.io.req <> x.in.head._1
val arb = Module(new FastArbiter(new TPmetaReq, x.in.size))
val arb = Module(new FastArbiter(new TPmetaReq(hartIdLen, wrapper.node.out.head._2.bundle.addressBits, offsetBits), x.in.size))
for ((arb, req) <- arb.io.in.zip(x.in)) {
arb <> req._1
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/scala/huancun/prefetch/TPmeta.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ import utility._


class TPmetaIO(implicit p: Parameters) extends TPmetaBundle {
val req = Flipped(DecoupledIO(new TPmetaReq))
val resp = ValidIO(new TPmetaResp)
val req = Flipped(DecoupledIO(new TPmetaReq(hartIdLen, fullAddressBits, offsetBits)))
val resp = ValidIO(new TPmetaResp(hartIdLen, fullAddressBits, offsetBits))
}

class metaEntry(implicit p:Parameters) extends TPmetaBundle {
val rawData = Vec(16, UInt((36-6).W))
val rawData = Vec(log2Floor(512 / (fullAddressBits - offsetBits)), UInt((fullAddressBits - offsetBits).W))
val hartid = UInt(hartIdLen.W)
// TODO: val compressedData = UInt(512.W)
}
Expand Down

0 comments on commit 3fc7e7e

Please sign in to comment.