1/*************************************************************************************** 2* Copyright (c) 2020-2021 Institute of Computing Technology, Chinese Academy of Sciences 3* Copyright (c) 2020-2021 Peng Cheng Laboratory 4* 5* XiangShan is licensed under Mulan PSL v2. 6* You can use this software according to the terms and conditions of the Mulan PSL v2. 7* You may obtain a copy of Mulan PSL v2 at: 8* http://license.coscl.org.cn/MulanPSL2 9* 10* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 11* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 12* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 13* 14* See the Mulan PSL v2 for more details. 15***************************************************************************************/ 16 17package xiangshan.cache 18 19import chipsalliance.rocketchip.config.Parameters 20import chisel3._ 21import chisel3.util._ 22import freechips.rocketchip.tilelink.ClientMetadata 23import utils.{HasPerfEvents, XSDebug, XSPerfAccumulate} 24import xiangshan.L1CacheErrorInfo 25import xiangshan.cache.dcache.{DCacheWPU, IdealWPU} 26 27class LoadPipe(id: Int)(implicit p: Parameters) extends DCacheModule with HasPerfEvents { 28 val io = IO(new DCacheBundle { 29 // incoming requests 30 val lsu = Flipped(new DCacheLoadIO) 31 // req got nacked in stage 0? 32 val nack = Input(Bool()) 33 34 // meta and data array read port 35 val meta_read = DecoupledIO(new MetaReadReq) 36 val meta_resp = Input(Vec(nWays, new Meta)) 37 val extra_meta_resp = Input(Vec(nWays, new DCacheExtraMeta)) 38 39 val tag_read = DecoupledIO(new TagReadReq) 40 val tag_resp = Input(Vec(nWays, UInt(encTagBits.W))) 41 42 val banked_data_read = DecoupledIO(new L1BankedDataReadReq) 43 val banked_data_resp = Input(new L1BankedDataReadResult()) 44 val read_error_delayed = Input(Bool()) 45 46 // access bit update 47 val access_flag_write = DecoupledIO(new FlagMetaWriteReq) 48 49 // banked data read conflict 50 val bank_conflict_slow = Input(Bool()) 51 val bank_conflict_fast = Input(Bool()) 52 53 // send miss request to miss queue 54 val miss_req = DecoupledIO(new MissReq) 55 val miss_resp = Input(new MissResp) 56 57 // update state vec in replacement algo 58 val replace_access = ValidIO(new ReplacementAccessBundle) 59 // find the way to be replaced 60 val replace_way = new ReplacementWayReqIO 61 62 // load fast wakeup should be disabled when data read is not ready 63 val disable_ld_fast_wakeup = Input(Bool()) 64 65 // ecc error 66 val error = Output(new L1CacheErrorInfo()) 67 68 // // debug_ls_info 69 // val debug_s2_cache_miss = Bool() 70 }) 71 72 assert(RegNext(io.meta_read.ready)) 73 74 val s1_ready = Wire(Bool()) 75 val s2_ready = Wire(Bool()) 76 // LSU requests 77 // it you got nacked, you can directly passdown 78 val not_nacked_ready = io.meta_read.ready && io.tag_read.ready && s1_ready 79 val nacked_ready = true.B 80 81 // ready can wait for valid 82 io.lsu.req.ready := (!io.nack && not_nacked_ready) || (io.nack && nacked_ready) 83 io.meta_read.valid := io.lsu.req.fire() && !io.nack 84 io.tag_read.valid := io.lsu.req.fire() && !io.nack 85 86 val meta_read = io.meta_read.bits 87 val tag_read = io.tag_read.bits 88 89 // Tag read for new requests 90 meta_read.idx := get_idx(io.lsu.req.bits.addr) 91 meta_read.way_en := ~0.U(nWays.W) 92 // meta_read.tag := DontCare 93 94 tag_read.idx := get_idx(io.lsu.req.bits.addr) 95 tag_read.way_en := ~0.U(nWays.W) 96 97 // Pipeline 98 // -------------------------------------------------------------------------------- 99 // stage 0 100 // -------------------------------------------------------------------------------- 101 // read tag 102 103 val s0_valid = io.lsu.req.fire() 104 val s0_req = io.lsu.req.bits 105 val s0_fire = s0_valid && s1_ready 106 val s0_vaddr = s0_req.addr 107 val s0_replayCarry = s0_req.replayCarry 108 assert(RegNext(!(s0_valid && (s0_req.cmd =/= MemoryOpConstants.M_XRD && s0_req.cmd =/= MemoryOpConstants.M_PFR && s0_req.cmd =/= MemoryOpConstants.M_PFW))), "LoadPipe only accepts load req / softprefetch read or write!") 109 dump_pipeline_reqs("LoadPipe s0", s0_valid, s0_req) 110 111 // -------------------------------------------------------------------------------- 112 // stage 1 113 // -------------------------------------------------------------------------------- 114 // tag match, read data 115 116 val s1_valid = RegInit(false.B) 117 val s1_req = RegEnable(s0_req, s0_fire) 118 // in stage 1, load unit gets the physical address 119 val s1_paddr_dup_lsu = io.lsu.s1_paddr_dup_lsu 120 val s1_paddr_dup_dcache = io.lsu.s1_paddr_dup_dcache 121 // LSU may update the address from io.lsu.s1_paddr, which affects the bank read enable only. 122 val s1_vaddr = Cat(s1_req.addr(PAddrBits - 1, blockOffBits), io.lsu.s1_paddr_dup_lsu(blockOffBits - 1, 0)) 123 val s1_bank_oh = UIntToOH(addr_to_dcache_bank(s1_vaddr)) 124 val s1_nack = RegNext(io.nack) 125 val s1_nack_data = !io.banked_data_read.ready 126 val s1_fire = s1_valid && s2_ready 127 s1_ready := !s1_valid || s1_fire 128 129 when (s0_fire) { s1_valid := true.B } 130 .elsewhen (s1_fire) { s1_valid := false.B } 131 132 dump_pipeline_reqs("LoadPipe s1", s1_valid, s1_req) 133 134 // tag check 135 val meta_resp = io.meta_resp 136 val tag_resp = io.tag_resp.map(r => r(tagBits - 1, 0)) 137 def wayMap[T <: Data](f: Int => T) = VecInit((0 until nWays).map(f)) 138 139 // dcache side tag match 140 /* // just ideal situation 141 val idealWPU = Module(new IdealWPU) 142 val s1_vaddr_dup_dc = Wire(UInt(PAddrBits.W)) 143 s1_vaddr_dup_dc := RegEnable(s0_req.addr, s0_fire) 144 idealWPU.io.req.bits.vaddr := s1_vaddr_dup_dc 145 idealWPU.io.req.valid := true.B 146 idealWPU.io.idealIf.s1_tag_resp := tag_resp 147 idealWPU.io.idealIf.s1_meta_resp := meta_resp 148 idealWPU.io.idealIf.s1_real_tag := get_tag(s1_paddr_dup_dcache) 149 */ 150 // real wpu 151 val wpu = Module(new DCacheWPU) 152 // req in s0 153 wpu.io.req.bits.vaddr := s0_vaddr 154 wpu.io.req.bits.replayCarry := s0_replayCarry 155 wpu.io.req.valid := s0_valid 156 // check in s1 157 wpu.io.check.bits.s1_tag_resp := tag_resp 158 wpu.io.check.bits.s1_meta_resp := meta_resp 159 wpu.io.check.bits.s1_real_tag := get_tag(s1_paddr_dup_dcache) 160 wpu.io.check.valid := s1_valid 161 // correct in s2 162 val s2_wpu_pred_fail = wpu.io.s2_pred_fail 163 val s2_real_way_en = wpu.io.s2_real_way_en 164 165 // resp in s1 166 val s1_tag_match_way_dup_dc = Wire(UInt(nWays.W)) 167 val s1_tag_match_way_dup_lsu = Wire(UInt(nWays.W)) 168 when (wpu.io.resp.valid){ 169 s1_tag_match_way_dup_dc := wpu.io.resp.bits.predict_way_en 170 s1_tag_match_way_dup_lsu := wpu.io.resp.bits.predict_way_en 171 }.otherwise { 172 val s1_tag_eq_way_dup_dc = wayMap((w: Int) => tag_resp(w) === (get_tag(s1_paddr_dup_dcache))).asUInt 173 s1_tag_match_way_dup_dc := wayMap((w: Int) => s1_tag_eq_way_dup_dc(w) && meta_resp(w).coh.isValid()).asUInt 174 175 // lsu side tag match 176 val s1_tag_eq_way_dup_lsu = wayMap((w: Int) => tag_resp(w) === (get_tag(s1_paddr_dup_lsu))).asUInt 177 s1_tag_match_way_dup_lsu := wayMap((w: Int) => s1_tag_eq_way_dup_lsu(w) && meta_resp(w).coh.isValid()).asUInt 178 } 179 val s1_tag_match_dup_dc = s1_tag_match_way_dup_dc.orR 180 val s1_tag_match_dup_lsu = s1_tag_match_way_dup_lsu.orR 181 assert(RegNext(!s1_valid || PopCount(s1_tag_match_way_dup_dc) <= 1.U), "tag should not match with more than 1 way") 182 183 val s1_fake_meta = Wire(new Meta) 184 // s1_fake_meta.tag := get_tag(s1_paddr_dup_dcache) 185 s1_fake_meta.coh := ClientMetadata.onReset 186 val s1_fake_tag = get_tag(s1_paddr_dup_dcache) 187 188 // when there are no tag match, we give it a Fake Meta 189 // this simplifies our logic in s2 stage 190 val s1_hit_meta = Mux(s1_tag_match_dup_dc, Mux1H(s1_tag_match_way_dup_dc, wayMap((w: Int) => meta_resp(w))), s1_fake_meta) 191 val s1_hit_coh = s1_hit_meta.coh 192 val s1_hit_error = Mux(s1_tag_match_dup_dc, Mux1H(s1_tag_match_way_dup_dc, wayMap((w: Int) => io.extra_meta_resp(w).error)), false.B) 193 val s1_hit_prefetch = Mux(s1_tag_match_dup_dc, Mux1H(s1_tag_match_way_dup_dc, wayMap((w: Int) => io.extra_meta_resp(w).prefetch)), false.B) 194 val s1_hit_access = Mux(s1_tag_match_dup_dc, Mux1H(s1_tag_match_way_dup_dc, wayMap((w: Int) => io.extra_meta_resp(w).access)), false.B) 195 196 io.replace_way.set.valid := RegNext(s0_fire) 197 io.replace_way.set.bits := get_idx(s1_vaddr) 198 val s1_repl_way_en = UIntToOH(io.replace_way.way) 199 val s1_repl_tag = Mux1H(s1_repl_way_en, wayMap(w => tag_resp(w))) 200 val s1_repl_coh = Mux1H(s1_repl_way_en, wayMap(w => meta_resp(w).coh)) 201 val s1_repl_extra_meta = Mux1H(s1_repl_way_en, wayMap(w => io.extra_meta_resp(w))) 202 203 val s1_need_replacement = !s1_tag_match_dup_dc 204 val s1_way_en = Mux(s1_need_replacement, s1_repl_way_en, s1_tag_match_way_dup_dc) 205 val s1_coh = Mux(s1_need_replacement, s1_repl_coh, s1_hit_coh) 206 val s1_tag = Mux(s1_need_replacement, s1_repl_tag, get_tag(s1_paddr_dup_dcache)) 207 208 // data read 209 io.banked_data_read.valid := s1_fire && !s1_nack 210 io.banked_data_read.bits.addr := s1_vaddr 211 io.banked_data_read.bits.way_en := s1_tag_match_way_dup_dc 212 213 // get s1_will_send_miss_req in lpad_s1 214 val s1_has_permission = s1_hit_coh.onAccess(s1_req.cmd)._1 215 val s1_new_hit_coh = s1_hit_coh.onAccess(s1_req.cmd)._3 216 val s1_hit = s1_tag_match_dup_dc && s1_has_permission && s1_hit_coh === s1_new_hit_coh 217 val s1_will_send_miss_req = s1_valid && !s1_nack && !s1_nack_data && !s1_hit 218 219 // check ecc error 220 val s1_encTag = Mux1H(s1_tag_match_way_dup_dc, wayMap((w: Int) => io.tag_resp(w))) 221 val s1_flag_error = Mux(s1_need_replacement, false.B, s1_hit_error) // error reported by exist dcache error bit 222 223 // -------------------------------------------------------------------------------- 224 // stage 2 225 // -------------------------------------------------------------------------------- 226 // return data 227 228 // val s2_valid = RegEnable(next = s1_valid && !io.lsu.s1_kill, init = false.B, enable = s1_fire) 229 val s2_valid = RegInit(false.B) 230 val s2_req = RegEnable(s1_req, s1_fire) 231 val s2_paddr = RegEnable(s1_paddr_dup_dcache, s1_fire) 232 val s2_vaddr = RegEnable(s1_vaddr, s1_fire) 233 val s2_bank_oh = RegEnable(s1_bank_oh, s1_fire) 234 val s2_bank_oh_dup_0 = RegEnable(s1_bank_oh, s1_fire) 235 s2_ready := true.B 236 237 val s2_fire = s2_valid 238 239 when (s1_fire) { s2_valid := !io.lsu.s1_kill } 240 .elsewhen(io.lsu.resp.fire()) { s2_valid := false.B } 241 242 dump_pipeline_reqs("LoadPipe s2", s2_valid, s2_req) 243 244 245 // hit, miss, nack, permission checking 246 // dcache side tag match 247 val s2_tag_match_way = RegEnable(s1_tag_match_way_dup_dc, s1_fire) 248 val s2_tag_match = RegEnable(s1_tag_match_dup_dc, s1_fire) 249 250 // lsu side tag match 251 val s2_hit_dup_lsu = RegNext(s1_tag_match_dup_lsu) 252 253 io.lsu.s2_hit := s2_hit_dup_lsu && !s2_wpu_pred_fail 254 255 val s2_hit_meta = RegEnable(s1_hit_meta, s1_fire) 256 val s2_hit_coh = RegEnable(s1_hit_coh, s1_fire) 257 val s2_has_permission = s2_hit_coh.onAccess(s2_req.cmd)._1 // for write prefetch 258 val s2_new_hit_coh = s2_hit_coh.onAccess(s2_req.cmd)._3 // for write prefetch 259 260 val s2_way_en = RegEnable(s1_way_en, s1_fire) 261 val s2_repl_coh = RegEnable(s1_repl_coh, s1_fire) 262 val s2_repl_tag = RegEnable(s1_repl_tag, s1_fire) 263 val s2_repl_extra_meta = RegEnable(s1_repl_extra_meta, s1_fire) // not used for now 264 val s2_encTag = RegEnable(s1_encTag, s1_fire) 265 266 // when req got nacked, upper levels should replay this request 267 // nacked or not 268 val s2_nack_hit = RegEnable(s1_nack, s1_fire) 269 // can no allocate mshr for load miss 270 val s2_nack_no_mshr = io.miss_req.valid && !io.miss_req.ready 271 // Bank conflict on data arrays 272 val s2_nack_data = RegEnable(!io.banked_data_read.ready, s1_fire) 273 val s2_nack = s2_nack_hit || s2_nack_no_mshr || s2_nack_data 274 // s2 miss merged 275 val s2_miss_merged = io.miss_req.valid && io.miss_resp.merged 276 277 val s2_bank_addr = addr_to_dcache_bank(s2_paddr) 278 dontTouch(s2_bank_addr) 279 280 val s2_instrtype = s2_req.instrtype 281 282 val s2_tag_error = dcacheParameters.tagCode.decode(s2_encTag).error // error reported by tag ecc check 283 val s2_flag_error = RegEnable(s1_flag_error, s1_fire) 284 285 val s2_hit_prefetch = RegEnable(s1_hit_prefetch, s1_fire) 286 val s2_hit_access = RegEnable(s1_hit_access, s1_fire) 287 288 val s2_hit = s2_tag_match && s2_has_permission && s2_hit_coh === s2_new_hit_coh && !s2_wpu_pred_fail 289 290 // only dump these signals when they are actually valid 291 dump_pipeline_valids("LoadPipe s2", "s2_hit", s2_valid && s2_hit) 292 dump_pipeline_valids("LoadPipe s2", "s2_nack", s2_valid && s2_nack) 293 dump_pipeline_valids("LoadPipe s2", "s2_nack_hit", s2_valid && s2_nack_hit) 294 dump_pipeline_valids("LoadPipe s2", "s2_nack_no_mshr", s2_valid && s2_nack_no_mshr) 295 296 val s2_can_send_miss_req = RegEnable(s1_will_send_miss_req, s1_fire) 297 298 // send load miss to miss queue 299 io.miss_req.valid := s2_valid && s2_can_send_miss_req && !s2_wpu_pred_fail 300 io.miss_req.bits := DontCare 301 io.miss_req.bits.source := s2_instrtype 302 io.miss_req.bits.cmd := s2_req.cmd 303 io.miss_req.bits.addr := get_block_addr(s2_paddr) 304 io.miss_req.bits.vaddr := s2_vaddr 305 io.miss_req.bits.way_en := s2_way_en 306 io.miss_req.bits.req_coh := s2_hit_coh 307 io.miss_req.bits.replace_coh := s2_repl_coh 308 io.miss_req.bits.replace_tag := s2_repl_tag 309 io.miss_req.bits.cancel := io.lsu.s2_kill || s2_tag_error 310 io.miss_req.bits.pc := io.lsu.s2_pc 311 312 // send back response 313 val resp = Wire(ValidIO(new DCacheWordResp)) 314 resp.valid := s2_valid 315 resp.bits := DontCare 316 // resp.bits.data := s2_word_decoded 317 // resp.bits.data := banked_data_resp_word.raw_data 318 // * on miss or nack, upper level should replay request 319 // but if we successfully sent the request to miss queue 320 // upper level does not need to replay request 321 // they can sit in load queue and wait for refill 322 // 323 // * report a miss if bank conflict is detected 324 val real_miss = Wire(Bool()) 325 when (wpu.io.resp.valid){ 326 real_miss := !s2_real_way_en.orR 327 }.otherwise{ 328 real_miss := !s2_hit_dup_lsu 329 } 330 // io.debug_s2_cache_miss := real_miss 331 resp.bits.miss := real_miss || io.bank_conflict_slow || s2_wpu_pred_fail 332 io.lsu.s2_first_hit := s2_req.isFirstIssue && s2_hit 333 // load pipe need replay when there is a bank conflict or wpu predict fail 334 resp.bits.replay := (resp.bits.miss && (!io.miss_req.fire() || s2_nack)) || io.bank_conflict_slow || s2_wpu_pred_fail 335 resp.bits.replayCarry.valid := resp.bits.miss 336 resp.bits.replayCarry.real_way_en := s2_real_way_en 337 resp.bits.meta_prefetch := s2_hit_prefetch 338 resp.bits.meta_access := s2_hit_access 339 resp.bits.tag_error := s2_tag_error // report tag_error in load s2 340 resp.bits.mshr_id := io.miss_resp.id 341 resp.bits.debug_robIdx := s2_req.debug_robIdx 342 343 XSPerfAccumulate("wpu_pred_fail", s2_wpu_pred_fail && s2_valid) 344 XSPerfAccumulate("dcache_read_bank_conflict", io.bank_conflict_slow && s2_valid) 345 XSPerfAccumulate("dcache_read_from_prefetched_line", s2_valid && s2_hit_prefetch && !resp.bits.miss) 346 XSPerfAccumulate("dcache_first_read_from_prefetched_line", s2_valid && s2_hit_prefetch && !resp.bits.miss && !s2_hit_access) 347 348 io.lsu.resp.valid := resp.valid 349 io.lsu.resp.bits := resp.bits 350 assert(RegNext(!(resp.valid && !io.lsu.resp.ready)), "lsu should be ready in s2") 351 352 when (resp.valid) { 353 resp.bits.dump() 354 } 355 356 io.lsu.debug_s1_hit_way := s1_tag_match_way_dup_dc 357 io.lsu.s1_disable_fast_wakeup := io.disable_ld_fast_wakeup 358 io.lsu.s1_bank_conflict := io.bank_conflict_fast 359 assert(RegNext(s1_ready && s2_ready), "load pipeline should never be blocked") 360 361 // -------------------------------------------------------------------------------- 362 // stage 3 363 // -------------------------------------------------------------------------------- 364 // report ecc error and get selected dcache data 365 366 val s3_valid = RegNext(s2_valid) 367 val s3_vaddr = RegEnable(s2_vaddr, s2_fire) 368 val s3_paddr = RegEnable(s2_paddr, s2_fire) 369 val s3_hit = RegEnable(s2_hit, s2_fire) 370 val s3_tag_match_way = RegEnable(s2_tag_match_way, s2_fire) 371 372 val s3_banked_data_resp_word = io.banked_data_resp.raw_data 373 val s3_data_error = io.read_error_delayed && s3_hit // banked_data_resp_word.error && !bank_conflict 374 val s3_tag_error = RegEnable(s2_tag_error, s2_fire) 375 val s3_flag_error = RegEnable(s2_flag_error, s2_fire) 376 val s3_error = s3_tag_error || s3_flag_error || s3_data_error 377 378 // error_delayed signal will be used to update uop.exception 1 cycle after load writeback 379 resp.bits.error_delayed := s3_error && (s3_hit || s3_tag_error) && s3_valid 380 resp.bits.data_delayed := s3_banked_data_resp_word 381 382 // report tag / data / l2 error (with paddr) to bus error unit 383 io.error := 0.U.asTypeOf(new L1CacheErrorInfo()) 384 io.error.report_to_beu := (s3_tag_error || s3_data_error) && s3_valid 385 io.error.paddr := s3_paddr 386 io.error.source.tag := s3_tag_error 387 io.error.source.data := s3_data_error 388 io.error.source.l2 := s3_flag_error 389 io.error.opType.load := true.B 390 // report tag error / l2 corrupted to CACHE_ERROR csr 391 io.error.valid := s3_error && s3_valid 392 393 // update plru in s3 394 if (!cfg.updateReplaceOn2ndmiss) { 395 // replacement is only updated on 1st miss 396 io.replace_access.valid := RegNext(RegNext( 397 RegNext(io.meta_read.fire()) && s1_valid && !io.lsu.s1_kill) && 398 !s2_nack_no_mshr && 399 !s2_miss_merged 400 ) 401 io.replace_access.bits.set := RegNext(RegNext(get_idx(s1_req.addr))) 402 io.replace_access.bits.way := RegNext(RegNext(Mux(s1_tag_match_dup_dc, OHToUInt(s1_tag_match_way_dup_dc), io.replace_way.way))) 403 } else { 404 // replacement is updated on both 1st and 2nd miss 405 // timing is worse than !cfg.updateReplaceOn2ndmiss 406 io.replace_access.valid := RegNext(RegNext( 407 RegNext(io.meta_read.fire()) && s1_valid && !io.lsu.s1_kill) && 408 !s2_nack_no_mshr 409 ) 410 io.replace_access.bits.set := RegNext(RegNext(get_idx(s1_req.addr))) 411 io.replace_access.bits.way := RegNext( 412 Mux( 413 RegNext(s1_tag_match_dup_dc), 414 RegNext(OHToUInt(s1_tag_match_way_dup_dc)), // if hit, access hit way in plru 415 Mux( // if miss 416 !s2_miss_merged, 417 RegNext(io.replace_way.way), // 1st fire: access new selected replace way 418 OHToUInt(io.miss_resp.repl_way_en) // 2nd fire: access replace way selected at miss queue allocate time 419 ) 420 ) 421 ) 422 } 423 424 // update access bit 425 io.access_flag_write.valid := s3_valid && s3_hit 426 io.access_flag_write.bits.idx := get_idx(s3_vaddr) 427 io.access_flag_write.bits.way_en := s3_tag_match_way 428 io.access_flag_write.bits.flag := true.B 429 430 // -------------------------------------------------------------------------------- 431 // Debug logging functions 432 def dump_pipeline_reqs(pipeline_stage_name: String, valid: Bool, 433 req: DCacheWordReq ) = { 434 when (valid) { 435 XSDebug(s"$pipeline_stage_name: ") 436 req.dump() 437 } 438 } 439 440 def dump_pipeline_valids(pipeline_stage_name: String, signal_name: String, valid: Bool) = { 441 when (valid) { 442 XSDebug(s"$pipeline_stage_name $signal_name\n") 443 } 444 } 445 446 // performance counters 447 XSPerfAccumulate("load_req", io.lsu.req.fire()) 448 XSPerfAccumulate("load_s1_kill", s1_fire && io.lsu.s1_kill) 449 XSPerfAccumulate("load_hit_way", s1_fire && s1_tag_match_dup_dc) 450 XSPerfAccumulate("load_replay", io.lsu.resp.fire() && resp.bits.replay) 451 XSPerfAccumulate("load_replay_for_data_nack", io.lsu.resp.fire() && resp.bits.replay && s2_nack_data) 452 XSPerfAccumulate("load_replay_for_no_mshr", io.lsu.resp.fire() && resp.bits.replay && s2_nack_no_mshr) 453 XSPerfAccumulate("load_replay_for_conflict", io.lsu.resp.fire() && resp.bits.replay && io.bank_conflict_slow) 454 XSPerfAccumulate("load_hit", io.lsu.resp.fire() && !real_miss) 455 XSPerfAccumulate("load_miss", io.lsu.resp.fire() && real_miss) 456 XSPerfAccumulate("load_succeed", io.lsu.resp.fire() && !resp.bits.miss && !resp.bits.replay) 457 XSPerfAccumulate("load_miss_or_conflict", io.lsu.resp.fire() && resp.bits.miss) 458 XSPerfAccumulate("actual_ld_fast_wakeup", s1_fire && s1_tag_match_dup_dc && !io.disable_ld_fast_wakeup) 459 XSPerfAccumulate("ideal_ld_fast_wakeup", io.banked_data_read.fire() && s1_tag_match_dup_dc) 460 461 val perfEvents = Seq( 462 ("load_req ", io.lsu.req.fire() ), 463 ("load_replay ", io.lsu.resp.fire() && resp.bits.replay ), 464 ("load_replay_for_data_nack", io.lsu.resp.fire() && resp.bits.replay && s2_nack_data ), 465 ("load_replay_for_no_mshr ", io.lsu.resp.fire() && resp.bits.replay && s2_nack_no_mshr ), 466 ("load_replay_for_conflict ", io.lsu.resp.fire() && resp.bits.replay && io.bank_conflict_slow ), 467 ) 468 generatePerfEvent() 469} 470