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 30c838dea1SXuan Hu val memEtyResps: MixedVec[ValidIO[EntryDeqRespBundle]] = { 3156715025SXuan Hu if (params.isLdAddrIQ && !params.isStAddrIQ) 32*6462eb1cSzhanglyGit MixedVecInit(io.og0Resp ++ io.og1Resp ++ io.finalIssueResp.get ++ io.memAddrIssueResp.get) 33*6462eb1cSzhanglyGit else if (params.isHyAddrIQ) 34*6462eb1cSzhanglyGit MixedVecInit(io.og0Resp ++ io.og1Resp ++ io.finalIssueResp.get ++ io.memAddrIssueResp.get ++ io.fromMem.get.slowResp) 3556715025SXuan Hu else if (params.isMemAddrIQ) 36*6462eb1cSzhanglyGit MixedVecInit(io.og0Resp ++ io.og1Resp ++ io.fromMem.get.slowResp) 37c838dea1SXuan Hu else MixedVecInit(Seq()) 38c838dea1SXuan Hu } 39c838dea1SXuan Hu 40*6462eb1cSzhanglyGit val resps: Vec[Vec[ValidIO[EntryDeqRespBundle]]] = VecInit(io.og0Resp, io.og1Resp, 0.U.asTypeOf(io.og0Resp)) 415db4956bSzhanglyGit 425db4956bSzhanglyGit //Module 43df26db8aSsinsanction val enqEntries = Seq.fill(EnqEntryNum)(Module(EnqEntry(isComp = true)(p, params))) 4428607074Ssinsanction val othersEntriesSimp = Seq.fill(SimpEntryNum)(Module(OthersEntry(isComp = false)(p, params))) 4528607074Ssinsanction val othersEntriesComp = Seq.fill(CompEntryNum)(Module(OthersEntry(isComp = true)(p, params))) 4628607074Ssinsanction val othersEntries = othersEntriesSimp ++ othersEntriesComp 4728607074Ssinsanction val othersTransPolicy = OptionWrapper(params.isAllComp || params.isAllSimp, Module(new EnqPolicy)) 4828607074Ssinsanction val simpTransPolicy = OptionWrapper(params.hasCompAndSimp, Module(new EnqPolicy)) 4928607074Ssinsanction 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()))) 62eea4a3caSzhanglyGit val loadDependencyVec = Wire(Vec(params.numEntries, Vec(LoadPipelineWidth, UInt(3.W)))) 63eea4a3caSzhanglyGit val srcLoadDependencyVec= Wire(Vec(params.numEntries, Vec(params.numRegSrc, Vec(LoadPipelineWidth, UInt(3.W))))) 64aa2bcc31SzhanglyGit val srcTimerVec = OptionWrapper(params.hasIQWakeUp, Wire(Vec(params.numEntries, Vec(params.numRegSrc, UInt(3.W))))) 65aa2bcc31SzhanglyGit val srcWakeUpL1ExuOHVec = OptionWrapper(params.hasIQWakeUp, Wire(Vec(params.numEntries, Vec(params.numRegSrc, ExuVec())))) 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 7228607074Ssinsanction val othersEntryEnqReadyVec = Wire(Vec(OthersEntryNum, Bool())) 7328607074Ssinsanction val othersEntryEnqVec = Wire(Vec(OthersEntryNum, Valid(new EntryBundle))) 7428607074Ssinsanction val enqEntryTransVec = Wire(Vec(EnqEntryNum, Valid(new EntryBundle))) 7528607074Ssinsanction val simpEntryTransVec = OptionWrapper(params.hasCompAndSimp, Wire(Vec(SimpEntryNum, Valid(new EntryBundle)))) 7628607074Ssinsanction val compEnqVec = OptionWrapper(params.hasCompAndSimp, Wire(Vec(EnqEntryNum, Valid(new EntryBundle)))) 7728607074Ssinsanction 7828607074Ssinsanction val enqCanTrans2Simp = OptionWrapper(params.hasCompAndSimp, Wire(Bool())) 7928607074Ssinsanction val enqCanTrans2Comp = OptionWrapper(params.hasCompAndSimp, Wire(Bool())) 8028607074Ssinsanction val simpCanTrans2Comp = OptionWrapper(params.hasCompAndSimp, Wire(Vec(EnqEntryNum, Bool()))) 8128607074Ssinsanction val simpTransSelVec = OptionWrapper(params.hasCompAndSimp, Wire(Vec(EnqEntryNum, Valid(UInt(SimpEntryNum.W))))) 8228607074Ssinsanction val compTransSelVec = OptionWrapper(params.hasCompAndSimp, Wire(Vec(EnqEntryNum, Valid(UInt(CompEntryNum.W))))) 8328607074Ssinsanction val finalSimpTransSelVec = OptionWrapper(params.hasCompAndSimp, Wire(Vec(EnqEntryNum, UInt(SimpEntryNum.W)))) 8428607074Ssinsanction val finalCompTransSelVec = OptionWrapper(params.hasCompAndSimp, Wire(Vec(EnqEntryNum, UInt(CompEntryNum.W)))) 8528607074Ssinsanction 8628607074Ssinsanction val enqCanTrans2Others = OptionWrapper(params.isAllComp || params.isAllSimp, Wire(Bool())) 8728607074Ssinsanction val othersTransSelVec = OptionWrapper(params.isAllComp || params.isAllSimp, Wire(Vec(EnqEntryNum, Valid(UInt(OthersEntryNum.W))))) 8828607074Ssinsanction val finalOthersTransSelVec = OptionWrapper(params.isAllComp || params.isAllSimp, Wire(Vec(EnqEntryNum, UInt(OthersEntryNum.W)))) 8928607074Ssinsanction 9028607074Ssinsanction val simpEntryEnqReadyVec = othersEntryEnqReadyVec.take(SimpEntryNum) 9128607074Ssinsanction val compEntryEnqReadyVec = othersEntryEnqReadyVec.takeRight(CompEntryNum) 9228607074Ssinsanction val simpEntryEnqVec = othersEntryEnqVec.take(SimpEntryNum) 9328607074Ssinsanction val compEntryEnqVec = othersEntryEnqVec.takeRight(CompEntryNum) 94aa2bcc31SzhanglyGit //debug 9589740385Ssinsanction val cancelVec = OptionWrapper(params.hasIQWakeUp, Wire(Vec(params.numEntries, Bool()))) 96a6938b17Ssinsanction val entryInValidVec = Wire(Vec(params.numEntries, Bool())) 97a6938b17Ssinsanction val entryOutDeqValidVec = Wire(Vec(params.numEntries, Bool())) 98a6938b17Ssinsanction val entryOutTransValidVec = Wire(Vec(params.numEntries, Bool())) 99a4d38a63SzhanglyGit //cancel bypass 100eea4a3caSzhanglyGit val cancelBypassVec = Wire(Vec(params.numEntries, Bool())) 1012d270511Ssinsanction val uopIdxVec = OptionWrapper(params.isVecMemIQ, Wire(Vec(params.numEntries, UopIdx()))) 1025db4956bSzhanglyGit 1035db4956bSzhanglyGit 1045db4956bSzhanglyGit //enqEntries 1055db4956bSzhanglyGit enqEntries.zipWithIndex.foreach { case (enqEntry, entryIdx) => 106aa2bcc31SzhanglyGit enqEntry.io.commonIn.enq := io.enq(entryIdx) 10728607074Ssinsanction enqEntry.io.commonIn.transSel := (if (params.isAllComp || params.isAllSimp) enqCanTrans2Others.get && othersTransSelVec.get(entryIdx).valid 10828607074Ssinsanction else enqCanTrans2Simp.get && simpTransSelVec.get(entryIdx).valid || enqCanTrans2Comp.get && compTransSelVec.get(entryIdx).valid) 109aa2bcc31SzhanglyGit EntriesConnect(enqEntry.io.commonIn, enqEntry.io.commonOut, entryIdx) 110aa2b5219Ssinsanction enqEntry.io.enqDelayWakeUpFromWB := RegNext(io.wakeUpFromWB) 111aa2b5219Ssinsanction enqEntry.io.enqDelayWakeUpFromIQ := RegNext(io.wakeUpFromIQ) 112aa2bcc31SzhanglyGit enqEntry.io.enqDelayOg0Cancel := RegNext(io.og0Cancel.asUInt) 113aa2b5219Ssinsanction enqEntry.io.enqDelayLdCancel := RegNext(io.ldCancel) 11428607074Ssinsanction enqEntryTransVec(entryIdx) := enqEntry.io.commonOut.transEntry 115aa2bcc31SzhanglyGit // TODO: move it into EntriesConnect 1162d270511Ssinsanction if (params.isVecMemIQ) { 117aa2bcc31SzhanglyGit enqEntry.io.commonIn.fromLsq.get.sqDeqPtr := io.vecMemIn.get.sqDeqPtr 118aa2bcc31SzhanglyGit enqEntry.io.commonIn.fromLsq.get.lqDeqPtr := io.vecMemIn.get.lqDeqPtr 1192d270511Ssinsanction } 1205db4956bSzhanglyGit } 1215db4956bSzhanglyGit //othersEntries 1225db4956bSzhanglyGit othersEntries.zipWithIndex.foreach { case (othersEntry, entryIdx) => 12328607074Ssinsanction othersEntry.io.commonIn.enq := othersEntryEnqVec(entryIdx) 12428607074Ssinsanction othersEntry.io.commonIn.transSel := (if (params.hasCompAndSimp && (entryIdx < SimpEntryNum)) 12528607074Ssinsanction io.simpEntryDeqSelVec.get.zip(simpCanTrans2Comp.get).map(x => x._1(entryIdx) && x._2).reduce(_ | _) 12628607074Ssinsanction else false.B) 127aa2bcc31SzhanglyGit EntriesConnect(othersEntry.io.commonIn, othersEntry.io.commonOut, entryIdx + EnqEntryNum) 12828607074Ssinsanction othersEntryEnqReadyVec(entryIdx) := othersEntry.io.commonOut.enqReady 12928607074Ssinsanction if (params.hasCompAndSimp && (entryIdx < SimpEntryNum)) { 13028607074Ssinsanction simpEntryTransVec.get(entryIdx) := othersEntry.io.commonOut.transEntry 13128607074Ssinsanction } 1322d270511Ssinsanction if (params.isVecMemIQ) { 133aa2bcc31SzhanglyGit othersEntry.io.commonIn.fromLsq.get.sqDeqPtr := io.vecMemIn.get.sqDeqPtr 134aa2bcc31SzhanglyGit othersEntry.io.commonIn.fromLsq.get.lqDeqPtr := io.vecMemIn.get.lqDeqPtr 1352d270511Ssinsanction } 1365db4956bSzhanglyGit } 1375db4956bSzhanglyGit 1385db4956bSzhanglyGit 1395db4956bSzhanglyGit deqSelVec.zip(deqPortIdxWriteVec).zipWithIndex.foreach { case ((deqSel, deqPortIdxWrite), i) => 140aa2bcc31SzhanglyGit val deqVec = io.deqSelOH.zip(io.deqReady).map(x => x._1.valid && x._1.bits(i) && x._2) 1415db4956bSzhanglyGit deqPortIdxWrite := OHToUInt(deqVec) 1425db4956bSzhanglyGit deqSel := deqVec.reduce(_ | _) 1435db4956bSzhanglyGit } 1445db4956bSzhanglyGit 1455db4956bSzhanglyGit 14628607074Ssinsanction if (params.isAllComp || params.isAllSimp) { 1475db4956bSzhanglyGit //transPolicy 14828607074Ssinsanction othersTransPolicy.get.io.canEnq := othersEntryEnqReadyVec.asUInt 14928607074Ssinsanction enqCanTrans2Others.get := PopCount(validVec.take(EnqEntryNum)) <= PopCount(othersEntryEnqReadyVec) 15028607074Ssinsanction othersTransSelVec.get(0).valid := othersTransPolicy.get.io.enqSelOHVec(0).valid && validVec(0) 15128607074Ssinsanction othersTransSelVec.get(0).bits := othersTransPolicy.get.io.enqSelOHVec(0).bits 15227811ea4SXuan Hu // Todo: comments why enqTransSelVec(1).valid relies on validVec(0) 1538321ef33Ssinsanction if (params.numEnq == 2) { 15428607074Ssinsanction othersTransSelVec.get(1).valid := Mux(!validVec(0), othersTransPolicy.get.io.enqSelOHVec(0).valid, othersTransPolicy.get.io.enqSelOHVec(1).valid) 15528607074Ssinsanction othersTransSelVec.get(1).bits := Mux(!validVec(0), othersTransPolicy.get.io.enqSelOHVec(0).bits, othersTransPolicy.get.io.enqSelOHVec(1).bits) 1568321ef33Ssinsanction } 1578321ef33Ssinsanction 15828607074Ssinsanction finalOthersTransSelVec.get.zip(othersTransSelVec.get).zipWithIndex.foreach { case ((finalOH, selOH), enqIdx) => 15928607074Ssinsanction finalOH := Fill(OthersEntryNum, enqCanTrans2Others.get && selOH.valid) & selOH.bits 1605db4956bSzhanglyGit } 1615db4956bSzhanglyGit 16228607074Ssinsanction //othersEntryEnq 16328607074Ssinsanction othersEntryEnqVec.zipWithIndex.foreach { case (othersEntryEnq, othersIdx) => 16428607074Ssinsanction val othersEnqOH = finalOthersTransSelVec.get.map(_(othersIdx)) 16528607074Ssinsanction if (othersEnqOH.size == 1) 16628607074Ssinsanction othersEntryEnq := Mux(othersEnqOH.head, enqEntryTransVec.head, 0.U.asTypeOf(enqEntryTransVec.head)) 16728607074Ssinsanction else 16828607074Ssinsanction othersEntryEnq := Mux1H(othersEnqOH, enqEntryTransVec) 1695db4956bSzhanglyGit } 17028607074Ssinsanction } 17128607074Ssinsanction else { 17228607074Ssinsanction //transPolicy 17328607074Ssinsanction simpTransPolicy.get.io.canEnq := VecInit(simpEntryEnqReadyVec).asUInt 17428607074Ssinsanction compTransPolicy.get.io.canEnq := VecInit(validVec.takeRight(CompEntryNum).map(!_)).asUInt 17528607074Ssinsanction 17628607074Ssinsanction enqCanTrans2Comp.get := PopCount(validVec.take(EnqEntryNum)) <= PopCount(validVec.takeRight(CompEntryNum).map(!_)) && !validVec.drop(EnqEntryNum).take(SimpEntryNum).reduce(_ || _) 17728607074Ssinsanction enqCanTrans2Simp.get := !enqCanTrans2Comp.get && PopCount(validVec.take(EnqEntryNum)) <= PopCount(simpEntryEnqReadyVec) 17828607074Ssinsanction simpCanTrans2Comp.get.zipWithIndex.foreach { case (canTrans, idx) => 17928607074Ssinsanction canTrans := !enqCanTrans2Comp.get && PopCount(validVec.takeRight(CompEntryNum).map(!_)) >= (idx + 1).U 18028607074Ssinsanction } 18128607074Ssinsanction 18228607074Ssinsanction simpTransSelVec.get(0).valid := simpTransPolicy.get.io.enqSelOHVec(0).valid && validVec(0) 18328607074Ssinsanction simpTransSelVec.get(0).bits := simpTransPolicy.get.io.enqSelOHVec(0).bits 18428607074Ssinsanction compTransSelVec.get(0).valid := compTransPolicy.get.io.enqSelOHVec(0).valid && validVec(0) 18528607074Ssinsanction compTransSelVec.get(0).bits := compTransPolicy.get.io.enqSelOHVec(0).bits 18628607074Ssinsanction if (params.numEnq == 2) { 18728607074Ssinsanction simpTransSelVec.get(1).valid := Mux(!validVec(0), simpTransPolicy.get.io.enqSelOHVec(0).valid, simpTransPolicy.get.io.enqSelOHVec(1).valid) 18828607074Ssinsanction simpTransSelVec.get(1).bits := Mux(!validVec(0), simpTransPolicy.get.io.enqSelOHVec(0).bits, simpTransPolicy.get.io.enqSelOHVec(1).bits) 18928607074Ssinsanction compTransSelVec.get(1).valid := Mux(!validVec(0), compTransPolicy.get.io.enqSelOHVec(0).valid, compTransPolicy.get.io.enqSelOHVec(1).valid) 19028607074Ssinsanction compTransSelVec.get(1).bits := Mux(!validVec(0), compTransPolicy.get.io.enqSelOHVec(0).bits, compTransPolicy.get.io.enqSelOHVec(1).bits) 19128607074Ssinsanction } 19228607074Ssinsanction 19328607074Ssinsanction finalSimpTransSelVec.get.zip(simpTransSelVec.get).zipWithIndex.foreach { case ((finalOH, selOH), enqIdx) => 19428607074Ssinsanction finalOH := Fill(SimpEntryNum, enqCanTrans2Simp.get && selOH.valid) & selOH.bits 19528607074Ssinsanction } 19628607074Ssinsanction finalCompTransSelVec.get.zip(compTransSelVec.get).zip(compTransPolicy.get.io.enqSelOHVec).zipWithIndex.foreach { 19728607074Ssinsanction case (((finalOH, selOH), origSelOH), enqIdx) => 19828607074Ssinsanction finalOH := Mux(enqCanTrans2Comp.get, Fill(CompEntryNum, selOH.valid) & selOH.bits, Fill(CompEntryNum, origSelOH.valid) & origSelOH.bits) 19928607074Ssinsanction } 20028607074Ssinsanction 20128607074Ssinsanction //othersEntryEnq 20228607074Ssinsanction simpEntryEnqVec.zipWithIndex.foreach { case (simpEntryEnq, simpIdx) => 20328607074Ssinsanction val simpEnqOH = finalSimpTransSelVec.get.map(_(simpIdx)) 20428607074Ssinsanction // shit Mux1H directly returns in(0) if the seq has only 1 elements 20528607074Ssinsanction if (simpEnqOH.size == 1) 20628607074Ssinsanction simpEntryEnq := Mux(simpEnqOH.head, enqEntryTransVec.head, 0.U.asTypeOf(enqEntryTransVec.head)) 20728607074Ssinsanction else 20828607074Ssinsanction simpEntryEnq := Mux1H(simpEnqOH, enqEntryTransVec) 20928607074Ssinsanction } 21028607074Ssinsanction 21128607074Ssinsanction compEnqVec.get.zip(enqEntryTransVec).zip(io.simpEntryDeqSelVec.get).foreach { case ((compEnq, enqEntry), deqSel) => 21228607074Ssinsanction compEnq := Mux(enqCanTrans2Comp.get, enqEntry, Mux1H(deqSel, simpEntryTransVec.get)) 21328607074Ssinsanction } 21428607074Ssinsanction compEntryEnqVec.zipWithIndex.foreach { case (compEntryEnq, compIdx) => 21528607074Ssinsanction val compEnqOH = finalCompTransSelVec.get.map(_(compIdx)) 21628607074Ssinsanction // shit Mux1H directly returns in(0) if the seq has only 1 elements 21728607074Ssinsanction if (compEnqOH.size == 1) 21828607074Ssinsanction compEntryEnq := Mux(compEnqOH.head, compEnqVec.get.head, 0.U.asTypeOf(compEnqVec.get.head)) 21928607074Ssinsanction else 22028607074Ssinsanction compEntryEnq := Mux1H(compEnqOH, compEnqVec.get) 22128607074Ssinsanction } 22228607074Ssinsanction 22328607074Ssinsanction assert(PopCount(simpEntryEnqVec.map(_.valid)) <= params.numEnq.U, "the number of simpEntryEnq is more than numEnq\n") 22428607074Ssinsanction assert(PopCount(compEntryEnqVec.map(_.valid)) <= params.numEnq.U, "the number of compEntryEnq is more than numEnq\n") 22528607074Ssinsanction } 22628607074Ssinsanction 2278d081717Sszw_kaixin if(backendParams.debugEn) { 22828607074Ssinsanction dontTouch(othersEntryEnqVec) 2298d081717Sszw_kaixin } 2305db4956bSzhanglyGit 2315db4956bSzhanglyGit //issueRespVec 232887f9c3dSzhanglinjuan if (params.isVecMemIQ) { 233887f9c3dSzhanglinjuan // vector memory IQ 234887f9c3dSzhanglinjuan issueRespVec.zip(robIdxVec).zip(uopIdxVec.get).foreach { case ((issueResp, robIdx), uopIdx) => 235887f9c3dSzhanglinjuan val hitRespsVec = VecInit(resps.flatten.map(x => 236aa2bcc31SzhanglyGit x.valid && x.bits.robIdx === robIdx && x.bits.uopIdx.get === uopIdx 237887f9c3dSzhanglinjuan )) 238887f9c3dSzhanglinjuan issueResp.valid := hitRespsVec.reduce(_ | _) 239887f9c3dSzhanglinjuan issueResp.bits := Mux1H(hitRespsVec, resps.flatten.map(_.bits)) 240887f9c3dSzhanglinjuan } 241887f9c3dSzhanglinjuan } else if (params.isMemAddrIQ) { 242887f9c3dSzhanglinjuan // scalar memory IQ 2435db4956bSzhanglyGit issueRespVec.zip(robIdxVec).foreach { case (issueResp, robIdx) => 244c838dea1SXuan Hu val hitRespsVec = VecInit(memEtyResps.map(x => x.valid && (x.bits.robIdx === robIdx)).toSeq) 2455db4956bSzhanglyGit issueResp.valid := hitRespsVec.reduce(_ | _) 246c838dea1SXuan Hu issueResp.bits := Mux1H(hitRespsVec, memEtyResps.map(_.bits).toSeq) 2475db4956bSzhanglyGit } 2485db4956bSzhanglyGit } 2495db4956bSzhanglyGit else { 2505db4956bSzhanglyGit issueRespVec.zip(issueTimerVec).zip(deqPortIdxReadVec).foreach { case ((issueResp, issueTimer), deqPortIdx) => 2515db4956bSzhanglyGit val Resp = resps(issueTimer)(deqPortIdx) 2525db4956bSzhanglyGit issueResp := Resp 2535db4956bSzhanglyGit } 2545db4956bSzhanglyGit } 2555db4956bSzhanglyGit 25640283787Ssinsanction //deq 25728607074Ssinsanction val enqEntryOldest = Wire(Vec(params.numDeq, ValidIO(new EntryBundle))) 25828607074Ssinsanction val simpEntryOldest = OptionWrapper(params.hasCompAndSimp, Wire(Vec(params.numDeq, ValidIO(new EntryBundle)))) 25928607074Ssinsanction val compEntryOldest = OptionWrapper(params.hasCompAndSimp, Wire(Vec(params.numDeq, ValidIO(new EntryBundle)))) 26028607074Ssinsanction val othersEntryOldest = OptionWrapper(params.isAllComp || params.isAllSimp, Wire(Vec(params.numDeq, ValidIO(new EntryBundle)))) 26128607074Ssinsanction val enqEntryOldestCancel = Wire(Vec(params.numDeq, Bool())) 26228607074Ssinsanction val simpEntryOldestCancel = OptionWrapper(params.hasCompAndSimp, Wire(Vec(params.numDeq, Bool()))) 26328607074Ssinsanction val compEntryOldestCancel = OptionWrapper(params.hasCompAndSimp, Wire(Vec(params.numDeq, Bool()))) 26428607074Ssinsanction val othersEntryOldestCancel = OptionWrapper(params.isAllComp || params.isAllSimp, Wire(Vec(params.numDeq, Bool()))) 26528607074Ssinsanction 26628607074Ssinsanction io.enqEntryOldestSel.zipWithIndex.map { case (sel, deqIdx) => 26728607074Ssinsanction enqEntryOldest(deqIdx) := Mux1H(sel.bits, entries.take(EnqEntryNum)) 268eea4a3caSzhanglyGit enqEntryOldestCancel(deqIdx) := Mux1H(sel.bits, cancelBypassVec.take(EnqEntryNum)) 26940283787Ssinsanction } 27028607074Ssinsanction 27128607074Ssinsanction if (params.isAllComp || params.isAllSimp) { 27228607074Ssinsanction io.othersEntryOldestSel.get.zipWithIndex.map { case (sel, deqIdx) => 27328607074Ssinsanction othersEntryOldest.get(deqIdx) := Mux1H(sel.bits, entries.drop(EnqEntryNum)) 274eea4a3caSzhanglyGit othersEntryOldestCancel.get(deqIdx) := Mux1H(sel.bits, cancelBypassVec.drop(EnqEntryNum)) 275af4bd265SzhanglyGit } 27640283787Ssinsanction } 27728607074Ssinsanction else { 27828607074Ssinsanction io.simpEntryOldestSel.get.zipWithIndex.map { case (sel, deqIdx) => 27928607074Ssinsanction simpEntryOldest.get(deqIdx) := Mux1H(sel.bits, entries.drop(EnqEntryNum).take(SimpEntryNum)) 280eea4a3caSzhanglyGit simpEntryOldestCancel.get(deqIdx) := Mux1H(sel.bits, cancelBypassVec.drop(EnqEntryNum).take(SimpEntryNum)) 28128607074Ssinsanction } 28228607074Ssinsanction io.compEntryOldestSel.get.zipWithIndex.map { case (sel, deqIdx) => 28328607074Ssinsanction compEntryOldest.get(deqIdx) := Mux1H(sel.bits, entries.drop(EnqEntryNum).takeRight(CompEntryNum)) 284eea4a3caSzhanglyGit compEntryOldestCancel.get(deqIdx) := Mux1H(sel.bits, cancelBypassVec.drop(EnqEntryNum).takeRight(CompEntryNum)) 28528607074Ssinsanction } 286af4bd265SzhanglyGit } 287cf4a131aSsinsanction 288cf4a131aSsinsanction if (params.deqFuSame) { 289cf4a131aSsinsanction val subDeqPolicyEntryVec = Wire(Vec(params.numDeq, ValidIO(new EntryBundle))) 290cf4a131aSsinsanction val subDeqPolicyValidVec = Wire(Vec(params.numDeq, Bool())) 291a4d38a63SzhanglyGit val subDeqPolicyCancelBypassVec = Wire(Vec(params.numDeq, Bool())) 292cf4a131aSsinsanction 293aa2bcc31SzhanglyGit subDeqPolicyValidVec(0) := PopCount(io.subDeqRequest.get(0)) >= 1.U 294aa2bcc31SzhanglyGit subDeqPolicyValidVec(1) := PopCount(io.subDeqRequest.get(0)) >= 2.U 29528607074Ssinsanction 29628607074Ssinsanction if (params.isAllComp || params.isAllSimp) { 29728607074Ssinsanction subDeqPolicyEntryVec(0) := PriorityMux(io.subDeqRequest.get(0), entries) 29828607074Ssinsanction subDeqPolicyEntryVec(1) := PriorityMux(Reverse(io.subDeqRequest.get(0)), entries.reverse) 299eea4a3caSzhanglyGit subDeqPolicyCancelBypassVec(0) := PriorityMux(io.subDeqRequest.get(0), cancelBypassVec) 300eea4a3caSzhanglyGit subDeqPolicyCancelBypassVec(1) := PriorityMux(Reverse(io.subDeqRequest.get(0)), cancelBypassVec.reverse) 301cf4a131aSsinsanction 30228607074Ssinsanction io.deqEntry(0) := Mux(io.othersEntryOldestSel.get(0).valid, othersEntryOldest.get(0), subDeqPolicyEntryVec(1)) 303aa2bcc31SzhanglyGit io.deqEntry(1) := subDeqPolicyEntryVec(0) 30428607074Ssinsanction io.cancelDeqVec(0) := Mux(io.othersEntryOldestSel.get(0).valid, othersEntryOldestCancel.get(0), subDeqPolicyCancelBypassVec(1)) 305a4d38a63SzhanglyGit io.cancelDeqVec(1) := subDeqPolicyCancelBypassVec(0) 30628607074Ssinsanction } 30728607074Ssinsanction else { 30828607074Ssinsanction subDeqPolicyEntryVec(0) := PriorityMux(Reverse(io.subDeqRequest.get(0)), entries.reverse) 30928607074Ssinsanction subDeqPolicyEntryVec(1) := PriorityMux(io.subDeqRequest.get(0), entries) 310eea4a3caSzhanglyGit subDeqPolicyCancelBypassVec(0) := PriorityMux(Reverse(io.subDeqRequest.get(0)), cancelBypassVec.reverse) 311eea4a3caSzhanglyGit subDeqPolicyCancelBypassVec(1) := PriorityMux(io.subDeqRequest.get(0), cancelBypassVec) 31228607074Ssinsanction 31328607074Ssinsanction io.deqEntry(0) := Mux(io.compEntryOldestSel.get(0).valid, 31428607074Ssinsanction compEntryOldest.get(0), 31528607074Ssinsanction Mux(io.simpEntryOldestSel.get(0).valid, simpEntryOldest.get(0), subDeqPolicyEntryVec(1))) 31628607074Ssinsanction io.deqEntry(1) := subDeqPolicyEntryVec(0) 31728607074Ssinsanction io.cancelDeqVec(0) := Mux(io.compEntryOldestSel.get(0).valid, 31828607074Ssinsanction compEntryOldestCancel.get(0), 31928607074Ssinsanction Mux(io.simpEntryOldestSel.get(0).valid, simpEntryOldestCancel.get(0), subDeqPolicyCancelBypassVec(1))) 32028607074Ssinsanction io.cancelDeqVec(1) := subDeqPolicyCancelBypassVec(0) 32128607074Ssinsanction } 322cf4a131aSsinsanction 323cf4a131aSsinsanction when (subDeqPolicyValidVec(0)) { 324aa2bcc31SzhanglyGit assert(Mux1H(io.subDeqSelOH.get(0), entries).bits.status.robIdx === subDeqPolicyEntryVec(0).bits.status.robIdx, "subDeqSelOH(0) is not the same\n") 32540283787Ssinsanction } 326cf4a131aSsinsanction when (subDeqPolicyValidVec(1)) { 327aa2bcc31SzhanglyGit assert(Mux1H(io.subDeqSelOH.get(1), entries).bits.status.robIdx === subDeqPolicyEntryVec(1).bits.status.robIdx, "subDeqSelOH(1) is not the same\n") 328f7f73727Ssinsanction } 329f7f73727Ssinsanction } 330f7f73727Ssinsanction else { 33128607074Ssinsanction if (params.isAllComp || params.isAllSimp) { 33228607074Ssinsanction io.othersEntryOldestSel.get.zipWithIndex.foreach { case (sel, i) => 33328607074Ssinsanction io.deqEntry(i) := Mux(sel.valid, othersEntryOldest.get(i), enqEntryOldest(i)) 33428607074Ssinsanction io.cancelDeqVec(i) := Mux(sel.valid, othersEntryOldestCancel.get(i), enqEntryOldestCancel(i)) 33528607074Ssinsanction } 33628607074Ssinsanction } 33728607074Ssinsanction else { 33828607074Ssinsanction io.compEntryOldestSel.get.zip(io.simpEntryOldestSel.get).zipWithIndex.foreach { case ((compSel, simpSel), i) => 33928607074Ssinsanction io.deqEntry(i) := Mux(compSel.valid, 34028607074Ssinsanction compEntryOldest.get(i), 34128607074Ssinsanction Mux(simpSel.valid, simpEntryOldest.get(i), enqEntryOldest(i))) 34228607074Ssinsanction io.cancelDeqVec(i) := Mux(compSel.valid, 34328607074Ssinsanction compEntryOldestCancel.get(i), 34428607074Ssinsanction Mux(simpSel.valid, simpEntryOldestCancel.get(i), enqEntryOldestCancel(i))) 34528607074Ssinsanction } 346af4bd265SzhanglyGit } 347af4bd265SzhanglyGit } 348af4bd265SzhanglyGit 349af4bd265SzhanglyGit if (params.hasIQWakeUp) { 350eea4a3caSzhanglyGit cancelBypassVec.zip(srcWakeUpL1ExuOHVec.get).zip(srcTimerVec.get).zip(srcLoadDependencyVec).foreach{ case (((cancelBypass: Bool, l1ExuOH: Vec[Vec[Bool]]), srcTimer: Vec[UInt]), srcLoadDependency: Vec[Vec[UInt]]) => 351a4d38a63SzhanglyGit val cancelByOg0 = l1ExuOH.zip(srcTimer).map { 352af4bd265SzhanglyGit case(exuOH, srcTimer) => 353af4bd265SzhanglyGit (exuOH.asUInt & io.og0Cancel.asUInt).orR && srcTimer === 1.U 354af4bd265SzhanglyGit }.reduce(_ | _) 355a4d38a63SzhanglyGit val cancelByLd = srcLoadDependency.map(x => LoadShouldCancel(Some(x), io.ldCancel)).reduce(_ | _) 356a4d38a63SzhanglyGit cancelBypass := cancelByOg0 || cancelByLd 35740283787Ssinsanction } 358eea4a3caSzhanglyGit } else { 359eea4a3caSzhanglyGit cancelBypassVec.zip(srcLoadDependencyVec).foreach { case (cancelBypass, srcLoadDependency) => 360eea4a3caSzhanglyGit val cancelByLd = srcLoadDependency.map(x => LoadShouldCancel(Some(x), io.ldCancel)).reduce(_ | _) 361eea4a3caSzhanglyGit cancelBypass := cancelByLd 362eea4a3caSzhanglyGit } 36340283787Ssinsanction } 36440283787Ssinsanction 3655db4956bSzhanglyGit io.valid := validVec.asUInt 3665db4956bSzhanglyGit io.canIssue := canIssueVec.asUInt 3675db4956bSzhanglyGit io.fuType := fuTypeVec 3685db4956bSzhanglyGit io.dataSources := dataSourceVec 369aa2bcc31SzhanglyGit io.srcWakeUpL1ExuOH.foreach(_ := srcWakeUpL1ExuOHVec.get.map(x => VecInit(x.map(_.asUInt)))) 3705db4956bSzhanglyGit io.srcTimer.foreach(_ := srcTimerVec.get) 371eea4a3caSzhanglyGit io.loadDependency := loadDependencyVec 372aa2bcc31SzhanglyGit io.isFirstIssue.zipWithIndex.foreach{ case (isFirstIssue, deqIdx) => 373aa2bcc31SzhanglyGit isFirstIssue := io.deqSelOH(deqIdx).valid && Mux1H(io.deqSelOH(deqIdx).bits, isFirstIssueVec) 3748d081717Sszw_kaixin } 37528607074Ssinsanction io.simpEntryEnqSelVec.foreach(_ := finalSimpTransSelVec.get.zip(enqEntryTransVec).map(x => x._1 & Fill(SimpEntryNum, x._2.valid))) 37628607074Ssinsanction io.compEntryEnqSelVec.foreach(_ := finalCompTransSelVec.get.zip(compEnqVec.get).map(x => x._1 & Fill(CompEntryNum, x._2.valid))) 37728607074Ssinsanction io.othersEntryEnqSelVec.foreach(_ := finalOthersTransSelVec.get.zip(enqEntryTransVec).map(x => x._1 & Fill(OthersEntryNum, x._2.valid))) 378aa2bcc31SzhanglyGit io.robIdx.foreach(_ := robIdxVec) 379aa2bcc31SzhanglyGit io.uopIdx.foreach(_ := uopIdxVec.get) 380aa2bcc31SzhanglyGit io.rsFeedback := 0.U.asTypeOf(io.rsFeedback) //should be removed 381aa2bcc31SzhanglyGit io.cancel.foreach(_ := cancelVec.get) //for debug 382aa2bcc31SzhanglyGit 383aa2bcc31SzhanglyGit def EntriesConnect(in: CommonInBundle, out: CommonOutBundle, entryIdx: Int) = { 384aa2bcc31SzhanglyGit in.flush := io.flush 385aa2bcc31SzhanglyGit in.wakeUpFromWB := io.wakeUpFromWB 386aa2bcc31SzhanglyGit in.wakeUpFromIQ := io.wakeUpFromIQ 387aa2bcc31SzhanglyGit in.og0Cancel := io.og0Cancel 388aa2bcc31SzhanglyGit in.og1Cancel := io.og1Cancel 389aa2bcc31SzhanglyGit in.ldCancel := io.ldCancel 390aa2bcc31SzhanglyGit in.deqSel := deqSelVec(entryIdx) 391aa2bcc31SzhanglyGit in.deqPortIdxWrite := deqPortIdxWriteVec(entryIdx) 392aa2bcc31SzhanglyGit in.issueResp := issueRespVec(entryIdx) 393aa2bcc31SzhanglyGit if (params.isMemAddrIQ) { 394aa2bcc31SzhanglyGit in.fromMem.get.stIssuePtr := io.fromMem.get.stIssuePtr 395aa2bcc31SzhanglyGit in.fromMem.get.memWaitUpdateReq := io.fromMem.get.memWaitUpdateReq 396aa2bcc31SzhanglyGit } 397aa2bcc31SzhanglyGit if (params.isVecMemIQ) { 398aa2bcc31SzhanglyGit in.fromLsq.get.sqDeqPtr := io.vecMemIn.get.sqDeqPtr 399aa2bcc31SzhanglyGit in.fromLsq.get.lqDeqPtr := io.vecMemIn.get.lqDeqPtr 400aa2bcc31SzhanglyGit } 401aa2bcc31SzhanglyGit validVec(entryIdx) := out.valid 402aa2bcc31SzhanglyGit canIssueVec(entryIdx) := out.canIssue 403aa2bcc31SzhanglyGit fuTypeVec(entryIdx) := out.fuType 404aa2bcc31SzhanglyGit robIdxVec(entryIdx) := out.robIdx 405aa2bcc31SzhanglyGit dataSourceVec(entryIdx) := out.dataSource 406aa2bcc31SzhanglyGit isFirstIssueVec(entryIdx) := out.isFirstIssue 407aa2bcc31SzhanglyGit entries(entryIdx) := out.entry 408aa2bcc31SzhanglyGit deqPortIdxReadVec(entryIdx) := out.deqPortIdxRead 409aa2bcc31SzhanglyGit issueTimerVec(entryIdx) := out.issueTimerRead 410eea4a3caSzhanglyGit srcLoadDependencyVec(entryIdx) := out.srcLoadDependency 411eea4a3caSzhanglyGit loadDependencyVec(entryIdx) := out.entry.bits.status.mergedLoadDependency 412aa2bcc31SzhanglyGit if (params.hasIQWakeUp) { 413aa2bcc31SzhanglyGit srcWakeUpL1ExuOHVec.get(entryIdx) := out.srcWakeUpL1ExuOH.get 414aa2bcc31SzhanglyGit srcTimerVec.get(entryIdx) := out.srcTimer.get 415aa2bcc31SzhanglyGit cancelVec.get(entryIdx) := out.cancel.get 416aa2bcc31SzhanglyGit } 417aa2bcc31SzhanglyGit if (params.isVecMemIQ) { 418aa2bcc31SzhanglyGit uopIdxVec.get(entryIdx) := out.uopIdx.get 419aa2bcc31SzhanglyGit } 420a6938b17Ssinsanction entryInValidVec(entryIdx) := out.entryInValid 421a6938b17Ssinsanction entryOutDeqValidVec(entryIdx) := out.entryOutDeqValid 422a6938b17Ssinsanction entryOutTransValidVec(entryIdx) := out.entryOutTransValid 423aa2bcc31SzhanglyGit } 424a6938b17Ssinsanction 425a6938b17Ssinsanction // entries perf counter 426a6938b17Ssinsanction // enq 427a6938b17Ssinsanction for (i <- 0 until params.numEnq) { 428a6938b17Ssinsanction XSPerfAccumulate(s"enqEntry_${i}_in_cnt", entryInValidVec(i)) 429a6938b17Ssinsanction XSPerfAccumulate(s"enqEntry_${i}_out_deq_cnt", entryOutDeqValidVec(i)) 430a6938b17Ssinsanction XSPerfAccumulate(s"enqEntry_${i}_out_trans_cnt", entryOutTransValidVec(i)) 431a6938b17Ssinsanction } 432a6938b17Ssinsanction // simple 433a6938b17Ssinsanction for (i <- 0 until params.numSimp) { 434a6938b17Ssinsanction XSPerfAccumulate(s"simpEntry_${i}_in_cnt", entryInValidVec(i + params.numEnq)) 435a6938b17Ssinsanction XSPerfAccumulate(s"simpEntry_${i}_out_deq_cnt", entryOutDeqValidVec(i + params.numEnq)) 436a6938b17Ssinsanction XSPerfAccumulate(s"simpEntry_${i}_out_trans_cnt", entryOutTransValidVec(i + params.numEnq)) 437a6938b17Ssinsanction } 438a6938b17Ssinsanction // complex 439a6938b17Ssinsanction for (i <- 0 until params.numComp) { 440a6938b17Ssinsanction XSPerfAccumulate(s"compEntry_${i}_in_cnt", entryInValidVec(i + params.numEnq + params.numSimp)) 441a6938b17Ssinsanction XSPerfAccumulate(s"compEntry_${i}_out_deq_cnt", entryOutDeqValidVec(i + params.numEnq + params.numSimp)) 442a6938b17Ssinsanction XSPerfAccumulate(s"compEntry_${i}_out_trans_cnt", entryOutTransValidVec(i + params.numEnq + params.numSimp)) 443a6938b17Ssinsanction } 444a6938b17Ssinsanction // total 445a6938b17Ssinsanction XSPerfAccumulate(s"enqEntry_all_in_cnt", PopCount(entryInValidVec.take(params.numEnq))) 446a6938b17Ssinsanction XSPerfAccumulate(s"enqEntry_all_out_deq_cnt", PopCount(entryOutDeqValidVec.take(params.numEnq))) 447a6938b17Ssinsanction XSPerfAccumulate(s"enqEntry_all_out_trans_cnt", PopCount(entryOutTransValidVec.take(params.numEnq))) 448a6938b17Ssinsanction 449a6938b17Ssinsanction XSPerfAccumulate(s"othersEntry_all_in_cnt", PopCount(entryInValidVec.drop(params.numEnq))) 450a6938b17Ssinsanction XSPerfAccumulate(s"othersEntry_all_out_deq_cnt", PopCount(entryOutDeqValidVec.drop(params.numEnq))) 451a6938b17Ssinsanction XSPerfAccumulate(s"othersEntry_all_out_trans_cnt", PopCount(entryOutTransValidVec.drop(params.numEnq))) 452aa2bcc31SzhanglyGit} 453aa2bcc31SzhanglyGit 454aa2bcc31SzhanglyGitclass EntriesIO(implicit p: Parameters, params: IssueBlockParams) extends XSBundle { 455aa2bcc31SzhanglyGit val flush = Flipped(ValidIO(new Redirect)) 456aa2bcc31SzhanglyGit //enq 457aa2bcc31SzhanglyGit val enq = Vec(params.numEnq, Flipped(ValidIO(new EntryBundle))) 458aa2bcc31SzhanglyGit val og0Resp = Vec(params.numDeq, Flipped(ValidIO(new EntryDeqRespBundle))) 459aa2bcc31SzhanglyGit val og1Resp = Vec(params.numDeq, Flipped(ValidIO(new EntryDeqRespBundle))) 460aa2bcc31SzhanglyGit val finalIssueResp = OptionWrapper(params.LdExuCnt > 0, Vec(params.numDeq, Flipped(ValidIO(new EntryDeqRespBundle)))) 461*6462eb1cSzhanglyGit val memAddrIssueResp = OptionWrapper(params.LdExuCnt > 0, Vec(params.numDeq, Flipped(ValidIO(new EntryDeqRespBundle)))) 462aa2bcc31SzhanglyGit //deq sel 463aa2bcc31SzhanglyGit val deqReady = Vec(params.numDeq, Input(Bool())) 464aa2bcc31SzhanglyGit val deqSelOH = Vec(params.numDeq, Flipped(ValidIO(UInt(params.numEntries.W)))) 465aa2bcc31SzhanglyGit val enqEntryOldestSel = Vec(params.numDeq, Flipped(ValidIO(UInt(params.numEnq.W)))) 46628607074Ssinsanction val simpEntryOldestSel = OptionWrapper(params.hasCompAndSimp, Vec(params.numDeq, Flipped(ValidIO(UInt(params.numSimp.W))))) 46728607074Ssinsanction val compEntryOldestSel = OptionWrapper(params.hasCompAndSimp, Vec(params.numDeq, Flipped(ValidIO(UInt(params.numComp.W))))) 46828607074Ssinsanction val othersEntryOldestSel= OptionWrapper(params.isAllComp || params.isAllSimp, Vec(params.numDeq, Flipped(ValidIO(UInt((params.numEntries - params.numEnq).W))))) 469aa2bcc31SzhanglyGit val subDeqRequest = OptionWrapper(params.deqFuSame, Vec(params.numDeq, Input(UInt(params.numEntries.W)))) 470aa2bcc31SzhanglyGit val subDeqSelOH = OptionWrapper(params.deqFuSame, Vec(params.numDeq, Input(UInt(params.numEntries.W)))) 471aa2bcc31SzhanglyGit // wakeup 472aa2bcc31SzhanglyGit val wakeUpFromWB: MixedVec[ValidIO[IssueQueueWBWakeUpBundle]] = Flipped(params.genWBWakeUpSinkValidBundle) 473aa2bcc31SzhanglyGit val wakeUpFromIQ: MixedVec[ValidIO[IssueQueueIQWakeUpBundle]] = Flipped(params.genIQWakeUpSinkValidBundle) 474aa2bcc31SzhanglyGit val og0Cancel = Input(ExuOH(backendParams.numExu)) 475aa2bcc31SzhanglyGit val og1Cancel = Input(ExuOH(backendParams.numExu)) 476aa2bcc31SzhanglyGit val ldCancel = Vec(backendParams.LdExuCnt, Flipped(new LoadCancelIO)) 477aa2bcc31SzhanglyGit //entries status 478aa2bcc31SzhanglyGit val valid = Output(UInt(params.numEntries.W)) 479aa2bcc31SzhanglyGit val canIssue = Output(UInt(params.numEntries.W)) 480aa2bcc31SzhanglyGit val fuType = Vec(params.numEntries, Output(FuType())) 481aa2bcc31SzhanglyGit val dataSources = Vec(params.numEntries, Vec(params.numRegSrc, Output(DataSource()))) 482eea4a3caSzhanglyGit val loadDependency = Vec(params.numEntries, Vec(LoadPipelineWidth, UInt(3.W))) 483aa2bcc31SzhanglyGit val srcWakeUpL1ExuOH = OptionWrapper(params.hasIQWakeUp, Vec(params.numEntries, Vec(params.numRegSrc, Output(ExuOH())))) 484aa2bcc31SzhanglyGit val srcTimer = OptionWrapper(params.hasIQWakeUp, Vec(params.numEntries, Vec(params.numRegSrc, Output(UInt(3.W))))) 485aa2bcc31SzhanglyGit //deq status 486aa2bcc31SzhanglyGit val isFirstIssue = Vec(params.numDeq, Output(Bool())) 487aa2bcc31SzhanglyGit val deqEntry = Vec(params.numDeq, ValidIO(new EntryBundle)) 488aa2bcc31SzhanglyGit val cancelDeqVec = Vec(params.numDeq, Output(Bool())) 489aa2bcc31SzhanglyGit // mem only 490aa2bcc31SzhanglyGit val fromMem = if (params.isMemAddrIQ) Some(new Bundle { 491aa2bcc31SzhanglyGit val stIssuePtr = Input(new SqPtr) 492aa2bcc31SzhanglyGit val memWaitUpdateReq = Flipped(new MemWaitUpdateReq) 493aa2bcc31SzhanglyGit val slowResp = Vec(params.numDeq, Flipped(ValidIO(new EntryDeqRespBundle))) 494aa2bcc31SzhanglyGit }) else None 495aa2bcc31SzhanglyGit val vecMemIn = OptionWrapper(params.isVecMemIQ, new Bundle { 496aa2bcc31SzhanglyGit val sqDeqPtr = Input(new SqPtr) 497aa2bcc31SzhanglyGit val lqDeqPtr = Input(new LqPtr) 498aa2bcc31SzhanglyGit }) 499aa2bcc31SzhanglyGit 500aa2bcc31SzhanglyGit val robIdx = OptionWrapper(params.isVecMemIQ, Output(Vec(params.numEntries, new RobPtr))) 501aa2bcc31SzhanglyGit val uopIdx = OptionWrapper(params.isVecMemIQ, Output(Vec(params.numEntries, UopIdx()))) 502aa2bcc31SzhanglyGit 503aa2bcc31SzhanglyGit val rsFeedback = Output(Vec(5, Bool())) 50428607074Ssinsanction // trans 50528607074Ssinsanction val simpEntryDeqSelVec = OptionWrapper(params.hasCompAndSimp, Vec(params.numEnq, Input(UInt(params.numSimp.W)))) 50628607074Ssinsanction val simpEntryEnqSelVec = OptionWrapper(params.hasCompAndSimp, Vec(params.numEnq, Output(UInt(params.numSimp.W)))) 50728607074Ssinsanction val compEntryEnqSelVec = OptionWrapper(params.hasCompAndSimp, Vec(params.numEnq, Output(UInt(params.numComp.W)))) 50828607074Ssinsanction val othersEntryEnqSelVec = OptionWrapper(params.isAllComp || params.isAllSimp, Vec(params.numEnq, Output(UInt((params.numEntries - params.numEnq).W)))) 509aa2bcc31SzhanglyGit 510aa2bcc31SzhanglyGit // debug 511aa2bcc31SzhanglyGit val cancel = OptionWrapper(params.hasIQWakeUp, Output(Vec(params.numEntries, Bool()))) 512aa2bcc31SzhanglyGit 513aa2bcc31SzhanglyGit def wakeup = wakeUpFromWB ++ wakeUpFromIQ 5145db4956bSzhanglyGit} 515