1package xiangshan.backend.datapath 2 3import org.chipsalliance.cde.config.Parameters 4import chisel3._ 5import chisel3.util._ 6import difftest.{DiffArchFpRegState, DiffArchIntRegState, DiffArchVecRegState, DifftestModule} 7import freechips.rocketchip.diplomacy.{LazyModule, LazyModuleImp} 8import utility._ 9import utils.SeqUtils._ 10import utils.{XSPerfAccumulate, XSPerfHistogram} 11import xiangshan._ 12import xiangshan.backend.BackendParams 13import xiangshan.backend.Bundles._ 14import xiangshan.backend.decode.ImmUnion 15import xiangshan.backend.datapath.DataConfig._ 16import xiangshan.backend.datapath.RdConfig._ 17import xiangshan.backend.issue.{ImmExtractor, IntScheduler, MemScheduler, VfScheduler, FpScheduler} 18import xiangshan.backend.issue.EntryBundles._ 19import xiangshan.backend.regfile._ 20import xiangshan.backend.PcToDataPathIO 21import xiangshan.backend.fu.FuType.is0latency 22 23class DataPath(params: BackendParams)(implicit p: Parameters) extends LazyModule { 24 override def shouldBeInlined: Boolean = false 25 26 private implicit val dpParams: BackendParams = params 27 lazy val module = new DataPathImp(this) 28 29 println(s"[DataPath] Preg Params: ") 30 println(s"[DataPath] Int R(${params.getRfReadSize(IntData())}), W(${params.getRfWriteSize(IntData())}) ") 31 println(s"[DataPath] Fp R(${params.getRfReadSize(FpData())}), W(${params.getRfWriteSize(FpData())}) ") 32 println(s"[DataPath] Vf R(${params.getRfReadSize(VecData())}), W(${params.getRfWriteSize(VecData())}) ") 33} 34 35class DataPathImp(override val wrapper: DataPath)(implicit p: Parameters, params: BackendParams) 36 extends LazyModuleImp(wrapper) with HasXSParameter { 37 38 val io = IO(new DataPathIO()) 39 40 private val (fromIntIQ, toIntIQ, toIntExu) = (io.fromIntIQ, io.toIntIQ, io.toIntExu) 41 private val (fromFpIQ, toFpIQ, toFpExu) = (io.fromFpIQ, io.toFpIQ, io.toFpExu) 42 private val (fromMemIQ, toMemIQ, toMemExu) = (io.fromMemIQ, io.toMemIQ, io.toMemExu) 43 private val (fromVfIQ , toVfIQ , toVfExu ) = (io.fromVfIQ , io.toVfIQ , io.toVecExu) 44 45 println(s"[DataPath] IntIQ(${fromIntIQ.size}), MemIQ(${fromFpIQ.size}), MemIQ(${fromMemIQ.size})") 46 println(s"[DataPath] IntExu(${fromIntIQ.map(_.size).sum}), FpExu(${fromFpIQ.map(_.size).sum}), MemExu(${fromMemIQ.map(_.size).sum})") 47 48 // just refences for convience 49 private val fromIQ: Seq[MixedVec[DecoupledIO[IssueQueueIssueBundle]]] = (fromIntIQ ++ fromFpIQ ++ fromVfIQ ++ fromMemIQ).toSeq 50 51 private val toIQs = toIntIQ ++ toFpIQ ++ toVfIQ ++ toMemIQ 52 53 private val toExu: Seq[MixedVec[DecoupledIO[ExuInput]]] = (toIntExu ++ toFpExu ++ toVfExu ++ toMemExu).toSeq 54 55 private val fromFlattenIQ: Seq[DecoupledIO[IssueQueueIssueBundle]] = fromIQ.flatten 56 57 private val toFlattenExu: Seq[DecoupledIO[ExuInput]] = toExu.flatten 58 59 private val intWbBusyArbiter = Module(new IntRFWBCollideChecker(backendParams)) 60 private val fpWbBusyArbiter = Module(new FpRFWBCollideChecker(backendParams)) 61 private val vfWbBusyArbiter = Module(new VfRFWBCollideChecker(backendParams)) 62 private val intRFReadArbiter = Module(new IntRFReadArbiter(backendParams)) 63 private val fpRFReadArbiter = Module(new FpRFReadArbiter(backendParams)) 64 private val vfRFReadArbiter = Module(new VfRFReadArbiter(backendParams)) 65 66 private val og0FailedVec2: MixedVec[Vec[Bool]] = Wire(MixedVec(fromIQ.map(x => Vec(x.size, Bool())).toSeq)) 67 private val og1FailedVec2: MixedVec[Vec[Bool]] = Wire(MixedVec(fromIQ.map(x => Vec(x.size, Bool())).toSeq)) 68 69 // port -> win 70 private val intRdArbWinner: Seq2[MixedVec[Bool]] = intRFReadArbiter.io.in.map(_.map(x => MixedVecInit(x.map(_.ready).toSeq)).toSeq).toSeq 71 private val fpRdArbWinner: Seq2[MixedVec[Bool]] = fpRFReadArbiter.io.in.map(_.map(x => MixedVecInit(x.map(_.ready).toSeq)).toSeq).toSeq 72 private val vfRdArbWinner: Seq2[MixedVec[Bool]] = vfRFReadArbiter.io.in.map(_.map(x => MixedVecInit(x.map(_.ready).toSeq)).toSeq).toSeq 73 private val intWbNotBlock: Seq[MixedVec[Bool]] = intWbBusyArbiter.io.in.map(x => MixedVecInit(x.map(_.ready).toSeq)).toSeq 74 private val vfWbNotBlock: Seq[MixedVec[Bool]] = vfWbBusyArbiter.io.in.map(x => MixedVecInit(x.map(_.ready).toSeq)).toSeq 75 76 private val intRdNotBlock: Seq2[Bool] = intRdArbWinner.map(_.map(_.asUInt.andR)) 77 private val fpRdNotBlock: Seq2[Bool] = fpRdArbWinner.map(_.map(_.asUInt.andR)) 78 private val vfRdNotBlock: Seq2[Bool] = vfRdArbWinner.map(_.map(_.asUInt.andR)) 79 80 private val intRFReadReq: Seq3[ValidIO[RfReadPortWithConfig]] = fromIQ.map(x => x.map(xx => xx.bits.getIntRfReadValidBundle(xx.valid)).toSeq).toSeq 81 private val fpRFReadReq: Seq3[ValidIO[RfReadPortWithConfig]] = fromIQ.map(x => x.map(xx => xx.bits.getFpRfReadValidBundle(xx.valid)).toSeq).toSeq 82 private val vfRFReadReq: Seq3[ValidIO[RfReadPortWithConfig]] = fromIQ.map(x => x.map(xx => xx.bits.getVfRfReadValidBundle(xx.valid)).toSeq).toSeq 83 private val allDataSources: Seq[Seq[Vec[DataSource]]] = fromIQ.map(x => x.map(xx => xx.bits.common.dataSources).toSeq) 84 private val allNumRegSrcs: Seq[Seq[Int]] = fromIQ.map(x => x.map(xx => xx.bits.exuParams.numRegSrc).toSeq) 85 86 intRFReadArbiter.io.in.zip(intRFReadReq).zipWithIndex.foreach { case ((arbInSeq2, inRFReadReqSeq2), iqIdx) => 87 arbInSeq2.zip(inRFReadReqSeq2).zipWithIndex.foreach { case ((arbInSeq, inRFReadReqSeq), exuIdx) => 88 val srcIndices: Seq[Int] = fromIQ(iqIdx)(exuIdx).bits.exuParams.getRfReadSrcIdx(IntData()) 89 for (srcIdx <- 0 until fromIQ(iqIdx)(exuIdx).bits.exuParams.numRegSrc) { 90 if (srcIndices.contains(srcIdx) && inRFReadReqSeq.isDefinedAt(srcIdx)) { 91 arbInSeq(srcIdx).valid := inRFReadReqSeq(srcIdx).valid && allDataSources(iqIdx)(exuIdx)(srcIdx).readReg 92 arbInSeq(srcIdx).bits.addr := inRFReadReqSeq(srcIdx).bits.addr 93// if (allNumRegSrcs(iqIdx)(exuIdx) == 2) { 94// val src0Req = inRFReadReqSeq(0).valid && allDataSources(iqIdx)(exuIdx)(0).readReg 95// val src1Req = inRFReadReqSeq(1).valid && allDataSources(iqIdx)(exuIdx)(1).readReg 96// if (srcIdx == 0) { 97// arbInSeq(srcIdx).valid := src0Req || src1Req 98// arbInSeq(srcIdx).bits.addr := Mux(src1Req && !src0Req, inRFReadReqSeq(1).bits.addr,inRFReadReqSeq(0).bits.addr) 99// } else { 100// arbInSeq(srcIdx).valid := src0Req && src1Req 101// arbInSeq(srcIdx).bits.addr := inRFReadReqSeq(srcIdx).bits.addr 102// } 103// } else { 104// arbInSeq(srcIdx).valid := inRFReadReqSeq(srcIdx).valid && allDataSources(iqIdx)(exuIdx)(srcIdx).readReg 105// arbInSeq(srcIdx).bits.addr := inRFReadReqSeq(srcIdx).bits.addr 106// } 107 } else { 108 arbInSeq(srcIdx).valid := false.B 109 arbInSeq(srcIdx).bits.addr := 0.U 110 } 111 } 112 } 113 } 114 fpRFReadArbiter.io.in.zip(fpRFReadReq).zipWithIndex.foreach { case ((arbInSeq2, inRFReadReqSeq2), iqIdx) => 115 arbInSeq2.zip(inRFReadReqSeq2).zipWithIndex.foreach { case ((arbInSeq, inRFReadReqSeq), exuIdx) => 116 val srcIndices: Seq[Int] = FpRegSrcDataSet.flatMap(data => fromIQ(iqIdx)(exuIdx).bits.exuParams.getRfReadSrcIdx(data)).toSeq.sorted 117 for (srcIdx <- 0 until fromIQ(iqIdx)(exuIdx).bits.exuParams.numRegSrc) { 118 if (srcIndices.contains(srcIdx) && inRFReadReqSeq.isDefinedAt(srcIdx)) { 119 arbInSeq(srcIdx).valid := inRFReadReqSeq(srcIdx).valid && allDataSources(iqIdx)(exuIdx)(srcIdx).readReg 120 arbInSeq(srcIdx).bits.addr := inRFReadReqSeq(srcIdx).bits.addr 121 } else { 122 arbInSeq(srcIdx).valid := false.B 123 arbInSeq(srcIdx).bits.addr := 0.U 124 } 125 } 126 } 127 } 128 129 vfRFReadArbiter.io.in.zip(vfRFReadReq).zipWithIndex.foreach { case ((arbInSeq2, inRFReadReqSeq2), iqIdx) => 130 arbInSeq2.zip(inRFReadReqSeq2).zipWithIndex.foreach { case ((arbInSeq, inRFReadReqSeq), exuIdx) => 131 val srcIndices: Seq[Int] = VfRegSrcDataSet.flatMap(data => fromIQ(iqIdx)(exuIdx).bits.exuParams.getRfReadSrcIdx(data)).toSeq.sorted 132 for (srcIdx <- 0 until fromIQ(iqIdx)(exuIdx).bits.exuParams.numRegSrc) { 133 if (srcIndices.contains(srcIdx) && inRFReadReqSeq.isDefinedAt(srcIdx)) { 134 arbInSeq(srcIdx).valid := inRFReadReqSeq(srcIdx).valid && allDataSources(iqIdx)(exuIdx)(srcIdx).readReg 135 arbInSeq(srcIdx).bits.addr := inRFReadReqSeq(srcIdx).bits.addr 136 } else { 137 arbInSeq(srcIdx).valid := false.B 138 arbInSeq(srcIdx).bits.addr := 0.U 139 } 140 } 141 } 142 } 143 144 private val intRFWriteReq: Seq2[Bool] = fromIQ.map(x => x.map(xx => xx.valid && xx.bits.common.rfWen.getOrElse(false.B)).toSeq).toSeq 145 private val fpRFWriteReq: Seq2[Bool] = fromIQ.map(x => x.map(xx => xx.valid && xx.bits.common.getFpWen.getOrElse(false.B)).toSeq).toSeq 146 private val vfRFWriteReq: Seq2[Bool] = fromIQ.map(x => x.map(xx => xx.valid && xx.bits.common.getVfWen.getOrElse(false.B)).toSeq).toSeq 147 148 intWbBusyArbiter.io.in.zip(intRFWriteReq).foreach { case (arbInSeq, inRFWriteReqSeq) => 149 arbInSeq.zip(inRFWriteReqSeq).foreach { case (arbIn, inRFWriteReq) => 150 arbIn.valid := inRFWriteReq 151 } 152 } 153 154 fpWbBusyArbiter.io.in.zip(fpRFWriteReq).foreach { case (arbInSeq, inRFWriteReqSeq) => 155 arbInSeq.zip(inRFWriteReqSeq).foreach { case (arbIn, inRFWriteReq) => 156 arbIn.valid := inRFWriteReq 157 } 158 } 159 160 vfWbBusyArbiter.io.in.zip(vfRFWriteReq).foreach { case (arbInSeq, inRFWriteReqSeq) => 161 arbInSeq.zip(inRFWriteReqSeq).foreach { case (arbIn, inRFWriteReq) => 162 arbIn.valid := inRFWriteReq 163 } 164 } 165 166 private val intSchdParams = params.schdParams(IntScheduler()) 167 private val fpSchdParams = params.schdParams(FpScheduler()) 168 private val vfSchdParams = params.schdParams(VfScheduler()) 169 private val memSchdParams = params.schdParams(MemScheduler()) 170 171 private val numIntRfReadByExu = intSchdParams.numIntRfReadByExu + memSchdParams.numIntRfReadByExu 172 private val numFpRfReadByExu = fpSchdParams.numFpRfReadByExu + memSchdParams.numFpRfReadByExu 173 private val numVfRfReadByExu = vfSchdParams.numVfRfReadByExu + memSchdParams.numVfRfReadByExu 174 // Todo: limit read port 175 private val numIntR = numIntRfReadByExu 176 private val numFpR = numFpRfReadByExu 177 private val numVfR = numVfRfReadByExu 178 println(s"[DataPath] RegFile read req needed by Exu: Int(${numIntRfReadByExu}), Fp(${numFpRfReadByExu}), Vf(${numVfRfReadByExu})") 179 println(s"[DataPath] RegFile read port: Int(${numIntR}), Fp(${numFpR}), Vf(${numVfR})") 180 181 private val schdParams = params.allSchdParams 182 183 private val pcReadValid = Wire(chiselTypeOf(io.fromPcTargetMem.fromDataPathValid)) 184 private val pcReadFtqPtr = Wire(chiselTypeOf(io.fromPcTargetMem.fromDataPathFtqPtr)) 185 private val pcReadFtqOffset = Wire(chiselTypeOf(io.fromPcTargetMem.fromDataPathFtqOffset)) 186 private val targetPCRdata = io.fromPcTargetMem.toDataPathTargetPC 187 private val pcRdata = io.fromPcTargetMem.toDataPathPC 188 private val intRfRaddr = Wire(Vec(params.numPregRd(IntData()), UInt(intSchdParams.pregIdxWidth.W))) 189 private val intRfRdata = Wire(Vec(params.numPregRd(IntData()), UInt(intSchdParams.rfDataWidth.W))) 190 private val intRfWen = Wire(Vec(io.fromIntWb.length, Bool())) 191 private val intRfWaddr = Wire(Vec(io.fromIntWb.length, UInt(intSchdParams.pregIdxWidth.W))) 192 private val intRfWdata = Wire(Vec(io.fromIntWb.length, UInt(intSchdParams.rfDataWidth.W))) 193 194 private val fpRfRaddr = Wire(Vec(params.numPregRd(FpData()), UInt(fpSchdParams.pregIdxWidth.W))) 195 private val fpRfRdata = Wire(Vec(params.numPregRd(FpData()), UInt(fpSchdParams.rfDataWidth.W))) 196 private val fpRfWen = Wire(Vec(io.fromFpWb.length, Bool())) 197 private val fpRfWaddr = Wire(Vec(io.fromFpWb.length, UInt(fpSchdParams.pregIdxWidth.W))) 198 private val fpRfWdata = Wire(Vec(io.fromFpWb.length, UInt(fpSchdParams.rfDataWidth.W))) 199 200 private val vfRfSplitNum = VLEN / XLEN 201 private val vfRfRaddr = Wire(Vec(params.numPregRd(VecData()), UInt(vfSchdParams.pregIdxWidth.W))) 202 private val vfRfRdata = Wire(Vec(params.numPregRd(VecData()), UInt(vfSchdParams.rfDataWidth.W))) 203 private val vfRfWen = Wire(Vec(vfRfSplitNum, Vec(io.fromVfWb.length, Bool()))) 204 private val vfRfWaddr = Wire(Vec(io.fromVfWb.length, UInt(vfSchdParams.pregIdxWidth.W))) 205 private val vfRfWdata = Wire(Vec(io.fromVfWb.length, UInt(vfSchdParams.rfDataWidth.W))) 206 207 val pcReadFtqPtrFormIQ = fromIntIQ.flatten.filter(x => x.bits.exuParams.needPc) 208 assert(pcReadFtqPtrFormIQ.size == pcReadFtqPtr.size, s"pcReadFtqPtrFormIQ.size ${pcReadFtqPtrFormIQ.size} not equal pcReadFtqPtr.size ${pcReadFtqPtr.size}") 209 pcReadValid.zip(pcReadFtqPtrFormIQ.map(_.valid)).map(x => x._1 := x._2) 210 pcReadFtqPtr.zip(pcReadFtqPtrFormIQ.map(_.bits.common.ftqIdx.get)).map(x => x._1 := x._2) 211 pcReadFtqOffset.zip(pcReadFtqPtrFormIQ.map(_.bits.common.ftqOffset.get)).map(x => x._1 := x._2) 212 io.fromPcTargetMem.fromDataPathValid := pcReadValid 213 io.fromPcTargetMem.fromDataPathFtqPtr := pcReadFtqPtr 214 io.fromPcTargetMem.fromDataPathFtqOffset := pcReadFtqOffset 215 216 private val intDebugRead: Option[(Vec[UInt], Vec[UInt])] = 217 if (env.AlwaysBasicDiff || env.EnableDifftest) { 218 Some(Wire(Vec(32, UInt(intSchdParams.pregIdxWidth.W))), Wire(Vec(32, UInt(XLEN.W)))) 219 } else { None } 220 private val fpDebugRead: Option[(Vec[UInt], Vec[UInt])] = 221 if (env.AlwaysBasicDiff || env.EnableDifftest) { 222 Some(Wire(Vec(32, UInt(fpSchdParams.pregIdxWidth.W))), Wire(Vec(32, UInt(XLEN.W)))) 223 } else { None } 224 private val vfDebugRead: Option[(Vec[UInt], Vec[UInt])] = 225 if (env.AlwaysBasicDiff || env.EnableDifftest) { 226 Some(Wire(Vec(32 + 1, UInt(vfSchdParams.pregIdxWidth.W))), Wire(Vec(32 + 1, UInt(VLEN.W)))) 227 } else { None } 228 229 private val fpDebugReadData: Option[Vec[UInt]] = 230 if (env.AlwaysBasicDiff || env.EnableDifftest) { 231 Some(Wire(Vec(32, UInt(XLEN.W)))) 232 } else { None } 233 private val vecDebugReadData: Option[Vec[UInt]] = 234 if (env.AlwaysBasicDiff || env.EnableDifftest) { 235 Some(Wire(Vec(64, UInt(64.W)))) // v0 = Cat(Vec(1), Vec(0)) 236 } else { None } 237 private val vconfigDebugReadData: Option[UInt] = 238 if (env.AlwaysBasicDiff || env.EnableDifftest) { 239 Some(Wire(UInt(64.W))) 240 } else { None } 241 242 243 fpDebugReadData.foreach(_ := fpDebugRead 244 .get._2 245 .slice(0, 32) 246 .map(_(63, 0)) 247 ) // fp only used [63, 0] 248 vecDebugReadData.foreach(_ := vfDebugRead 249 .get._2 250 .slice(0, 32) 251 .map(x => Seq(x(63, 0), x(127, 64))).flatten 252 ) 253 vconfigDebugReadData.foreach(_ := vfDebugRead 254 .get._2(32)(63, 0) 255 ) 256 257 io.debugVconfig.foreach(_ := vconfigDebugReadData.get) 258 259 IntRegFile("IntRegFile", intSchdParams.numPregs, intRfRaddr, intRfRdata, intRfWen, intRfWaddr, intRfWdata, 260 bankNum = 4, 261 debugReadAddr = intDebugRead.map(_._1), 262 debugReadData = intDebugRead.map(_._2)) 263 FpRegFile("FpRegFile", fpSchdParams.numPregs, fpRfRaddr, fpRfRdata, fpRfWen, fpRfWaddr, fpRfWdata, 264 bankNum = 1, 265 debugReadAddr = fpDebugRead.map(_._1), 266 debugReadData = fpDebugRead.map(_._2)) 267 VfRegFile("VfRegFile", vfSchdParams.numPregs, vfRfSplitNum, vfRfRaddr, vfRfRdata, vfRfWen, vfRfWaddr, vfRfWdata, 268 debugReadAddr = vfDebugRead.map(_._1), 269 debugReadData = vfDebugRead.map(_._2)) 270 271 intRfWaddr := io.fromIntWb.map(_.addr).toSeq 272 intRfWdata := io.fromIntWb.map(_.data).toSeq 273 intRfWen := io.fromIntWb.map(_.wen).toSeq 274 275 for (portIdx <- intRfRaddr.indices) { 276 if (intRFReadArbiter.io.out.isDefinedAt(portIdx)) 277 intRfRaddr(portIdx) := intRFReadArbiter.io.out(portIdx).bits.addr 278 else 279 intRfRaddr(portIdx) := 0.U 280 } 281 282 fpRfWaddr := io.fromFpWb.map(_.addr).toSeq 283 fpRfWdata := io.fromFpWb.map(_.data).toSeq 284 fpRfWen := io.fromFpWb.map(_.wen).toSeq 285 286 for (portIdx <- fpRfRaddr.indices) { 287 if (fpRFReadArbiter.io.out.isDefinedAt(portIdx)) 288 fpRfRaddr(portIdx) := fpRFReadArbiter.io.out(portIdx).bits.addr 289 else 290 fpRfRaddr(portIdx) := 0.U 291 } 292 293 vfRfWaddr := io.fromVfWb.map(x => RegEnable(x.addr, x.wen)).toSeq 294 vfRfWdata := io.fromVfWb.map(x => RegEnable(x.data, x.wen)).toSeq 295 vfRfWen.foreach(_.zip(io.fromVfWb.map(x => RegNext(x.wen))).foreach { case (wenSink, wenSource) => wenSink := wenSource } )// Todo: support fp multi-write 296 297 for (portIdx <- vfRfRaddr.indices) { 298 if (vfRFReadArbiter.io.out.isDefinedAt(portIdx)) 299 vfRfRaddr(portIdx) := vfRFReadArbiter.io.out(portIdx).bits.addr 300 else 301 vfRfRaddr(portIdx) := 0.U 302 } 303 304 305 intDebugRead.foreach { case (addr, _) => 306 addr := io.debugIntRat.get 307 } 308 309 fpDebugRead.foreach { case (addr, _) => 310 addr := io.debugFpRat.get 311 } 312 313 vfDebugRead.foreach { case (addr, _) => 314 addr := io.debugVecRat.get :+ io.debugVconfigRat.get 315 } 316 println(s"[DataPath] " + 317 s"has intDebugRead: ${intDebugRead.nonEmpty}, " + 318 s"has vfDebugRead: ${vfDebugRead.nonEmpty}") 319 320 val s1_addrOHs = Reg(MixedVec( 321 fromIQ.map(x => MixedVec(x.map(_.bits.addrOH.cloneType).toSeq)).toSeq 322 )) 323 val s1_toExuValid: MixedVec[MixedVec[Bool]] = Reg(MixedVec( 324 toExu.map(x => MixedVec(x.map(_.valid.cloneType).toSeq)).toSeq 325 )) 326 val s1_toExuData: MixedVec[MixedVec[ExuInput]] = Reg(MixedVec(toExu.map(x => MixedVec(x.map(_.bits.cloneType).toSeq)).toSeq)) 327 val s1_immInfo = Reg(MixedVec(toExu.map(x => MixedVec(x.map(x => new ImmInfo).toSeq)).toSeq)) 328 s1_immInfo.zip(fromIQ).map { case (s1Vec, s0Vec) => 329 s1Vec.zip(s0Vec).map { case (s1, s0) => 330 s1.imm := Mux(s0.valid, s0.bits.common.imm, s1.imm) 331 s1.immType := Mux(s0.valid, s0.bits.immType, s1.immType) 332 } 333 } 334 io.og1ImmInfo.zip(s1_immInfo.flatten).map{ case(out, reg) => 335 out := reg 336 } 337 val s1_toExuReady = Wire(MixedVec(toExu.map(x => MixedVec(x.map(_.ready.cloneType).toSeq)))) 338 val s1_srcType: MixedVec[MixedVec[Vec[UInt]]] = MixedVecInit(fromIQ.map(x => MixedVecInit(x.map(xx => RegEnable(xx.bits.srcType, xx.fire)).toSeq))) 339 340 val s1_intPregRData: MixedVec[MixedVec[Vec[UInt]]] = Wire(MixedVec(toExu.map(x => MixedVec(x.map(_.bits.src.cloneType).toSeq)))) 341 val s1_fpPregRData: MixedVec[MixedVec[Vec[UInt]]] = Wire(MixedVec(toExu.map(x => MixedVec(x.map(_.bits.src.cloneType).toSeq)))) 342 val s1_vfPregRData: MixedVec[MixedVec[Vec[UInt]]] = Wire(MixedVec(toExu.map(x => MixedVec(x.map(_.bits.src.cloneType).toSeq)))) 343 344 val rfrPortConfigs = schdParams.map(_.issueBlockParams).flatten.map(_.exuBlockParams.map(_.rfrPortConfigs)) 345 346 println(s"[DataPath] s1_intPregRData.flatten.flatten.size: ${s1_intPregRData.flatten.flatten.size}, intRfRdata.size: ${intRfRdata.size}") 347 s1_intPregRData.foreach(_.foreach(_.foreach(_ := 0.U))) 348 s1_intPregRData.zip(rfrPortConfigs).foreach { case (iqRdata, iqCfg) => 349 iqRdata.zip(iqCfg).foreach { case (iuRdata, iuCfg) => 350 val realIuCfg = iuCfg.map(x => x.filter(_.isInstanceOf[IntRD])).flatten 351 iuRdata.zip(realIuCfg) 352 .filter { case (_, rfrPortConfig) => rfrPortConfig.isInstanceOf[IntRD] } 353 .foreach { case (sink, cfg) => sink := intRfRdata(cfg.port) } 354 } 355 } 356 357 println(s"[DataPath] s1_fpPregRData.flatten.flatten.size: ${s1_fpPregRData.flatten.flatten.size}, fpRfRdata.size: ${fpRfRdata.size}") 358 s1_fpPregRData.foreach(_.foreach(_.foreach(_ := 0.U))) 359 s1_fpPregRData.zip(rfrPortConfigs).foreach { case (iqRdata, iqCfg) => 360 iqRdata.zip(iqCfg).foreach { case (iuRdata, iuCfg) => 361 val realIuCfg = iuCfg.map(x => x.filter(_.isInstanceOf[FpRD])).flatten 362 iuRdata.zip(realIuCfg) 363 .filter { case (_, rfrPortConfig) => rfrPortConfig.isInstanceOf[FpRD] } 364 .foreach { case (sink, cfg) => sink := fpRfRdata(cfg.port) } 365 } 366 } 367 368 println(s"[DataPath] s1_vfPregRData.flatten.flatten.size: ${s1_vfPregRData.flatten.flatten.size}, vfRfRdata.size: ${vfRfRdata.size}") 369 s1_vfPregRData.foreach(_.foreach(_.foreach(_ := 0.U))) 370 s1_vfPregRData.zip(rfrPortConfigs).foreach{ case(iqRdata, iqCfg) => 371 iqRdata.zip(iqCfg).foreach{ case(iuRdata, iuCfg) => 372 val realIuCfg = iuCfg.map(x => x.filter(_.isInstanceOf[VfRD])).flatten 373 iuRdata.zip(realIuCfg) 374 .filter { case (_, rfrPortConfig) => rfrPortConfig.isInstanceOf[VfRD] } 375 .foreach { case (sink, cfg) => sink := vfRfRdata(cfg.port) } 376 } 377 } 378 379 val og0_cancel_no_load = VecInit(og0FailedVec2.flatten.zip(params.allExuParams).filter(!_._2.hasLoadFu).map(_._1).toSeq) 380 val exuParamsNoLoad = fromIQ.flatten.zip(params.allExuParams).filter(!_._2.hasLoadFu) 381 val is_0latency = Wire(Vec(og0_cancel_no_load.size, Bool())) 382 is_0latency := exuParamsNoLoad.map(x => is0latency(x._1.bits.common.fuType)) 383 val og0_cancel_delay = RegNext(VecInit(og0_cancel_no_load.zip(is_0latency).map(x => x._1 && x._2))) 384 val isVfScheduler = VecInit(exuParamsNoLoad.map(x => x._2.schdType.isInstanceOf[VfScheduler].B)) 385 val og0_cancel_delay_for_mem = VecInit(og0_cancel_delay.zip(isVfScheduler).map(x => x._1 && !x._2)) 386 for (i <- fromIQ.indices) { 387 for (j <- fromIQ(i).indices) { 388 // IQ(s0) --[Ctrl]--> s1Reg ---------- begin 389 // refs 390 val s1_valid = s1_toExuValid(i)(j) 391 val s1_ready = s1_toExuReady(i)(j) 392 val s1_data = s1_toExuData(i)(j) 393 val s1_addrOH = s1_addrOHs(i)(j) 394 val s0 = fromIQ(i)(j) // s0 395 396 val srcNotBlock = Wire(Bool()) 397 srcNotBlock := s0.bits.common.dataSources.zip(intRdArbWinner(i)(j) zip vfRdArbWinner(i)(j)).map { case (source, win) => 398 !source.readReg || win._1 && win._2 399 }.fold(true.B)(_ && _) 400// if (fromIQ(i)(j).bits.exuParams.schdType.isInstanceOf[IntScheduler] && (fromIQ(i)(j).bits.exuParams.numRegSrc == 2)) { 401// val src0VfBlock = s0.bits.common.dataSources(0).readReg && !vfRdArbWinner(i)(j)(0) 402// val src1VfBlock = s0.bits.common.dataSources(1).readReg && !vfRdArbWinner(i)(j)(1) 403// val src1IntBlock = s0.bits.common.dataSources(0).readReg && s0.bits.common.dataSources(1).readReg && !intRdArbWinner(i)(j)(1) 404// val src0IntBlock = (s0.bits.common.dataSources(0).readReg || s0.bits.common.dataSources(1).readReg) && !intRdArbWinner(i)(j)(0) 405// srcNotBlock := !src0VfBlock && !src1VfBlock && !src1IntBlock && !src0IntBlock 406// } 407 val notBlock = srcNotBlock && intWbNotBlock(i)(j) && vfWbNotBlock(i)(j) 408 val s1_flush = s0.bits.common.robIdx.needFlush(Seq(io.flush, RegNextWithEnable(io.flush))) 409 val s1_cancel = og1FailedVec2(i)(j) 410 val s0_cancel = Wire(Bool()) 411 val og0_cancel_delay_need = if (s0.bits.exuParams.schdType.isInstanceOf[MemScheduler]) og0_cancel_delay_for_mem else og0_cancel_delay 412 if (s0.bits.exuParams.isIQWakeUpSink) { 413 val exuOHNoLoad = s0.bits.common.l1ExuOH.get.map(x => x.asTypeOf(Vec(x.getWidth, Bool())).zip(params.allExuParams).filter(!_._2.hasLoadFu).map(_._1)) 414 s0_cancel := exuOHNoLoad.zip(s0.bits.common.dataSources).map{ 415 case (exuOH, dataSource) => (VecInit(exuOH).asUInt & og0_cancel_delay_need.asUInt).orR && dataSource.readForward 416 }.reduce(_ || _) && s0.valid 417 } else s0_cancel := false.B 418 val s0_ldCancel = LoadShouldCancel(s0.bits.common.loadDependency, io.ldCancel) 419 when (s0.fire && !s1_flush && notBlock && !s1_cancel && !s0_ldCancel && !s0_cancel) { 420 s1_valid := s0.valid 421 s1_data.fromIssueBundle(s0.bits) // no src data here 422// if (fromIQ(i)(j).bits.exuParams.schdType.isInstanceOf[IntScheduler] && (fromIQ(i)(j).bits.exuParams.numRegSrc == 2)) { 423// s1_data.dataSources(1).value := Mux(!s0.bits.common.dataSources(0).readReg && s0.bits.common.dataSources(1).readReg, DataSource.anotherReg, s0.bits.common.dataSources(1).value) 424// } 425 s1_addrOH := s0.bits.addrOH 426 }.otherwise { 427 s1_valid := false.B 428 } 429 s0.ready := (s1_ready || !s1_valid) && notBlock && !s1_cancel && !s0_ldCancel && !s0_cancel 430 // IQ(s0) --[Ctrl]--> s1Reg ---------- end 431 } 432 } 433 434 private val fromIQFire = fromIQ.map(_.map(_.fire)) 435 private val toExuFire = toExu.map(_.map(_.fire)) 436 toIQs.zipWithIndex.foreach { 437 case(toIQ, iqIdx) => 438 toIQ.zipWithIndex.foreach { 439 case (toIU, iuIdx) => 440 // IU: issue unit 441 val og0resp = toIU.og0resp 442 og0FailedVec2(iqIdx)(iuIdx) := fromIQ(iqIdx)(iuIdx).valid && (!fromIQFire(iqIdx)(iuIdx)) 443 og0resp.valid := og0FailedVec2(iqIdx)(iuIdx) 444 og0resp.bits.robIdx := fromIQ(iqIdx)(iuIdx).bits.common.robIdx 445 og0resp.bits.uopIdx.foreach(_ := fromIQ(iqIdx)(iuIdx).bits.common.vpu.get.vuopIdx) 446 og0resp.bits.resp := RespType.block 447 og0resp.bits.fuType := fromIQ(iqIdx)(iuIdx).bits.common.fuType 448 449 val og1resp = toIU.og1resp 450 og1FailedVec2(iqIdx)(iuIdx) := s1_toExuValid(iqIdx)(iuIdx) && !toExuFire(iqIdx)(iuIdx) 451 og1resp.valid := s1_toExuValid(iqIdx)(iuIdx) 452 og1resp.bits.robIdx := s1_toExuData(iqIdx)(iuIdx).robIdx 453 og1resp.bits.uopIdx.foreach(_ := s1_toExuData(iqIdx)(iuIdx).vpu.get.vuopIdx) 454 // respType: fuIdle ->IQ entry clear 455 // fuUncertain ->IQ entry no action 456 // fuBusy ->IQ entry issued set false, then re-issue 457 // Only hyu, lda and sta are fuUncertain at OG1 stage 458 og1resp.bits.resp := Mux(!og1FailedVec2(iqIdx)(iuIdx), 459 if (toIU.issueQueueParams match { case x => x.isMemAddrIQ && !x.isVecMemIQ || x.inVfSchd}) RespType.uncertain else RespType.success, 460 RespType.block 461 ) 462 og1resp.bits.fuType := s1_toExuData(iqIdx)(iuIdx).fuType 463 } 464 } 465 466 io.og0CancelOH := VecInit(fromFlattenIQ.map(x => x.valid && !x.fire)).asUInt 467 io.og1CancelOH := VecInit(toFlattenExu.map(x => x.valid && !x.fire)).asUInt 468 469 io.cancelToBusyTable.zipWithIndex.foreach { case (cancel, i) => 470 cancel.valid := fromFlattenIQ(i).valid && !fromFlattenIQ(i).fire 471 cancel.bits.rfWen := fromFlattenIQ(i).bits.common.rfWen.getOrElse(false.B) 472 cancel.bits.fpWen := fromFlattenIQ(i).bits.common.fpWen.getOrElse(false.B) 473 cancel.bits.vecWen := fromFlattenIQ(i).bits.common.vecWen.getOrElse(false.B) 474 cancel.bits.pdest := fromFlattenIQ(i).bits.common.pdest 475 } 476 477 if (backendParams.debugEn){ 478 dontTouch(og0_cancel_no_load) 479 dontTouch(is_0latency) 480 dontTouch(og0_cancel_delay) 481 dontTouch(isVfScheduler) 482 dontTouch(og0_cancel_delay_for_mem) 483 } 484 for (i <- toExu.indices) { 485 for (j <- toExu(i).indices) { 486 // s1Reg --[Ctrl]--> exu(s1) ---------- begin 487 // refs 488 val sinkData = toExu(i)(j).bits 489 // assign 490 toExu(i)(j).valid := s1_toExuValid(i)(j) 491 s1_toExuReady(i)(j) := toExu(i)(j).ready 492 sinkData := s1_toExuData(i)(j) 493 // s1Reg --[Ctrl]--> exu(s1) ---------- end 494 495 // s1Reg --[Data]--> exu(s1) ---------- begin 496 // data source1: preg read data 497 for (k <- sinkData.src.indices) { 498 val srcDataTypeSet: Set[DataConfig] = sinkData.params.getSrcDataType(k) 499 500 val readRfMap: Seq[(Bool, UInt)] = (Seq(None) :+ 501 (if (s1_intPregRData(i)(j).isDefinedAt(k) && srcDataTypeSet.intersect(IntRegSrcDataSet).nonEmpty) 502 Some(SrcType.isXp(s1_srcType(i)(j)(k)) -> s1_intPregRData(i)(j)(k)) 503 else None) :+ 504 (if (s1_vfPregRData(i)(j).isDefinedAt(k) && srcDataTypeSet.intersect(VfRegSrcDataSet).nonEmpty) 505 Some(SrcType.isVp(s1_srcType(i)(j)(k))-> s1_vfPregRData(i)(j)(k)) 506 else None) :+ 507 (if (s1_fpPregRData(i)(j).isDefinedAt(k) && srcDataTypeSet.intersect(FpRegSrcDataSet).nonEmpty) 508 Some(SrcType.isFp(s1_srcType(i)(j)(k)) -> s1_fpPregRData(i)(j)(k)) 509 else None) 510 ).filter(_.nonEmpty).map(_.get) 511 if (readRfMap.nonEmpty) 512 sinkData.src(k) := Mux1H(readRfMap) 513 } 514 if (sinkData.params.hasJmpFu) { 515 val index = pcReadFtqPtrFormIQ.map(_.bits.exuParams).indexOf(sinkData.params) 516 sinkData.pc.get := pcRdata(index) 517 } 518 if (sinkData.params.needTarget) { 519 val index = pcReadFtqPtrFormIQ.map(_.bits.exuParams).indexOf(sinkData.params) 520 sinkData.predictInfo.get.target := targetPCRdata(index) 521 } 522 } 523 } 524 525 if (env.AlwaysBasicDiff || env.EnableDifftest) { 526 val delayedCnt = 2 527 val difftestArchIntRegState = DifftestModule(new DiffArchIntRegState, delay = delayedCnt) 528 difftestArchIntRegState.coreid := io.hartId 529 difftestArchIntRegState.value := intDebugRead.get._2 530 531 val difftestArchFpRegState = DifftestModule(new DiffArchFpRegState, delay = delayedCnt) 532 difftestArchFpRegState.coreid := io.hartId 533 difftestArchFpRegState.value := fpDebugReadData.get 534 535 val difftestArchVecRegState = DifftestModule(new DiffArchVecRegState, delay = delayedCnt) 536 difftestArchVecRegState.coreid := io.hartId 537 difftestArchVecRegState.value := vecDebugReadData.get 538 } 539 540 val int_regcache_size = 48 541 val int_regcache_tag = RegInit(VecInit(Seq.fill(int_regcache_size)(0.U(intSchdParams.pregIdxWidth.W)))) 542 val int_regcache_enqPtr = RegInit(0.U(log2Up(int_regcache_size).W)) 543 int_regcache_enqPtr := int_regcache_enqPtr + PopCount(intRfWen) 544 for (i <- intRfWen.indices) { 545 when (intRfWen(i)) { 546 int_regcache_tag(int_regcache_enqPtr + PopCount(intRfWen.take(i))) := intRfWaddr(i) 547 } 548 } 549 550 val vf_regcache_size = 48 551 val vf_regcache_tag = RegInit(VecInit(Seq.fill(vf_regcache_size)(0.U(vfSchdParams.pregIdxWidth.W)))) 552 val vf_regcache_enqPtr = RegInit(0.U(log2Up(vf_regcache_size).W)) 553 vf_regcache_enqPtr := vf_regcache_enqPtr + PopCount(vfRfWen.head) 554 for (i <- vfRfWen.indices) { 555 when (vfRfWen.head(i)) { 556 vf_regcache_tag(vf_regcache_enqPtr + PopCount(vfRfWen.head.take(i))) := vfRfWaddr(i) 557 } 558 } 559 560 XSPerfHistogram(s"IntRegFileRead_hist", PopCount(intRFReadArbiter.io.in.flatten.flatten.map(_.valid)), true.B, 0, 20, 1) 561 XSPerfHistogram(s"FpRegFileRead_hist", PopCount(fpRFReadArbiter.io.in.flatten.flatten.map(_.valid)), true.B, 0, 20, 1) 562 XSPerfHistogram(s"VfRegFileRead_hist", PopCount(vfRFReadArbiter.io.in.flatten.flatten.map(_.valid)), true.B, 0, 20, 1) 563 XSPerfHistogram(s"IntRegFileWrite_hist", PopCount(intRFWriteReq.flatten), true.B, 0, 20, 1) 564 XSPerfHistogram(s"FpRegFileWrite_hist", PopCount(fpRFWriteReq.flatten), true.B, 0, 20, 1) 565 XSPerfHistogram(s"VfRegFileWrite_hist", PopCount(vfRFWriteReq.flatten), true.B, 0, 20, 1) 566 567 val int_regcache_part32 = (1 until 33).map(i => int_regcache_tag(int_regcache_enqPtr - i.U)) 568 val int_regcache_part24 = (1 until 24).map(i => int_regcache_tag(int_regcache_enqPtr - i.U)) 569 val int_regcache_part16 = (1 until 17).map(i => int_regcache_tag(int_regcache_enqPtr - i.U)) 570 val int_regcache_part8 = (1 until 9).map(i => int_regcache_tag(int_regcache_enqPtr - i.U)) 571 572 val int_regcache_48_hit_vec = intRFReadArbiter.io.in.flatten.flatten.map(x => x.valid && int_regcache_tag.map(_ === x.bits.addr).reduce(_ || _)) 573 val int_regcache_8_hit_vec = intRFReadArbiter.io.in.flatten.flatten.map(x => x.valid && int_regcache_part8.map(_ === x.bits.addr).reduce(_ || _)) 574 val int_regcache_16_hit_vec = intRFReadArbiter.io.in.flatten.flatten.map(x => x.valid && int_regcache_part16.map(_ === x.bits.addr).reduce(_ || _)) 575 val int_regcache_24_hit_vec = intRFReadArbiter.io.in.flatten.flatten.map(x => x.valid && int_regcache_part24.map(_ === x.bits.addr).reduce(_ || _)) 576 val int_regcache_32_hit_vec = intRFReadArbiter.io.in.flatten.flatten.map(x => x.valid && int_regcache_part32.map(_ === x.bits.addr).reduce(_ || _)) 577 XSPerfAccumulate("IntRegCache48Hit", PopCount(int_regcache_48_hit_vec)) 578 XSPerfAccumulate("IntRegCache8Hit", PopCount(int_regcache_8_hit_vec)) 579 XSPerfAccumulate("IntRegCache16Hit", PopCount(int_regcache_16_hit_vec)) 580 XSPerfAccumulate("IntRegCache24Hit", PopCount(int_regcache_24_hit_vec)) 581 XSPerfAccumulate("IntRegCache32Hit", PopCount(int_regcache_32_hit_vec)) 582 XSPerfHistogram("IntRegCache48Hit_hist", PopCount(int_regcache_48_hit_vec), true.B, 0, 16, 2) 583 584 XSPerfAccumulate(s"IntRFReadBeforeArb", PopCount(intRFReadArbiter.io.in.flatten.flatten.map(_.valid))) 585 XSPerfAccumulate(s"IntRFReadAfterArb", PopCount(intRFReadArbiter.io.out.map(_.valid))) 586 XSPerfAccumulate(s"FpRFReadBeforeArb", PopCount(fpRFReadArbiter.io.in.flatten.flatten.map(_.valid))) 587 XSPerfAccumulate(s"FpRFReadAfterArb", PopCount(fpRFReadArbiter.io.out.map(_.valid))) 588 XSPerfAccumulate(s"VfRFReadBeforeArb", PopCount(vfRFReadArbiter.io.in.flatten.flatten.map(_.valid))) 589 XSPerfAccumulate(s"VfRFReadAfterArb", PopCount(vfRFReadArbiter.io.out.map(_.valid))) 590 XSPerfAccumulate(s"IntUopBeforeArb", PopCount(fromIntIQ.flatten.map(_.valid))) 591 XSPerfAccumulate(s"IntUopAfterArb", PopCount(fromIntIQ.flatten.map(_.fire))) 592 XSPerfAccumulate(s"MemUopBeforeArb", PopCount(fromMemIQ.flatten.map(_.valid))) 593 XSPerfAccumulate(s"MemUopAfterArb", PopCount(fromMemIQ.flatten.map(_.fire))) 594 XSPerfAccumulate(s"VfUopBeforeArb", PopCount(fromVfIQ.flatten.map(_.valid))) 595 XSPerfAccumulate(s"VfUopAfterArb", PopCount(fromVfIQ.flatten.map(_.fire))) 596 597 XSPerfHistogram(s"IntRFReadBeforeArb_hist", PopCount(intRFReadArbiter.io.in.flatten.flatten.map(_.valid)), true.B, 0, 16, 2) 598 XSPerfHistogram(s"IntRFReadAfterArb_hist", PopCount(intRFReadArbiter.io.out.map(_.valid)), true.B, 0, 16, 2) 599 XSPerfHistogram(s"FpRFReadBeforeArb_hist", PopCount(fpRFReadArbiter.io.in.flatten.flatten.map(_.valid)), true.B, 0, 16, 2) 600 XSPerfHistogram(s"FpRFReadAfterArb_hist", PopCount(fpRFReadArbiter.io.out.map(_.valid)), true.B, 0, 16, 2) 601 XSPerfHistogram(s"VfRFReadBeforeArb_hist", PopCount(vfRFReadArbiter.io.in.flatten.flatten.map(_.valid)), true.B, 0, 16, 2) 602 XSPerfHistogram(s"VfRFReadAfterArb_hist", PopCount(vfRFReadArbiter.io.out.map(_.valid)), true.B, 0, 16, 2) 603 XSPerfHistogram(s"IntUopBeforeArb_hist", PopCount(fromIntIQ.flatten.map(_.valid)), true.B, 0, 8, 2) 604 XSPerfHistogram(s"IntUopAfterArb_hist", PopCount(fromIntIQ.flatten.map(_.fire)), true.B, 0, 8, 2) 605 XSPerfHistogram(s"MemUopBeforeArb_hist", PopCount(fromMemIQ.flatten.map(_.valid)), true.B, 0, 8, 2) 606 XSPerfHistogram(s"MemUopAfterArb_hist", PopCount(fromMemIQ.flatten.map(_.fire)), true.B, 0, 8, 2) 607 XSPerfHistogram(s"VfUopBeforeArb_hist", PopCount(fromVfIQ.flatten.map(_.valid)), true.B, 0, 8, 2) 608 XSPerfHistogram(s"VfUopAfterArb_hist", PopCount(fromVfIQ.flatten.map(_.fire)), true.B, 0, 8, 2) 609} 610 611class DataPathIO()(implicit p: Parameters, params: BackendParams) extends XSBundle { 612 // params 613 private val intSchdParams = params.schdParams(IntScheduler()) 614 private val fpSchdParams = params.schdParams(FpScheduler()) 615 private val vfSchdParams = params.schdParams(VfScheduler()) 616 private val memSchdParams = params.schdParams(MemScheduler()) 617 // bundles 618 val hartId = Input(UInt(8.W)) 619 620 val flush: ValidIO[Redirect] = Flipped(ValidIO(new Redirect)) 621 622 val wbConfictRead = Input(MixedVec(params.allSchdParams.map(x => MixedVec(x.issueBlockParams.map(x => x.genWbConflictBundle()))))) 623 624 val fromIntIQ: MixedVec[MixedVec[DecoupledIO[IssueQueueIssueBundle]]] = 625 Flipped(MixedVec(intSchdParams.issueBlockParams.map(_.genIssueDecoupledBundle))) 626 627 val fromFpIQ: MixedVec[MixedVec[DecoupledIO[IssueQueueIssueBundle]]] = 628 Flipped(MixedVec(fpSchdParams.issueBlockParams.map(_.genIssueDecoupledBundle))) 629 630 val fromMemIQ: MixedVec[MixedVec[DecoupledIO[IssueQueueIssueBundle]]] = 631 Flipped(MixedVec(memSchdParams.issueBlockParams.map(_.genIssueDecoupledBundle))) 632 633 val fromVfIQ = Flipped(MixedVec(vfSchdParams.issueBlockParams.map(_.genIssueDecoupledBundle))) 634 635 val toIntIQ = MixedVec(intSchdParams.issueBlockParams.map(_.genOGRespBundle)) 636 637 val toFpIQ = MixedVec(fpSchdParams.issueBlockParams.map(_.genOGRespBundle)) 638 639 val toMemIQ = MixedVec(memSchdParams.issueBlockParams.map(_.genOGRespBundle)) 640 641 val toVfIQ = MixedVec(vfSchdParams.issueBlockParams.map(_.genOGRespBundle)) 642 643 val og0CancelOH = Output(ExuOH(backendParams.numExu)) 644 645 val og1CancelOH = Output(ExuOH(backendParams.numExu)) 646 647 val ldCancel = Vec(backendParams.LduCnt + backendParams.HyuCnt, Flipped(new LoadCancelIO)) 648 649 val cancelToBusyTable = Vec(backendParams.numExu, ValidIO(new CancelSignal)) 650 651 val toIntExu: MixedVec[MixedVec[DecoupledIO[ExuInput]]] = intSchdParams.genExuInputBundle 652 653 val toFpExu: MixedVec[MixedVec[DecoupledIO[ExuInput]]] = MixedVec(fpSchdParams.genExuInputBundle) 654 655 val toVecExu: MixedVec[MixedVec[DecoupledIO[ExuInput]]] = MixedVec(vfSchdParams.genExuInputBundle) 656 657 val toMemExu: MixedVec[MixedVec[DecoupledIO[ExuInput]]] = memSchdParams.genExuInputBundle 658 659 val og1ImmInfo: Vec[ImmInfo] = Output(Vec(params.allExuParams.size, new ImmInfo)) 660 661 val fromIntWb: MixedVec[RfWritePortWithConfig] = MixedVec(params.genIntWriteBackBundle) 662 663 val fromFpWb: MixedVec[RfWritePortWithConfig] = MixedVec(params.genFpWriteBackBundle) 664 665 val fromVfWb: MixedVec[RfWritePortWithConfig] = MixedVec(params.genVfWriteBackBundle) 666 667 val fromPcTargetMem = Flipped(new PcToDataPathIO(params)) 668 669 val debugIntRat = if (params.debugEn) Some(Input(Vec(32, UInt(intSchdParams.pregIdxWidth.W)))) else None 670 val debugFpRat = if (params.debugEn) Some(Input(Vec(32, UInt(fpSchdParams.pregIdxWidth.W)))) else None 671 val debugVecRat = if (params.debugEn) Some(Input(Vec(32, UInt(vfSchdParams.pregIdxWidth.W)))) else None 672 val debugVconfigRat = if (params.debugEn) Some(Input(UInt(vfSchdParams.pregIdxWidth.W))) else None 673 val debugVconfig = if (params.debugEn) Some(Output(UInt(XLEN.W))) else None 674} 675