xref: /XiangShan/src/main/scala/xiangshan/backend/datapath/DataPath.scala (revision ea0f92d8a18e593ddd63d932eaff3d3099c091c0)
1package xiangshan.backend.datapath
2
3import chipsalliance.rocketchip.config.Parameters
4import chisel3._
5import chisel3.util._
6import difftest.{DifftestArchFpRegState, DifftestArchIntRegState, DifftestArchVecRegState}
7import freechips.rocketchip.diplomacy.{LazyModule, LazyModuleImp}
8import utility._
9import xiangshan._
10import xiangshan.backend.BackendParams
11import xiangshan.backend.datapath.DataConfig._
12import xiangshan.backend.datapath.RdConfig._
13import xiangshan.backend.issue.{ImmExtractor, IntScheduler, MemScheduler, VfScheduler}
14import xiangshan.backend.Bundles._
15import xiangshan.backend.regfile._
16
17class RFArbiterBundle(addrWidth: Int)(implicit p: Parameters) extends XSBundle {
18  val addr = UInt(addrWidth.W)
19}
20
21class RFReadArbiterIO(inPortSize: Int, outPortSize: Int, pregWidth: Int)(implicit p: Parameters) extends XSBundle {
22  val in = Vec(inPortSize, Flipped(DecoupledIO(new RFArbiterBundle(pregWidth))))
23  val out = Vec(outPortSize, Valid(new RFArbiterBundle(pregWidth)))
24  val flush = Flipped(ValidIO(new Redirect))
25}
26
27class RFReadArbiter(isInt: Boolean)(implicit p: Parameters) extends XSModule {
28  val allExuParams = backendParams.allExuParams
29
30  val portConfigs = allExuParams.map(_.rfrPortConfigs.flatten).flatten.filter{
31    rfrPortConfigs =>
32      if(isInt){
33        rfrPortConfigs.isInstanceOf[IntRD]
34      }
35      else{
36        rfrPortConfigs.isInstanceOf[VfRD]
37      }
38  }
39
40  val pregParams = if(isInt) backendParams.intPregParams else backendParams.vfPregParams
41
42  val io = IO(new RFReadArbiterIO(portConfigs.size, backendParams.numRfRead, pregParams.addrWidth))
43  // inGroup[port -> Bundle]
44  val inGroup: Map[Int, IndexedSeq[(DecoupledIO[RFArbiterBundle], RdConfig)]] = io.in.zip(portConfigs).groupBy{ case(port, config) => config.port}
45  // sort by priority
46  val inGroupSorted: Map[Int, IndexedSeq[(DecoupledIO[RFArbiterBundle], RdConfig)]] = inGroup.map{
47    case(key, value) => (key -> value.sortBy{ case(port, config) => config.priority})
48  }
49
50  private val arbiters: Seq[Option[Arbiter[RFArbiterBundle]]] = Seq.tabulate(backendParams.numRfRead) { x => {
51    if (inGroupSorted.contains(x)) {
52      Some(Module(new Arbiter(new RFArbiterBundle(pregParams.addrWidth), inGroupSorted(x).length)))
53    } else {
54      None
55    }
56  }}
57
58  arbiters.zipWithIndex.foreach { case (arb, i) =>
59    if (arb.nonEmpty) {
60      arb.get.io.in.zip(inGroupSorted(i).map(_._1)).foreach { case (arbIn, addrIn) =>
61        arbIn <> addrIn
62      }
63    }
64  }
65
66  io.out.zip(arbiters).foreach { case (addrOut, arb) =>
67    if (arb.nonEmpty) {
68      val arbOut = arb.get.io.out
69      arbOut.ready := true.B
70      addrOut.valid := arbOut.valid
71      addrOut.bits := arbOut.bits
72    } else {
73      addrOut := 0.U.asTypeOf(addrOut)
74    }
75  }
76}
77
78class DataPath(params: BackendParams)(implicit p: Parameters) extends LazyModule {
79  private implicit val dpParams: BackendParams = params
80  lazy val module = new DataPathImp(this)
81}
82
83class DataPathImp(override val wrapper: DataPath)(implicit p: Parameters, params: BackendParams)
84  extends LazyModuleImp(wrapper) with HasXSParameter {
85
86  val io = IO(new DataPathIO())
87
88  private val (fromIntIQ, toIntIQ, toIntExu) = (io.fromIntIQ, io.toIntIQ, io.toIntExu)
89  private val (fromMemIQ, toMemIQ, toMemExu) = (io.fromMemIQ, io.toMemIQ, io.toMemExu)
90  private val (fromVfIQ , toVfIQ , toVfExu ) = (io.fromVfIQ , io.toVfIQ , io.toFpExu)
91
92  println(s"[DataPath] IntIQ(${fromIntIQ.size}), MemIQ(${fromMemIQ.size})")
93  println(s"[DataPath] IntExu(${fromIntIQ.map(_.size).sum}), MemExu(${fromMemIQ.map(_.size).sum})")
94
95  // just refences for convience
96  private val fromIQ = fromIntIQ ++ fromVfIQ ++ fromMemIQ
97
98  private val toIQs = toIntIQ ++ toVfIQ ++ toMemIQ
99
100  private val toExu = toIntExu ++ toVfExu ++ toMemExu
101
102  private val intRFReadArbiter = Module(new RFReadArbiter(true))
103  private val vfRFReadArbiter = Module(new RFReadArbiter(false))
104
105  private val issuePortsIn = fromIQ.flatten
106  private val intBlocks = fromIQ.map{ case iq => Wire(Vec(iq.size, Bool())) }
107  private val intBlocksSeq = intBlocks.flatten
108  private val vfBlocks = fromIQ.map { case iq => Wire(Vec(iq.size, Bool())) }
109  private val vfBlocksSeq = vfBlocks.flatten
110
111  val intReadPortInSize = issuePortsIn.map(issuePortIn => issuePortIn.bits.getIntRfReadBundle.size).scan(0)(_ + _)
112  issuePortsIn.zipWithIndex.foreach{
113    case (issuePortIn, idx) =>
114      val readPortIn = issuePortIn.bits.getIntRfReadBundle
115      val l = intReadPortInSize(idx)
116      val r = intReadPortInSize(idx + 1)
117      val arbiterIn = intRFReadArbiter.io.in.slice(l, r)
118      arbiterIn.zip(readPortIn).foreach{
119        case(sink, source) =>
120          sink.bits.addr := source.addr
121          sink.valid := issuePortIn.valid && SrcType.isXp(source.srcType)
122      }
123      if(r > l){
124        intBlocksSeq(idx) := !arbiterIn.zip(readPortIn).map {
125          case (sink, source) => Mux(SrcType.isXp(source.srcType), sink.ready, true.B)
126        }.reduce(_ & _)
127      }
128      else{
129        intBlocksSeq(idx) := false.B
130      }
131  }
132  intRFReadArbiter.io.flush := io.flush
133
134  val vfReadPortInSize = issuePortsIn.map(issuePortIn => issuePortIn.bits.getFpRfReadBundle.size).scan(0)(_ + _)
135  issuePortsIn.zipWithIndex.foreach {
136    case (issuePortIn, idx) =>
137      val readPortIn = issuePortIn.bits.getFpRfReadBundle
138      val l = vfReadPortInSize(idx)
139      val r = vfReadPortInSize(idx + 1)
140      val arbiterIn = vfRFReadArbiter.io.in.slice(l, r)
141      arbiterIn.zip(readPortIn).foreach {
142        case (sink, source) =>
143          sink.bits.addr := source.addr
144          sink.valid := issuePortIn.valid && SrcType.isVfp(source.srcType)
145      }
146      if (r > l) {
147        vfBlocksSeq(idx) := !arbiterIn.zip(readPortIn).map {
148          case (sink, source) => Mux(SrcType.isVfp(source.srcType), sink.ready, true.B)
149        }.reduce(_ & _)
150      }
151      else {
152        vfBlocksSeq(idx) := false.B
153      }
154  }
155  vfRFReadArbiter.io.flush := io.flush
156
157  private val intSchdParams = params.schdParams(IntScheduler())
158  private val vfSchdParams = params.schdParams(VfScheduler())
159  private val memSchdParams = params.schdParams(MemScheduler())
160
161  private val numIntRfReadByExu = intSchdParams.numIntRfReadByExu + memSchdParams.numIntRfReadByExu
162  private val numVfRfReadByExu = vfSchdParams.numVfRfReadByExu + memSchdParams.numVfRfReadByExu
163  // Todo: limit read port
164  private val numIntR = numIntRfReadByExu
165  private val numVfR = numVfRfReadByExu
166  println(s"[DataPath] RegFile read req needed by Exu: Int(${numIntRfReadByExu}), Vf(${numVfRfReadByExu})")
167  println(s"[DataPath] RegFile read port: Int(${numIntR}), Vf(${numVfR})")
168
169  private val schdParams = params.allSchdParams
170
171  private val intRfRaddr = Wire(Vec(params.numRfRead, UInt(intSchdParams.pregIdxWidth.W)))
172  private val intRfRdata = Wire(Vec(params.numRfRead, UInt(intSchdParams.rfDataWidth.W)))
173  private val intRfWen = Wire(Vec(io.fromIntWb.length, Bool()))
174  private val intRfWaddr = Wire(Vec(io.fromIntWb.length, UInt(intSchdParams.pregIdxWidth.W)))
175  private val intRfWdata = Wire(Vec(io.fromIntWb.length, UInt(intSchdParams.rfDataWidth.W)))
176
177  private val vfRfSplitNum = VLEN / XLEN
178  private val vfRfRaddr = Wire(Vec(params.numRfRead, UInt(vfSchdParams.pregIdxWidth.W)))
179  private val vfRfRdata = Wire(Vec(params.numRfRead, UInt(vfSchdParams.rfDataWidth.W)))
180  private val vfRfWen = Wire(Vec(vfRfSplitNum, Vec(io.fromVfWb.length, Bool())))
181  private val vfRfWaddr = Wire(Vec(io.fromVfWb.length, UInt(vfSchdParams.pregIdxWidth.W)))
182  private val vfRfWdata = Wire(Vec(io.fromVfWb.length, UInt(vfSchdParams.rfDataWidth.W)))
183
184  private val intDebugRead: Option[(Vec[UInt], Vec[UInt])] =
185    if (env.AlwaysBasicDiff || env.EnableDifftest) {
186      Some(Wire(Vec(32, UInt(intSchdParams.pregIdxWidth.W))), Wire(Vec(32, UInt(XLEN.W))))
187    } else { None }
188  private val vfDebugRead: Option[(Vec[UInt], Vec[UInt])] =
189    if (env.AlwaysBasicDiff || env.EnableDifftest) {
190      Some(Wire(Vec(32 + 32, UInt(vfSchdParams.pregIdxWidth.W))), Wire(Vec(32 + 32, UInt(VLEN.W))))
191    } else { None }
192
193  private val fpDebugReadData: Option[Vec[UInt]] =
194    if (env.AlwaysBasicDiff || env.EnableDifftest) {
195      Some(Wire(Vec(32, UInt(XLEN.W))))
196    } else { None }
197  private val vecDebugReadData: Option[Vec[UInt]] =
198    if (env.AlwaysBasicDiff || env.EnableDifftest) {
199      Some(Wire(Vec(64, UInt(64.W)))) // v0 = Cat(Vec(1), Vec(0))
200    } else { None }
201
202  fpDebugReadData.foreach(_ := vfDebugRead
203    .get._2
204    .slice(0, 32)
205    .map(_(63, 0))
206  ) // fp only used [63, 0]
207  vecDebugReadData.foreach(_ := vfDebugRead
208    .get._2
209    .slice(32, 64)
210    .map(x => Seq(x(63, 0), x(127, 64))).flatten
211  )
212
213  IntRegFile("IntRegFile", intSchdParams.numPregs, intRfRaddr, intRfRdata, intRfWen, intRfWaddr, intRfWdata,
214    debugReadAddr = intDebugRead.map(_._1),
215    debugReadData = intDebugRead.map(_._2))
216  VfRegFile("VfRegFile", vfSchdParams.numPregs, vfRfSplitNum, vfRfRaddr, vfRfRdata, vfRfWen, vfRfWaddr, vfRfWdata,
217    debugReadAddr = vfDebugRead.map(_._1),
218    debugReadData = vfDebugRead.map(_._2))
219
220  intRfWaddr := io.fromIntWb.map(_.addr)
221  intRfWdata := io.fromIntWb.map(_.data)
222  intRfWen := io.fromIntWb.map(_.wen)
223
224  intRFReadArbiter.io.out.map(_.bits.addr).zip(intRfRaddr).foreach{ case(source, sink) => sink := source }
225
226  vfRfWaddr := io.fromVfWb.map(_.addr)
227  vfRfWdata := io.fromVfWb.map(_.data)
228  vfRfWen.foreach(_.zip(io.fromVfWb.map(_.wen)).foreach { case (wenSink, wenSource) => wenSink := wenSource } )// Todo: support fp multi-write
229
230  vfRFReadArbiter.io.out.map(_.bits.addr).zip(vfRfRaddr).foreach{ case(source, sink) => sink := source }
231
232  intDebugRead.foreach { case (addr, _) =>
233    addr := io.debugIntRat
234  }
235
236  vfDebugRead.foreach { case (addr, _) =>
237    addr := io.debugFpRat ++ io.debugVecRat
238  }
239  println(s"[DataPath] " +
240    s"has intDebugRead: ${intDebugRead.nonEmpty}, " +
241    s"has vfDebugRead: ${vfDebugRead.nonEmpty}")
242
243  val s1_addrOHs = Reg(MixedVec(
244    fromIQ.map(x => MixedVec(x.map(_.bits.addrOH.cloneType)))
245  ))
246  val s1_toExuValid: MixedVec[MixedVec[Bool]] = Reg(MixedVec(
247    toExu.map(x => MixedVec(x.map(_.valid.cloneType)))
248  ))
249  val s1_toExuData: MixedVec[MixedVec[ExuInput]] = Reg(MixedVec(toExu.map(x => MixedVec(x.map(_.bits.cloneType)))))
250  val s1_toExuReady = Wire(MixedVec(toExu.map(x => MixedVec(x.map(_.ready.cloneType))))) // Todo
251  val s1_srcType: MixedVec[MixedVec[Vec[UInt]]] = MixedVecInit(fromIQ.map(x => MixedVecInit(x.map(xx => RegEnable(xx.bits.srcType, xx.fire)))))
252
253  val s1_intPregRData: MixedVec[MixedVec[Vec[UInt]]] = Wire(MixedVec(toExu.map(x => MixedVec(x.map(_.bits.src.cloneType)))))
254  val s1_vfPregRData: MixedVec[MixedVec[Vec[UInt]]] = Wire(MixedVec(toExu.map(x => MixedVec(x.map(_.bits.src.cloneType)))))
255
256  val rfrPortConfigs = schdParams.map(_.issueBlockParams).flatten.map(_.exuBlockParams.map(_.rfrPortConfigs))
257
258  println(s"[DataPath] s1_intPregRData.flatten.flatten.size: ${s1_intPregRData.flatten.flatten.size}, intRfRdata.size: ${intRfRdata.size}")
259  s1_intPregRData.foreach(_.foreach(_.foreach(_ := 0.U)))
260  s1_intPregRData.zip(rfrPortConfigs).foreach { case (iqRdata, iqCfg) =>
261      iqRdata.zip(iqCfg).foreach { case (iuRdata, iuCfg) =>
262        val realIuCfg = iuCfg.map(x => if(x.size > 1) x.filter(_.isInstanceOf[IntRD]) else x).flatten
263        assert(iuRdata.size == realIuCfg.size, "iuRdata.size != realIuCfg.size")
264        iuRdata.zip(realIuCfg)
265          .filter { case (_, rfrPortConfig) => rfrPortConfig.isInstanceOf[IntRD] }
266          .foreach { case (sink, cfg) => sink := intRfRdata(cfg.port) }
267      }
268  }
269
270  println(s"[DataPath] s1_vfPregRData.flatten.flatten.size: ${s1_vfPregRData.flatten.flatten.size}, vfRfRdata.size: ${vfRfRdata.size}")
271  s1_vfPregRData.foreach(_.foreach(_.foreach(_ := 0.U)))
272  s1_vfPregRData.zip(rfrPortConfigs).foreach{ case(iqRdata, iqCfg) =>
273      iqRdata.zip(iqCfg).foreach{ case(iuRdata, iuCfg) =>
274        val realIuCfg = iuCfg.map(x => if(x.size > 1) x.filter(_.isInstanceOf[VfRD]) else x).flatten
275        assert(iuRdata.size == realIuCfg.size, "iuRdata.size != realIuCfg.size")
276        iuRdata.zip(realIuCfg)
277          .filter { case (_, rfrPortConfig) => rfrPortConfig.isInstanceOf[VfRD] }
278          .foreach { case (sink, cfg) => sink := vfRfRdata(cfg.port) }
279      }
280  }
281
282  //  var intRfRdataIdx = 0
283//  var vfRfRdataIdx = 0
284//  for (iqIdx <- toExu.indices) {
285//    for (exuIdx <- toExu(iqIdx).indices) {
286//      for (srcIdx <- toExu(iqIdx)(exuIdx).bits.src.indices) {
287//        val readDataCfgSet = toExu(iqIdx)(exuIdx).bits.params.getSrcDataType(srcIdx)
288//        // need read int reg
289//        if (readDataCfgSet.intersect(IntRegSrcDataSet).nonEmpty) {
290//          println(s"[DataPath] (iqIdx, exuIdx, srcIdx): ($iqIdx, $exuIdx, $srcIdx)")
291//          s1_intPregRData(iqIdx)(exuIdx)(srcIdx) := intRfRdata(intRfRdataIdx)
292//        } else {
293//          // better for debug, should never assigned to other bundles
294//          s1_intPregRData(iqIdx)(exuIdx)(srcIdx) := "hdead_beef_dead_beef".U
295//        }
296//        // need read vf reg
297//        if (readDataCfgSet.intersect(VfRegSrcDataSet).nonEmpty) {
298//          s1_vfPregRData(iqIdx)(exuIdx)(srcIdx) := vfRfRdata(vfRfRdataIdx)
299//          vfRfRdataIdx += 1
300//        } else {
301//          // better for debug, should never assigned to other bundles
302//          s1_vfPregRData(iqIdx)(exuIdx)(srcIdx) := "hdead_beef_dead_beef_dead_beef_dead_beef".U
303//        }
304//      }
305//    }
306//  }
307//
308//  println(s"[DataPath] assigned RegFile Rdata: int(${intRfRdataIdx}), vf(${vfRfRdataIdx})")
309
310  for (i <- fromIQ.indices) {
311    for (j <- fromIQ(i).indices) {
312      // IQ(s0) --[Ctrl]--> s1Reg ---------- begin
313      // refs
314      val s1_valid = s1_toExuValid(i)(j)
315      val s1_ready = s1_toExuReady(i)(j)
316      val s1_data = s1_toExuData(i)(j)
317      val s1_addrOH = s1_addrOHs(i)(j)
318      val s0 = fromIQ(i)(j) // s0
319      val block = intBlocks(i)(j) || vfBlocks(i)(j)
320      val s1_flush = s0.bits.common.robIdx.needFlush(Seq(io.flush, RegNextWithEnable(io.flush)))
321      when (s0.fire && !s1_flush && !block) {
322        s1_valid := s0.valid
323        s1_data.fromIssueBundle(s0.bits) // no src data here
324        s1_addrOH := s0.bits.addrOH
325      }.otherwise {
326        s1_valid := false.B
327      }
328
329      s0.ready := (s1_ready || !s1_valid) && !block
330      // IQ(s0) --[Ctrl]--> s1Reg ---------- end
331
332      // IQ(s0) --[Data]--> s1Reg ---------- begin
333      // imm extract
334      when (s0.fire && !s1_flush && !block) {
335        if (s1_data.params.immType.nonEmpty && s1_data.src.size > 1) {
336          // rs1 is always int reg, rs2 may be imm
337          when(SrcType.isImm(s0.bits.srcType(1))) {
338            s1_data.src(1) := ImmExtractor(
339              s0.bits.common.imm,
340              s0.bits.immType,
341              s1_data.DataBits,
342              s1_data.params.immType.map(_.litValue)
343            )
344          }
345        }
346        if (s1_data.params.hasJmpFu) {
347          when(SrcType.isPc(s0.bits.srcType(0))) {
348            s1_data.src(0) := SignExt(s0.bits.jmp.get.pc, XLEN)
349          }
350        }
351      }
352      // IQ(s0) --[Data]--> s1Reg ---------- end
353    }
354  }
355
356  private val fromIQFire = fromIQ.map(_.map(_.fire))
357  private val toExuFire = toExu.map(_.map(_.fire))
358  toIQs.zipWithIndex.foreach {
359    case(toIQ, iqIdx) =>
360      toIQ.zipWithIndex.foreach {
361        case (toIU, iuIdx) =>
362          // IU: issue unit
363          val og0resp = toIU.og0resp
364          og0resp.valid := fromIQ(iqIdx)(iuIdx).valid && (!fromIQFire(iqIdx)(iuIdx))
365          og0resp.bits.respType := RSFeedbackType.rfArbitFail
366          og0resp.bits.success := false.B
367          og0resp.bits.addrOH := fromIQ(iqIdx)(iuIdx).bits.addrOH
368
369          val og1resp = toIU.og1resp
370          og1resp.valid := s1_toExuValid(iqIdx)(iuIdx)
371          og1resp.bits.respType := Mux(toExuFire(iqIdx)(iuIdx), RSFeedbackType.fuIdle, RSFeedbackType.fuBusy)
372          og1resp.bits.success := false.B
373          og1resp.bits.addrOH := s1_addrOHs(iqIdx)(iuIdx)
374      }
375  }
376
377  for (i <- toExu.indices) {
378    for (j <- toExu(i).indices) {
379      // s1Reg --[Ctrl]--> exu(s1) ---------- begin
380      // refs
381      val sinkData = toExu(i)(j).bits
382      // assign
383      toExu(i)(j).valid := s1_toExuValid(i)(j)
384      s1_toExuReady(i)(j) := toExu(i)(j).ready
385      sinkData := s1_toExuData(i)(j)
386      // s1Reg --[Ctrl]--> exu(s1) ---------- end
387
388      // s1Reg --[Data]--> exu(s1) ---------- begin
389      // data source1: preg read data
390      for (k <- sinkData.src.indices) {
391        val srcDataTypeSet: Set[DataConfig] = sinkData.params.getSrcDataType(k)
392
393        val readRfMap: Seq[(Bool, UInt)] = (Seq(None) :+
394          (if (s1_intPregRData(i)(j).isDefinedAt(k) && srcDataTypeSet.intersect(IntRegSrcDataSet).nonEmpty)
395            Some(SrcType.isXp(s1_srcType(i)(j)(k)) -> s1_intPregRData(i)(j)(k))
396          else None) :+
397          (if (s1_vfPregRData(i)(j).isDefinedAt(k) && srcDataTypeSet.intersect(VfRegSrcDataSet).nonEmpty)
398            Some(SrcType.isVfp(s1_srcType(i)(j)(k))-> s1_vfPregRData(i)(j)(k))
399          else None)
400        ).filter(_.nonEmpty).map(_.get)
401        if (readRfMap.nonEmpty)
402          sinkData.src(k) := Mux1H(readRfMap)
403      }
404
405      // data source2: extracted imm and pc saved in s1Reg
406      if (sinkData.params.immType.nonEmpty && sinkData.src.size > 1) {
407        when(SrcType.isImm(s1_srcType(i)(j)(1))) {
408          sinkData.src(1) := s1_toExuData(i)(j).src(1)
409        }
410      }
411      if (sinkData.params.hasJmpFu) {
412        when(SrcType.isPc(s1_srcType(i)(j)(0))) {
413          sinkData.src(0) := s1_toExuData(i)(j).src(0)
414        }
415      }
416      // s1Reg --[Data]--> exu(s1) ---------- end
417    }
418  }
419
420  if (env.AlwaysBasicDiff || env.EnableDifftest) {
421    val delayedCnt = 2
422    val difftestArchIntRegState = Module(new DifftestArchIntRegState)
423    difftestArchIntRegState.io.clock := clock
424    difftestArchIntRegState.io.coreid := io.hartId
425    difftestArchIntRegState.io.gpr := DelayN(intDebugRead.get._2, delayedCnt)
426
427    val difftestArchFpRegState = Module(new DifftestArchFpRegState)
428    difftestArchFpRegState.io.clock := clock
429    difftestArchFpRegState.io.coreid := io.hartId
430    difftestArchFpRegState.io.fpr := DelayN(fpDebugReadData.get, delayedCnt)
431
432    val difftestArchVecRegState = Module(new DifftestArchVecRegState)
433    difftestArchVecRegState.io.clock := clock
434    difftestArchVecRegState.io.coreid := io.hartId
435    difftestArchVecRegState.io.vpr := DelayN(vecDebugReadData.get, delayedCnt)
436  }
437}
438
439class DataPathIO()(implicit p: Parameters, params: BackendParams) extends XSBundle {
440  // params
441  private val intSchdParams = params.schdParams(IntScheduler())
442  private val vfSchdParams = params.schdParams(VfScheduler())
443  private val memSchdParams = params.schdParams(MemScheduler())
444  // bundles
445  val hartId = Input(UInt(8.W))
446
447  val flush: ValidIO[Redirect] = Flipped(ValidIO(new Redirect))
448
449  val fromIntIQ: MixedVec[MixedVec[DecoupledIO[IssueQueueIssueBundle]]] =
450    Flipped(MixedVec(intSchdParams.issueBlockParams.map(_.genIssueDecoupledBundle)))
451
452  val fromMemIQ: MixedVec[MixedVec[DecoupledIO[IssueQueueIssueBundle]]] =
453    Flipped(MixedVec(memSchdParams.issueBlockParams.map(_.genIssueDecoupledBundle)))
454
455  val fromVfIQ = Flipped(MixedVec(vfSchdParams.issueBlockParams.map(_.genIssueDecoupledBundle)))
456
457  val toIntIQ = MixedVec(intSchdParams.issueBlockParams.map(_.genOGRespBundle))
458
459  val toMemIQ = MixedVec(memSchdParams.issueBlockParams.map(_.genOGRespBundle))
460
461  val toVfIQ = MixedVec(vfSchdParams.issueBlockParams.map(_.genOGRespBundle))
462
463  val toIntExu: MixedVec[MixedVec[DecoupledIO[ExuInput]]] = intSchdParams.genExuInputBundle
464
465  val toFpExu: MixedVec[MixedVec[DecoupledIO[ExuInput]]] = MixedVec(vfSchdParams.genExuInputBundle)
466
467  val toMemExu: MixedVec[MixedVec[DecoupledIO[ExuInput]]] = memSchdParams.genExuInputBundle
468
469  val fromIntWb: MixedVec[RfWritePortWithConfig] = MixedVec(params.genIntWriteBackBundle)
470
471  val fromVfWb: MixedVec[RfWritePortWithConfig] = MixedVec(params.genVfWriteBackBundle)
472
473  val debugIntRat = Input(Vec(32, UInt(intSchdParams.pregIdxWidth.W)))
474  val debugFpRat = Input(Vec(32, UInt(vfSchdParams.pregIdxWidth.W)))
475  val debugVecRat = Input(Vec(32, UInt(vfSchdParams.pregIdxWidth.W)))
476}
477