15db4956bSzhanglyGitpackage xiangshan.backend.issue 25db4956bSzhanglyGit 383ba63b3SXuan Huimport org.chipsalliance.cde.config.Parameters 45db4956bSzhanglyGitimport chisel3._ 55db4956bSzhanglyGitimport chisel3.util._ 65db4956bSzhanglyGitimport utility.HasCircularQueuePtrHelper 7a6938b17Ssinsanctionimport utils._ 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 2528607074Ssinsanction private val SimpEntryNum = params.numSimp 2628607074Ssinsanction private val CompEntryNum = params.numComp 275db4956bSzhanglyGit val io = IO(new EntriesIO) 285db4956bSzhanglyGit 29c838dea1SXuan Hu // only memAddrIQ use it 307e471bf8SXuan Hu val memEtyResps: Seq[ValidIO[EntryDeqRespBundle]] = { 317e471bf8SXuan Hu val resps = 32d3372210SzhanglyGit if (params.isLdAddrIQ && !params.isStAddrIQ) //LDU 337e471bf8SXuan Hu Seq(io.og0Resp, io.og1Resp, io.fromLoad.get.finalIssueResp, io.fromLoad.get.memAddrIssueResp) 34d3372210SzhanglyGit else if (params.isLdAddrIQ && params.isStAddrIQ || params.isHyAddrIQ) //HYU 357e471bf8SXuan Hu Seq(io.og0Resp, io.og1Resp, io.fromLoad.get.finalIssueResp, io.fromLoad.get.memAddrIssueResp, io.fromMem.get.fastResp, io.fromMem.get.slowResp) 367e471bf8SXuan Hu else if (params.isStAddrIQ) //STU 377e471bf8SXuan Hu Seq(io.og0Resp, io.og1Resp, io.fromMem.get.slowResp) 388f3cbbcfSXuan Hu else if (params.isVecLduIQ && params.isVecStuIQ) // Vector store IQ need no vecLdIn.resp, but for now vector store share the vector load IQ 398f3cbbcfSXuan Hu Seq(io.og0Resp, io.og1Resp, io.vecLdIn.get.resp, io.fromMem.get.slowResp) 408f3cbbcfSXuan Hu else if (params.isVecLduIQ) 417e471bf8SXuan Hu Seq(io.og0Resp, io.og1Resp, io.vecLdIn.get.resp) 427e471bf8SXuan Hu else if (params.isVecStuIQ) 437e471bf8SXuan Hu Seq(io.og0Resp, io.og1Resp, io.fromMem.get.slowResp) 447e471bf8SXuan Hu else Seq() 457e471bf8SXuan Hu if (params.isMemAddrIQ) { 467e471bf8SXuan Hu println(s"[${this.desiredName}] resp: {" + 477e471bf8SXuan Hu s"og0Resp: ${resps.contains(io.og0Resp)}, " + 487e471bf8SXuan Hu s"og1Resp: ${resps.contains(io.og1Resp)}, " + 497e471bf8SXuan Hu s"finalResp: ${io.fromLoad.nonEmpty && resps.contains(io.fromLoad.get.finalIssueResp)}, " + 507e471bf8SXuan Hu s"loadBorderResp: ${io.fromLoad.nonEmpty && resps.contains(io.fromLoad.get.memAddrIssueResp)}, " + 517e471bf8SXuan Hu s"memFastResp: ${io.fromMem.nonEmpty && resps.contains(io.fromMem.get.fastResp)}, " + 527e471bf8SXuan Hu s"memSlowResp: ${io.fromMem.nonEmpty && resps.contains(io.fromMem.get.slowResp)}, " + 537e471bf8SXuan Hu s"vecLoadBorderResp: ${io.vecLdIn.nonEmpty && resps.contains(io.vecLdIn.get.resp)}, " + 547e471bf8SXuan Hu s"}" 557e471bf8SXuan Hu ) 567e471bf8SXuan Hu } 577e471bf8SXuan Hu resps.flatten 58c838dea1SXuan Hu } 59c838dea1SXuan Hu 606462eb1cSzhanglyGit val resps: Vec[Vec[ValidIO[EntryDeqRespBundle]]] = VecInit(io.og0Resp, io.og1Resp, 0.U.asTypeOf(io.og0Resp)) 615db4956bSzhanglyGit 627e471bf8SXuan Hu 637e471bf8SXuan Hu 645db4956bSzhanglyGit //Module 65df26db8aSsinsanction val enqEntries = Seq.fill(EnqEntryNum)(Module(EnqEntry(isComp = true)(p, params))) 6628607074Ssinsanction val othersEntriesSimp = Seq.fill(SimpEntryNum)(Module(OthersEntry(isComp = false)(p, params))) 6728607074Ssinsanction val othersEntriesComp = Seq.fill(CompEntryNum)(Module(OthersEntry(isComp = true)(p, params))) 6828607074Ssinsanction val othersEntries = othersEntriesSimp ++ othersEntriesComp 6928607074Ssinsanction val othersTransPolicy = OptionWrapper(params.isAllComp || params.isAllSimp, Module(new EnqPolicy)) 7028607074Ssinsanction val simpTransPolicy = OptionWrapper(params.hasCompAndSimp, Module(new EnqPolicy)) 7128607074Ssinsanction val compTransPolicy = OptionWrapper(params.hasCompAndSimp, Module(new EnqPolicy)) 725db4956bSzhanglyGit 735db4956bSzhanglyGit //Wire 74aa2bcc31SzhanglyGit //entries status 755db4956bSzhanglyGit val entries = Wire(Vec(params.numEntries, ValidIO(new EntryBundle))) 76aa2bcc31SzhanglyGit val robIdxVec = Wire(Vec(params.numEntries, new RobPtr)) 775db4956bSzhanglyGit val validVec = Wire(Vec(params.numEntries, Bool())) 785db4956bSzhanglyGit val canIssueVec = Wire(Vec(params.numEntries, Bool())) 795db4956bSzhanglyGit val fuTypeVec = Wire(Vec(params.numEntries, FuType())) 805db4956bSzhanglyGit val isFirstIssueVec = Wire(Vec(params.numEntries, Bool())) 815db4956bSzhanglyGit val issueTimerVec = Wire(Vec(params.numEntries, UInt(2.W))) 8299944b79Ssinsanction val uopIdxVec = OptionWrapper(params.isVecMemIQ, Wire(Vec(params.numEntries, UopIdx()))) 83aa2bcc31SzhanglyGit //src status 84aa2bcc31SzhanglyGit val dataSourceVec = Wire(Vec(params.numEntries, Vec(params.numRegSrc, DataSource()))) 85eea4a3caSzhanglyGit val loadDependencyVec = Wire(Vec(params.numEntries, Vec(LoadPipelineWidth, UInt(3.W)))) 86eea4a3caSzhanglyGit val srcLoadDependencyVec= Wire(Vec(params.numEntries, Vec(params.numRegSrc, Vec(LoadPipelineWidth, UInt(3.W))))) 87aa2bcc31SzhanglyGit val srcTimerVec = OptionWrapper(params.hasIQWakeUp, Wire(Vec(params.numEntries, Vec(params.numRegSrc, UInt(3.W))))) 88aa2bcc31SzhanglyGit val srcWakeUpL1ExuOHVec = OptionWrapper(params.hasIQWakeUp, Wire(Vec(params.numEntries, Vec(params.numRegSrc, ExuVec())))) 89aa2bcc31SzhanglyGit //deq sel 90aa2bcc31SzhanglyGit val deqSelVec = Wire(Vec(params.numEntries, Bool())) 91aa2bcc31SzhanglyGit val issueRespVec = Wire(Vec(params.numEntries, ValidIO(new EntryDeqRespBundle))) 925db4956bSzhanglyGit val deqPortIdxWriteVec = Wire(Vec(params.numEntries, UInt(1.W))) 935db4956bSzhanglyGit val deqPortIdxReadVec = Wire(Vec(params.numEntries, UInt(1.W))) 94aa2bcc31SzhanglyGit //trans sel 9528607074Ssinsanction val othersEntryEnqReadyVec = Wire(Vec(OthersEntryNum, Bool())) 9628607074Ssinsanction val othersEntryEnqVec = Wire(Vec(OthersEntryNum, Valid(new EntryBundle))) 9728607074Ssinsanction val enqEntryTransVec = Wire(Vec(EnqEntryNum, Valid(new EntryBundle))) 9828607074Ssinsanction val simpEntryTransVec = OptionWrapper(params.hasCompAndSimp, Wire(Vec(SimpEntryNum, Valid(new EntryBundle)))) 9928607074Ssinsanction val compEnqVec = OptionWrapper(params.hasCompAndSimp, Wire(Vec(EnqEntryNum, Valid(new EntryBundle)))) 10028607074Ssinsanction 10128607074Ssinsanction val enqCanTrans2Simp = OptionWrapper(params.hasCompAndSimp, Wire(Bool())) 10228607074Ssinsanction val enqCanTrans2Comp = OptionWrapper(params.hasCompAndSimp, Wire(Bool())) 10328607074Ssinsanction val simpCanTrans2Comp = OptionWrapper(params.hasCompAndSimp, Wire(Vec(EnqEntryNum, Bool()))) 10428607074Ssinsanction val simpTransSelVec = OptionWrapper(params.hasCompAndSimp, Wire(Vec(EnqEntryNum, Valid(UInt(SimpEntryNum.W))))) 10528607074Ssinsanction val compTransSelVec = OptionWrapper(params.hasCompAndSimp, Wire(Vec(EnqEntryNum, Valid(UInt(CompEntryNum.W))))) 10628607074Ssinsanction val finalSimpTransSelVec = OptionWrapper(params.hasCompAndSimp, Wire(Vec(EnqEntryNum, UInt(SimpEntryNum.W)))) 10728607074Ssinsanction val finalCompTransSelVec = OptionWrapper(params.hasCompAndSimp, Wire(Vec(EnqEntryNum, UInt(CompEntryNum.W)))) 10828607074Ssinsanction 10928607074Ssinsanction val enqCanTrans2Others = OptionWrapper(params.isAllComp || params.isAllSimp, Wire(Bool())) 11028607074Ssinsanction val othersTransSelVec = OptionWrapper(params.isAllComp || params.isAllSimp, Wire(Vec(EnqEntryNum, Valid(UInt(OthersEntryNum.W))))) 11128607074Ssinsanction val finalOthersTransSelVec = OptionWrapper(params.isAllComp || params.isAllSimp, Wire(Vec(EnqEntryNum, UInt(OthersEntryNum.W)))) 11228607074Ssinsanction 11328607074Ssinsanction val simpEntryEnqReadyVec = othersEntryEnqReadyVec.take(SimpEntryNum) 11428607074Ssinsanction val compEntryEnqReadyVec = othersEntryEnqReadyVec.takeRight(CompEntryNum) 11528607074Ssinsanction val simpEntryEnqVec = othersEntryEnqVec.take(SimpEntryNum) 11628607074Ssinsanction val compEntryEnqVec = othersEntryEnqVec.takeRight(CompEntryNum) 117aa2bcc31SzhanglyGit //debug 11889740385Ssinsanction val cancelVec = OptionWrapper(params.hasIQWakeUp, Wire(Vec(params.numEntries, Bool()))) 119a6938b17Ssinsanction val entryInValidVec = Wire(Vec(params.numEntries, Bool())) 120a6938b17Ssinsanction val entryOutDeqValidVec = Wire(Vec(params.numEntries, Bool())) 121a6938b17Ssinsanction val entryOutTransValidVec = Wire(Vec(params.numEntries, Bool())) 122a4d38a63SzhanglyGit //cancel bypass 123eea4a3caSzhanglyGit val cancelBypassVec = Wire(Vec(params.numEntries, Bool())) 1245db4956bSzhanglyGit 1255db4956bSzhanglyGit 1265db4956bSzhanglyGit //enqEntries 1275db4956bSzhanglyGit enqEntries.zipWithIndex.foreach { case (enqEntry, entryIdx) => 128aa2bcc31SzhanglyGit enqEntry.io.commonIn.enq := io.enq(entryIdx) 12928607074Ssinsanction enqEntry.io.commonIn.transSel := (if (params.isAllComp || params.isAllSimp) enqCanTrans2Others.get && othersTransSelVec.get(entryIdx).valid 13028607074Ssinsanction else enqCanTrans2Simp.get && simpTransSelVec.get(entryIdx).valid || enqCanTrans2Comp.get && compTransSelVec.get(entryIdx).valid) 131aa2bcc31SzhanglyGit EntriesConnect(enqEntry.io.commonIn, enqEntry.io.commonOut, entryIdx) 13241dbbdfdSsinceforYy enqEntry.io.enqDelayWakeUpFromWB := RegEnable(io.wakeUpFromWB, io.enq(entryIdx).valid) 13341dbbdfdSsinceforYy enqEntry.io.enqDelayWakeUpFromIQ := RegEnable(io.wakeUpFromIQ, io.enq(entryIdx).valid) 134aa2bcc31SzhanglyGit enqEntry.io.enqDelayOg0Cancel := RegNext(io.og0Cancel.asUInt) 135aa2b5219Ssinsanction enqEntry.io.enqDelayLdCancel := RegNext(io.ldCancel) 13628607074Ssinsanction enqEntryTransVec(entryIdx) := enqEntry.io.commonOut.transEntry 1375db4956bSzhanglyGit } 1385db4956bSzhanglyGit //othersEntries 1395db4956bSzhanglyGit othersEntries.zipWithIndex.foreach { case (othersEntry, entryIdx) => 14028607074Ssinsanction othersEntry.io.commonIn.enq := othersEntryEnqVec(entryIdx) 14128607074Ssinsanction othersEntry.io.commonIn.transSel := (if (params.hasCompAndSimp && (entryIdx < SimpEntryNum)) 14228607074Ssinsanction io.simpEntryDeqSelVec.get.zip(simpCanTrans2Comp.get).map(x => x._1(entryIdx) && x._2).reduce(_ | _) 14328607074Ssinsanction else false.B) 144aa2bcc31SzhanglyGit EntriesConnect(othersEntry.io.commonIn, othersEntry.io.commonOut, entryIdx + EnqEntryNum) 14528607074Ssinsanction othersEntryEnqReadyVec(entryIdx) := othersEntry.io.commonOut.enqReady 14628607074Ssinsanction if (params.hasCompAndSimp && (entryIdx < SimpEntryNum)) { 14728607074Ssinsanction simpEntryTransVec.get(entryIdx) := othersEntry.io.commonOut.transEntry 14828607074Ssinsanction } 1495db4956bSzhanglyGit } 1505db4956bSzhanglyGit 1515db4956bSzhanglyGit 1525db4956bSzhanglyGit deqSelVec.zip(deqPortIdxWriteVec).zipWithIndex.foreach { case ((deqSel, deqPortIdxWrite), i) => 153aa2bcc31SzhanglyGit val deqVec = io.deqSelOH.zip(io.deqReady).map(x => x._1.valid && x._1.bits(i) && x._2) 1545db4956bSzhanglyGit deqPortIdxWrite := OHToUInt(deqVec) 1555db4956bSzhanglyGit deqSel := deqVec.reduce(_ | _) 1565db4956bSzhanglyGit } 1575db4956bSzhanglyGit 1585db4956bSzhanglyGit 15928607074Ssinsanction if (params.isAllComp || params.isAllSimp) { 1605db4956bSzhanglyGit //transPolicy 16128607074Ssinsanction othersTransPolicy.get.io.canEnq := othersEntryEnqReadyVec.asUInt 162b43488b9Ssinsanction 163b43488b9Ssinsanction // we only allow all or none of the enq entries transfering to others entries. 16428607074Ssinsanction enqCanTrans2Others.get := PopCount(validVec.take(EnqEntryNum)) <= PopCount(othersEntryEnqReadyVec) 165b43488b9Ssinsanction // othersTransSelVec(i) is the target others entry for enq entry [i]. 166b43488b9Ssinsanction // note that dispatch does not guarantee the validity of enq entries with low index. 167b43488b9Ssinsanction // that means in some cases enq entry [0] is invalid while enq entry [1] is valid. 168b43488b9Ssinsanction // in this case, enq entry [1] should use result [0] of TransPolicy. 16928607074Ssinsanction othersTransSelVec.get(0).valid := othersTransPolicy.get.io.enqSelOHVec(0).valid && validVec(0) 17028607074Ssinsanction othersTransSelVec.get(0).bits := othersTransPolicy.get.io.enqSelOHVec(0).bits 1718321ef33Ssinsanction if (params.numEnq == 2) { 17228607074Ssinsanction othersTransSelVec.get(1).valid := Mux(!validVec(0), othersTransPolicy.get.io.enqSelOHVec(0).valid, othersTransPolicy.get.io.enqSelOHVec(1).valid) 17328607074Ssinsanction othersTransSelVec.get(1).bits := Mux(!validVec(0), othersTransPolicy.get.io.enqSelOHVec(0).bits, othersTransPolicy.get.io.enqSelOHVec(1).bits) 1748321ef33Ssinsanction } 1758321ef33Ssinsanction 17628607074Ssinsanction finalOthersTransSelVec.get.zip(othersTransSelVec.get).zipWithIndex.foreach { case ((finalOH, selOH), enqIdx) => 17728607074Ssinsanction finalOH := Fill(OthersEntryNum, enqCanTrans2Others.get && selOH.valid) & selOH.bits 1785db4956bSzhanglyGit } 1795db4956bSzhanglyGit 18028607074Ssinsanction //othersEntryEnq 18128607074Ssinsanction othersEntryEnqVec.zipWithIndex.foreach { case (othersEntryEnq, othersIdx) => 18228607074Ssinsanction val othersEnqOH = finalOthersTransSelVec.get.map(_(othersIdx)) 18328607074Ssinsanction if (othersEnqOH.size == 1) 18428607074Ssinsanction othersEntryEnq := Mux(othersEnqOH.head, enqEntryTransVec.head, 0.U.asTypeOf(enqEntryTransVec.head)) 18528607074Ssinsanction else 18628607074Ssinsanction othersEntryEnq := Mux1H(othersEnqOH, enqEntryTransVec) 1875db4956bSzhanglyGit } 18828607074Ssinsanction } 18928607074Ssinsanction else { 19028607074Ssinsanction //transPolicy 19128607074Ssinsanction simpTransPolicy.get.io.canEnq := VecInit(simpEntryEnqReadyVec).asUInt 19228607074Ssinsanction compTransPolicy.get.io.canEnq := VecInit(validVec.takeRight(CompEntryNum).map(!_)).asUInt 19328607074Ssinsanction 194b43488b9Ssinsanction // we only allow all or none of the enq entries transfering to comp/simp entries. 195b43488b9Ssinsanction // when all of simp entries are empty and comp entries are enough, transfer to comp entries. 196b43488b9Ssinsanction // otherwise, transfer to simp entries. 19728607074Ssinsanction enqCanTrans2Comp.get := PopCount(validVec.take(EnqEntryNum)) <= PopCount(validVec.takeRight(CompEntryNum).map(!_)) && !validVec.drop(EnqEntryNum).take(SimpEntryNum).reduce(_ || _) 19828607074Ssinsanction enqCanTrans2Simp.get := !enqCanTrans2Comp.get && PopCount(validVec.take(EnqEntryNum)) <= PopCount(simpEntryEnqReadyVec) 19928607074Ssinsanction simpCanTrans2Comp.get.zipWithIndex.foreach { case (canTrans, idx) => 20028607074Ssinsanction canTrans := !enqCanTrans2Comp.get && PopCount(validVec.takeRight(CompEntryNum).map(!_)) >= (idx + 1).U 20128607074Ssinsanction } 20228607074Ssinsanction 203b43488b9Ssinsanction // simp/compTransSelVec(i) is the target simp/comp entry for enq entry [i]. 204b43488b9Ssinsanction // note that dispatch does not guarantee the validity of enq entries with low index. 205b43488b9Ssinsanction // that means in some cases enq entry [0] is invalid while enq entry [1] is valid. 206b43488b9Ssinsanction // in this case, enq entry [1] should use result [0] of TransPolicy. 20728607074Ssinsanction simpTransSelVec.get(0).valid := simpTransPolicy.get.io.enqSelOHVec(0).valid && validVec(0) 20828607074Ssinsanction simpTransSelVec.get(0).bits := simpTransPolicy.get.io.enqSelOHVec(0).bits 20928607074Ssinsanction compTransSelVec.get(0).valid := compTransPolicy.get.io.enqSelOHVec(0).valid && validVec(0) 21028607074Ssinsanction compTransSelVec.get(0).bits := compTransPolicy.get.io.enqSelOHVec(0).bits 21128607074Ssinsanction if (params.numEnq == 2) { 21228607074Ssinsanction simpTransSelVec.get(1).valid := Mux(!validVec(0), simpTransPolicy.get.io.enqSelOHVec(0).valid, simpTransPolicy.get.io.enqSelOHVec(1).valid) 21328607074Ssinsanction simpTransSelVec.get(1).bits := Mux(!validVec(0), simpTransPolicy.get.io.enqSelOHVec(0).bits, simpTransPolicy.get.io.enqSelOHVec(1).bits) 21428607074Ssinsanction compTransSelVec.get(1).valid := Mux(!validVec(0), compTransPolicy.get.io.enqSelOHVec(0).valid, compTransPolicy.get.io.enqSelOHVec(1).valid) 21528607074Ssinsanction compTransSelVec.get(1).bits := Mux(!validVec(0), compTransPolicy.get.io.enqSelOHVec(0).bits, compTransPolicy.get.io.enqSelOHVec(1).bits) 21628607074Ssinsanction } 21728607074Ssinsanction 21828607074Ssinsanction finalSimpTransSelVec.get.zip(simpTransSelVec.get).zipWithIndex.foreach { case ((finalOH, selOH), enqIdx) => 21928607074Ssinsanction finalOH := Fill(SimpEntryNum, enqCanTrans2Simp.get && selOH.valid) & selOH.bits 22028607074Ssinsanction } 22128607074Ssinsanction finalCompTransSelVec.get.zip(compTransSelVec.get).zip(compTransPolicy.get.io.enqSelOHVec).zipWithIndex.foreach { 22228607074Ssinsanction case (((finalOH, selOH), origSelOH), enqIdx) => 22328607074Ssinsanction finalOH := Mux(enqCanTrans2Comp.get, Fill(CompEntryNum, selOH.valid) & selOH.bits, Fill(CompEntryNum, origSelOH.valid) & origSelOH.bits) 22428607074Ssinsanction } 22528607074Ssinsanction 22628607074Ssinsanction //othersEntryEnq 22728607074Ssinsanction simpEntryEnqVec.zipWithIndex.foreach { case (simpEntryEnq, simpIdx) => 22828607074Ssinsanction val simpEnqOH = finalSimpTransSelVec.get.map(_(simpIdx)) 22928607074Ssinsanction // shit Mux1H directly returns in(0) if the seq has only 1 elements 23028607074Ssinsanction if (simpEnqOH.size == 1) 23128607074Ssinsanction simpEntryEnq := Mux(simpEnqOH.head, enqEntryTransVec.head, 0.U.asTypeOf(enqEntryTransVec.head)) 23228607074Ssinsanction else 23328607074Ssinsanction simpEntryEnq := Mux1H(simpEnqOH, enqEntryTransVec) 23428607074Ssinsanction } 23528607074Ssinsanction 23628607074Ssinsanction compEnqVec.get.zip(enqEntryTransVec).zip(io.simpEntryDeqSelVec.get).foreach { case ((compEnq, enqEntry), deqSel) => 23728607074Ssinsanction compEnq := Mux(enqCanTrans2Comp.get, enqEntry, Mux1H(deqSel, simpEntryTransVec.get)) 23828607074Ssinsanction } 23928607074Ssinsanction compEntryEnqVec.zipWithIndex.foreach { case (compEntryEnq, compIdx) => 24028607074Ssinsanction val compEnqOH = finalCompTransSelVec.get.map(_(compIdx)) 24128607074Ssinsanction // shit Mux1H directly returns in(0) if the seq has only 1 elements 24228607074Ssinsanction if (compEnqOH.size == 1) 24328607074Ssinsanction compEntryEnq := Mux(compEnqOH.head, compEnqVec.get.head, 0.U.asTypeOf(compEnqVec.get.head)) 24428607074Ssinsanction else 24528607074Ssinsanction compEntryEnq := Mux1H(compEnqOH, compEnqVec.get) 24628607074Ssinsanction } 24728607074Ssinsanction 24828607074Ssinsanction assert(PopCount(simpEntryEnqVec.map(_.valid)) <= params.numEnq.U, "the number of simpEntryEnq is more than numEnq\n") 24928607074Ssinsanction assert(PopCount(compEntryEnqVec.map(_.valid)) <= params.numEnq.U, "the number of compEntryEnq is more than numEnq\n") 25028607074Ssinsanction } 25128607074Ssinsanction 2528d081717Sszw_kaixin if(backendParams.debugEn) { 25328607074Ssinsanction dontTouch(othersEntryEnqVec) 2548d081717Sszw_kaixin } 2555db4956bSzhanglyGit 2565db4956bSzhanglyGit //issueRespVec 257887f9c3dSzhanglinjuan if (params.isVecMemIQ) { 258887f9c3dSzhanglinjuan // vector memory IQ 259887f9c3dSzhanglinjuan issueRespVec.zip(robIdxVec).zip(uopIdxVec.get).foreach { case ((issueResp, robIdx), uopIdx) => 260f7890d3cSXuan Hu val hitRespsVec = VecInit(memEtyResps.map(x => 261aa2bcc31SzhanglyGit x.valid && x.bits.robIdx === robIdx && x.bits.uopIdx.get === uopIdx 262f7890d3cSXuan Hu ).toSeq) 263887f9c3dSzhanglinjuan issueResp.valid := hitRespsVec.reduce(_ | _) 264f7890d3cSXuan Hu issueResp.bits := Mux1H(hitRespsVec, memEtyResps.map(_.bits).toSeq) 265887f9c3dSzhanglinjuan } 266887f9c3dSzhanglinjuan } else if (params.isMemAddrIQ) { 267887f9c3dSzhanglinjuan // scalar memory IQ 2685db4956bSzhanglyGit issueRespVec.zip(robIdxVec).foreach { case (issueResp, robIdx) => 269c838dea1SXuan Hu val hitRespsVec = VecInit(memEtyResps.map(x => x.valid && (x.bits.robIdx === robIdx)).toSeq) 2705db4956bSzhanglyGit issueResp.valid := hitRespsVec.reduce(_ | _) 271c838dea1SXuan Hu issueResp.bits := Mux1H(hitRespsVec, memEtyResps.map(_.bits).toSeq) 2725db4956bSzhanglyGit } 2735db4956bSzhanglyGit } 2745db4956bSzhanglyGit else { 2755db4956bSzhanglyGit issueRespVec.zip(issueTimerVec).zip(deqPortIdxReadVec).foreach { case ((issueResp, issueTimer), deqPortIdx) => 2765db4956bSzhanglyGit val Resp = resps(issueTimer)(deqPortIdx) 2775db4956bSzhanglyGit issueResp := Resp 2785db4956bSzhanglyGit } 2795db4956bSzhanglyGit } 2805db4956bSzhanglyGit 28140283787Ssinsanction //deq 28228607074Ssinsanction val enqEntryOldest = Wire(Vec(params.numDeq, ValidIO(new EntryBundle))) 28328607074Ssinsanction val simpEntryOldest = OptionWrapper(params.hasCompAndSimp, Wire(Vec(params.numDeq, ValidIO(new EntryBundle)))) 28428607074Ssinsanction val compEntryOldest = OptionWrapper(params.hasCompAndSimp, Wire(Vec(params.numDeq, ValidIO(new EntryBundle)))) 28528607074Ssinsanction val othersEntryOldest = OptionWrapper(params.isAllComp || params.isAllSimp, Wire(Vec(params.numDeq, ValidIO(new EntryBundle)))) 28628607074Ssinsanction val enqEntryOldestCancel = Wire(Vec(params.numDeq, Bool())) 28728607074Ssinsanction val simpEntryOldestCancel = OptionWrapper(params.hasCompAndSimp, Wire(Vec(params.numDeq, Bool()))) 28828607074Ssinsanction val compEntryOldestCancel = OptionWrapper(params.hasCompAndSimp, Wire(Vec(params.numDeq, Bool()))) 28928607074Ssinsanction val othersEntryOldestCancel = OptionWrapper(params.isAllComp || params.isAllSimp, Wire(Vec(params.numDeq, Bool()))) 29028607074Ssinsanction 29128607074Ssinsanction io.enqEntryOldestSel.zipWithIndex.map { case (sel, deqIdx) => 29228607074Ssinsanction enqEntryOldest(deqIdx) := Mux1H(sel.bits, entries.take(EnqEntryNum)) 293eea4a3caSzhanglyGit enqEntryOldestCancel(deqIdx) := Mux1H(sel.bits, cancelBypassVec.take(EnqEntryNum)) 29440283787Ssinsanction } 29528607074Ssinsanction 29628607074Ssinsanction if (params.isAllComp || params.isAllSimp) { 29728607074Ssinsanction io.othersEntryOldestSel.get.zipWithIndex.map { case (sel, deqIdx) => 29828607074Ssinsanction othersEntryOldest.get(deqIdx) := Mux1H(sel.bits, entries.drop(EnqEntryNum)) 299eea4a3caSzhanglyGit othersEntryOldestCancel.get(deqIdx) := Mux1H(sel.bits, cancelBypassVec.drop(EnqEntryNum)) 300af4bd265SzhanglyGit } 30140283787Ssinsanction } 30228607074Ssinsanction else { 30328607074Ssinsanction io.simpEntryOldestSel.get.zipWithIndex.map { case (sel, deqIdx) => 30428607074Ssinsanction simpEntryOldest.get(deqIdx) := Mux1H(sel.bits, entries.drop(EnqEntryNum).take(SimpEntryNum)) 305eea4a3caSzhanglyGit simpEntryOldestCancel.get(deqIdx) := Mux1H(sel.bits, cancelBypassVec.drop(EnqEntryNum).take(SimpEntryNum)) 30628607074Ssinsanction } 30728607074Ssinsanction io.compEntryOldestSel.get.zipWithIndex.map { case (sel, deqIdx) => 30828607074Ssinsanction compEntryOldest.get(deqIdx) := Mux1H(sel.bits, entries.drop(EnqEntryNum).takeRight(CompEntryNum)) 309eea4a3caSzhanglyGit compEntryOldestCancel.get(deqIdx) := Mux1H(sel.bits, cancelBypassVec.drop(EnqEntryNum).takeRight(CompEntryNum)) 31028607074Ssinsanction } 311af4bd265SzhanglyGit } 312cf4a131aSsinsanction 313cf4a131aSsinsanction if (params.deqFuSame) { 314cf4a131aSsinsanction val subDeqPolicyEntryVec = Wire(Vec(params.numDeq, ValidIO(new EntryBundle))) 315cf4a131aSsinsanction val subDeqPolicyValidVec = Wire(Vec(params.numDeq, Bool())) 316a4d38a63SzhanglyGit val subDeqPolicyCancelBypassVec = Wire(Vec(params.numDeq, Bool())) 317cf4a131aSsinsanction 318aa2bcc31SzhanglyGit subDeqPolicyValidVec(0) := PopCount(io.subDeqRequest.get(0)) >= 1.U 319aa2bcc31SzhanglyGit subDeqPolicyValidVec(1) := PopCount(io.subDeqRequest.get(0)) >= 2.U 32028607074Ssinsanction 32128607074Ssinsanction if (params.isAllComp || params.isAllSimp) { 32228607074Ssinsanction subDeqPolicyEntryVec(0) := PriorityMux(io.subDeqRequest.get(0), entries) 32328607074Ssinsanction subDeqPolicyEntryVec(1) := PriorityMux(Reverse(io.subDeqRequest.get(0)), entries.reverse) 324eea4a3caSzhanglyGit subDeqPolicyCancelBypassVec(0) := PriorityMux(io.subDeqRequest.get(0), cancelBypassVec) 325eea4a3caSzhanglyGit subDeqPolicyCancelBypassVec(1) := PriorityMux(Reverse(io.subDeqRequest.get(0)), cancelBypassVec.reverse) 326cf4a131aSsinsanction 32728607074Ssinsanction io.deqEntry(0) := Mux(io.othersEntryOldestSel.get(0).valid, othersEntryOldest.get(0), subDeqPolicyEntryVec(1)) 328aa2bcc31SzhanglyGit io.deqEntry(1) := subDeqPolicyEntryVec(0) 32928607074Ssinsanction io.cancelDeqVec(0) := Mux(io.othersEntryOldestSel.get(0).valid, othersEntryOldestCancel.get(0), subDeqPolicyCancelBypassVec(1)) 330a4d38a63SzhanglyGit io.cancelDeqVec(1) := subDeqPolicyCancelBypassVec(0) 33128607074Ssinsanction } 33228607074Ssinsanction else { 33328607074Ssinsanction subDeqPolicyEntryVec(0) := PriorityMux(Reverse(io.subDeqRequest.get(0)), entries.reverse) 33428607074Ssinsanction subDeqPolicyEntryVec(1) := PriorityMux(io.subDeqRequest.get(0), entries) 335eea4a3caSzhanglyGit subDeqPolicyCancelBypassVec(0) := PriorityMux(Reverse(io.subDeqRequest.get(0)), cancelBypassVec.reverse) 336eea4a3caSzhanglyGit subDeqPolicyCancelBypassVec(1) := PriorityMux(io.subDeqRequest.get(0), cancelBypassVec) 33728607074Ssinsanction 33828607074Ssinsanction io.deqEntry(0) := Mux(io.compEntryOldestSel.get(0).valid, 33928607074Ssinsanction compEntryOldest.get(0), 34028607074Ssinsanction Mux(io.simpEntryOldestSel.get(0).valid, simpEntryOldest.get(0), subDeqPolicyEntryVec(1))) 34128607074Ssinsanction io.deqEntry(1) := subDeqPolicyEntryVec(0) 34228607074Ssinsanction io.cancelDeqVec(0) := Mux(io.compEntryOldestSel.get(0).valid, 34328607074Ssinsanction compEntryOldestCancel.get(0), 34428607074Ssinsanction Mux(io.simpEntryOldestSel.get(0).valid, simpEntryOldestCancel.get(0), subDeqPolicyCancelBypassVec(1))) 34528607074Ssinsanction io.cancelDeqVec(1) := subDeqPolicyCancelBypassVec(0) 34628607074Ssinsanction } 347cf4a131aSsinsanction 348cf4a131aSsinsanction when (subDeqPolicyValidVec(0)) { 349aa2bcc31SzhanglyGit assert(Mux1H(io.subDeqSelOH.get(0), entries).bits.status.robIdx === subDeqPolicyEntryVec(0).bits.status.robIdx, "subDeqSelOH(0) is not the same\n") 35040283787Ssinsanction } 351cf4a131aSsinsanction when (subDeqPolicyValidVec(1)) { 352aa2bcc31SzhanglyGit assert(Mux1H(io.subDeqSelOH.get(1), entries).bits.status.robIdx === subDeqPolicyEntryVec(1).bits.status.robIdx, "subDeqSelOH(1) is not the same\n") 353f7f73727Ssinsanction } 354f7f73727Ssinsanction } 355f7f73727Ssinsanction else { 35628607074Ssinsanction if (params.isAllComp || params.isAllSimp) { 35728607074Ssinsanction io.othersEntryOldestSel.get.zipWithIndex.foreach { case (sel, i) => 35828607074Ssinsanction io.deqEntry(i) := Mux(sel.valid, othersEntryOldest.get(i), enqEntryOldest(i)) 35928607074Ssinsanction io.cancelDeqVec(i) := Mux(sel.valid, othersEntryOldestCancel.get(i), enqEntryOldestCancel(i)) 36028607074Ssinsanction } 36128607074Ssinsanction } 36228607074Ssinsanction else { 36328607074Ssinsanction io.compEntryOldestSel.get.zip(io.simpEntryOldestSel.get).zipWithIndex.foreach { case ((compSel, simpSel), i) => 36428607074Ssinsanction io.deqEntry(i) := Mux(compSel.valid, 36528607074Ssinsanction compEntryOldest.get(i), 36628607074Ssinsanction Mux(simpSel.valid, simpEntryOldest.get(i), enqEntryOldest(i))) 36728607074Ssinsanction io.cancelDeqVec(i) := Mux(compSel.valid, 36828607074Ssinsanction compEntryOldestCancel.get(i), 36928607074Ssinsanction Mux(simpSel.valid, simpEntryOldestCancel.get(i), enqEntryOldestCancel(i))) 37028607074Ssinsanction } 371af4bd265SzhanglyGit } 372af4bd265SzhanglyGit } 373af4bd265SzhanglyGit 374af4bd265SzhanglyGit if (params.hasIQWakeUp) { 375eea4a3caSzhanglyGit cancelBypassVec.zip(srcWakeUpL1ExuOHVec.get).zip(srcTimerVec.get).zip(srcLoadDependencyVec).foreach{ case (((cancelBypass: Bool, l1ExuOH: Vec[Vec[Bool]]), srcTimer: Vec[UInt]), srcLoadDependency: Vec[Vec[UInt]]) => 376a4d38a63SzhanglyGit val cancelByOg0 = l1ExuOH.zip(srcTimer).map { 377af4bd265SzhanglyGit case(exuOH, srcTimer) => 378af4bd265SzhanglyGit (exuOH.asUInt & io.og0Cancel.asUInt).orR && srcTimer === 1.U 379af4bd265SzhanglyGit }.reduce(_ | _) 380a4d38a63SzhanglyGit val cancelByLd = srcLoadDependency.map(x => LoadShouldCancel(Some(x), io.ldCancel)).reduce(_ | _) 381e5feb625Sxiaofeibao-xjtu cancelBypass := cancelByLd 38240283787Ssinsanction } 383eea4a3caSzhanglyGit } else { 384eea4a3caSzhanglyGit cancelBypassVec.zip(srcLoadDependencyVec).foreach { case (cancelBypass, srcLoadDependency) => 385eea4a3caSzhanglyGit val cancelByLd = srcLoadDependency.map(x => LoadShouldCancel(Some(x), io.ldCancel)).reduce(_ | _) 386eea4a3caSzhanglyGit cancelBypass := cancelByLd 387eea4a3caSzhanglyGit } 38840283787Ssinsanction } 38940283787Ssinsanction 3905db4956bSzhanglyGit io.valid := validVec.asUInt 3915db4956bSzhanglyGit io.canIssue := canIssueVec.asUInt 3925db4956bSzhanglyGit io.fuType := fuTypeVec 3935db4956bSzhanglyGit io.dataSources := dataSourceVec 394aa2bcc31SzhanglyGit io.srcWakeUpL1ExuOH.foreach(_ := srcWakeUpL1ExuOHVec.get.map(x => VecInit(x.map(_.asUInt)))) 3955db4956bSzhanglyGit io.srcTimer.foreach(_ := srcTimerVec.get) 396eea4a3caSzhanglyGit io.loadDependency := loadDependencyVec 397aa2bcc31SzhanglyGit io.isFirstIssue.zipWithIndex.foreach{ case (isFirstIssue, deqIdx) => 398aa2bcc31SzhanglyGit isFirstIssue := io.deqSelOH(deqIdx).valid && Mux1H(io.deqSelOH(deqIdx).bits, isFirstIssueVec) 3998d081717Sszw_kaixin } 40028607074Ssinsanction io.simpEntryEnqSelVec.foreach(_ := finalSimpTransSelVec.get.zip(enqEntryTransVec).map(x => x._1 & Fill(SimpEntryNum, x._2.valid))) 40128607074Ssinsanction io.compEntryEnqSelVec.foreach(_ := finalCompTransSelVec.get.zip(compEnqVec.get).map(x => x._1 & Fill(CompEntryNum, x._2.valid))) 40228607074Ssinsanction io.othersEntryEnqSelVec.foreach(_ := finalOthersTransSelVec.get.zip(enqEntryTransVec).map(x => x._1 & Fill(OthersEntryNum, x._2.valid))) 403aa2bcc31SzhanglyGit io.robIdx.foreach(_ := robIdxVec) 404aa2bcc31SzhanglyGit io.uopIdx.foreach(_ := uopIdxVec.get) 405aa2bcc31SzhanglyGit io.cancel.foreach(_ := cancelVec.get) //for debug 406aa2bcc31SzhanglyGit 4077e471bf8SXuan Hu 408aa2bcc31SzhanglyGit def EntriesConnect(in: CommonInBundle, out: CommonOutBundle, entryIdx: Int) = { 409aa2bcc31SzhanglyGit in.flush := io.flush 410aa2bcc31SzhanglyGit in.wakeUpFromWB := io.wakeUpFromWB 411aa2bcc31SzhanglyGit in.wakeUpFromIQ := io.wakeUpFromIQ 412*b6279fc6SZiyue Zhang in.vlIsZero := io.vlIsZero 413*b6279fc6SZiyue Zhang in.vlIsVlmax := io.vlIsVlmax 414aa2bcc31SzhanglyGit in.og0Cancel := io.og0Cancel 415aa2bcc31SzhanglyGit in.og1Cancel := io.og1Cancel 416aa2bcc31SzhanglyGit in.ldCancel := io.ldCancel 417aa2bcc31SzhanglyGit in.deqSel := deqSelVec(entryIdx) 418aa2bcc31SzhanglyGit in.deqPortIdxWrite := deqPortIdxWriteVec(entryIdx) 419aa2bcc31SzhanglyGit in.issueResp := issueRespVec(entryIdx) 420aa2bcc31SzhanglyGit if (params.isVecMemIQ) { 421aa2bcc31SzhanglyGit in.fromLsq.get.sqDeqPtr := io.vecMemIn.get.sqDeqPtr 422aa2bcc31SzhanglyGit in.fromLsq.get.lqDeqPtr := io.vecMemIn.get.lqDeqPtr 423aa2bcc31SzhanglyGit } 424aa2bcc31SzhanglyGit validVec(entryIdx) := out.valid 425aa2bcc31SzhanglyGit canIssueVec(entryIdx) := out.canIssue 426aa2bcc31SzhanglyGit fuTypeVec(entryIdx) := out.fuType 427aa2bcc31SzhanglyGit robIdxVec(entryIdx) := out.robIdx 428aa2bcc31SzhanglyGit dataSourceVec(entryIdx) := out.dataSource 429aa2bcc31SzhanglyGit isFirstIssueVec(entryIdx) := out.isFirstIssue 430aa2bcc31SzhanglyGit entries(entryIdx) := out.entry 431aa2bcc31SzhanglyGit deqPortIdxReadVec(entryIdx) := out.deqPortIdxRead 432aa2bcc31SzhanglyGit issueTimerVec(entryIdx) := out.issueTimerRead 433eea4a3caSzhanglyGit srcLoadDependencyVec(entryIdx) := out.srcLoadDependency 434eea4a3caSzhanglyGit loadDependencyVec(entryIdx) := out.entry.bits.status.mergedLoadDependency 435aa2bcc31SzhanglyGit if (params.hasIQWakeUp) { 436aa2bcc31SzhanglyGit srcWakeUpL1ExuOHVec.get(entryIdx) := out.srcWakeUpL1ExuOH.get 437aa2bcc31SzhanglyGit srcTimerVec.get(entryIdx) := out.srcTimer.get 438aa2bcc31SzhanglyGit cancelVec.get(entryIdx) := out.cancel.get 439aa2bcc31SzhanglyGit } 440aa2bcc31SzhanglyGit if (params.isVecMemIQ) { 441aa2bcc31SzhanglyGit uopIdxVec.get(entryIdx) := out.uopIdx.get 442aa2bcc31SzhanglyGit } 443a6938b17Ssinsanction entryInValidVec(entryIdx) := out.entryInValid 444a6938b17Ssinsanction entryOutDeqValidVec(entryIdx) := out.entryOutDeqValid 445a6938b17Ssinsanction entryOutTransValidVec(entryIdx) := out.entryOutTransValid 446aa2bcc31SzhanglyGit } 447a6938b17Ssinsanction 448a6938b17Ssinsanction // entries perf counter 449a6938b17Ssinsanction // enq 450a6938b17Ssinsanction for (i <- 0 until params.numEnq) { 451a6938b17Ssinsanction XSPerfAccumulate(s"enqEntry_${i}_in_cnt", entryInValidVec(i)) 452a6938b17Ssinsanction XSPerfAccumulate(s"enqEntry_${i}_out_deq_cnt", entryOutDeqValidVec(i)) 453a6938b17Ssinsanction XSPerfAccumulate(s"enqEntry_${i}_out_trans_cnt", entryOutTransValidVec(i)) 454a6938b17Ssinsanction } 455a6938b17Ssinsanction // simple 456a6938b17Ssinsanction for (i <- 0 until params.numSimp) { 457a6938b17Ssinsanction XSPerfAccumulate(s"simpEntry_${i}_in_cnt", entryInValidVec(i + params.numEnq)) 458a6938b17Ssinsanction XSPerfAccumulate(s"simpEntry_${i}_out_deq_cnt", entryOutDeqValidVec(i + params.numEnq)) 459a6938b17Ssinsanction XSPerfAccumulate(s"simpEntry_${i}_out_trans_cnt", entryOutTransValidVec(i + params.numEnq)) 460a6938b17Ssinsanction } 461a6938b17Ssinsanction // complex 462a6938b17Ssinsanction for (i <- 0 until params.numComp) { 463a6938b17Ssinsanction XSPerfAccumulate(s"compEntry_${i}_in_cnt", entryInValidVec(i + params.numEnq + params.numSimp)) 464a6938b17Ssinsanction XSPerfAccumulate(s"compEntry_${i}_out_deq_cnt", entryOutDeqValidVec(i + params.numEnq + params.numSimp)) 465a6938b17Ssinsanction XSPerfAccumulate(s"compEntry_${i}_out_trans_cnt", entryOutTransValidVec(i + params.numEnq + params.numSimp)) 466a6938b17Ssinsanction } 467a6938b17Ssinsanction // total 468a6938b17Ssinsanction XSPerfAccumulate(s"enqEntry_all_in_cnt", PopCount(entryInValidVec.take(params.numEnq))) 469a6938b17Ssinsanction XSPerfAccumulate(s"enqEntry_all_out_deq_cnt", PopCount(entryOutDeqValidVec.take(params.numEnq))) 470a6938b17Ssinsanction XSPerfAccumulate(s"enqEntry_all_out_trans_cnt", PopCount(entryOutTransValidVec.take(params.numEnq))) 471a6938b17Ssinsanction 472a6938b17Ssinsanction XSPerfAccumulate(s"othersEntry_all_in_cnt", PopCount(entryInValidVec.drop(params.numEnq))) 473a6938b17Ssinsanction XSPerfAccumulate(s"othersEntry_all_out_deq_cnt", PopCount(entryOutDeqValidVec.drop(params.numEnq))) 474a6938b17Ssinsanction XSPerfAccumulate(s"othersEntry_all_out_trans_cnt", PopCount(entryOutTransValidVec.drop(params.numEnq))) 4757e471bf8SXuan Hu 4767e471bf8SXuan Hu io.vecLdIn.foreach(dontTouch(_)) 477aa2bcc31SzhanglyGit} 478aa2bcc31SzhanglyGit 479aa2bcc31SzhanglyGitclass EntriesIO(implicit p: Parameters, params: IssueBlockParams) extends XSBundle { 480aa2bcc31SzhanglyGit val flush = Flipped(ValidIO(new Redirect)) 481aa2bcc31SzhanglyGit //enq 482aa2bcc31SzhanglyGit val enq = Vec(params.numEnq, Flipped(ValidIO(new EntryBundle))) 483aa2bcc31SzhanglyGit val og0Resp = Vec(params.numDeq, Flipped(ValidIO(new EntryDeqRespBundle))) 484aa2bcc31SzhanglyGit val og1Resp = Vec(params.numDeq, Flipped(ValidIO(new EntryDeqRespBundle))) 485aa2bcc31SzhanglyGit //deq sel 486aa2bcc31SzhanglyGit val deqReady = Vec(params.numDeq, Input(Bool())) 487aa2bcc31SzhanglyGit val deqSelOH = Vec(params.numDeq, Flipped(ValidIO(UInt(params.numEntries.W)))) 488aa2bcc31SzhanglyGit val enqEntryOldestSel = Vec(params.numDeq, Flipped(ValidIO(UInt(params.numEnq.W)))) 48928607074Ssinsanction val simpEntryOldestSel = OptionWrapper(params.hasCompAndSimp, Vec(params.numDeq, Flipped(ValidIO(UInt(params.numSimp.W))))) 49028607074Ssinsanction val compEntryOldestSel = OptionWrapper(params.hasCompAndSimp, Vec(params.numDeq, Flipped(ValidIO(UInt(params.numComp.W))))) 49128607074Ssinsanction val othersEntryOldestSel= OptionWrapper(params.isAllComp || params.isAllSimp, Vec(params.numDeq, Flipped(ValidIO(UInt((params.numEntries - params.numEnq).W))))) 492aa2bcc31SzhanglyGit val subDeqRequest = OptionWrapper(params.deqFuSame, Vec(params.numDeq, Input(UInt(params.numEntries.W)))) 493aa2bcc31SzhanglyGit val subDeqSelOH = OptionWrapper(params.deqFuSame, Vec(params.numDeq, Input(UInt(params.numEntries.W)))) 494aa2bcc31SzhanglyGit // wakeup 495aa2bcc31SzhanglyGit val wakeUpFromWB: MixedVec[ValidIO[IssueQueueWBWakeUpBundle]] = Flipped(params.genWBWakeUpSinkValidBundle) 496aa2bcc31SzhanglyGit val wakeUpFromIQ: MixedVec[ValidIO[IssueQueueIQWakeUpBundle]] = Flipped(params.genIQWakeUpSinkValidBundle) 497*b6279fc6SZiyue Zhang val vlIsZero = Input(Bool()) 498*b6279fc6SZiyue Zhang val vlIsVlmax = Input(Bool()) 499aa2bcc31SzhanglyGit val og0Cancel = Input(ExuOH(backendParams.numExu)) 500aa2bcc31SzhanglyGit val og1Cancel = Input(ExuOH(backendParams.numExu)) 501aa2bcc31SzhanglyGit val ldCancel = Vec(backendParams.LdExuCnt, Flipped(new LoadCancelIO)) 502aa2bcc31SzhanglyGit //entries status 503aa2bcc31SzhanglyGit val valid = Output(UInt(params.numEntries.W)) 504aa2bcc31SzhanglyGit val canIssue = Output(UInt(params.numEntries.W)) 505aa2bcc31SzhanglyGit val fuType = Vec(params.numEntries, Output(FuType())) 506aa2bcc31SzhanglyGit val dataSources = Vec(params.numEntries, Vec(params.numRegSrc, Output(DataSource()))) 507eea4a3caSzhanglyGit val loadDependency = Vec(params.numEntries, Vec(LoadPipelineWidth, UInt(3.W))) 508aa2bcc31SzhanglyGit val srcWakeUpL1ExuOH = OptionWrapper(params.hasIQWakeUp, Vec(params.numEntries, Vec(params.numRegSrc, Output(ExuOH())))) 509aa2bcc31SzhanglyGit val srcTimer = OptionWrapper(params.hasIQWakeUp, Vec(params.numEntries, Vec(params.numRegSrc, Output(UInt(3.W))))) 510aa2bcc31SzhanglyGit //deq status 511aa2bcc31SzhanglyGit val isFirstIssue = Vec(params.numDeq, Output(Bool())) 512aa2bcc31SzhanglyGit val deqEntry = Vec(params.numDeq, ValidIO(new EntryBundle)) 513aa2bcc31SzhanglyGit val cancelDeqVec = Vec(params.numDeq, Output(Bool())) 514e07131b2Ssinsanction 515e07131b2Ssinsanction // load/hybird only 516e07131b2Ssinsanction val fromLoad = OptionWrapper(params.isLdAddrIQ || params.isHyAddrIQ, new Bundle { 517e07131b2Ssinsanction val finalIssueResp = Vec(params.numDeq, Flipped(ValidIO(new EntryDeqRespBundle))) 518e07131b2Ssinsanction val memAddrIssueResp = Vec(params.numDeq, Flipped(ValidIO(new EntryDeqRespBundle))) 519e07131b2Ssinsanction }) 520aa2bcc31SzhanglyGit // mem only 521e07131b2Ssinsanction val fromMem = OptionWrapper(params.isMemAddrIQ, new Bundle { 522aa2bcc31SzhanglyGit val slowResp = Vec(params.numDeq, Flipped(ValidIO(new EntryDeqRespBundle))) 523d3372210SzhanglyGit val fastResp = Vec(params.numDeq, Flipped(ValidIO(new EntryDeqRespBundle))) 524e07131b2Ssinsanction }) 52599944b79Ssinsanction // vec mem only 526aa2bcc31SzhanglyGit val vecMemIn = OptionWrapper(params.isVecMemIQ, new Bundle { 527aa2bcc31SzhanglyGit val sqDeqPtr = Input(new SqPtr) 528aa2bcc31SzhanglyGit val lqDeqPtr = Input(new LqPtr) 529aa2bcc31SzhanglyGit }) 5307e471bf8SXuan Hu val vecLdIn = OptionWrapper(params.isVecLduIQ, new Bundle { 5317e471bf8SXuan Hu val resp = Vec(params.numDeq, Flipped(ValidIO(new EntryDeqRespBundle))) 5327e471bf8SXuan Hu }) 533aa2bcc31SzhanglyGit val robIdx = OptionWrapper(params.isVecMemIQ, Output(Vec(params.numEntries, new RobPtr))) 534aa2bcc31SzhanglyGit val uopIdx = OptionWrapper(params.isVecMemIQ, Output(Vec(params.numEntries, UopIdx()))) 535aa2bcc31SzhanglyGit 53628607074Ssinsanction // trans 53728607074Ssinsanction val simpEntryDeqSelVec = OptionWrapper(params.hasCompAndSimp, Vec(params.numEnq, Input(UInt(params.numSimp.W)))) 53828607074Ssinsanction val simpEntryEnqSelVec = OptionWrapper(params.hasCompAndSimp, Vec(params.numEnq, Output(UInt(params.numSimp.W)))) 53928607074Ssinsanction val compEntryEnqSelVec = OptionWrapper(params.hasCompAndSimp, Vec(params.numEnq, Output(UInt(params.numComp.W)))) 54028607074Ssinsanction val othersEntryEnqSelVec = OptionWrapper(params.isAllComp || params.isAllSimp, Vec(params.numEnq, Output(UInt((params.numEntries - params.numEnq).W)))) 541aa2bcc31SzhanglyGit 542aa2bcc31SzhanglyGit // debug 543aa2bcc31SzhanglyGit val cancel = OptionWrapper(params.hasIQWakeUp, Output(Vec(params.numEntries, Bool()))) 544aa2bcc31SzhanglyGit 545aa2bcc31SzhanglyGit def wakeup = wakeUpFromWB ++ wakeUpFromIQ 5465db4956bSzhanglyGit} 547