1package xiangshan.mem 2 3import chipsalliance.rocketchip.config.Parameters 4import chisel3._ 5import chisel3.util._ 6import utils._ 7import xiangshan._ 8import xiangshan.cache._ 9import xiangshan.cache.{DCacheWordIO, DCacheLineIO, TlbRequestIO, MemoryOpConstants} 10import xiangshan.backend.roq.{RoqLsqIO, RoqPtr} 11import difftest._ 12 13class SqPtr(implicit p: Parameters) extends CircularQueuePtr[SqPtr]( 14 p => p(XSCoreParamsKey).StoreQueueSize 15){ 16 override def cloneType = (new SqPtr).asInstanceOf[this.type] 17} 18 19object SqPtr { 20 def apply(f: Bool, v: UInt)(implicit p: Parameters): SqPtr = { 21 val ptr = Wire(new SqPtr) 22 ptr.flag := f 23 ptr.value := v 24 ptr 25 } 26} 27 28class SqEnqIO(implicit p: Parameters) extends XSBundle { 29 val canAccept = Output(Bool()) 30 val lqCanAccept = Input(Bool()) 31 val needAlloc = Vec(RenameWidth, Input(Bool())) 32 val req = Vec(RenameWidth, Flipped(ValidIO(new MicroOp))) 33 val resp = Vec(RenameWidth, Output(new SqPtr)) 34} 35 36// Store Queue 37class StoreQueue(implicit p: Parameters) extends XSModule with HasDCacheParameters with HasCircularQueuePtrHelper { 38 val io = IO(new Bundle() { 39 val enq = new SqEnqIO 40 val brqRedirect = Flipped(ValidIO(new Redirect)) 41 val flush = Input(Bool()) 42 val storeIn = Vec(StorePipelineWidth, Flipped(Valid(new LsPipelineBundle))) // store addr, data is not included 43 val storeDataIn = Vec(StorePipelineWidth, Flipped(Valid(new StoreDataBundle))) // store data, send to sq from rs 44 val sbuffer = Vec(StorePipelineWidth, Decoupled(new DCacheWordReq)) // write commited store to sbuffer 45 val mmioStout = DecoupledIO(new ExuOutput) // writeback uncached store 46 val forward = Vec(LoadPipelineWidth, Flipped(new PipeLoadForwardQueryIO)) 47 val roq = Flipped(new RoqLsqIO) 48 val uncache = new DCacheWordIO 49 // val refill = Flipped(Valid(new DCacheLineReq )) 50 val exceptionAddr = new ExceptionAddrIO 51 val sqempty = Output(Bool()) 52 val issuePtrExt = Output(new SqPtr) // used to wake up delayed load/store 53 val storeIssue = Vec(StorePipelineWidth, Flipped(Valid(new ExuInput))) // used to update issuePtrExt 54 val sqFull = Output(Bool()) 55 }) 56 57 // data modules 58 val uop = Reg(Vec(StoreQueueSize, new MicroOp)) 59 // val data = Reg(Vec(StoreQueueSize, new LsqEntry)) 60 val dataModule = Module(new SQDataModule(StoreQueueSize, numRead = StorePipelineWidth, numWrite = StorePipelineWidth, numForward = StorePipelineWidth)) 61 dataModule.io := DontCare 62 val paddrModule = Module(new SQPaddrModule(StoreQueueSize, numRead = StorePipelineWidth, numWrite = StorePipelineWidth, numForward = StorePipelineWidth)) 63 paddrModule.io := DontCare 64 val vaddrModule = Module(new SyncDataModuleTemplate(UInt(VAddrBits.W), StoreQueueSize, numRead = 1, numWrite = StorePipelineWidth)) 65 vaddrModule.io := DontCare 66 67 // state & misc 68 val allocated = RegInit(VecInit(List.fill(StoreQueueSize)(false.B))) // sq entry has been allocated 69 val addrvalid = RegInit(VecInit(List.fill(StoreQueueSize)(false.B))) // non-mmio addr is valid 70 val datavalid = RegInit(VecInit(List.fill(StoreQueueSize)(false.B))) // non-mmio data is valid 71 val allvalid = VecInit((0 until StoreQueueSize).map(i => addrvalid(i) && datavalid(i))) // non-mmio data & addr is valid 72 val issued = Reg(Vec(StoreQueueSize, Bool())) // inst has been issued by rs 73 val commited = Reg(Vec(StoreQueueSize, Bool())) // inst has been commited by roq 74 val pending = Reg(Vec(StoreQueueSize, Bool())) // mmio pending: inst is an mmio inst, it will not be executed until it reachs the end of roq 75 val mmio = Reg(Vec(StoreQueueSize, Bool())) // mmio: inst is an mmio inst 76 77 // ptr 78 require(StoreQueueSize > RenameWidth) 79 val enqPtrExt = RegInit(VecInit((0 until RenameWidth).map(_.U.asTypeOf(new SqPtr)))) 80 val deqPtrExt = RegInit(VecInit((0 until StorePipelineWidth).map(_.U.asTypeOf(new SqPtr)))) 81 val cmtPtrExt = RegInit(VecInit((0 until CommitWidth).map(_.U.asTypeOf(new SqPtr)))) 82 val issuePtrExt = RegInit(0.U.asTypeOf(new SqPtr)) 83 val validCounter = RegInit(0.U(log2Ceil(LoadQueueSize + 1).W)) 84 val allowEnqueue = RegInit(true.B) 85 86 val enqPtr = enqPtrExt(0).value 87 val deqPtr = deqPtrExt(0).value 88 val cmtPtr = cmtPtrExt(0).value 89 90 val deqMask = UIntToMask(deqPtr, StoreQueueSize) 91 val enqMask = UIntToMask(enqPtr, StoreQueueSize) 92 93 val commitCount = RegNext(io.roq.scommit) 94 95 // Read dataModule 96 // deqPtrExtNext and deqPtrExtNext+1 entry will be read from dataModule 97 // if !sbuffer.fire(), read the same ptr 98 // if sbuffer.fire(), read next 99 val deqPtrExtNext = WireInit(Mux(io.sbuffer(1).fire(), 100 VecInit(deqPtrExt.map(_ + 2.U)), 101 Mux(io.sbuffer(0).fire() || io.mmioStout.fire(), 102 VecInit(deqPtrExt.map(_ + 1.U)), 103 deqPtrExt 104 ) 105 )) 106 for (i <- 0 until StorePipelineWidth) { 107 dataModule.io.raddr(i) := deqPtrExtNext(i).value 108 paddrModule.io.raddr(i) := deqPtrExtNext(i).value 109 } 110 111 // no inst will be commited 1 cycle before tval update 112 vaddrModule.io.raddr(0) := (cmtPtrExt(0) + commitCount).value 113 114 /** 115 * Enqueue at dispatch 116 * 117 * Currently, StoreQueue only allows enqueue when #emptyEntries > RenameWidth(EnqWidth) 118 */ 119 io.enq.canAccept := allowEnqueue 120 for (i <- 0 until RenameWidth) { 121 val offset = if (i == 0) 0.U else PopCount(io.enq.needAlloc.take(i)) 122 val sqIdx = enqPtrExt(offset) 123 val index = sqIdx.value 124 when (io.enq.req(i).valid && io.enq.canAccept && io.enq.lqCanAccept && !(io.brqRedirect.valid || io.flush)) { 125 uop(index) := io.enq.req(i).bits 126 allocated(index) := true.B 127 datavalid(index) := false.B 128 addrvalid(index) := false.B 129 issued(index) := false.B 130 commited(index) := false.B 131 pending(index) := false.B 132 } 133 io.enq.resp(i) := sqIdx 134 } 135 XSDebug(p"(ready, valid): ${io.enq.canAccept}, ${Binary(Cat(io.enq.req.map(_.valid)))}\n") 136 137 /** 138 * Update issuePtr when issue from rs 139 */ 140 141 // update state bit issued 142 for (i <- 0 until StorePipelineWidth) { 143 when (io.storeIssue(i).valid) { 144 issued(io.storeIssue(i).bits.uop.sqIdx.value) := true.B 145 } 146 } 147 148 // update issuePtr 149 val IssuePtrMoveStride = 4 150 require(IssuePtrMoveStride >= 2) 151 152 val issueLookupVec = (0 until IssuePtrMoveStride).map(issuePtrExt + _.U) 153 val issueLookup = issueLookupVec.map(ptr => allocated(ptr.value) && issued(ptr.value) && ptr =/= enqPtrExt(0)) 154 val nextIssuePtr = issuePtrExt + PriorityEncoder(VecInit(issueLookup.map(!_) :+ true.B)) 155 issuePtrExt := nextIssuePtr 156 157 when (io.brqRedirect.valid || io.flush) { 158 issuePtrExt := Mux( 159 isAfter(cmtPtrExt(0), deqPtrExt(0)), 160 cmtPtrExt(0), 161 deqPtrExtNext(0) // for mmio insts, deqPtr may be ahead of cmtPtr 162 ) 163 } 164 // send issuePtrExt to rs 165 // io.issuePtrExt := cmtPtrExt(0) 166 io.issuePtrExt := issuePtrExt 167 168 /** 169 * Writeback store from store units 170 * 171 * Most store instructions writeback to regfile in the previous cycle. 172 * However, 173 * (1) For an mmio instruction with exceptions, we need to mark it as addrvalid 174 * (in this way it will trigger an exception when it reaches ROB's head) 175 * instead of pending to avoid sending them to lower level. 176 * (2) For an mmio instruction without exceptions, we mark it as pending. 177 * When the instruction reaches ROB's head, StoreQueue sends it to uncache channel. 178 * Upon receiving the response, StoreQueue writes back the instruction 179 * through arbiter with store units. It will later commit as normal. 180 */ 181 182 // Write addr to sq 183 for (i <- 0 until StorePipelineWidth) { 184 paddrModule.io.wen(i) := false.B 185 dataModule.io.mask.wen(i) := false.B 186 val stWbIndex = io.storeIn(i).bits.uop.sqIdx.value 187 when (io.storeIn(i).fire()) { 188 addrvalid(stWbIndex) := true.B//!io.storeIn(i).bits.mmio 189 pending(stWbIndex) := io.storeIn(i).bits.mmio 190 191 dataModule.io.mask.waddr(i) := stWbIndex 192 dataModule.io.mask.wdata(i) := io.storeIn(i).bits.mask 193 dataModule.io.mask.wen(i) := true.B 194 195 paddrModule.io.waddr(i) := stWbIndex 196 paddrModule.io.wdata(i) := io.storeIn(i).bits.paddr 197 paddrModule.io.wen(i) := true.B 198 199 mmio(stWbIndex) := io.storeIn(i).bits.mmio 200 201 XSInfo("store addr write to sq idx %d pc 0x%x vaddr %x paddr %x mmio %x\n", 202 io.storeIn(i).bits.uop.sqIdx.value, 203 io.storeIn(i).bits.uop.cf.pc, 204 io.storeIn(i).bits.vaddr, 205 io.storeIn(i).bits.paddr, 206 io.storeIn(i).bits.mmio 207 ) 208 } 209 // vaddrModule write is delayed, as vaddrModule will not be read right after write 210 vaddrModule.io.waddr(i) := RegNext(stWbIndex) 211 vaddrModule.io.wdata(i) := RegNext(io.storeIn(i).bits.vaddr) 212 vaddrModule.io.wen(i) := RegNext(io.storeIn(i).fire()) 213 } 214 215 // Write data to sq 216 for (i <- 0 until StorePipelineWidth) { 217 dataModule.io.data.wen(i) := false.B 218 io.roq.storeDataRoqWb(i).valid := false.B 219 io.roq.storeDataRoqWb(i).bits := DontCare 220 val stWbIndex = io.storeDataIn(i).bits.uop.sqIdx.value 221 when (io.storeDataIn(i).fire()) { 222 datavalid(stWbIndex) := true.B 223 224 dataModule.io.data.waddr(i) := stWbIndex 225 dataModule.io.data.wdata(i) := genWdata(io.storeDataIn(i).bits.data, io.storeDataIn(i).bits.uop.ctrl.fuOpType(1,0)) 226 dataModule.io.data.wen(i) := true.B 227 228 io.roq.storeDataRoqWb(i).valid := true.B 229 io.roq.storeDataRoqWb(i).bits := io.storeDataIn(i).bits.uop.roqIdx 230 231 XSInfo("store data write to sq idx %d pc 0x%x data %x -> %x\n", 232 io.storeDataIn(i).bits.uop.sqIdx.value, 233 io.storeDataIn(i).bits.uop.cf.pc, 234 io.storeDataIn(i).bits.data, 235 dataModule.io.data.wdata(i) 236 ) 237 } 238 } 239 240 /** 241 * load forward query 242 * 243 * Check store queue for instructions that is older than the load. 244 * The response will be valid at the next cycle after req. 245 */ 246 // check over all lq entries and forward data from the first matched store 247 for (i <- 0 until LoadPipelineWidth) { 248 io.forward(i).forwardMask := 0.U(8.W).asBools 249 io.forward(i).forwardData := DontCare 250 251 // Compare deqPtr (deqPtr) and forward.sqIdx, we have two cases: 252 // (1) if they have the same flag, we need to check range(tail, sqIdx) 253 // (2) if they have different flags, we need to check range(tail, LoadQueueSize) and range(0, sqIdx) 254 // Forward1: Mux(same_flag, range(tail, sqIdx), range(tail, LoadQueueSize)) 255 // Forward2: Mux(same_flag, 0.U, range(0, sqIdx) ) 256 // i.e. forward1 is the target entries with the same flag bits and forward2 otherwise 257 val differentFlag = deqPtrExt(0).flag =/= io.forward(i).sqIdx.flag 258 val forwardMask = io.forward(i).sqIdxMask 259 // all addrvalid terms need to be checked 260 val addrValidVec = WireInit(VecInit((0 until StoreQueueSize).map(i => addrvalid(i) && allocated(i)))) 261 val dataValidVec = WireInit(VecInit((0 until StoreQueueSize).map(i => datavalid(i)))) 262 val allValidVec = WireInit(VecInit((0 until StoreQueueSize).map(i => addrvalid(i) && datavalid(i) && allocated(i)))) 263 val canForward1 = Mux(differentFlag, ~deqMask, deqMask ^ forwardMask) & allValidVec.asUInt 264 val canForward2 = Mux(differentFlag, forwardMask, 0.U(StoreQueueSize.W)) & allValidVec.asUInt 265 val needForward = Mux(differentFlag, ~deqMask | forwardMask, deqMask ^ forwardMask) 266 267 XSDebug(p"$i f1 ${Binary(canForward1)} f2 ${Binary(canForward2)} " + 268 p"sqIdx ${io.forward(i).sqIdx} pa ${Hexadecimal(io.forward(i).paddr)}\n" 269 ) 270 271 // do real fwd query (cam lookup in load_s1) 272 dataModule.io.needForward(i)(0) := canForward1 & paddrModule.io.forwardMmask(i).asUInt 273 dataModule.io.needForward(i)(1) := canForward2 & paddrModule.io.forwardMmask(i).asUInt 274 275 paddrModule.io.forwardMdata(i) := io.forward(i).paddr 276 277 // Forward result will be generated 1 cycle later (load_s2) 278 io.forward(i).forwardMask := dataModule.io.forwardMask(i) 279 io.forward(i).forwardData := dataModule.io.forwardData(i) 280 281 // If addr match, data not ready, mark it as dataInvalid 282 // load_s1: generate dataInvalid in load_s1 to set fastUop to 283 io.forward(i).dataInvalidFast := (addrValidVec.asUInt & ~dataValidVec.asUInt & paddrModule.io.forwardMmask(i).asUInt & needForward).orR 284 // load_s2 285 io.forward(i).dataInvalid := RegNext(io.forward(i).dataInvalidFast) 286 } 287 288 /** 289 * Memory mapped IO / other uncached operations 290 * 291 * States: 292 * (1) writeback from store units: mark as pending 293 * (2) when they reach ROB's head, they can be sent to uncache channel 294 * (3) response from uncache channel: mark as datavalidmask.wen 295 * (4) writeback to ROB (and other units): mark as writebacked 296 * (5) ROB commits the instruction: same as normal instructions 297 */ 298 //(2) when they reach ROB's head, they can be sent to uncache channel 299 val s_idle :: s_req :: s_resp :: s_wb :: s_wait :: Nil = Enum(5) 300 val uncacheState = RegInit(s_idle) 301 switch(uncacheState) { 302 is(s_idle) { 303 when(io.roq.pendingst && pending(deqPtr) && allocated(deqPtr) && datavalid(deqPtr) && addrvalid(deqPtr)) { 304 uncacheState := s_req 305 } 306 } 307 is(s_req) { 308 when(io.uncache.req.fire()) { 309 uncacheState := s_resp 310 } 311 } 312 is(s_resp) { 313 when(io.uncache.resp.fire()) { 314 uncacheState := s_wb 315 } 316 } 317 is(s_wb) { 318 when (io.mmioStout.fire()) { 319 uncacheState := s_wait 320 } 321 } 322 is(s_wait) { 323 when(io.roq.commit) { 324 uncacheState := s_idle // ready for next mmio 325 } 326 } 327 } 328 io.uncache.req.valid := uncacheState === s_req 329 330 io.uncache.req.bits.cmd := MemoryOpConstants.M_XWR 331 io.uncache.req.bits.addr := paddrModule.io.rdata(0) // data(deqPtr) -> rdata(0) 332 io.uncache.req.bits.data := dataModule.io.rdata(0).data 333 io.uncache.req.bits.mask := dataModule.io.rdata(0).mask 334 335 io.uncache.req.bits.id := DontCare 336 337 when(io.uncache.req.fire()){ 338 // mmio store should not be committed until uncache req is sent 339 pending(deqPtr) := false.B 340 341 XSDebug( 342 p"uncache req: pc ${Hexadecimal(uop(deqPtr).cf.pc)} " + 343 p"addr ${Hexadecimal(io.uncache.req.bits.addr)} " + 344 p"data ${Hexadecimal(io.uncache.req.bits.data)} " + 345 p"op ${Hexadecimal(io.uncache.req.bits.cmd)} " + 346 p"mask ${Hexadecimal(io.uncache.req.bits.mask)}\n" 347 ) 348 } 349 350 // (3) response from uncache channel: mark as datavalid 351 io.uncache.resp.ready := true.B 352 353 // (4) writeback to ROB (and other units): mark as writebacked 354 io.mmioStout.valid := uncacheState === s_wb 355 io.mmioStout.bits.uop := uop(deqPtr) 356 io.mmioStout.bits.uop.sqIdx := deqPtrExt(0) 357 io.mmioStout.bits.data := dataModule.io.rdata(0).data // dataModule.io.rdata.read(deqPtr) 358 io.mmioStout.bits.redirectValid := false.B 359 io.mmioStout.bits.redirect := DontCare 360 io.mmioStout.bits.debug.isMMIO := true.B 361 io.mmioStout.bits.debug.paddr := DontCare 362 io.mmioStout.bits.debug.isPerfCnt := false.B 363 io.mmioStout.bits.fflags := DontCare 364 when (io.mmioStout.fire()) { 365 allocated(deqPtr) := false.B 366 } 367 368 /** 369 * ROB commits store instructions (mark them as commited) 370 * 371 * (1) When store commits, mark it as commited. 372 * (2) They will not be cancelled and can be sent to lower level. 373 */ 374 for (i <- 0 until CommitWidth) { 375 when (commitCount > i.U) { 376 commited(cmtPtrExt(i).value) := true.B 377 } 378 } 379 cmtPtrExt := cmtPtrExt.map(_ + commitCount) 380 381 // Commited stores will not be cancelled and can be sent to lower level. 382 // remove retired insts from sq, add retired store to sbuffer 383 for (i <- 0 until StorePipelineWidth) { 384 // We use RegNext to prepare data for sbuffer 385 val ptr = deqPtrExt(i).value 386 // if !sbuffer.fire(), read the same ptr 387 // if sbuffer.fire(), read next 388 io.sbuffer(i).valid := allocated(ptr) && commited(ptr) && !mmio(ptr) 389 // Note that store data/addr should both be valid after store's commit 390 assert(!io.sbuffer(i).valid || allvalid(ptr)) 391 io.sbuffer(i).bits.cmd := MemoryOpConstants.M_XWR 392 io.sbuffer(i).bits.addr := paddrModule.io.rdata(i) 393 io.sbuffer(i).bits.data := dataModule.io.rdata(i).data 394 io.sbuffer(i).bits.mask := dataModule.io.rdata(i).mask 395 io.sbuffer(i).bits.id := DontCare 396 397 when (io.sbuffer(i).fire()) { 398 allocated(ptr) := false.B 399 XSDebug("sbuffer "+i+" fire: ptr %d\n", ptr) 400 } 401 } 402 when (io.sbuffer(1).fire()) { 403 assert(io.sbuffer(0).fire()) 404 } 405 406 if (!env.FPGAPlatform) { 407 for (i <- 0 until StorePipelineWidth) { 408 val storeCommit = io.sbuffer(i).fire() 409 val waddr = SignExt(io.sbuffer(i).bits.addr, 64) 410 val wdata = io.sbuffer(i).bits.data & MaskExpand(io.sbuffer(i).bits.mask) 411 val wmask = io.sbuffer(i).bits.mask 412 413 val difftest = Module(new DifftestStoreEvent) 414 difftest.io.clock := clock 415 difftest.io.coreid := hardId.U 416 difftest.io.index := i.U 417 difftest.io.valid := storeCommit 418 difftest.io.storeAddr := waddr 419 difftest.io.storeData := wdata 420 difftest.io.storeMask := wmask 421 } 422 } 423 424 // Read vaddr for mem exception 425 io.exceptionAddr.vaddr := vaddrModule.io.rdata(0) 426 427 // misprediction recovery / exception redirect 428 // invalidate sq term using robIdx 429 val needCancel = Wire(Vec(StoreQueueSize, Bool())) 430 for (i <- 0 until StoreQueueSize) { 431 needCancel(i) := uop(i).roqIdx.needFlush(io.brqRedirect, io.flush) && allocated(i) && !commited(i) 432 when (needCancel(i)) { 433 allocated(i) := false.B 434 } 435 } 436 437 /** 438 * update pointers 439 */ 440 val lastCycleRedirect = RegNext(io.brqRedirect.valid) 441 val lastCycleFlush = RegNext(io.flush) 442 val lastCycleCancelCount = PopCount(RegNext(needCancel)) 443 // when io.brqRedirect.valid, we don't allow eneuque even though it may fire. 444 val enqNumber = Mux(io.enq.canAccept && io.enq.lqCanAccept && !(io.brqRedirect.valid || io.flush), PopCount(io.enq.req.map(_.valid)), 0.U) 445 when (lastCycleRedirect || lastCycleFlush) { 446 // we recover the pointers in the next cycle after redirect 447 enqPtrExt := VecInit(enqPtrExt.map(_ - lastCycleCancelCount)) 448 }.otherwise { 449 enqPtrExt := VecInit(enqPtrExt.map(_ + enqNumber)) 450 } 451 452 deqPtrExt := deqPtrExtNext 453 454 val dequeueCount = Mux(io.sbuffer(1).fire(), 2.U, Mux(io.sbuffer(0).fire() || io.mmioStout.fire(), 1.U, 0.U)) 455 val validCount = distanceBetween(enqPtrExt(0), deqPtrExt(0)) 456 457 allowEnqueue := validCount + enqNumber <= (StoreQueueSize - RenameWidth).U 458 459 // io.sqempty will be used by sbuffer 460 // We delay it for 1 cycle for better timing 461 // When sbuffer need to check if it is empty, the pipeline is blocked, which means delay io.sqempty 462 // for 1 cycle will also promise that sq is empty in that cycle 463 io.sqempty := RegNext(enqPtrExt(0).value === deqPtrExt(0).value && enqPtrExt(0).flag === deqPtrExt(0).flag) 464 465 // perf counter 466 QueuePerf(StoreQueueSize, validCount, !allowEnqueue) 467 io.sqFull := !allowEnqueue 468 XSPerfAccumulate("mmioCycle", uncacheState =/= s_idle) // lq is busy dealing with uncache req 469 XSPerfAccumulate("mmioCnt", io.uncache.req.fire()) 470 XSPerfAccumulate("mmio_wb_success", io.mmioStout.fire()) 471 XSPerfAccumulate("mmio_wb_blocked", io.mmioStout.valid && !io.mmioStout.ready) 472 XSPerfAccumulate("validEntryCnt", distanceBetween(enqPtrExt(0), deqPtrExt(0))) 473 XSPerfAccumulate("cmtEntryCnt", distanceBetween(cmtPtrExt(0), deqPtrExt(0))) 474 XSPerfAccumulate("nCmtEntryCnt", distanceBetween(enqPtrExt(0), cmtPtrExt(0))) 475 476 // debug info 477 XSDebug("enqPtrExt %d:%d deqPtrExt %d:%d\n", enqPtrExt(0).flag, enqPtr, deqPtrExt(0).flag, deqPtr) 478 479 def PrintFlag(flag: Bool, name: String): Unit = { 480 when(flag) { 481 XSDebug(false, true.B, name) 482 }.otherwise { 483 XSDebug(false, true.B, " ") 484 } 485 } 486 487 for (i <- 0 until StoreQueueSize) { 488 if (i % 4 == 0) XSDebug("") 489 XSDebug(false, true.B, "%x ", uop(i).cf.pc) 490 PrintFlag(allocated(i), "a") 491 PrintFlag(allocated(i) && addrvalid(i), "a") 492 PrintFlag(allocated(i) && datavalid(i), "d") 493 PrintFlag(allocated(i) && commited(i), "c") 494 PrintFlag(allocated(i) && pending(i), "p") 495 PrintFlag(allocated(i) && mmio(i), "m") 496 XSDebug(false, true.B, " ") 497 if (i % 4 == 3 || i == StoreQueueSize - 1) XSDebug(false, true.B, "\n") 498 } 499 500} 501