xref: /XiangShan/src/main/scala/xiangshan/backend/issue/Entries.scala (revision 28607074d64ccca05aab94e22fec1390305572ec)
15db4956bSzhanglyGitpackage xiangshan.backend.issue
25db4956bSzhanglyGit
383ba63b3SXuan Huimport org.chipsalliance.cde.config.Parameters
45db4956bSzhanglyGitimport chisel3._
55db4956bSzhanglyGitimport chisel3.util._
65db4956bSzhanglyGitimport utility.HasCircularQueuePtrHelper
75db4956bSzhanglyGitimport utils.{MathUtils, OptionWrapper, XSError}
85db4956bSzhanglyGitimport xiangshan._
95db4956bSzhanglyGitimport xiangshan.backend.Bundles._
105db4956bSzhanglyGitimport xiangshan.backend.datapath.DataConfig.VAddrData
115db4956bSzhanglyGitimport xiangshan.backend.datapath.DataSource
125db4956bSzhanglyGitimport xiangshan.backend.fu.FuType
135db4956bSzhanglyGitimport xiangshan.backend.fu.vector.Utils.NOnes
145db4956bSzhanglyGitimport xiangshan.backend.rob.RobPtr
15aa2bcc31SzhanglyGitimport xiangshan.mem.{LqPtr, MemWaitUpdateReq, SqPtr}
16aa2bcc31SzhanglyGitimport xiangshan.backend.issue.EntryBundles._
175db4956bSzhanglyGit
185db4956bSzhanglyGitclass Entries(implicit p: Parameters, params: IssueBlockParams) extends XSModule {
190721d1aaSXuan Hu  override def desiredName: String = params.getEntryName
200721d1aaSXuan Hu
2127811ea4SXuan Hu  require(params.numEnq <= 2, "number of enq should be no more than 2")
2227811ea4SXuan Hu
235db4956bSzhanglyGit  private val EnqEntryNum         = params.numEnq
245db4956bSzhanglyGit  private val OthersEntryNum      = params.numEntries - params.numEnq
25*28607074Ssinsanction  private val SimpEntryNum        = params.numSimp
26*28607074Ssinsanction  private val CompEntryNum        = params.numComp
275db4956bSzhanglyGit  val io = IO(new EntriesIO)
285db4956bSzhanglyGit
29c838dea1SXuan Hu  // only memAddrIQ use it
30c838dea1SXuan Hu  val memEtyResps: MixedVec[ValidIO[EntryDeqRespBundle]] = {
3156715025SXuan Hu    if (params.isLdAddrIQ && !params.isStAddrIQ)
32aa2bcc31SzhanglyGit      MixedVecInit(io.og0Resp ++ io.og1Resp ++ io.finalIssueResp.get)
3356715025SXuan Hu    else if (params.isLdAddrIQ && params.isStAddrIQ || params.isHyAddrIQ)
34aa2bcc31SzhanglyGit      MixedVecInit(io.og0Resp ++ io.og1Resp ++ io.finalIssueResp.get ++ io.fromMem.get.fastResp ++ io.fromMem.get.slowResp)
3556715025SXuan Hu    else if (params.isMemAddrIQ)
36ea159d42Ssinsanction      MixedVecInit(io.og0Resp ++ io.og1Resp ++ io.fromMem.get.fastResp ++ io.fromMem.get.slowResp)
37c838dea1SXuan Hu    else MixedVecInit(Seq())
38c838dea1SXuan Hu  }
39c838dea1SXuan Hu
40ea159d42Ssinsanction  val resps: Vec[Vec[ValidIO[EntryDeqRespBundle]]] = VecInit(io.og0Resp, io.og1Resp, 0.U.asTypeOf(io.og0Resp), 0.U.asTypeOf(io.og0Resp))
415db4956bSzhanglyGit
425db4956bSzhanglyGit  //Module
43df26db8aSsinsanction  val enqEntries          = Seq.fill(EnqEntryNum)(Module(EnqEntry(isComp = true)(p, params)))
44*28607074Ssinsanction  val othersEntriesSimp   = Seq.fill(SimpEntryNum)(Module(OthersEntry(isComp = false)(p, params)))
45*28607074Ssinsanction  val othersEntriesComp   = Seq.fill(CompEntryNum)(Module(OthersEntry(isComp = true)(p, params)))
46*28607074Ssinsanction  val othersEntries       = othersEntriesSimp ++ othersEntriesComp
47*28607074Ssinsanction  val othersTransPolicy   = OptionWrapper(params.isAllComp || params.isAllSimp, Module(new EnqPolicy))
48*28607074Ssinsanction  val simpTransPolicy     = OptionWrapper(params.hasCompAndSimp, Module(new EnqPolicy))
49*28607074Ssinsanction  val compTransPolicy     = OptionWrapper(params.hasCompAndSimp, Module(new EnqPolicy))
505db4956bSzhanglyGit
515db4956bSzhanglyGit  //Wire
52aa2bcc31SzhanglyGit  //entries status
535db4956bSzhanglyGit  val entries             = Wire(Vec(params.numEntries, ValidIO(new EntryBundle)))
54aa2bcc31SzhanglyGit  val robIdxVec           = Wire(Vec(params.numEntries, new RobPtr))
555db4956bSzhanglyGit  val validVec            = Wire(Vec(params.numEntries, Bool()))
565db4956bSzhanglyGit  val canIssueVec         = Wire(Vec(params.numEntries, Bool()))
575db4956bSzhanglyGit  val fuTypeVec           = Wire(Vec(params.numEntries, FuType()))
585db4956bSzhanglyGit  val isFirstIssueVec     = Wire(Vec(params.numEntries, Bool()))
595db4956bSzhanglyGit  val issueTimerVec       = Wire(Vec(params.numEntries, UInt(2.W)))
60aa2bcc31SzhanglyGit  //src status
61aa2bcc31SzhanglyGit  val dataSourceVec       = Wire(Vec(params.numEntries, Vec(params.numRegSrc, DataSource())))
62aa2bcc31SzhanglyGit  val srcTimerVec         = OptionWrapper(params.hasIQWakeUp, Wire(Vec(params.numEntries, Vec(params.numRegSrc, UInt(3.W)))))
63aa2bcc31SzhanglyGit  val srcWakeUpL1ExuOHVec = OptionWrapper(params.hasIQWakeUp, Wire(Vec(params.numEntries, Vec(params.numRegSrc, ExuVec()))))
64a4d38a63SzhanglyGit  val srcLoadDependencyVec= OptionWrapper(params.hasIQWakeUp, Wire(Vec(params.numEntries, Vec(params.numRegSrc, Vec(LoadPipelineWidth, UInt(3.W))))))
653d81019fSzhanglyGit  val loadDependencyVec   = OptionWrapper(params.hasIQWakeUp, Wire(Vec(params.numEntries, Vec(LoadPipelineWidth, UInt(3.W)))))
66aa2bcc31SzhanglyGit  //deq sel
67aa2bcc31SzhanglyGit  val deqSelVec           = Wire(Vec(params.numEntries, Bool()))
68aa2bcc31SzhanglyGit  val issueRespVec        = Wire(Vec(params.numEntries, ValidIO(new EntryDeqRespBundle)))
695db4956bSzhanglyGit  val deqPortIdxWriteVec  = Wire(Vec(params.numEntries, UInt(1.W)))
705db4956bSzhanglyGit  val deqPortIdxReadVec   = Wire(Vec(params.numEntries, UInt(1.W)))
71aa2bcc31SzhanglyGit  //trans sel
72*28607074Ssinsanction  val othersEntryEnqReadyVec = Wire(Vec(OthersEntryNum, Bool()))
73*28607074Ssinsanction  val othersEntryEnqVec      = Wire(Vec(OthersEntryNum, Valid(new EntryBundle)))
74*28607074Ssinsanction  val enqEntryTransVec       = Wire(Vec(EnqEntryNum, Valid(new EntryBundle)))
75*28607074Ssinsanction  val simpEntryTransVec      = OptionWrapper(params.hasCompAndSimp, Wire(Vec(SimpEntryNum, Valid(new EntryBundle))))
76*28607074Ssinsanction  val compEnqVec             = OptionWrapper(params.hasCompAndSimp, Wire(Vec(EnqEntryNum, Valid(new EntryBundle))))
77*28607074Ssinsanction
78*28607074Ssinsanction  val enqCanTrans2Simp       = OptionWrapper(params.hasCompAndSimp, Wire(Bool()))
79*28607074Ssinsanction  val enqCanTrans2Comp       = OptionWrapper(params.hasCompAndSimp, Wire(Bool()))
80*28607074Ssinsanction  val simpCanTrans2Comp      = OptionWrapper(params.hasCompAndSimp, Wire(Vec(EnqEntryNum, Bool())))
81*28607074Ssinsanction  val simpTransSelVec        = OptionWrapper(params.hasCompAndSimp, Wire(Vec(EnqEntryNum, Valid(UInt(SimpEntryNum.W)))))
82*28607074Ssinsanction  val compTransSelVec        = OptionWrapper(params.hasCompAndSimp, Wire(Vec(EnqEntryNum, Valid(UInt(CompEntryNum.W)))))
83*28607074Ssinsanction  val finalSimpTransSelVec   = OptionWrapper(params.hasCompAndSimp, Wire(Vec(EnqEntryNum, UInt(SimpEntryNum.W))))
84*28607074Ssinsanction  val finalCompTransSelVec   = OptionWrapper(params.hasCompAndSimp, Wire(Vec(EnqEntryNum, UInt(CompEntryNum.W))))
85*28607074Ssinsanction
86*28607074Ssinsanction  val enqCanTrans2Others     = OptionWrapper(params.isAllComp || params.isAllSimp, Wire(Bool()))
87*28607074Ssinsanction  val othersTransSelVec      = OptionWrapper(params.isAllComp || params.isAllSimp, Wire(Vec(EnqEntryNum, Valid(UInt(OthersEntryNum.W)))))
88*28607074Ssinsanction  val finalOthersTransSelVec = OptionWrapper(params.isAllComp || params.isAllSimp, Wire(Vec(EnqEntryNum, UInt(OthersEntryNum.W))))
89*28607074Ssinsanction
90*28607074Ssinsanction  val simpEntryEnqReadyVec   = othersEntryEnqReadyVec.take(SimpEntryNum)
91*28607074Ssinsanction  val compEntryEnqReadyVec   = othersEntryEnqReadyVec.takeRight(CompEntryNum)
92*28607074Ssinsanction  val simpEntryEnqVec        = othersEntryEnqVec.take(SimpEntryNum)
93*28607074Ssinsanction  val compEntryEnqVec        = othersEntryEnqVec.takeRight(CompEntryNum)
94aa2bcc31SzhanglyGit  //debug
9589740385Ssinsanction  val cancelVec              = OptionWrapper(params.hasIQWakeUp, Wire(Vec(params.numEntries, Bool())))
96a4d38a63SzhanglyGit  //cancel bypass
97a4d38a63SzhanglyGit  val cancelBypassVec     = OptionWrapper(params.hasIQWakeUp, Wire(Vec(params.numEntries, Bool())))
982d270511Ssinsanction  val uopIdxVec           = OptionWrapper(params.isVecMemIQ, Wire(Vec(params.numEntries, UopIdx())))
995db4956bSzhanglyGit
1005db4956bSzhanglyGit
1015db4956bSzhanglyGit  //enqEntries
1025db4956bSzhanglyGit  enqEntries.zipWithIndex.foreach { case (enqEntry, entryIdx) =>
103aa2bcc31SzhanglyGit    enqEntry.io.commonIn.enq                  := io.enq(entryIdx)
104*28607074Ssinsanction    enqEntry.io.commonIn.transSel             := (if (params.isAllComp || params.isAllSimp) enqCanTrans2Others.get && othersTransSelVec.get(entryIdx).valid
105*28607074Ssinsanction                                                  else enqCanTrans2Simp.get && simpTransSelVec.get(entryIdx).valid || enqCanTrans2Comp.get && compTransSelVec.get(entryIdx).valid)
106aa2bcc31SzhanglyGit    EntriesConnect(enqEntry.io.commonIn, enqEntry.io.commonOut, entryIdx)
107aa2b5219Ssinsanction    enqEntry.io.enqDelayWakeUpFromWB          := RegNext(io.wakeUpFromWB)
108aa2b5219Ssinsanction    enqEntry.io.enqDelayWakeUpFromIQ          := RegNext(io.wakeUpFromIQ)
109aa2bcc31SzhanglyGit    enqEntry.io.enqDelayOg0Cancel             := RegNext(io.og0Cancel.asUInt)
110aa2b5219Ssinsanction    enqEntry.io.enqDelayLdCancel              := RegNext(io.ldCancel)
111*28607074Ssinsanction    enqEntryTransVec(entryIdx)                := enqEntry.io.commonOut.transEntry
112aa2bcc31SzhanglyGit    // TODO: move it into EntriesConnect
1132d270511Ssinsanction    if (params.isVecMemIQ) {
114aa2bcc31SzhanglyGit      enqEntry.io.commonIn.fromLsq.get.sqDeqPtr := io.vecMemIn.get.sqDeqPtr
115aa2bcc31SzhanglyGit      enqEntry.io.commonIn.fromLsq.get.lqDeqPtr := io.vecMemIn.get.lqDeqPtr
1162d270511Ssinsanction    }
1175db4956bSzhanglyGit  }
1185db4956bSzhanglyGit  //othersEntries
1195db4956bSzhanglyGit  othersEntries.zipWithIndex.foreach { case (othersEntry, entryIdx) =>
120*28607074Ssinsanction    othersEntry.io.commonIn.enq               := othersEntryEnqVec(entryIdx)
121*28607074Ssinsanction    othersEntry.io.commonIn.transSel          := (if (params.hasCompAndSimp && (entryIdx < SimpEntryNum))
122*28607074Ssinsanction                                                    io.simpEntryDeqSelVec.get.zip(simpCanTrans2Comp.get).map(x => x._1(entryIdx) && x._2).reduce(_ | _)
123*28607074Ssinsanction                                                  else false.B)
124aa2bcc31SzhanglyGit    EntriesConnect(othersEntry.io.commonIn, othersEntry.io.commonOut, entryIdx + EnqEntryNum)
125*28607074Ssinsanction    othersEntryEnqReadyVec(entryIdx)          := othersEntry.io.commonOut.enqReady
126*28607074Ssinsanction    if (params.hasCompAndSimp && (entryIdx < SimpEntryNum)) {
127*28607074Ssinsanction      simpEntryTransVec.get(entryIdx)         := othersEntry.io.commonOut.transEntry
128*28607074Ssinsanction    }
1292d270511Ssinsanction    if (params.isVecMemIQ) {
130aa2bcc31SzhanglyGit      othersEntry.io.commonIn.fromLsq.get.sqDeqPtr := io.vecMemIn.get.sqDeqPtr
131aa2bcc31SzhanglyGit      othersEntry.io.commonIn.fromLsq.get.lqDeqPtr := io.vecMemIn.get.lqDeqPtr
1322d270511Ssinsanction    }
1335db4956bSzhanglyGit  }
1345db4956bSzhanglyGit
1355db4956bSzhanglyGit
1365db4956bSzhanglyGit  deqSelVec.zip(deqPortIdxWriteVec).zipWithIndex.foreach { case ((deqSel, deqPortIdxWrite), i) =>
137aa2bcc31SzhanglyGit    val deqVec = io.deqSelOH.zip(io.deqReady).map(x => x._1.valid && x._1.bits(i) && x._2)
1385db4956bSzhanglyGit    deqPortIdxWrite := OHToUInt(deqVec)
1395db4956bSzhanglyGit    deqSel := deqVec.reduce(_ | _)
1405db4956bSzhanglyGit  }
1415db4956bSzhanglyGit
1425db4956bSzhanglyGit
143*28607074Ssinsanction  if (params.isAllComp || params.isAllSimp) {
1445db4956bSzhanglyGit    //transPolicy
145*28607074Ssinsanction    othersTransPolicy.get.io.canEnq := othersEntryEnqReadyVec.asUInt
146*28607074Ssinsanction    enqCanTrans2Others.get := PopCount(validVec.take(EnqEntryNum)) <= PopCount(othersEntryEnqReadyVec)
147*28607074Ssinsanction    othersTransSelVec.get(0).valid := othersTransPolicy.get.io.enqSelOHVec(0).valid && validVec(0)
148*28607074Ssinsanction    othersTransSelVec.get(0).bits  := othersTransPolicy.get.io.enqSelOHVec(0).bits
14927811ea4SXuan Hu    // Todo: comments why enqTransSelVec(1).valid relies on validVec(0)
1508321ef33Ssinsanction  if (params.numEnq == 2) {
151*28607074Ssinsanction    othersTransSelVec.get(1).valid := Mux(!validVec(0), othersTransPolicy.get.io.enqSelOHVec(0).valid, othersTransPolicy.get.io.enqSelOHVec(1).valid)
152*28607074Ssinsanction      othersTransSelVec.get(1).bits  := Mux(!validVec(0), othersTransPolicy.get.io.enqSelOHVec(0).bits,  othersTransPolicy.get.io.enqSelOHVec(1).bits)
1538321ef33Ssinsanction    }
1548321ef33Ssinsanction
155*28607074Ssinsanction    finalOthersTransSelVec.get.zip(othersTransSelVec.get).zipWithIndex.foreach { case ((finalOH, selOH), enqIdx) =>
156*28607074Ssinsanction      finalOH := Fill(OthersEntryNum, enqCanTrans2Others.get && selOH.valid) & selOH.bits
1575db4956bSzhanglyGit    }
1585db4956bSzhanglyGit
159*28607074Ssinsanction    //othersEntryEnq
160*28607074Ssinsanction    othersEntryEnqVec.zipWithIndex.foreach { case (othersEntryEnq, othersIdx) =>
161*28607074Ssinsanction      val othersEnqOH = finalOthersTransSelVec.get.map(_(othersIdx))
162*28607074Ssinsanction      if (othersEnqOH.size == 1)
163*28607074Ssinsanction        othersEntryEnq := Mux(othersEnqOH.head, enqEntryTransVec.head, 0.U.asTypeOf(enqEntryTransVec.head))
164*28607074Ssinsanction      else
165*28607074Ssinsanction        othersEntryEnq := Mux1H(othersEnqOH, enqEntryTransVec)
1665db4956bSzhanglyGit    }
167*28607074Ssinsanction  }
168*28607074Ssinsanction  else {
169*28607074Ssinsanction    //transPolicy
170*28607074Ssinsanction    simpTransPolicy.get.io.canEnq := VecInit(simpEntryEnqReadyVec).asUInt
171*28607074Ssinsanction    compTransPolicy.get.io.canEnq := VecInit(validVec.takeRight(CompEntryNum).map(!_)).asUInt
172*28607074Ssinsanction
173*28607074Ssinsanction    enqCanTrans2Comp.get := PopCount(validVec.take(EnqEntryNum)) <= PopCount(validVec.takeRight(CompEntryNum).map(!_)) && !validVec.drop(EnqEntryNum).take(SimpEntryNum).reduce(_ || _)
174*28607074Ssinsanction    enqCanTrans2Simp.get := !enqCanTrans2Comp.get && PopCount(validVec.take(EnqEntryNum)) <= PopCount(simpEntryEnqReadyVec)
175*28607074Ssinsanction    simpCanTrans2Comp.get.zipWithIndex.foreach { case (canTrans, idx) =>
176*28607074Ssinsanction      canTrans := !enqCanTrans2Comp.get && PopCount(validVec.takeRight(CompEntryNum).map(!_)) >= (idx + 1).U
177*28607074Ssinsanction    }
178*28607074Ssinsanction
179*28607074Ssinsanction    simpTransSelVec.get(0).valid := simpTransPolicy.get.io.enqSelOHVec(0).valid && validVec(0)
180*28607074Ssinsanction    simpTransSelVec.get(0).bits  := simpTransPolicy.get.io.enqSelOHVec(0).bits
181*28607074Ssinsanction    compTransSelVec.get(0).valid := compTransPolicy.get.io.enqSelOHVec(0).valid && validVec(0)
182*28607074Ssinsanction    compTransSelVec.get(0).bits  := compTransPolicy.get.io.enqSelOHVec(0).bits
183*28607074Ssinsanction    if (params.numEnq == 2) {
184*28607074Ssinsanction      simpTransSelVec.get(1).valid := Mux(!validVec(0), simpTransPolicy.get.io.enqSelOHVec(0).valid, simpTransPolicy.get.io.enqSelOHVec(1).valid)
185*28607074Ssinsanction      simpTransSelVec.get(1).bits  := Mux(!validVec(0), simpTransPolicy.get.io.enqSelOHVec(0).bits,  simpTransPolicy.get.io.enqSelOHVec(1).bits)
186*28607074Ssinsanction      compTransSelVec.get(1).valid := Mux(!validVec(0), compTransPolicy.get.io.enqSelOHVec(0).valid, compTransPolicy.get.io.enqSelOHVec(1).valid)
187*28607074Ssinsanction      compTransSelVec.get(1).bits  := Mux(!validVec(0), compTransPolicy.get.io.enqSelOHVec(0).bits,  compTransPolicy.get.io.enqSelOHVec(1).bits)
188*28607074Ssinsanction    }
189*28607074Ssinsanction
190*28607074Ssinsanction    finalSimpTransSelVec.get.zip(simpTransSelVec.get).zipWithIndex.foreach { case ((finalOH, selOH), enqIdx) =>
191*28607074Ssinsanction      finalOH := Fill(SimpEntryNum, enqCanTrans2Simp.get && selOH.valid) & selOH.bits
192*28607074Ssinsanction    }
193*28607074Ssinsanction    finalCompTransSelVec.get.zip(compTransSelVec.get).zip(compTransPolicy.get.io.enqSelOHVec).zipWithIndex.foreach {
194*28607074Ssinsanction      case (((finalOH, selOH), origSelOH), enqIdx) =>
195*28607074Ssinsanction        finalOH := Mux(enqCanTrans2Comp.get, Fill(CompEntryNum, selOH.valid) & selOH.bits, Fill(CompEntryNum, origSelOH.valid) & origSelOH.bits)
196*28607074Ssinsanction    }
197*28607074Ssinsanction
198*28607074Ssinsanction    //othersEntryEnq
199*28607074Ssinsanction    simpEntryEnqVec.zipWithIndex.foreach { case (simpEntryEnq, simpIdx) =>
200*28607074Ssinsanction      val simpEnqOH = finalSimpTransSelVec.get.map(_(simpIdx))
201*28607074Ssinsanction      // shit Mux1H directly returns in(0) if the seq has only 1 elements
202*28607074Ssinsanction      if (simpEnqOH.size == 1)
203*28607074Ssinsanction        simpEntryEnq := Mux(simpEnqOH.head, enqEntryTransVec.head, 0.U.asTypeOf(enqEntryTransVec.head))
204*28607074Ssinsanction      else
205*28607074Ssinsanction        simpEntryEnq := Mux1H(simpEnqOH, enqEntryTransVec)
206*28607074Ssinsanction    }
207*28607074Ssinsanction
208*28607074Ssinsanction    compEnqVec.get.zip(enqEntryTransVec).zip(io.simpEntryDeqSelVec.get).foreach { case ((compEnq, enqEntry), deqSel) =>
209*28607074Ssinsanction      compEnq := Mux(enqCanTrans2Comp.get, enqEntry, Mux1H(deqSel, simpEntryTransVec.get))
210*28607074Ssinsanction    }
211*28607074Ssinsanction    compEntryEnqVec.zipWithIndex.foreach { case (compEntryEnq, compIdx) =>
212*28607074Ssinsanction      val compEnqOH = finalCompTransSelVec.get.map(_(compIdx))
213*28607074Ssinsanction      // shit Mux1H directly returns in(0) if the seq has only 1 elements
214*28607074Ssinsanction      if (compEnqOH.size == 1)
215*28607074Ssinsanction        compEntryEnq := Mux(compEnqOH.head, compEnqVec.get.head, 0.U.asTypeOf(compEnqVec.get.head))
216*28607074Ssinsanction      else
217*28607074Ssinsanction        compEntryEnq := Mux1H(compEnqOH, compEnqVec.get)
218*28607074Ssinsanction    }
219*28607074Ssinsanction
220*28607074Ssinsanction    assert(PopCount(simpEntryEnqVec.map(_.valid)) <= params.numEnq.U, "the number of simpEntryEnq is more than numEnq\n")
221*28607074Ssinsanction    assert(PopCount(compEntryEnqVec.map(_.valid)) <= params.numEnq.U, "the number of compEntryEnq is more than numEnq\n")
222*28607074Ssinsanction  }
223*28607074Ssinsanction
2248d081717Sszw_kaixin  if(backendParams.debugEn) {
225*28607074Ssinsanction    dontTouch(othersEntryEnqVec)
2268d081717Sszw_kaixin  }
2275db4956bSzhanglyGit
2285db4956bSzhanglyGit  //issueRespVec
229887f9c3dSzhanglinjuan  if (params.isVecMemIQ) {
230887f9c3dSzhanglinjuan    // vector memory IQ
231887f9c3dSzhanglinjuan    issueRespVec.zip(robIdxVec).zip(uopIdxVec.get).foreach { case ((issueResp, robIdx), uopIdx) =>
232887f9c3dSzhanglinjuan      val hitRespsVec = VecInit(resps.flatten.map(x =>
233aa2bcc31SzhanglyGit        x.valid && x.bits.robIdx === robIdx && x.bits.uopIdx.get === uopIdx
234887f9c3dSzhanglinjuan      ))
235887f9c3dSzhanglinjuan      issueResp.valid := hitRespsVec.reduce(_ | _)
236887f9c3dSzhanglinjuan      issueResp.bits := Mux1H(hitRespsVec, resps.flatten.map(_.bits))
237887f9c3dSzhanglinjuan    }
238887f9c3dSzhanglinjuan  } else if (params.isMemAddrIQ) {
239887f9c3dSzhanglinjuan    // scalar memory IQ
2405db4956bSzhanglyGit    issueRespVec.zip(robIdxVec).foreach { case (issueResp, robIdx) =>
241c838dea1SXuan Hu      val hitRespsVec = VecInit(memEtyResps.map(x => x.valid && (x.bits.robIdx === robIdx)).toSeq)
2425db4956bSzhanglyGit      issueResp.valid := hitRespsVec.reduce(_ | _)
243c838dea1SXuan Hu      issueResp.bits := Mux1H(hitRespsVec, memEtyResps.map(_.bits).toSeq)
2445db4956bSzhanglyGit    }
2455db4956bSzhanglyGit  }
2465db4956bSzhanglyGit  else {
2475db4956bSzhanglyGit    issueRespVec.zip(issueTimerVec).zip(deqPortIdxReadVec).foreach { case ((issueResp, issueTimer), deqPortIdx) =>
2485db4956bSzhanglyGit      val Resp = resps(issueTimer)(deqPortIdx)
2495db4956bSzhanglyGit      issueResp := Resp
2505db4956bSzhanglyGit    }
2515db4956bSzhanglyGit  }
2525db4956bSzhanglyGit
25340283787Ssinsanction  //deq
254*28607074Ssinsanction  val enqEntryOldest          = Wire(Vec(params.numDeq, ValidIO(new EntryBundle)))
255*28607074Ssinsanction  val simpEntryOldest         = OptionWrapper(params.hasCompAndSimp, Wire(Vec(params.numDeq, ValidIO(new EntryBundle))))
256*28607074Ssinsanction  val compEntryOldest         = OptionWrapper(params.hasCompAndSimp, Wire(Vec(params.numDeq, ValidIO(new EntryBundle))))
257*28607074Ssinsanction  val othersEntryOldest       = OptionWrapper(params.isAllComp || params.isAllSimp, Wire(Vec(params.numDeq, ValidIO(new EntryBundle))))
258*28607074Ssinsanction  val enqEntryOldestCancel    = Wire(Vec(params.numDeq, Bool()))
259*28607074Ssinsanction  val simpEntryOldestCancel   = OptionWrapper(params.hasCompAndSimp, Wire(Vec(params.numDeq, Bool())))
260*28607074Ssinsanction  val compEntryOldestCancel   = OptionWrapper(params.hasCompAndSimp, Wire(Vec(params.numDeq, Bool())))
261*28607074Ssinsanction  val othersEntryOldestCancel = OptionWrapper(params.isAllComp || params.isAllSimp, Wire(Vec(params.numDeq, Bool())))
262*28607074Ssinsanction
263*28607074Ssinsanction  io.enqEntryOldestSel.zipWithIndex.map { case (sel, deqIdx) =>
264*28607074Ssinsanction    enqEntryOldest(deqIdx) := Mux1H(sel.bits, entries.take(EnqEntryNum))
265*28607074Ssinsanction    enqEntryOldestCancel(deqIdx) := Mux1H(sel.bits, cancelBypassVec.getOrElse(VecInit(Seq.fill(params.numEntries)(false.B))).take(EnqEntryNum))
26640283787Ssinsanction  }
267*28607074Ssinsanction
268*28607074Ssinsanction  if (params.isAllComp || params.isAllSimp) {
269*28607074Ssinsanction    io.othersEntryOldestSel.get.zipWithIndex.map { case (sel, deqIdx) =>
270*28607074Ssinsanction      othersEntryOldest.get(deqIdx) := Mux1H(sel.bits, entries.drop(EnqEntryNum))
271*28607074Ssinsanction      othersEntryOldestCancel.get(deqIdx) := Mux1H(sel.bits, cancelBypassVec.getOrElse(VecInit(Seq.fill(params.numEntries)(false.B))).drop(EnqEntryNum))
272af4bd265SzhanglyGit    }
27340283787Ssinsanction  }
274*28607074Ssinsanction  else {
275*28607074Ssinsanction    io.simpEntryOldestSel.get.zipWithIndex.map { case (sel, deqIdx) =>
276*28607074Ssinsanction      simpEntryOldest.get(deqIdx) := Mux1H(sel.bits, entries.drop(EnqEntryNum).take(SimpEntryNum))
277*28607074Ssinsanction      simpEntryOldestCancel.get(deqIdx) := Mux1H(sel.bits, cancelBypassVec.getOrElse(VecInit(Seq.fill(params.numEntries)(false.B))).drop(EnqEntryNum).take(SimpEntryNum))
278*28607074Ssinsanction    }
279*28607074Ssinsanction    io.compEntryOldestSel.get.zipWithIndex.map { case (sel, deqIdx) =>
280*28607074Ssinsanction      compEntryOldest.get(deqIdx) := Mux1H(sel.bits, entries.drop(EnqEntryNum).takeRight(CompEntryNum))
281*28607074Ssinsanction      compEntryOldestCancel.get(deqIdx) := Mux1H(sel.bits, cancelBypassVec.getOrElse(VecInit(Seq.fill(params.numEntries)(false.B))).drop(EnqEntryNum).takeRight(CompEntryNum))
282*28607074Ssinsanction    }
283af4bd265SzhanglyGit  }
284cf4a131aSsinsanction
285cf4a131aSsinsanction  if (params.deqFuSame) {
286cf4a131aSsinsanction    val subDeqPolicyEntryVec = Wire(Vec(params.numDeq, ValidIO(new EntryBundle)))
287cf4a131aSsinsanction    val subDeqPolicyValidVec = Wire(Vec(params.numDeq, Bool()))
288a4d38a63SzhanglyGit    val subDeqPolicyCancelBypassVec = Wire(Vec(params.numDeq, Bool()))
289cf4a131aSsinsanction
290aa2bcc31SzhanglyGit    subDeqPolicyValidVec(0) := PopCount(io.subDeqRequest.get(0)) >= 1.U
291aa2bcc31SzhanglyGit    subDeqPolicyValidVec(1) := PopCount(io.subDeqRequest.get(0)) >= 2.U
292*28607074Ssinsanction
293*28607074Ssinsanction    if (params.isAllComp || params.isAllSimp) {
294*28607074Ssinsanction      subDeqPolicyEntryVec(0) := PriorityMux(io.subDeqRequest.get(0), entries)
295*28607074Ssinsanction      subDeqPolicyEntryVec(1) := PriorityMux(Reverse(io.subDeqRequest.get(0)), entries.reverse)
296a4d38a63SzhanglyGit      subDeqPolicyCancelBypassVec(0) := PriorityMux(io.subDeqRequest.get(0), cancelBypassVec.getOrElse(VecInit(Seq.fill(params.numEntries)(false.B))))
297a4d38a63SzhanglyGit      subDeqPolicyCancelBypassVec(1) := PriorityMux(Reverse(io.subDeqRequest.get(0)), cancelBypassVec.getOrElse(VecInit(Seq.fill(params.numEntries)(false.B))).reverse)
298cf4a131aSsinsanction
299*28607074Ssinsanction      io.deqEntry(0) := Mux(io.othersEntryOldestSel.get(0).valid, othersEntryOldest.get(0), subDeqPolicyEntryVec(1))
300aa2bcc31SzhanglyGit      io.deqEntry(1) := subDeqPolicyEntryVec(0)
301*28607074Ssinsanction      io.cancelDeqVec(0) := Mux(io.othersEntryOldestSel.get(0).valid, othersEntryOldestCancel.get(0), subDeqPolicyCancelBypassVec(1))
302a4d38a63SzhanglyGit      io.cancelDeqVec(1) := subDeqPolicyCancelBypassVec(0)
303*28607074Ssinsanction    }
304*28607074Ssinsanction    else {
305*28607074Ssinsanction      subDeqPolicyEntryVec(0) := PriorityMux(Reverse(io.subDeqRequest.get(0)), entries.reverse)
306*28607074Ssinsanction      subDeqPolicyEntryVec(1) := PriorityMux(io.subDeqRequest.get(0), entries)
307*28607074Ssinsanction      subDeqPolicyCancelBypassVec(0) := PriorityMux(Reverse(io.subDeqRequest.get(0)), cancelBypassVec.getOrElse(VecInit(Seq.fill(params.numEntries)(false.B))).reverse)
308*28607074Ssinsanction      subDeqPolicyCancelBypassVec(1) := PriorityMux(io.subDeqRequest.get(0), cancelBypassVec.getOrElse(VecInit(Seq.fill(params.numEntries)(false.B))))
309*28607074Ssinsanction
310*28607074Ssinsanction      io.deqEntry(0) := Mux(io.compEntryOldestSel.get(0).valid,
311*28607074Ssinsanction                            compEntryOldest.get(0),
312*28607074Ssinsanction                            Mux(io.simpEntryOldestSel.get(0).valid, simpEntryOldest.get(0), subDeqPolicyEntryVec(1)))
313*28607074Ssinsanction      io.deqEntry(1) := subDeqPolicyEntryVec(0)
314*28607074Ssinsanction      io.cancelDeqVec(0) := Mux(io.compEntryOldestSel.get(0).valid,
315*28607074Ssinsanction                                compEntryOldestCancel.get(0),
316*28607074Ssinsanction                                Mux(io.simpEntryOldestSel.get(0).valid, simpEntryOldestCancel.get(0), subDeqPolicyCancelBypassVec(1)))
317*28607074Ssinsanction      io.cancelDeqVec(1) := subDeqPolicyCancelBypassVec(0)
318*28607074Ssinsanction    }
319cf4a131aSsinsanction
320cf4a131aSsinsanction    when (subDeqPolicyValidVec(0)) {
321aa2bcc31SzhanglyGit      assert(Mux1H(io.subDeqSelOH.get(0), entries).bits.status.robIdx === subDeqPolicyEntryVec(0).bits.status.robIdx, "subDeqSelOH(0) is not the same\n")
32240283787Ssinsanction    }
323cf4a131aSsinsanction    when (subDeqPolicyValidVec(1)) {
324aa2bcc31SzhanglyGit      assert(Mux1H(io.subDeqSelOH.get(1), entries).bits.status.robIdx === subDeqPolicyEntryVec(1).bits.status.robIdx, "subDeqSelOH(1) is not the same\n")
325f7f73727Ssinsanction    }
326f7f73727Ssinsanction  }
327f7f73727Ssinsanction  else {
328*28607074Ssinsanction    if (params.isAllComp || params.isAllSimp) {
329*28607074Ssinsanction      io.othersEntryOldestSel.get.zipWithIndex.foreach { case (sel, i) =>
330*28607074Ssinsanction        io.deqEntry(i)     := Mux(sel.valid, othersEntryOldest.get(i), enqEntryOldest(i))
331*28607074Ssinsanction        io.cancelDeqVec(i) := Mux(sel.valid, othersEntryOldestCancel.get(i), enqEntryOldestCancel(i))
332*28607074Ssinsanction      }
333*28607074Ssinsanction    }
334*28607074Ssinsanction    else {
335*28607074Ssinsanction      io.compEntryOldestSel.get.zip(io.simpEntryOldestSel.get).zipWithIndex.foreach { case ((compSel, simpSel), i) =>
336*28607074Ssinsanction        io.deqEntry(i)     := Mux(compSel.valid,
337*28607074Ssinsanction                                  compEntryOldest.get(i),
338*28607074Ssinsanction                                  Mux(simpSel.valid, simpEntryOldest.get(i), enqEntryOldest(i)))
339*28607074Ssinsanction        io.cancelDeqVec(i) := Mux(compSel.valid,
340*28607074Ssinsanction                                  compEntryOldestCancel.get(i),
341*28607074Ssinsanction                                  Mux(simpSel.valid, simpEntryOldestCancel.get(i), enqEntryOldestCancel(i)))
342*28607074Ssinsanction      }
343af4bd265SzhanglyGit    }
344af4bd265SzhanglyGit  }
345af4bd265SzhanglyGit
346af4bd265SzhanglyGit  if (params.hasIQWakeUp) {
347a4d38a63SzhanglyGit    cancelBypassVec.get.zip(srcWakeUpL1ExuOHVec.get).zip(srcTimerVec.get).zip(srcLoadDependencyVec.get).foreach{ case (((cancelBypass: Bool, l1ExuOH: Vec[Vec[Bool]]), srcTimer: Vec[UInt]), srcLoadDependency: Vec[Vec[UInt]]) =>
348a4d38a63SzhanglyGit      val cancelByOg0 = l1ExuOH.zip(srcTimer).map {
349af4bd265SzhanglyGit        case(exuOH, srcTimer) =>
350af4bd265SzhanglyGit          (exuOH.asUInt & io.og0Cancel.asUInt).orR && srcTimer === 1.U
351af4bd265SzhanglyGit      }.reduce(_ | _)
352a4d38a63SzhanglyGit      val cancelByLd = srcLoadDependency.map(x => LoadShouldCancel(Some(x), io.ldCancel)).reduce(_ | _)
353a4d38a63SzhanglyGit      cancelBypass := cancelByOg0 || cancelByLd
35440283787Ssinsanction    }
35540283787Ssinsanction  }
35640283787Ssinsanction
3575db4956bSzhanglyGit  io.valid                          := validVec.asUInt
3585db4956bSzhanglyGit  io.canIssue                       := canIssueVec.asUInt
3595db4956bSzhanglyGit  io.fuType                         := fuTypeVec
3605db4956bSzhanglyGit  io.dataSources                    := dataSourceVec
361aa2bcc31SzhanglyGit  io.srcWakeUpL1ExuOH.foreach(_     := srcWakeUpL1ExuOHVec.get.map(x => VecInit(x.map(_.asUInt))))
3625db4956bSzhanglyGit  io.srcTimer.foreach(_             := srcTimerVec.get)
3633d81019fSzhanglyGit  io.loadDependency.foreach(_       := loadDependencyVec.get)
364aa2bcc31SzhanglyGit  io.isFirstIssue.zipWithIndex.foreach{ case (isFirstIssue, deqIdx) =>
365aa2bcc31SzhanglyGit    isFirstIssue                    := io.deqSelOH(deqIdx).valid && Mux1H(io.deqSelOH(deqIdx).bits, isFirstIssueVec)
3668d081717Sszw_kaixin  }
367*28607074Ssinsanction  io.simpEntryEnqSelVec.foreach(_   := finalSimpTransSelVec.get.zip(enqEntryTransVec).map(x => x._1 & Fill(SimpEntryNum, x._2.valid)))
368*28607074Ssinsanction  io.compEntryEnqSelVec.foreach(_   := finalCompTransSelVec.get.zip(compEnqVec.get).map(x => x._1 & Fill(CompEntryNum, x._2.valid)))
369*28607074Ssinsanction  io.othersEntryEnqSelVec.foreach(_ := finalOthersTransSelVec.get.zip(enqEntryTransVec).map(x => x._1 & Fill(OthersEntryNum, x._2.valid)))
370aa2bcc31SzhanglyGit  io.robIdx.foreach(_           := robIdxVec)
371aa2bcc31SzhanglyGit  io.uopIdx.foreach(_           := uopIdxVec.get)
372aa2bcc31SzhanglyGit  io.rsFeedback                     := 0.U.asTypeOf(io.rsFeedback)  //should be removed
373aa2bcc31SzhanglyGit  io.cancel.foreach(_               := cancelVec.get)               //for debug
374aa2bcc31SzhanglyGit
375aa2bcc31SzhanglyGit  def EntriesConnect(in: CommonInBundle, out: CommonOutBundle, entryIdx: Int) = {
376aa2bcc31SzhanglyGit    in.flush                    := io.flush
377aa2bcc31SzhanglyGit    in.wakeUpFromWB             := io.wakeUpFromWB
378aa2bcc31SzhanglyGit    in.wakeUpFromIQ             := io.wakeUpFromIQ
379aa2bcc31SzhanglyGit    in.og0Cancel                := io.og0Cancel
380aa2bcc31SzhanglyGit    in.og1Cancel                := io.og1Cancel
381aa2bcc31SzhanglyGit    in.ldCancel                 := io.ldCancel
382aa2bcc31SzhanglyGit    in.deqSel                   := deqSelVec(entryIdx)
383aa2bcc31SzhanglyGit    in.deqPortIdxWrite          := deqPortIdxWriteVec(entryIdx)
384aa2bcc31SzhanglyGit    in.issueResp                := issueRespVec(entryIdx)
385aa2bcc31SzhanglyGit    if (params.isMemAddrIQ) {
386aa2bcc31SzhanglyGit      in.fromMem.get.stIssuePtr := io.fromMem.get.stIssuePtr
387aa2bcc31SzhanglyGit      in.fromMem.get.memWaitUpdateReq := io.fromMem.get.memWaitUpdateReq
388aa2bcc31SzhanglyGit    }
389aa2bcc31SzhanglyGit    if (params.isVecMemIQ) {
390aa2bcc31SzhanglyGit      in.fromLsq.get.sqDeqPtr := io.vecMemIn.get.sqDeqPtr
391aa2bcc31SzhanglyGit      in.fromLsq.get.lqDeqPtr := io.vecMemIn.get.lqDeqPtr
392aa2bcc31SzhanglyGit    }
393aa2bcc31SzhanglyGit    validVec(entryIdx)          := out.valid
394aa2bcc31SzhanglyGit    canIssueVec(entryIdx)       := out.canIssue
395aa2bcc31SzhanglyGit    fuTypeVec(entryIdx)         := out.fuType
396aa2bcc31SzhanglyGit    robIdxVec(entryIdx)         := out.robIdx
397aa2bcc31SzhanglyGit    dataSourceVec(entryIdx)     := out.dataSource
398aa2bcc31SzhanglyGit    isFirstIssueVec(entryIdx)   := out.isFirstIssue
399aa2bcc31SzhanglyGit    entries(entryIdx)           := out.entry
400aa2bcc31SzhanglyGit    deqPortIdxReadVec(entryIdx) := out.deqPortIdxRead
401aa2bcc31SzhanglyGit    issueTimerVec(entryIdx)     := out.issueTimerRead
402aa2bcc31SzhanglyGit    if (params.hasIQWakeUp) {
403aa2bcc31SzhanglyGit      srcWakeUpL1ExuOHVec.get(entryIdx)       := out.srcWakeUpL1ExuOH.get
404aa2bcc31SzhanglyGit      srcTimerVec.get(entryIdx)               := out.srcTimer.get
405a4d38a63SzhanglyGit      srcLoadDependencyVec.get(entryIdx)      := out.srcLoadDependency.get
4063d81019fSzhanglyGit      loadDependencyVec.get(entryIdx)         := out.entry.bits.status.mergedLoadDependency.get
407aa2bcc31SzhanglyGit      cancelVec.get(entryIdx)                 := out.cancel.get
408aa2bcc31SzhanglyGit    }
409aa2bcc31SzhanglyGit    if (params.isVecMemIQ) {
410aa2bcc31SzhanglyGit      uopIdxVec.get(entryIdx)   := out.uopIdx.get
411aa2bcc31SzhanglyGit    }
412aa2bcc31SzhanglyGit  }
413aa2bcc31SzhanglyGit}
414aa2bcc31SzhanglyGit
415aa2bcc31SzhanglyGitclass EntriesIO(implicit p: Parameters, params: IssueBlockParams) extends XSBundle {
416aa2bcc31SzhanglyGit  val flush               = Flipped(ValidIO(new Redirect))
417aa2bcc31SzhanglyGit  //enq
418aa2bcc31SzhanglyGit  val enq                 = Vec(params.numEnq, Flipped(ValidIO(new EntryBundle)))
419aa2bcc31SzhanglyGit  val og0Resp             = Vec(params.numDeq, Flipped(ValidIO(new EntryDeqRespBundle)))
420aa2bcc31SzhanglyGit  val og1Resp             = Vec(params.numDeq, Flipped(ValidIO(new EntryDeqRespBundle)))
421aa2bcc31SzhanglyGit  val finalIssueResp      = OptionWrapper(params.LdExuCnt > 0, Vec(params.numDeq, Flipped(ValidIO(new EntryDeqRespBundle))))
422aa2bcc31SzhanglyGit  //deq sel
423aa2bcc31SzhanglyGit  val deqReady            = Vec(params.numDeq, Input(Bool()))
424aa2bcc31SzhanglyGit  val deqSelOH            = Vec(params.numDeq, Flipped(ValidIO(UInt(params.numEntries.W))))
425aa2bcc31SzhanglyGit  val enqEntryOldestSel   = Vec(params.numDeq, Flipped(ValidIO(UInt(params.numEnq.W))))
426*28607074Ssinsanction  val simpEntryOldestSel  = OptionWrapper(params.hasCompAndSimp, Vec(params.numDeq, Flipped(ValidIO(UInt(params.numSimp.W)))))
427*28607074Ssinsanction  val compEntryOldestSel  = OptionWrapper(params.hasCompAndSimp, Vec(params.numDeq, Flipped(ValidIO(UInt(params.numComp.W)))))
428*28607074Ssinsanction  val othersEntryOldestSel= OptionWrapper(params.isAllComp || params.isAllSimp, Vec(params.numDeq, Flipped(ValidIO(UInt((params.numEntries - params.numEnq).W)))))
429aa2bcc31SzhanglyGit  val subDeqRequest       = OptionWrapper(params.deqFuSame, Vec(params.numDeq, Input(UInt(params.numEntries.W))))
430aa2bcc31SzhanglyGit  val subDeqSelOH         = OptionWrapper(params.deqFuSame, Vec(params.numDeq, Input(UInt(params.numEntries.W))))
431aa2bcc31SzhanglyGit  // wakeup
432aa2bcc31SzhanglyGit  val wakeUpFromWB: MixedVec[ValidIO[IssueQueueWBWakeUpBundle]] = Flipped(params.genWBWakeUpSinkValidBundle)
433aa2bcc31SzhanglyGit  val wakeUpFromIQ: MixedVec[ValidIO[IssueQueueIQWakeUpBundle]] = Flipped(params.genIQWakeUpSinkValidBundle)
434aa2bcc31SzhanglyGit  val og0Cancel           = Input(ExuOH(backendParams.numExu))
435aa2bcc31SzhanglyGit  val og1Cancel           = Input(ExuOH(backendParams.numExu))
436aa2bcc31SzhanglyGit  val ldCancel            = Vec(backendParams.LdExuCnt, Flipped(new LoadCancelIO))
437aa2bcc31SzhanglyGit  //entries status
438aa2bcc31SzhanglyGit  val valid               = Output(UInt(params.numEntries.W))
439aa2bcc31SzhanglyGit  val canIssue            = Output(UInt(params.numEntries.W))
440aa2bcc31SzhanglyGit  val fuType              = Vec(params.numEntries, Output(FuType()))
441aa2bcc31SzhanglyGit  val dataSources         = Vec(params.numEntries, Vec(params.numRegSrc, Output(DataSource())))
442aa2bcc31SzhanglyGit  val srcWakeUpL1ExuOH    = OptionWrapper(params.hasIQWakeUp, Vec(params.numEntries, Vec(params.numRegSrc, Output(ExuOH()))))
443aa2bcc31SzhanglyGit  val srcTimer            = OptionWrapper(params.hasIQWakeUp, Vec(params.numEntries, Vec(params.numRegSrc, Output(UInt(3.W)))))
4443d81019fSzhanglyGit  val loadDependency      = OptionWrapper(params.hasIQWakeUp, Vec(params.numEntries, Vec(LoadPipelineWidth, UInt(3.W))))
445aa2bcc31SzhanglyGit  //deq status
446aa2bcc31SzhanglyGit  val isFirstIssue        = Vec(params.numDeq, Output(Bool()))
447aa2bcc31SzhanglyGit  val deqEntry            = Vec(params.numDeq, ValidIO(new EntryBundle))
448aa2bcc31SzhanglyGit  val cancelDeqVec        = Vec(params.numDeq, Output(Bool()))
449aa2bcc31SzhanglyGit  // mem only
450aa2bcc31SzhanglyGit  val fromMem = if (params.isMemAddrIQ) Some(new Bundle {
451aa2bcc31SzhanglyGit    val stIssuePtr        = Input(new SqPtr)
452aa2bcc31SzhanglyGit    val memWaitUpdateReq  = Flipped(new MemWaitUpdateReq)
453aa2bcc31SzhanglyGit    val slowResp          = Vec(params.numDeq, Flipped(ValidIO(new EntryDeqRespBundle)))
454aa2bcc31SzhanglyGit    val fastResp          = Vec(params.numDeq, Flipped(ValidIO(new EntryDeqRespBundle)))
455aa2bcc31SzhanglyGit  }) else None
456aa2bcc31SzhanglyGit  val vecMemIn = OptionWrapper(params.isVecMemIQ, new Bundle {
457aa2bcc31SzhanglyGit    val sqDeqPtr = Input(new SqPtr)
458aa2bcc31SzhanglyGit    val lqDeqPtr = Input(new LqPtr)
459aa2bcc31SzhanglyGit  })
460aa2bcc31SzhanglyGit
461aa2bcc31SzhanglyGit  val robIdx = OptionWrapper(params.isVecMemIQ, Output(Vec(params.numEntries, new RobPtr)))
462aa2bcc31SzhanglyGit  val uopIdx = OptionWrapper(params.isVecMemIQ, Output(Vec(params.numEntries, UopIdx())))
463aa2bcc31SzhanglyGit
464aa2bcc31SzhanglyGit  val rsFeedback          = Output(Vec(5, Bool()))
465*28607074Ssinsanction  // trans
466*28607074Ssinsanction  val simpEntryDeqSelVec = OptionWrapper(params.hasCompAndSimp, Vec(params.numEnq, Input(UInt(params.numSimp.W))))
467*28607074Ssinsanction  val simpEntryEnqSelVec = OptionWrapper(params.hasCompAndSimp, Vec(params.numEnq, Output(UInt(params.numSimp.W))))
468*28607074Ssinsanction  val compEntryEnqSelVec = OptionWrapper(params.hasCompAndSimp, Vec(params.numEnq, Output(UInt(params.numComp.W))))
469*28607074Ssinsanction  val othersEntryEnqSelVec = OptionWrapper(params.isAllComp || params.isAllSimp, Vec(params.numEnq, Output(UInt((params.numEntries - params.numEnq).W))))
470aa2bcc31SzhanglyGit
471aa2bcc31SzhanglyGit  // debug
472aa2bcc31SzhanglyGit  val cancel              = OptionWrapper(params.hasIQWakeUp, Output(Vec(params.numEntries, Bool())))
473aa2bcc31SzhanglyGit
474aa2bcc31SzhanglyGit  def wakeup = wakeUpFromWB ++ wakeUpFromIQ
4755db4956bSzhanglyGit}
476