Skip to content

Commit

Permalink
configs: correct MaxHartIdBits (#173)
Browse files Browse the repository at this point in the history
Currently, many different lengths of HartId in Xiangshan, making it hard to
configure it to scale more than 16 cores since we have set 4bits somewhere.
This commit corrects MaxHartIdBits in config and uses MaxHartIDBits where
it needs to get this solved.

Signed-off-by: Yangyu Chen <[email protected]>
  • Loading branch information
cyyself authored Apr 7, 2024
1 parent eca09f7 commit a69ea2c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 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 extends Bundle {
class TPmetaReq(implicit p: Parameters) extends HuanCunBundle {
// FIXME: parameterize the hard code
val hartid = UInt(4.W) // max 16 harts
val hartid = UInt(hartIdLen.W)
val set = UInt(32.W)
val way = UInt(4.W)
val wmode = Bool()
val rawData = Vec(16, UInt((36-6).W))
}

class TPmetaResp extends Bundle {
val hartid = UInt(4.W)
class TPmetaResp(implicit p: Parameters) extends HuanCunBundle {
val hartid = UInt(hartIdLen.W)
val rawData = Vec(16, UInt((36-6).W))
}
2 changes: 2 additions & 0 deletions src/main/scala/huancun/HuanCun.scala
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ trait HasHuanCunParameters {

lazy val outerSinkBits = edgeOut.bundle.sinkBits

lazy val hartIdLen: Int = log2Up(cacheParams.hartIds.length)

val block_granularity = if (!cacheParams.inclusive && cacheParams.clientCaches.nonEmpty) {
cacheParams.clientCaches.head.blockGranularity
} else setBits
Expand Down
2 changes: 1 addition & 1 deletion 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 hartid = UInt(4.W)
val hartid = UInt(hartIdLen.W)
// TODO: val compressedData = UInt(512.W)
}

Expand Down

0 comments on commit a69ea2c

Please sign in to comment.