Skip to content

Commit

Permalink
sms: fix evict condition (#2288)
Browse files Browse the repository at this point in the history
* sms: fix evict condition

* pass evict from agt to pht only when access_cnt is greater than 1

* sms: fix agt

* fix compile
  • Loading branch information
happy-lx authored Sep 11, 2023
1 parent 7d45a14 commit d7fb6da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/main/scala/xiangshan/backend/MemBlock.scala
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,7 @@ class MemBlockImp(outer: MemBlock) extends LazyModuleImp(outer)
val prefetcherOpt: Option[BasePrefecher] = coreParams.prefetcher.map {
case _: SMSParams =>
val sms = Module(new SMSPrefetcher())
// sms.io_agt_en := RegNextN(io.csrCtrl.l1D_pf_enable_agt, 2, Some(false.B))
sms.io_agt_en := false.B
sms.io_agt_en := RegNextN(io.ooo_to_mem.csrCtrl.l1D_pf_enable_agt, 2, Some(false.B))
sms.io_pht_en := RegNextN(io.ooo_to_mem.csrCtrl.l1D_pf_enable_pht, 2, Some(false.B))
sms.io_act_threshold := RegNextN(io.ooo_to_mem.csrCtrl.l1D_pf_active_threshold, 2, Some(12.U))
sms.io_act_stride := RegNextN(io.ooo_to_mem.csrCtrl.l1D_pf_active_stride, 2, Some(30.U))
Expand Down
7 changes: 4 additions & 3 deletions src/main/scala/xiangshan/mem/prefetch/SMSPrefetcher.scala
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ class ActiveGenerationTable()(implicit p: Parameters) extends XSModule with HasS
val s2_pht_lookup_valid = RegNext(s1_pht_lookup_valid, false.B) && !io.s2_stride_hit
val s2_pht_lookup = RegEnable(s1_pht_lookup, s1_pht_lookup_valid)

io.s2_evict.valid := s2_evict_valid
io.s2_evict.valid := s2_evict_valid && (s2_evict_entry.access_cnt > 1.U)
io.s2_evict.bits := s2_evict_entry

io.s2_pf_gen_req.bits.region_tag := s2_pf_gen_region_tag
Expand All @@ -464,7 +464,7 @@ class ActiveGenerationTable()(implicit p: Parameters) extends XSModule with HasS
io.s2_pf_gen_req.bits.region_bits := s2_pf_gen_region_bits
io.s2_pf_gen_req.bits.paddr_valid := s2_paddr_valid
io.s2_pf_gen_req.bits.decr_mode := s2_pf_gen_decr_mode
io.s2_pf_gen_req.valid := s2_pf_gen_valid
io.s2_pf_gen_req.valid := false.B
io.s2_pf_gen_req.bits.debug_source_type := HW_PREFETCH_AGT.U

io.s2_pht_lookup.valid := s2_pht_lookup_valid
Expand All @@ -485,7 +485,8 @@ class ActiveGenerationTable()(implicit p: Parameters) extends XSModule with HasS
s1_alloc && s1_replace_mask(i) || s1_update && s1_update_mask(i)
)
}

XSPerfAccumulate("sms_agt_evict", s2_evict_valid)
XSPerfAccumulate("sms_agt_evict_one_hot_pattern", s2_evict_valid && (s2_evict_entry.access_cnt === 1.U))
}

class PhtLookup()(implicit p: Parameters) extends XSBundle with HasSMSModuleHelper {
Expand Down

0 comments on commit d7fb6da

Please sign in to comment.