@@ -65,6 +65,7 @@ trait HasCDPParams extends HasPrefetcherHelper with HasCoupledL2Parameters {
6565
6666 val hot_threshold = cdpParams.HotThreshold
6767 val depth_threshold = cdpParams.DepthThreshold
68+ require(depth_threshold <= pfDepthMax, s " depth_threshold( ${depth_threshold}) should be less than pfDepthMax( ${pfDepthMax}) " )
6869
6970 // helper function
7071 def get_folded_hash (origin_val : UInt , resultBitWidth : Int ): UInt = { // fold $origin_val length value into $resultBitWidth
@@ -210,14 +211,14 @@ abstract class CDPModule(implicit val p: Parameters) extends Module with HasCDPP
210211
211212class CDPDetectTrigger (implicit p : Parameters ) extends CDPBundle {
212213 val cacheblock = UInt (blockBits.W )
213- val pfDepth = UInt (4 .W )
214+ val pfDepth = UInt (pfDepthBits .W )
214215 val pfSource = UInt (PfSource .pfSourceBits.W )
215216 val is_hit = Bool ()
216217}
217218
218219class CDPDetectEntry (implicit p : Parameters ) extends CDPBundle {
219220 val half_cacheblock = UInt ((blockBits / 2 ).W )
220- val pfDepth = UInt (4 .W )
221+ val pfDepth = UInt (pfDepthBits .W )
221222 val pfSource = UInt (PfSource .pfSourceBits.W )
222223
223224 val is_hit = Bool ()
@@ -443,9 +444,9 @@ class FilterTable(implicit p: Parameters) extends CDPModule {
443444 val (query_req, query_rsp) = (io.query_req, io.query_rsp)
444445 val train_req = io.train_req
445446
446- require(FilterEntryBlks % 4 == 0 , " FilterEntryBlks must be divisible by 4" )
447- val SatBankNum = 4
447+ val SatBankNum = 2
448448 val SatBankBlks = FilterEntryBlks / SatBankNum
449+ require(FilterEntryBlks % SatBankNum == 0 , " FilterEntryBlks must be divisible by SatBankNum" )
449450
450451 def ftMetaEntry () = new Bundle {
451452 val valid = Bool ()
@@ -521,15 +522,15 @@ class FilterTable(implicit p: Parameters) extends CDPModule {
521522
522523class CDPDetectReq (implicit p : Parameters ) extends CDPBundle {
523524 val vaddr = UInt (fullAddressBits.W )
524- val pfDepth = UInt (4 .W )
525+ val pfDepth = UInt (pfDepthBits .W )
525526 val pfSource = UInt (PfSource .pfSourceBits.W )
526527
527528 val is_hit = Bool ()
528529}
529530
530531class CDPPrefetchReq (implicit p : Parameters ) extends CDPBundle {
531532 val pfAddr = UInt (fullAddressBits.W )
532- val pfDepth = UInt (4 .W )
533+ val pfDepth = UInt (pfDepthBits .W )
533534
534535 // Only for monitor
535536 val pfSource = UInt (PfSource .pfSourceBits.W )
@@ -888,7 +889,7 @@ class DetectPipeline(name:String)(implicit p: Parameters) extends CDPModule {
888889 val s3_depth = RegNext (Mux (
889890 s2_is_hit,
890891 1 .U , // hit a CDP prefetched block, reinforce
891- Mux (s2_depth === 0 .U , 4 .U , s2_depth + 1 .U )
892+ Mux (s2_depth === 0 .U , pfDepthMax .U , s2_depth + 1 .U )
892893 ))
893894
894895 val s3_addr = s3_req.bits.vaddr
@@ -907,7 +908,7 @@ class DetectPipeline(name:String)(implicit p: Parameters) extends CDPModule {
907908 // ----------- ChiselDB -----------
908909 class detectTriggerEntry extends CDPBundle {
909910 val vaddr = UInt (fullAddressBits.W )
910- val pfDepth = UInt (4 .W )
911+ val pfDepth = UInt (pfDepthBits .W )
911912 val pfSource = UInt (PfSource .pfSourceBits.W )
912913 val main_idx = UInt (mainEntryBits.W )
913914 val sub_idx = UInt (subEntryBits.W )
@@ -936,7 +937,7 @@ class PrefetchFilterEntry(implicit p: Parameters) extends CDPBundle {
936937 val paddr_valid = Bool ()
937938 val pTag = UInt (ReqFilterTagBits .W )
938939 val vTag = UInt (ReqFilterTagBits .W )
939- val pfDepth = UInt (4 .W )
940+ val pfDepth = UInt (pfDepthBits .W )
940941
941942 // for TLB retry
942943 val retry_en = Bool ()
@@ -1295,7 +1296,7 @@ class CDPPrefetcher(implicit p: Parameters) extends CDPModule {
12951296 /**
12961297 * Check : Detection Condition
12971298 * Hit Trigger:
1298- a) Hit a CDP prefetched block, pfDepth == 2 or 4
1299+ a) Hit a CDP prefetched block, pfDepth == 1 or pfDepthMax
12991300 b) Hit a SMS/BOP prefetched block
13001301
13011302 * Refill Trigger:
@@ -1314,10 +1315,13 @@ class CDPPrefetcher(implicit p: Parameters) extends CDPModule {
13141315 val hit_trigger = detect_trig.bits.is_hit &&
13151316 (
13161317 if (UseFilteredDetect ) {
1317- detect_trig_fromCDP && (detect_trig.bits.pfDepth === 1 .U || detect_trig.bits.pfDepth === 4 .U ) || detect_trig_fromSMS || detect_trig_fromBOP
1318+ detect_trig_fromCDP &&
1319+ (detect_trig.bits.pfDepth === 1 .U || detect_trig.bits.pfDepth === pfDepthMax.U ) ||
1320+ detect_trig_fromSMS || detect_trig_fromBOP
13181321 }
13191322 else {
1320- detect_trig_fromCDP && (detect_trig.bits.pfDepth === 1 .U || detect_trig.bits.pfDepth === 4 .U )
1323+ detect_trig_fromCDP &&
1324+ (detect_trig.bits.pfDepth === 1 .U || detect_trig.bits.pfDepth === pfDepthMax.U )
13211325 }
13221326 )
13231327 val refill_trigger = ! detect_trig.bits.is_hit && detect_trig.bits.pfDepth < depth_threshold.U &&
0 commit comments