Skip to content

Commit

Permalink
utility: use unified MemReqSource (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang-Haojin authored Aug 17, 2023
1 parent 8f2f050 commit 51b7c5f
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 25 deletions.
19 changes: 1 addition & 18 deletions src/main/scala/huancun/Common.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import chipsalliance.rocketchip.config.Parameters
import chisel3._
import chisel3.util._
import freechips.rocketchip.util.{BundleMap, UIntToOH1}
import utility.MemReqSource

abstract class InnerTask(implicit p: Parameters) extends HuanCunBundle {
val sourceId = UInt(sourceIdBits.W)
Expand Down Expand Up @@ -235,21 +236,3 @@ class PrefetchRecv extends Bundle {
val addr_valid = Bool()
val l2_pf_en = Bool()
}

// indicates where the memory access request comes from
// a dupliacte of this is in Xiangshan.package and CoupledL2.common
object MemReqSource extends Enumeration {
val NoWhere = Value("NoWhere")

val CPUInst = Value("CPUInst")
val CPULoadData = Value("CPULoadData")
val CPUStoreData = Value("CPUStoreData")
val CPUAtomicData = Value("CPUAtomicData")
val L1InstPrefetch = Value("L1InstPrefetch")
val L1DataPrefetch = Value("L1DataPrefetch")
val PTW = Value("PTW")
val L2Prefetch = Value("L2Prefetch")
val ReqSourceCount = Value("ReqSourceCount")

val reqSourceBits = log2Ceil(ReqSourceCount.id)
}
3 changes: 1 addition & 2 deletions src/main/scala/huancun/HCCacheParameters.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ import freechips.rocketchip.diplomacy.BufferParams
import freechips.rocketchip.tilelink.{TLBufferParams, TLChannelBeatBytes, TLEdgeIn, TLEdgeOut}
import freechips.rocketchip.util.{BundleField, BundleFieldBase, BundleKeyBase, ControlKey}
import huancun.prefetch.PrefetchParameters
import MemReqSource._
import utility.ReqSourceKey
import utility.{MemReqSource, ReqSourceKey}

case object HCCacheParamsKey extends Field[HCCacheParameters](HCCacheParameters())

Expand Down
1 change: 1 addition & 0 deletions src/main/scala/huancun/SinkA.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import chipsalliance.rocketchip.config.Parameters
import chisel3._
import chisel3.util._
import freechips.rocketchip.tilelink._
import utility.MemReqSource

class SinkA(implicit p: Parameters) extends HuanCunModule {
val io = IO(new Bundle() {
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/huancun/SinkB.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import chipsalliance.rocketchip.config.Parameters
import chisel3._
import chisel3.util._
import freechips.rocketchip.tilelink._
import utility.MemReqSource

class SinkB(edge: TLEdgeOut)(implicit p: Parameters) extends HuanCunModule {
val io = IO(new Bundle() {
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/huancun/SourceA.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import chisel3.util._
import freechips.rocketchip.tilelink.TLMessages._
import freechips.rocketchip.tilelink._
import huancun.utils.HoldUnless
import utility.MemReqSource

class SourceA(edge: TLEdgeOut)(implicit p: Parameters) extends HuanCunModule {
val io = IO(new Bundle() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/huancun/SourceC.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import chipsalliance.rocketchip.config.Parameters
import chisel3._
import chisel3.util._
import freechips.rocketchip.tilelink._
import utility.ReqSourceKey
import utility.{MemReqSource, ReqSourceKey}

class SourceCPipe(implicit p: Parameters) extends HuanCunBundle {
val task = new SourceCReq
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/huancun/TopDownMonitor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import chisel3._
import chisel3.util._
import huancun.noninclusive.DirResult
import huancun.utils.{XSPerfAccumulate, XSPerfHistogram}
import utility.MemReqSource

class TopDownMonitor()(implicit p: Parameters) extends HuanCunModule {
val banks = 1 << bankBits
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/huancun/noninclusive/MSHR.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import freechips.rocketchip.tilelink.TLHints._
import huancun._
import huancun.utils._
import huancun.MetaData._
import utility.ParallelMax
import utility.{MemReqSource, ParallelMax}

class C_Status(implicit p: Parameters) extends HuanCunBundle {
// When C nest A, A needs to know the status of C and tells C to release through to next level
Expand Down
3 changes: 2 additions & 1 deletion src/main/scala/huancun/noninclusive/ProbeHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import chipsalliance.rocketchip.config.Parameters
import chisel3._
import chisel3.util._
import freechips.rocketchip.tilelink.{TLMessages, TLPermissions}
import huancun.{HuanCunModule, MSHRRequest, MemReqSource, MetaData}
import huancun.{HuanCunModule, MSHRRequest, MetaData}
import huancun.utils.XSPerfAccumulate
import utility.MemReqSource

class ProbeHelper(entries: Int = 5, enqDelay: Int = 1)(implicit p: Parameters)
extends HuanCunModule with HasClientInfo
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/huancun/noninclusive/SinkC.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import chisel3.util._
import chipsalliance.rocketchip.config.Parameters
import freechips.rocketchip.tilelink.{TLBundleC, TLMessages}
import huancun._
import utility.MemReqSource

class SinkC(implicit p: Parameters) extends BaseSinkC {

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/huancun/noninclusive/SliceCtrl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import chipsalliance.rocketchip.config.Parameters
import chisel3._
import chisel3.util._
import huancun._
import utility.RegNextN
import utility.{MemReqSource, RegNextN}

class SliceCtrl()(implicit p: Parameters) extends HuanCunModule {

Expand Down

0 comments on commit 51b7c5f

Please sign in to comment.