Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(TP): fix XS compiling bug in TPmetaReq/Resp #181

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading