Skip to content

Commit

Permalink
utility: use unified MemReqSource (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tang-Haojin authored Aug 16, 2023
1 parent fc272c9 commit 445988b
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 24 deletions.
20 changes: 1 addition & 19 deletions src/main/scala/coupledL2/Common.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ package coupledL2
import chisel3._
import chisel3.util._
import chipsalliance.rocketchip.config.Parameters

import freechips.rocketchip.tilelink.TLPermissions._
import utility.MemReqSource

abstract class L2Module(implicit val p: Parameters) extends MultiIOModule with HasCoupledL2Parameters
abstract class L2Bundle(implicit val p: Parameters) extends Bundle with HasCoupledL2Parameters
Expand Down Expand Up @@ -252,21 +252,3 @@ class PrefetchRecv extends Bundle {
class L2ToL1Hint(implicit p: Parameters) extends Bundle {
val sourceId = UInt(32.W) // tilelink sourceID
}

// indicates where the memory access request comes from
// a dupliacte of this is in xiangShan/package.scala utility/TLUtils/BusKeyField.scala
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/coupledL2/L2Param.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ import freechips.rocketchip.util._
import chipsalliance.rocketchip.config.Field
import huancun.CacheParameters
import coupledL2.prefetch._
import MemReqSource._
import utility.ReqSourceKey
import utility.{MemReqSource, ReqSourceKey}

// General parameter key of CoupledL2
case object L2ParamKey extends Field[L2Param](L2Param())
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/coupledL2/MSHR.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package coupledL2
import chisel3._
import chisel3.util._
import coupledL2.MetaData._
import utility.{ParallelLookUp, ParallelPriorityMux}
import utility.{MemReqSource, ParallelLookUp, ParallelPriorityMux}
import freechips.rocketchip.tilelink._
import freechips.rocketchip.tilelink.TLMessages._
import freechips.rocketchip.tilelink.TLPermissions._
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/coupledL2/SinkA.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import freechips.rocketchip.tilelink.TLMessages._
import freechips.rocketchip.tilelink.TLHints._
import coupledL2.prefetch.PrefetchReq
import coupledL2.utils.XSPerfAccumulate
import utility.MemReqSource

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

class BMergeTask(implicit p: Parameters) extends L2Bundle {
val id = UInt(mshrBits.W)
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/coupledL2/SinkC.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import freechips.rocketchip.tilelink._
import freechips.rocketchip.tilelink.TLMessages._
import chipsalliance.rocketchip.config.Parameters
import coupledL2.utils.XSPerfAccumulate
import utility.MemReqSource

class PipeBufferRead(implicit p: Parameters) extends L2Bundle {
val bufIdx = UInt(bufIdxBits.W)
Expand Down
1 change: 1 addition & 0 deletions src/main/scala/coupledL2/TopDownMonitor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import chipsalliance.rocketchip.config.Parameters
import chisel3._
import chisel3.util._
import coupledL2.utils.{XSPerfAccumulate, XSPerfHistogram, XSPerfRolling}
import utility.MemReqSource

class TopDownMonitor()(implicit p: Parameters) extends L2Module {
val banks = 1 << bankBits
Expand Down

0 comments on commit 445988b

Please sign in to comment.