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***************************************************************************************/ 16package xiangshan.mem 17 18import chisel3._ 19import chisel3.util._ 20import chipsalliance.rocketchip.config._ 21import xiangshan._ 22import xiangshan.backend.rob.{RobPtr, RobLsqIO} 23import xiangshan.cache._ 24import xiangshan.backend.fu.fpu.FPU 25import xiangshan.cache._ 26import xiangshan.frontend.FtqPtr 27import xiangshan.ExceptionNO._ 28import xiangshan.cache.dcache.ReplayCarry 29import xiangshan.mem.mdp._ 30import utils._ 31import utility._ 32 33object LoadReplayCauses { 34 // these causes have priority, lower coding has higher priority. 35 // when load replay happens, load unit will select highest priority 36 // from replay causes vector 37 38 /* 39 * Warning: 40 * ************************************************************ 41 * * Don't change the priority. If the priority is changed, * 42 * * deadlock may occur. If you really need to change or * 43 * * add priority, please ensure that no deadlock will occur. * 44 * ************************************************************ 45 * 46 */ 47 // st-ld violation 48 val waitStore = 0 49 // tlb miss check 50 val tlbMiss = 1 51 // st-ld violation re-execute check 52 val schedError = 2 53 // dcache bank conflict check 54 val bankConflict = 3 55 // store-to-load-forwarding check 56 val forwardFail = 4 57 // dcache replay check 58 val dcacheReplay = 5 59 // dcache miss check 60 val dcacheMiss = 6 61 // RAR queue accept check 62 val rarReject = 7 63 // RAW queue accept check 64 val rawReject = 8 65 // total causes 66 val allCauses = 9 67} 68 69class AgeDetector(numEntries: Int, numEnq: Int, regOut: Boolean = true)(implicit p: Parameters) extends XSModule { 70 val io = IO(new Bundle { 71 // NOTE: deq and enq may come at the same cycle. 72 val enq = Vec(numEnq, Input(UInt(numEntries.W))) 73 val deq = Input(UInt(numEntries.W)) 74 val ready = Input(UInt(numEntries.W)) 75 val out = Output(UInt(numEntries.W)) 76 }) 77 78 // age(i)(j): entry i enters queue before entry j 79 val age = Seq.fill(numEntries)(Seq.fill(numEntries)(RegInit(false.B))) 80 val nextAge = Seq.fill(numEntries)(Seq.fill(numEntries)(Wire(Bool()))) 81 82 // to reduce reg usage, only use upper matrix 83 def get_age(row: Int, col: Int): Bool = if (row <= col) age(row)(col) else !age(col)(row) 84 def get_next_age(row: Int, col: Int): Bool = if (row <= col) nextAge(row)(col) else !nextAge(col)(row) 85 def isFlushed(i: Int): Bool = io.deq(i) 86 def isEnqueued(i: Int, numPorts: Int = -1): Bool = { 87 val takePorts = if (numPorts == -1) io.enq.length else numPorts 88 takePorts match { 89 case 0 => false.B 90 case 1 => io.enq.head(i) && !isFlushed(i) 91 case n => VecInit(io.enq.take(n).map(_(i))).asUInt.orR && !isFlushed(i) 92 } 93 } 94 95 for ((row, i) <- nextAge.zipWithIndex) { 96 val thisValid = get_age(i, i) || isEnqueued(i) 97 for ((elem, j) <- row.zipWithIndex) { 98 when (isFlushed(i)) { 99 // (1) when entry i is flushed or dequeues, set row(i) to false.B 100 elem := false.B 101 }.elsewhen (isFlushed(j)) { 102 // (2) when entry j is flushed or dequeues, set column(j) to validVec 103 elem := thisValid 104 }.elsewhen (isEnqueued(i)) { 105 // (3) when entry i enqueues from port k, 106 // (3.1) if entry j enqueues from previous ports, set to false 107 // (3.2) otherwise, set to true if and only of entry j is invalid 108 // overall: !jEnqFromPreviousPorts && !jIsValid 109 val sel = io.enq.map(_(i)) 110 val result = (0 until numEnq).map(k => isEnqueued(j, k)) 111 // why ParallelMux: sel must be one-hot since enq is one-hot 112 elem := !get_age(j, j) && !ParallelMux(sel, result) 113 }.otherwise { 114 // default: unchanged 115 elem := get_age(i, j) 116 } 117 age(i)(j) := elem 118 } 119 } 120 121 def getOldest(get: (Int, Int) => Bool): UInt = { 122 VecInit((0 until numEntries).map(i => { 123 io.ready(i) & VecInit((0 until numEntries).map(j => if (i != j) !io.ready(j) || get(i, j) else true.B)).asUInt.andR 124 })).asUInt 125 } 126 val best = getOldest(get_age) 127 val nextBest = getOldest(get_next_age) 128 129 io.out := (if (regOut) best else nextBest) 130} 131 132object AgeDetector { 133 def apply(numEntries: Int, enq: Vec[UInt], deq: UInt, ready: UInt)(implicit p: Parameters): Valid[UInt] = { 134 val age = Module(new AgeDetector(numEntries, enq.length, regOut = true)) 135 age.io.enq := enq 136 age.io.deq := deq 137 age.io.ready:= ready 138 val out = Wire(Valid(UInt(deq.getWidth.W))) 139 out.valid := age.io.out.orR 140 out.bits := age.io.out 141 out 142 } 143} 144 145 146class LoadQueueReplay(implicit p: Parameters) extends XSModule 147 with HasDCacheParameters 148 with HasCircularQueuePtrHelper 149 with HasLoadHelper 150 with HasPerfEvents 151{ 152 val io = IO(new Bundle() { 153 val redirect = Flipped(ValidIO(new Redirect)) 154 val enq = Vec(LoadPipelineWidth, Flipped(Decoupled(new LqWriteBundle))) 155 val storeAddrIn = Vec(StorePipelineWidth, Flipped(Valid(new LsPipelineBundle))) 156 val storeDataIn = Vec(StorePipelineWidth, Flipped(Valid(new ExuOutput))) 157 val replay = Vec(LoadPipelineWidth, Decoupled(new LsPipelineBundle)) 158 val refill = Flipped(ValidIO(new Refill)) 159 val stAddrReadySqPtr = Input(new SqPtr) 160 val stAddrReadyVec = Input(Vec(StoreQueueSize, Bool())) 161 val stDataReadySqPtr = Input(new SqPtr) 162 val stDataReadyVec = Input(Vec(StoreQueueSize, Bool())) 163 val sqEmpty = Input(Bool()) 164 val lqFull = Output(Bool()) 165 val ldWbPtr = Input(new LqPtr) 166 val tlbReplayDelayCycleCtrl = Vec(4, Input(UInt(ReSelectLen.W))) 167 val rarFull = Input(Bool()) 168 val rawFull = Input(Bool()) 169 val l2Hint = Input(Valid(new L2ToL1Hint())) 170 }) 171 172 println("LoadQueueReplay size: " + LoadQueueReplaySize) 173 // LoadQueueReplay field: 174 // +-----------+---------+-------+-------------+--------+ 175 // | Allocated | MicroOp | VAddr | Cause | Flags | 176 // +-----------+---------+-------+-------------+--------+ 177 // Allocated : entry has been allocated already 178 // MicroOp : inst's microOp 179 // VAddr : virtual address 180 // Cause : replay cause 181 // Flags : rar/raw queue allocate flags 182 val allocated = RegInit(VecInit(List.fill(LoadQueueReplaySize)(false.B))) // The control signals need to explicitly indicate the initial value 183 val scheduled = RegInit(VecInit(List.fill(LoadQueueReplaySize)(false.B))) 184 val uop = Reg(Vec(LoadQueueReplaySize, new MicroOp)) 185 val vaddrModule = Module(new LqVAddrModule( 186 gen = UInt(VAddrBits.W), 187 numEntries = LoadQueueReplaySize, 188 numRead = LoadPipelineWidth, 189 numWrite = LoadPipelineWidth, 190 numWBank = LoadQueueNWriteBanks, 191 numWDelay = 2, 192 numCamPort = 0)) 193 vaddrModule.io := DontCare 194 val debug_vaddr = RegInit(VecInit(List.fill(LoadQueueReplaySize)(0.U(VAddrBits.W)))) 195 val cause = RegInit(VecInit(List.fill(LoadQueueReplaySize)(0.U(LoadReplayCauses.allCauses.W)))) 196 197 // freeliset: store valid entries index. 198 // +---+---+--------------+-----+-----+ 199 // | 0 | 1 | ...... | n-2 | n-1 | 200 // +---+---+--------------+-----+-----+ 201 val freeList = Module(new FreeList( 202 size = LoadQueueReplaySize, 203 allocWidth = LoadPipelineWidth, 204 freeWidth = 4, 205 moduleName = "LoadQueueReplay freelist" 206 )) 207 freeList.io := DontCare 208 /** 209 * used for re-select control 210 */ 211 val credit = RegInit(VecInit(List.fill(LoadQueueReplaySize)(0.U(ReSelectLen.W)))) 212 val selBlocked = RegInit(VecInit(List.fill(LoadQueueReplaySize)(false.B))) 213 // Ptrs to control which cycle to choose 214 val blockPtrTlb = RegInit(VecInit(List.fill(LoadQueueReplaySize)(0.U(2.W)))) 215 val blockPtrCache = RegInit(VecInit(List.fill(LoadQueueReplaySize)(0.U(2.W)))) 216 val blockPtrOthers = RegInit(VecInit(List.fill(LoadQueueReplaySize)(0.U(2.W)))) 217 // Specific cycles to block 218 val blockCyclesTlb = Reg(Vec(4, UInt(ReSelectLen.W))) 219 blockCyclesTlb := io.tlbReplayDelayCycleCtrl 220 val blockCyclesCache = RegInit(VecInit(Seq(0.U(ReSelectLen.W), 0.U(ReSelectLen.W), 0.U(ReSelectLen.W), 0.U(ReSelectLen.W)))) 221 val blockCyclesOthers = RegInit(VecInit(Seq(0.U(ReSelectLen.W), 0.U(ReSelectLen.W), 0.U(ReSelectLen.W), 0.U(ReSelectLen.W)))) 222 val blockSqIdx = Reg(Vec(LoadQueueReplaySize, new SqPtr)) 223 // block causes 224 val blockByTlbMiss = RegInit(VecInit(List.fill(LoadQueueReplaySize)(false.B))) 225 val blockByForwardFail = RegInit(VecInit(List.fill(LoadQueueReplaySize)(false.B))) 226 val blockByWaitStore = RegInit(VecInit(List.fill(LoadQueueReplaySize)(false.B))) 227 val blockByCacheMiss = RegInit(VecInit(List.fill(LoadQueueReplaySize)(false.B))) 228 val blockByRARReject = RegInit(VecInit(List.fill(LoadQueueReplaySize)(false.B))) 229 val blockByRAWReject = RegInit(VecInit(List.fill(LoadQueueReplaySize)(false.B))) 230 val blockByOthers = RegInit(VecInit(List.fill(LoadQueueReplaySize)(false.B))) 231 // DCache miss block 232 val missMSHRId = RegInit(VecInit(List.fill(LoadQueueReplaySize)(0.U((log2Up(cfg.nMissEntries).W))))) 233 // Has this load already updated dcache replacement? 234 val replacementUpdated = RegInit(VecInit(List.fill(LoadQueueReplaySize)(false.B))) 235 val trueCacheMissReplay = WireInit(VecInit(cause.map(_(LoadReplayCauses.dcacheMiss)))) 236 val creditUpdate = WireInit(VecInit(List.fill(LoadQueueReplaySize)(0.U(ReSelectLen.W)))) 237 (0 until LoadQueueReplaySize).map(i => { 238 creditUpdate(i) := Mux(credit(i) > 0.U(ReSelectLen.W), credit(i)-1.U(ReSelectLen.W), credit(i)) 239 selBlocked(i) := creditUpdate(i) =/= 0.U(ReSelectLen.W) || credit(i) =/= 0.U(ReSelectLen.W) 240 }) 241 val replayCarryReg = RegInit(VecInit(List.fill(LoadQueueReplaySize)(ReplayCarry(0.U, false.B)))) 242 val dataInLastBeatReg = RegInit(VecInit(List.fill(LoadQueueReplaySize)(false.B))) 243 244 /** 245 * Enqueue 246 */ 247 val canEnqueue = io.enq.map(_.valid) 248 val cancelEnq = io.enq.map(enq => enq.bits.uop.robIdx.needFlush(io.redirect)) 249 val needReplay = io.enq.map(enq => enq.bits.replayInfo.needReplay()) 250 val hasExceptions = io.enq.map(enq => ExceptionNO.selectByFu(enq.bits.uop.cf.exceptionVec, lduCfg).asUInt.orR && !enq.bits.tlbMiss) 251 val loadReplay = io.enq.map(enq => enq.bits.isLoadReplay) 252 val needEnqueue = VecInit((0 until LoadPipelineWidth).map(w => { 253 canEnqueue(w) && !cancelEnq(w) && needReplay(w) && !hasExceptions(w) 254 })) 255 val canFreeVec = VecInit((0 until LoadPipelineWidth).map(w => { 256 canEnqueue(w) && loadReplay(w) && (!needReplay(w) || hasExceptions(w)) 257 })) 258 259 // select LoadPipelineWidth valid index. 260 val lqFull = freeList.io.empty 261 val lqFreeNums = freeList.io.validCount 262 263 // replay logic 264 // release logic generation 265 val storeAddrInSameCycleVec = Wire(Vec(LoadQueueReplaySize, Bool())) 266 val storeDataInSameCycleVec = Wire(Vec(LoadQueueReplaySize, Bool())) 267 val addrNotBlockVec = Wire(Vec(LoadQueueReplaySize, Bool())) 268 val dataNotBlockVec = Wire(Vec(LoadQueueReplaySize, Bool())) 269 val storeAddrValidVec = addrNotBlockVec.asUInt | storeAddrInSameCycleVec.asUInt 270 val storeDataValidVec = dataNotBlockVec.asUInt | storeDataInSameCycleVec.asUInt 271 272 // store data valid check 273 val stAddrReadyVec = io.stAddrReadyVec 274 val stDataReadyVec = io.stDataReadyVec 275 276 for (i <- 0 until LoadQueueReplaySize) { 277 // dequeue 278 // FIXME: store*Ptr is not accurate 279 dataNotBlockVec(i) := !isBefore(io.stDataReadySqPtr, blockSqIdx(i)) || stDataReadyVec(blockSqIdx(i).value) || io.sqEmpty // for better timing 280 addrNotBlockVec(i) := !isBefore(io.stAddrReadySqPtr, blockSqIdx(i)) || stAddrReadyVec(blockSqIdx(i).value) || io.sqEmpty // for better timing 281 282 // store address execute 283 storeAddrInSameCycleVec(i) := VecInit((0 until StorePipelineWidth).map(w => { 284 io.storeAddrIn(w).valid && 285 !io.storeAddrIn(w).bits.miss && 286 blockSqIdx(i) === io.storeAddrIn(w).bits.uop.sqIdx 287 })).asUInt.orR // for better timing 288 289 // store data execute 290 storeDataInSameCycleVec(i) := VecInit((0 until StorePipelineWidth).map(w => { 291 io.storeDataIn(w).valid && 292 blockSqIdx(i) === io.storeDataIn(w).bits.uop.sqIdx 293 })).asUInt.orR // for better timing 294 295 } 296 297 // store addr issue check 298 val stAddrDeqVec = Wire(Vec(LoadQueueReplaySize, Bool())) 299 (0 until LoadQueueReplaySize).map(i => { 300 stAddrDeqVec(i) := allocated(i) && storeAddrValidVec(i) 301 }) 302 303 // store data issue check 304 val stDataDeqVec = Wire(Vec(LoadQueueReplaySize, Bool())) 305 (0 until LoadQueueReplaySize).map(i => { 306 stDataDeqVec(i) := allocated(i) && storeDataValidVec(i) 307 }) 308 309 // update block condition 310 (0 until LoadQueueReplaySize).map(i => { 311 blockByForwardFail(i) := Mux(blockByForwardFail(i) && stDataDeqVec(i), false.B, blockByForwardFail(i)) 312 blockByWaitStore(i) := Mux(blockByWaitStore(i) && stAddrDeqVec(i), false.B, blockByWaitStore(i)) 313 blockByCacheMiss(i) := Mux(blockByCacheMiss(i) && io.refill.valid && io.refill.bits.id === missMSHRId(i), false.B, blockByCacheMiss(i)) 314 315 when (blockByCacheMiss(i) && io.refill.valid && io.refill.bits.id === missMSHRId(i)) { creditUpdate(i) := 0.U } 316 when (blockByRARReject(i) && (!io.rarFull || !isAfter(uop(i).lqIdx, io.ldWbPtr))) { blockByRARReject(i) := false.B } 317 when (blockByRAWReject(i) && (!io.rawFull || !isAfter(uop(i).sqIdx, io.stAddrReadySqPtr))) { blockByRAWReject(i) := false.B } 318 when (blockByTlbMiss(i) && creditUpdate(i) === 0.U) { blockByTlbMiss(i) := false.B } 319 when (blockByOthers(i) && creditUpdate(i) === 0.U) { blockByOthers(i) := false.B } 320 }) 321 322 // Replay is splitted into 3 stages 323 require((LoadQueueReplaySize % LoadPipelineWidth) == 0) 324 def getRemBits(input: UInt)(rem: Int): UInt = { 325 VecInit((0 until LoadQueueReplaySize / LoadPipelineWidth).map(i => { input(LoadPipelineWidth * i + rem) })).asUInt 326 } 327 328 def getRemSeq(input: Seq[Seq[Bool]])(rem: Int) = { 329 (0 until LoadQueueReplaySize / LoadPipelineWidth).map(i => { input(LoadPipelineWidth * i + rem) }) 330 } 331 332 // stage1: select 2 entries and read their vaddr 333 val s0_oldestSel = Wire(Vec(LoadPipelineWidth, Valid(UInt(log2Up(LoadQueueReplaySize + 1).W)))) 334 val s1_can_go = Wire(Vec(LoadPipelineWidth, Bool())) 335 val s1_oldestSel = Wire(Vec(LoadPipelineWidth, Valid(UInt(log2Up(LoadQueueReplaySize + 1).W)))) 336 val s2_can_go = Wire(Vec(LoadPipelineWidth, Bool())) 337 val s2_oldestSel = Wire(Vec(LoadPipelineWidth, Valid(UInt(log2Up(LoadQueueReplaySize + 1).W)))) 338 339 // generate mask 340 val needCancel = Wire(Vec(LoadQueueReplaySize, Bool())) 341 // generate enq mask 342 val selectIndexOH = Wire(Vec(LoadPipelineWidth, UInt(LoadQueueReplaySize.W))) 343 val s0_loadEnqFireMask = io.enq.map(x => x.fire && !x.bits.isLoadReplay).zip(selectIndexOH).map(x => Mux(x._1, x._2, 0.U)) 344 val s0_remLoadEnqFireVec = s0_loadEnqFireMask.map(x => VecInit((0 until LoadPipelineWidth).map(rem => getRemBits(x)(rem)))) 345 val s0_remEnqSelVec = Seq.tabulate(LoadPipelineWidth)(w => VecInit(s0_remLoadEnqFireVec.map(x => x(w)))) 346 347 // generate free mask 348 val s0_loadFreeSelMask = needCancel.asUInt 349 val s0_remFreeSelVec = VecInit(Seq.tabulate(LoadPipelineWidth)(rem => getRemBits(s0_loadFreeSelMask)(rem))) 350 351 // l2 hint wakes up cache missed load 352 // l2 will send GrantData in next 2/3 cycle, wake up the missed load early and sent them to load pipe, so them will hit the data in D channel or mshr in load S1 353 val s0_loadHintWakeMask = VecInit((0 until LoadQueueReplaySize).map(i => { 354 allocated(i) && !scheduled(i) && blockByCacheMiss(i) && missMSHRId(i) === io.l2Hint.bits.sourceId && io.l2Hint.valid 355 })).asUInt() 356 // l2 will send 2 beats data in 2 cycles, so if data needed by this load is in first beat, select it this cycle, otherwise next cycle 357 val s0_loadHintSelMask = s0_loadHintWakeMask & VecInit(dataInLastBeatReg.map(!_)).asUInt 358 val s0_remLoadHintSelMask = VecInit((0 until LoadPipelineWidth).map(rem => getRemBits(s0_loadHintSelMask)(rem))) 359 val s0_hintSelValid = s0_loadHintSelMask.orR 360 361 // wake up cache missed load 362 (0 until LoadQueueReplaySize).foreach(i => { 363 when(s0_loadHintWakeMask(i)) { 364 blockByCacheMiss(i) := false.B 365 creditUpdate(i) := 0.U 366 } 367 }) 368 369 // generate replay mask 370 // replay select priority is given as follow 371 // 1. hint wake up load 372 // 2. higher priority load 373 // 3. lower priority load 374 val s0_loadHigherPriorityReplaySelMask = VecInit((0 until LoadQueueReplaySize).map(i => { 375 val blocked = selBlocked(i) || blockByWaitStore(i) || blockByRARReject(i) || blockByRAWReject(i) || blockByOthers(i) || blockByForwardFail(i) || blockByCacheMiss(i) || blockByTlbMiss(i) 376 val hasHigherPriority = cause(i)(LoadReplayCauses.dcacheMiss) || cause(i)(LoadReplayCauses.forwardFail) 377 allocated(i) && !scheduled(i) && !blocked && hasHigherPriority 378 })).asUInt // use uint instead vec to reduce verilog lines 379 val s0_loadLowerPriorityReplaySelMask = VecInit((0 until LoadQueueReplaySize).map(i => { 380 val blocked = selBlocked(i) || blockByWaitStore(i) || blockByRARReject(i) || blockByRAWReject(i) || blockByOthers(i) || blockByForwardFail(i) || blockByCacheMiss(i) || blockByTlbMiss(i) 381 val hasLowerPriority = !cause(i)(LoadReplayCauses.dcacheMiss) && !cause(i)(LoadReplayCauses.forwardFail) 382 allocated(i) && !scheduled(i) && !blocked && hasLowerPriority 383 })).asUInt // use uint instead vec to reduce verilog lines 384 val s0_loadNormalReplaySelMask = s0_loadLowerPriorityReplaySelMask | s0_loadHigherPriorityReplaySelMask | s0_loadHintSelMask 385 val s0_remNormalReplaySelVec = VecInit((0 until LoadPipelineWidth).map(rem => getRemBits(s0_loadNormalReplaySelMask)(rem))) 386 val s0_loadPriorityReplaySelMask = Mux(s0_hintSelValid, s0_loadHintSelMask, Mux(s0_loadHigherPriorityReplaySelMask.orR, s0_loadHigherPriorityReplaySelMask, s0_loadLowerPriorityReplaySelMask)) 387 val s0_remPriorityReplaySelVec = VecInit((0 until LoadPipelineWidth).map(rem => getRemBits(s0_loadPriorityReplaySelMask)(rem))) 388 389 /****************************************************************************************************** 390 * WARNING: Make sure that OldestSelectStride must less than or equal stages of load pipeline. * 391 ****************************************************************************************************** 392 */ 393 val OldestSelectStride = 4 394 val oldestPtrExt = (0 until OldestSelectStride).map(i => io.ldWbPtr + i.U) 395 val s0_oldestMatchMaskVec = (0 until LoadQueueReplaySize).map(i => (0 until OldestSelectStride).map(j => s0_loadNormalReplaySelMask(i) && uop(i).lqIdx === oldestPtrExt(j))) 396 val s0_remOldsetMatchMaskVec = (0 until LoadPipelineWidth).map(rem => getRemSeq(s0_oldestMatchMaskVec.map(_.take(1)))(rem)) 397 val s0_remOlderMatchMaskVec = (0 until LoadPipelineWidth).map(rem => getRemSeq(s0_oldestMatchMaskVec.map(_.drop(1)))(rem)) 398 val s0_remOldestSelVec = VecInit(Seq.tabulate(LoadPipelineWidth)(rem => { 399 VecInit((0 until LoadQueueReplaySize / LoadPipelineWidth).map(i => { 400 Mux(VecInit(s0_remOldsetMatchMaskVec(rem).map(_(0))).asUInt.orR, s0_remOldsetMatchMaskVec(rem)(i)(0), s0_remOlderMatchMaskVec(rem)(i).reduce(_|_)) 401 })).asUInt 402 })) 403 val s0_remOldestHintSelVec = s0_remOldestSelVec.zip(s0_remLoadHintSelMask).map { 404 case(oldestVec, hintVec) => oldestVec & hintVec 405 } 406 407 // select oldest logic 408 s0_oldestSel := VecInit((0 until LoadPipelineWidth).map(rport => { 409 // select enqueue earlest inst 410 val ageOldest = AgeDetector(LoadQueueReplaySize / LoadPipelineWidth, s0_remEnqSelVec(rport), s0_remFreeSelVec(rport), s0_remPriorityReplaySelVec(rport)) 411 assert(!(ageOldest.valid && PopCount(ageOldest.bits) > 1.U), "oldest index must be one-hot!") 412 val ageOldestValid = ageOldest.valid 413 val ageOldestIndexOH = ageOldest.bits 414 415 // select program order oldest 416 val l2HintFirst = io.l2Hint.valid && s0_remOldestHintSelVec(rport).orR 417 val issOldestValid = l2HintFirst || s0_remOldestSelVec(rport).orR 418 val issOldestIndexOH = Mux(l2HintFirst, PriorityEncoderOH(s0_remOldestHintSelVec(rport)), PriorityEncoderOH(s0_remOldestSelVec(rport))) 419 420 val oldest = Wire(Valid(UInt())) 421 val oldestSel = Mux(issOldestValid, issOldestIndexOH, ageOldestIndexOH) 422 val oldestBitsVec = Wire(Vec(LoadQueueReplaySize, Bool())) 423 424 require((LoadQueueReplaySize % LoadPipelineWidth) == 0) 425 oldestBitsVec.foreach(e => e := false.B) 426 for (i <- 0 until LoadQueueReplaySize / LoadPipelineWidth) { 427 oldestBitsVec(i * LoadPipelineWidth + rport) := oldestSel(i) 428 } 429 430 oldest.valid := ageOldest.valid || issOldestValid 431 oldest.bits := OHToUInt(oldestBitsVec.asUInt) 432 oldest 433 })) 434 435 436 // Replay port reorder 437 class BalanceEntry extends XSBundle { 438 val balance = Bool() 439 val index = UInt(log2Up(LoadQueueReplaySize).W) 440 val port = UInt(log2Up(LoadPipelineWidth).W) 441 } 442 443 def balanceReOrder(sel: Seq[ValidIO[BalanceEntry]]): Seq[ValidIO[BalanceEntry]] = { 444 require(sel.length > 0) 445 val balancePick = ParallelPriorityMux(sel.map(x => (x.valid && x.bits.balance) -> x)) 446 val reorderSel = Wire(Vec(sel.length, ValidIO(new BalanceEntry))) 447 (0 until sel.length).map(i => 448 if (i == 0) { 449 when (balancePick.valid && balancePick.bits.balance) { 450 reorderSel(i) := balancePick 451 } .otherwise { 452 reorderSel(i) := sel(i) 453 } 454 } else { 455 when (balancePick.valid && balancePick.bits.balance && i.U === balancePick.bits.port) { 456 reorderSel(i) := sel(0) 457 } .otherwise { 458 reorderSel(i) := sel(i) 459 } 460 } 461 ) 462 reorderSel 463 } 464 465 // stage2: send replay request to load unit 466 // replay cold down 467 val ColdDownCycles = 16 468 val coldCounter = RegInit(VecInit(List.fill(LoadPipelineWidth)(0.U(log2Up(ColdDownCycles).W)))) 469 val ColdDownThreshold = Wire(UInt(log2Up(ColdDownCycles).W)) 470 ColdDownThreshold := Constantin.createRecord("ColdDownThreshold_"+p(XSCoreParamsKey).HartId.toString(), initValue = 12.U) 471 assert(ColdDownCycles.U > ColdDownThreshold, "ColdDownCycles must great than ColdDownThreshold!") 472 473 def replayCanFire(i: Int) = coldCounter(i) >= 0.U && coldCounter(i) < ColdDownThreshold 474 def coldDownNow(i: Int) = coldCounter(i) >= ColdDownThreshold 475 476 val s1_balanceOldestSelExt = (0 until LoadPipelineWidth).map(i => { 477 val wrapper = Wire(Valid(new BalanceEntry)) 478 wrapper.valid := s1_oldestSel(i).valid 479 wrapper.bits.balance := cause(s1_oldestSel(i).bits)(LoadReplayCauses.bankConflict) 480 wrapper.bits.index := s1_oldestSel(i).bits 481 wrapper.bits.port := i.U 482 wrapper 483 }) 484 485 val s1_balanceOldestSel = VecInit(balanceReOrder(s1_balanceOldestSelExt)) 486 for (i <- 0 until LoadPipelineWidth) { 487 val s0_can_go = s1_can_go(s1_balanceOldestSel(i).bits.port) || uop(s1_oldestSel(i).bits).robIdx.needFlush(io.redirect) 488 val s0_cancel = uop(s0_oldestSel(i).bits).robIdx.needFlush(io.redirect) 489 val s0_oldestSelV = s0_oldestSel(i).valid && !s0_cancel 490 s1_oldestSel(i).valid := RegEnable(s0_oldestSelV, s0_can_go) 491 s1_oldestSel(i).bits := RegEnable(s0_oldestSel(i).bits, s0_can_go) 492 493 when (s0_can_go && s0_oldestSelV) { 494 scheduled(s0_oldestSel(i).bits) := true.B 495 } 496 } 497 val s2_cancelReplay = Wire(Vec(LoadPipelineWidth, Bool())) 498 for (i <- 0 until LoadPipelineWidth) { 499 val s1_cancel = uop(s1_balanceOldestSel(i).bits.index).robIdx.needFlush(io.redirect) 500 val s1_oldestSelV = s1_balanceOldestSel(i).valid && !s1_cancel 501 s1_can_go(i) := Mux(s2_oldestSel(i).valid && !s2_cancelReplay(i), io.replay(i).ready && replayCanFire(i), true.B) 502 s2_oldestSel(i).valid := RegEnable(s1_oldestSelV, s1_can_go(i)) 503 s2_oldestSel(i).bits := RegEnable(s1_balanceOldestSel(i).bits.index, s1_can_go(i)) 504 505 vaddrModule.io.ren(i) := s1_balanceOldestSel(i).valid && s1_can_go(i) 506 vaddrModule.io.raddr(i) := s1_balanceOldestSel(i).bits.index 507 } 508 509 for (i <- 0 until LoadPipelineWidth) { 510 val s1_replayIdx = s1_balanceOldestSel(i).bits.index 511 val s2_replayUop = RegEnable(uop(s1_replayIdx), s1_can_go(i)) 512 val s2_replayMSHRId = RegEnable(missMSHRId(s1_replayIdx), s1_can_go(i)) 513 val s2_replacementUpdated = RegEnable(replacementUpdated(s1_replayIdx), s1_can_go(i)) 514 val s2_replayCauses = RegEnable(cause(s1_replayIdx), s1_can_go(i)) 515 val s2_replayCarry = RegEnable(replayCarryReg(s1_replayIdx), s1_can_go(i)) 516 val s2_replayCacheMissReplay = RegEnable(trueCacheMissReplay(s1_replayIdx), s1_can_go(i)) 517 s2_cancelReplay(i) := s2_replayUop.robIdx.needFlush(io.redirect) 518 519 s2_can_go(i) := DontCare 520 io.replay(i).valid := s2_oldestSel(i).valid && !s2_cancelReplay(i) && replayCanFire(i) 521 io.replay(i).bits := DontCare 522 io.replay(i).bits.uop := s2_replayUop 523 io.replay(i).bits.vaddr := vaddrModule.io.rdata(i) 524 io.replay(i).bits.isFirstIssue := false.B 525 io.replay(i).bits.isLoadReplay := true.B 526 io.replay(i).bits.replayCarry := s2_replayCarry 527 io.replay(i).bits.mshrid := s2_replayMSHRId 528 io.replay(i).bits.replacementUpdated := s2_replacementUpdated 529 io.replay(i).bits.forward_tlDchannel := s2_replayCauses(LoadReplayCauses.dcacheMiss) 530 io.replay(i).bits.sleepIndex := s2_oldestSel(i).bits 531 532 when (io.replay(i).fire) { 533 XSError(!allocated(s2_oldestSel(i).bits), p"LoadQueueReplay: why replay an invalid entry ${s2_oldestSel(i).bits} ?") 534 } 535 } 536 537 // update cold counter 538 val lastReplay = RegNext(VecInit(io.replay.map(_.fire))) 539 for (i <- 0 until LoadPipelineWidth) { 540 when (lastReplay(i) && io.replay(i).fire) { 541 coldCounter(i) := coldCounter(i) + 1.U 542 } .elsewhen (coldDownNow(i)) { 543 coldCounter(i) := coldCounter(i) + 1.U 544 } .otherwise { 545 coldCounter(i) := 0.U 546 } 547 } 548 549 when(io.refill.valid) { 550 XSDebug("miss resp: paddr:0x%x data %x\n", io.refill.bits.addr, io.refill.bits.data) 551 } 552 553 // LoadQueueReplay deallocate 554 val freeMaskVec = Wire(Vec(LoadQueueReplaySize, Bool())) 555 556 // init 557 freeMaskVec.map(e => e := false.B) 558 559 // Allocate logic 560 val enqValidVec = Wire(Vec(LoadPipelineWidth, Bool())) 561 val enqIndexVec = Wire(Vec(LoadPipelineWidth, UInt())) 562 563 val newEnqueue = (0 until LoadPipelineWidth).map(i => { 564 needEnqueue(i) && !io.enq(i).bits.isLoadReplay 565 }) 566 567 for ((enq, w) <- io.enq.zipWithIndex) { 568 vaddrModule.io.wen(w) := false.B 569 freeList.io.doAllocate(w) := false.B 570 571 freeList.io.allocateReq(w) := newEnqueue(w) 572 573 // Allocated ready 574 enqValidVec(w) := freeList.io.canAllocate(w) 575 enqIndexVec(w) := Mux(enq.bits.isLoadReplay, enq.bits.sleepIndex, freeList.io.allocateSlot(w)) 576 selectIndexOH(w) := UIntToOH(enqIndexVec(w)) 577 enq.ready := Mux(enq.bits.isLoadReplay, true.B, enqValidVec(w)) 578 579 val enqIndex = enqIndexVec(w) 580 when (needEnqueue(w) && enq.ready) { 581 582 val debug_robIdx = enq.bits.uop.robIdx.asUInt 583 XSError(allocated(enqIndex) && !enq.bits.isLoadReplay, p"LoadQueueReplay: can not accept more load, check: ldu $w, robIdx $debug_robIdx!") 584 XSError(hasExceptions(w), p"LoadQueueReplay: The instruction has exception, it can not be replay, check: ldu $w, robIdx $debug_robIdx!") 585 586 freeList.io.doAllocate(w) := !enq.bits.isLoadReplay 587 588 // Allocate new entry 589 allocated(enqIndex) := true.B 590 scheduled(enqIndex) := false.B 591 uop(enqIndex) := enq.bits.uop 592 593 vaddrModule.io.wen(w) := true.B 594 vaddrModule.io.waddr(w) := enqIndex 595 vaddrModule.io.wdata(w) := enq.bits.vaddr 596 debug_vaddr(enqIndex) := enq.bits.vaddr 597 598 /** 599 * used for feedback and replay 600 */ 601 // set flags 602 val replayInfo = enq.bits.replayInfo 603 val dataInLastBeat = replayInfo.dataInLastBeat 604 cause(enqIndex) := replayInfo.cause.asUInt 605 606 // update credit 607 val blockCyclesTlbPtr = blockPtrTlb(enqIndex) 608 val blockCyclesCachePtr = blockPtrCache(enqIndex) 609 val blockCyclesOtherPtr = blockPtrOthers(enqIndex) 610 creditUpdate(enqIndex) := Mux(replayInfo.cause(LoadReplayCauses.tlbMiss), blockCyclesTlb(blockCyclesTlbPtr), 611 Mux(replayInfo.cause(LoadReplayCauses.dcacheMiss), blockCyclesCache(blockCyclesCachePtr) + dataInLastBeat, blockCyclesOthers(blockCyclesOtherPtr))) 612 613 // init 614 blockByTlbMiss(enqIndex) := false.B 615 blockByWaitStore(enqIndex) := false.B 616 blockByForwardFail(enqIndex) := false.B 617 blockByCacheMiss(enqIndex) := false.B 618 blockByRARReject(enqIndex) := false.B 619 blockByRAWReject(enqIndex) := false.B 620 blockByOthers(enqIndex) := false.B 621 622 // update block pointer 623 when (replayInfo.cause(LoadReplayCauses.dcacheReplay)) { 624 // normal case: dcache replay 625 blockByOthers(enqIndex) := true.B 626 blockPtrOthers(enqIndex) := Mux(blockPtrOthers(enqIndex) === 3.U(2.W), blockPtrOthers(enqIndex), blockPtrOthers(enqIndex) + 1.U(2.W)) 627 } .elsewhen (replayInfo.cause(LoadReplayCauses.bankConflict) || replayInfo.cause(LoadReplayCauses.schedError)) { 628 // normal case: bank conflict or schedule error 629 // can replay next cycle 630 creditUpdate(enqIndex) := 0.U 631 blockByOthers(enqIndex) := false.B 632 } 633 634 // special case: tlb miss 635 when (replayInfo.cause(LoadReplayCauses.tlbMiss)) { 636 blockByTlbMiss(enqIndex) := true.B 637 blockPtrTlb(enqIndex) := Mux(blockPtrTlb(enqIndex) === 3.U(2.W), blockPtrTlb(enqIndex), blockPtrTlb(enqIndex) + 1.U(2.W)) 638 } 639 640 // special case: dcache miss 641 when (replayInfo.cause(LoadReplayCauses.dcacheMiss) && enq.bits.handledByMSHR) { 642 blockByCacheMiss(enqIndex) := !replayInfo.canForwardFullData && // dcache miss 643 !(io.refill.valid && io.refill.bits.id === replayInfo.missMSHRId) // no refill in this cycle 644 645 blockPtrCache(enqIndex) := Mux(blockPtrCache(enqIndex) === 3.U(2.W), blockPtrCache(enqIndex), blockPtrCache(enqIndex) + 1.U(2.W)) 646 } 647 648 // special case: st-ld violation 649 when (replayInfo.cause(LoadReplayCauses.waitStore)) { 650 blockByWaitStore(enqIndex) := true.B 651 blockSqIdx(enqIndex) := replayInfo.addrInvalidSqIdx 652 blockPtrOthers(enqIndex) := Mux(blockPtrOthers(enqIndex) === 3.U(2.W), blockPtrOthers(enqIndex), blockPtrOthers(enqIndex) + 1.U(2.W)) 653 } 654 655 // special case: data forward fail 656 when (replayInfo.cause(LoadReplayCauses.forwardFail)) { 657 blockByForwardFail(enqIndex) := true.B 658 blockSqIdx(enqIndex) := replayInfo.dataInvalidSqIdx 659 blockPtrOthers(enqIndex) := Mux(blockPtrOthers(enqIndex) === 3.U(2.W), blockPtrOthers(enqIndex), blockPtrOthers(enqIndex) + 1.U(2.W)) 660 } 661 662 // special case: rar reject 663 when (replayInfo.cause(LoadReplayCauses.rarReject)) { 664 blockByRARReject(enqIndex) := true.B 665 blockPtrOthers(enqIndex) := Mux(blockPtrOthers(enqIndex) === 3.U(2.W), blockPtrOthers(enqIndex), blockPtrOthers(enqIndex) + 1.U(2.W)) 666 } 667 668 // special case: raw reject 669 when (replayInfo.cause(LoadReplayCauses.rawReject)) { 670 blockByRAWReject(enqIndex) := true.B 671 blockPtrOthers(enqIndex) := Mux(blockPtrOthers(enqIndex) === 3.U(2.W), blockPtrOthers(enqIndex), blockPtrOthers(enqIndex) + 1.U(2.W)) 672 } 673 674 // extra info 675 replayCarryReg(enqIndex) := replayInfo.replayCarry 676 replacementUpdated(enqIndex) := enq.bits.replacementUpdated 677 // update missMSHRId only when the load has already been handled by mshr 678 when(enq.bits.handledByMSHR) { 679 missMSHRId(enqIndex) := replayInfo.missMSHRId 680 } 681 dataInLastBeatReg(enqIndex) := dataInLastBeat 682 } 683 684 // 685 val sleepIndex = enq.bits.sleepIndex 686 when (enq.valid && enq.bits.isLoadReplay) { 687 when (!needReplay(w) || hasExceptions(w)) { 688 allocated(sleepIndex) := false.B 689 freeMaskVec(sleepIndex) := true.B 690 } .otherwise { 691 scheduled(sleepIndex) := false.B 692 } 693 } 694 } 695 696 // misprediction recovery / exception redirect 697 for (i <- 0 until LoadQueueReplaySize) { 698 needCancel(i) := uop(i).robIdx.needFlush(io.redirect) && allocated(i) 699 when (needCancel(i)) { 700 allocated(i) := false.B 701 freeMaskVec(i) := true.B 702 } 703 } 704 705 freeList.io.free := freeMaskVec.asUInt 706 707 io.lqFull := lqFull 708 709 // Topdown 710 val sourceVaddr = WireInit(0.U.asTypeOf(new Valid(UInt(VAddrBits.W)))) 711 712 ExcitingUtils.addSink(sourceVaddr, s"rob_head_vaddr_${coreParams.HartId}", ExcitingUtils.Perf) 713 714 val uop_wrapper = Wire(Vec(LoadQueueReplaySize, new XSBundleWithMicroOp)) 715 (uop_wrapper.zipWithIndex).foreach { 716 case (u, i) => { 717 u.uop := uop(i) 718 } 719 } 720 val lq_match_vec = (debug_vaddr.zip(allocated)).map{case(va, alloc) => alloc && (va === sourceVaddr.bits)} 721 val rob_head_lq_match = ParallelOperation(lq_match_vec.zip(uop_wrapper), (a: Tuple2[Bool, XSBundleWithMicroOp], b: Tuple2[Bool, XSBundleWithMicroOp]) => { 722 val (a_v, a_uop) = (a._1, a._2) 723 val (b_v, b_uop) = (b._1, b._2) 724 725 val res = Mux(a_v && b_v, Mux(isAfter(a_uop.uop.robIdx, b_uop.uop.robIdx), b_uop, a_uop), 726 Mux(a_v, a_uop, 727 Mux(b_v, b_uop, 728 a_uop))) 729 (a_v || b_v, res) 730 }) 731 732 val lq_match_bits = rob_head_lq_match._2.uop 733 val lq_match = rob_head_lq_match._1 && sourceVaddr.valid 734 val lq_match_idx = lq_match_bits.lqIdx.value 735 736 val rob_head_tlb_miss = lq_match && cause(lq_match_idx)(LoadReplayCauses.tlbMiss) 737 val rob_head_sched_error = lq_match && cause(lq_match_idx)(LoadReplayCauses.schedError) 738 val rob_head_wait_store = lq_match && cause(lq_match_idx)(LoadReplayCauses.waitStore) 739 val rob_head_confilct_replay = lq_match && cause(lq_match_idx)(LoadReplayCauses.bankConflict) 740 val rob_head_forward_fail = lq_match && cause(lq_match_idx)(LoadReplayCauses.forwardFail) 741 val rob_head_mshrfull_replay = lq_match && cause(lq_match_idx)(LoadReplayCauses.dcacheReplay) 742 val rob_head_dcache_miss = lq_match && cause(lq_match_idx)(LoadReplayCauses.dcacheMiss) 743 val rob_head_rar_reject = lq_match && cause(lq_match_idx)(LoadReplayCauses.rarReject) 744 val rob_head_raw_reject = lq_match && cause(lq_match_idx)(LoadReplayCauses.rawReject) 745 val rob_head_other_replay = lq_match && (rob_head_rar_reject || rob_head_raw_reject || rob_head_forward_fail) 746 747 val rob_head_vio_replay = rob_head_sched_error || rob_head_wait_store 748 749 val rob_head_miss_in_dtlb = WireInit(false.B) 750 ExcitingUtils.addSink(rob_head_miss_in_dtlb, s"miss_in_dtlb_${coreParams.HartId}", ExcitingUtils.Perf) 751 ExcitingUtils.addSource(rob_head_tlb_miss && !rob_head_miss_in_dtlb, s"load_tlb_replay_stall_${coreParams.HartId}", ExcitingUtils.Perf, true) 752 ExcitingUtils.addSource(rob_head_tlb_miss && rob_head_miss_in_dtlb, s"load_tlb_miss_stall_${coreParams.HartId}", ExcitingUtils.Perf, true) 753 ExcitingUtils.addSource(rob_head_vio_replay, s"load_vio_replay_stall_${coreParams.HartId}", ExcitingUtils.Perf, true) 754 ExcitingUtils.addSource(rob_head_mshrfull_replay, s"load_mshr_replay_stall_${coreParams.HartId}", ExcitingUtils.Perf, true) 755 // ExcitingUtils.addSource(rob_head_confilct_replay, s"load_l1_cache_stall_with_bank_conflict_${coreParams.HartId}", ExcitingUtils.Perf, true) 756 ExcitingUtils.addSource(rob_head_other_replay, s"rob_head_other_replay_${coreParams.HartId}", ExcitingUtils.Perf, true) 757 val perfValidCount = RegNext(PopCount(allocated)) 758 759 // perf cnt 760 val enqCount = PopCount(io.enq.map(enq => enq.fire && !enq.bits.isLoadReplay)) 761 val deqCount = PopCount(io.replay.map(_.fire)) 762 val deqBlockCount = PopCount(io.replay.map(r => r.valid && !r.ready)) 763 val replayTlbMissCount = PopCount(io.enq.map(enq => enq.fire && !enq.bits.isLoadReplay && enq.bits.replayInfo.cause(LoadReplayCauses.tlbMiss))) 764 val replayWaitStoreCount = PopCount(io.enq.map(enq => enq.fire && !enq.bits.isLoadReplay && enq.bits.replayInfo.cause(LoadReplayCauses.waitStore))) 765 val replaySchedErrorCount = PopCount(io.enq.map(enq => enq.fire && !enq.bits.isLoadReplay && enq.bits.replayInfo.cause(LoadReplayCauses.schedError))) 766 val replayRARRejectCount = PopCount(io.enq.map(enq => enq.fire && !enq.bits.isLoadReplay && enq.bits.replayInfo.cause(LoadReplayCauses.rarReject))) 767 val replayRAWRejectCount = PopCount(io.enq.map(enq => enq.fire && !enq.bits.isLoadReplay && enq.bits.replayInfo.cause(LoadReplayCauses.rawReject))) 768 val replayBankConflictCount = PopCount(io.enq.map(enq => enq.fire && !enq.bits.isLoadReplay && enq.bits.replayInfo.cause(LoadReplayCauses.bankConflict))) 769 val replayDCacheReplayCount = PopCount(io.enq.map(enq => enq.fire && !enq.bits.isLoadReplay && enq.bits.replayInfo.cause(LoadReplayCauses.dcacheReplay))) 770 val replayForwardFailCount = PopCount(io.enq.map(enq => enq.fire && !enq.bits.isLoadReplay && enq.bits.replayInfo.cause(LoadReplayCauses.forwardFail))) 771 val replayDCacheMissCount = PopCount(io.enq.map(enq => enq.fire && !enq.bits.isLoadReplay && enq.bits.replayInfo.cause(LoadReplayCauses.dcacheMiss))) 772 XSPerfAccumulate("enq", enqCount) 773 XSPerfAccumulate("deq", deqCount) 774 XSPerfAccumulate("deq_block", deqBlockCount) 775 XSPerfAccumulate("replay_full", io.lqFull) 776 XSPerfAccumulate("replay_rar_reject", replayRARRejectCount) 777 XSPerfAccumulate("replay_raw_reject", replayRAWRejectCount) 778 XSPerfAccumulate("replay_sched_error", replaySchedErrorCount) 779 XSPerfAccumulate("replay_wait_store", replayWaitStoreCount) 780 XSPerfAccumulate("replay_tlb_miss", replayTlbMissCount) 781 XSPerfAccumulate("replay_bank_conflict", replayBankConflictCount) 782 XSPerfAccumulate("replay_dcache_replay", replayDCacheReplayCount) 783 XSPerfAccumulate("replay_forward_fail", replayForwardFailCount) 784 XSPerfAccumulate("replay_dcache_miss", replayDCacheMissCount) 785 XSPerfAccumulate("replay_hint_wakeup", s0_hintSelValid) 786 787 val perfEvents: Seq[(String, UInt)] = Seq( 788 ("enq", enqCount), 789 ("deq", deqCount), 790 ("deq_block", deqBlockCount), 791 ("replay_full", io.lqFull), 792 ("replay_rar_reject", replayRARRejectCount), 793 ("replay_raw_reject", replayRAWRejectCount), 794 ("replay_advance_sched", replaySchedErrorCount), 795 ("replay_wait_store", replayWaitStoreCount), 796 ("replay_tlb_miss", replayTlbMissCount), 797 ("replay_bank_conflict", replayBankConflictCount), 798 ("replay_dcache_replay", replayDCacheReplayCount), 799 ("replay_forward_fail", replayForwardFailCount), 800 ("replay_dcache_miss", replayDCacheMissCount), 801 ) 802 generatePerfEvent() 803 // end 804} 805