Skip to content

Commit

Permalink
configs: correct MaxHartIdBits
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 <cyy@cyyself.name>
  • Loading branch information
cyyself committed Apr 2, 2024
1 parent eca09f7 commit bb0cb1d
Show file tree
Hide file tree
Showing 3 changed files with 8 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))
}
3 changes: 3 additions & 0 deletions src/main/scala/huancun/HuanCun.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import org.chipsalliance.cde.config.Parameters
import chisel3._
import chisel3.util._
import freechips.rocketchip.diplomacy._
import freechips.rocketchip.tile.MaxHartIdBits
import freechips.rocketchip.tilelink._
import freechips.rocketchip.tilelink.TLMessages._
import freechips.rocketchip.util.{BundleField, BundleFieldBase, UIntToOH1}
Expand Down Expand Up @@ -103,6 +104,8 @@ trait HasHuanCunParameters {

lazy val outerSinkBits = edgeOut.bundle.sinkBits

lazy val hartIdLen: Int = p(MaxHartIdBits)

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 bb0cb1d

Please sign in to comment.