CtrlBlock.scala 15.6 KB
Newer Older
1 2 3 4
package xiangshan.backend

import chisel3._
import chisel3.util._
Y
Yinan Xu 已提交
5
import utils._
6
import xiangshan._
7
import xiangshan.backend.decode.{DecodeStage, ImmUnion, WaitTableParameters}
L
LinJiawei 已提交
8
import xiangshan.backend.rename.{BusyTable, Rename}
9 10
import xiangshan.backend.dispatch.Dispatch
import xiangshan.backend.exu._
11
import xiangshan.backend.exu.Exu.exuConfigs
L
LinJiawei 已提交
12
import xiangshan.backend.ftq.{Ftq, FtqRead, GetPcByFtq}
13
import xiangshan.backend.regfile.RfReadPort
14
import xiangshan.backend.roq.{Roq, RoqCSRIO, RoqLsqIO, RoqPtr}
Y
Yinan Xu 已提交
15
import xiangshan.mem.LsqEnqIO
16 17 18

class CtrlToIntBlockIO extends XSBundle {
  val enqIqCtrl = Vec(exuParameters.IntExuCnt, DecoupledIO(new MicroOp))
Y
Yinan Xu 已提交
19
  val readRf = Vec(NRIntReadPorts, Output(UInt(PhyRegIdxWidth.W)))
L
LinJiawei 已提交
20
  val jumpPc = Output(UInt(VAddrBits.W))
L
LinJiawei 已提交
21
  val jalr_target = Output(UInt(VAddrBits.W))
Y
YikeZhou 已提交
22 23
  // int block only uses port 0~7
  val readPortIndex = Vec(exuParameters.IntExuCnt, Output(UInt(log2Ceil(8 / 2).W))) // TODO parameterize 8 here
Y
Yinan Xu 已提交
24
  val redirect = ValidIO(new Redirect)
25
  val flush = Output(Bool())
26 27 28 29
}

class CtrlToFpBlockIO extends XSBundle {
  val enqIqCtrl = Vec(exuParameters.FpExuCnt, DecoupledIO(new MicroOp))
Y
Yinan Xu 已提交
30
  val readRf = Vec(NRFpReadPorts, Output(UInt(PhyRegIdxWidth.W)))
Y
YikeZhou 已提交
31 32
  // fp block uses port 0~11
  val readPortIndex = Vec(exuParameters.FpExuCnt, Output(UInt(log2Ceil((NRFpReadPorts - exuParameters.StuCnt) / 3).W)))
Y
Yinan Xu 已提交
33
  val redirect = ValidIO(new Redirect)
34
  val flush = Output(Bool())
35 36 37 38
}

class CtrlToLsBlockIO extends XSBundle {
  val enqIqCtrl = Vec(exuParameters.LsExuCnt, DecoupledIO(new MicroOp))
Y
Yinan Xu 已提交
39
  val enqLsq = Flipped(new LsqEnqIO)
40
  val waitTableUpdate = Vec(StorePipelineWidth, Input(new WaitTableUpdateReq))
Y
Yinan Xu 已提交
41
  val redirect = ValidIO(new Redirect)
42
  val flush = Output(Bool())
43 44
}

45
class RedirectGenerator extends XSModule with HasCircularQueuePtrHelper with WaitTableParameters {
L
ljw 已提交
46
  val numRedirect = exuParameters.JmpCnt + exuParameters.AluCnt
L
LinJiawei 已提交
47
  val io = IO(new Bundle() {
L
ljw 已提交
48
    val exuMispredict = Vec(numRedirect, Flipped(ValidIO(new ExuOutput)))
L
ljw 已提交
49
    val loadReplay = Flipped(ValidIO(new Redirect))
50
    val flush = Input(Bool())
L
ljw 已提交
51
    val stage1FtqRead = Vec(numRedirect + 1, new FtqRead)
L
LinJiawei 已提交
52
    val stage2FtqRead = new FtqRead
L
LinJiawei 已提交
53
    val stage2Redirect = ValidIO(new Redirect)
L
LinJiawei 已提交
54
    val stage3Redirect = ValidIO(new Redirect)
L
ljw 已提交
55
    val waitTableUpdate = Output(new WaitTableUpdateReq) 
L
LinJiawei 已提交
56 57 58 59
  })
  /*
        LoadQueue  Jump  ALU0  ALU1  ALU2  ALU3   exception    Stage1
          |         |      |    |     |     |         |
L
LinJiawei 已提交
60
          |============= reg & compare =====|         |       ========
L
LinJiawei 已提交
61 62 63 64
                            |                         |
                            |                         |
                            |                         |        Stage2
                            |                         |
L
LinJiawei 已提交
65 66 67 68 69 70 71 72
                    redirect (flush backend)          |
                    |                                 |
               === reg ===                            |       ========
                    |                                 |
                    |----- mux (exception first) -----|        Stage3
                            |
                redirect (send to frontend)
   */
L
ljw 已提交
73 74 75 76
  private class Wrapper(val n: Int) extends Bundle {
    val redirect = new Redirect
    val valid = Bool()
    val idx = UInt(log2Up(n).W)
77
  }
L
ljw 已提交
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
  def selectOldestRedirect(xs: Seq[Valid[Redirect]]): (Valid[Redirect], UInt) = {
    val wrappers = for((r, i) <- xs.zipWithIndex) yield {
      val wrap = Wire(new Wrapper(xs.size))
      wrap.redirect := r.bits
      wrap.valid := r.valid
      wrap.idx := i.U
      wrap
    }
    val oldest = ParallelOperation[Wrapper](wrappers, (x, y) => {
      Mux(x.valid,
        Mux(y.valid, Mux(isAfter(x.redirect.roqIdx, y.redirect.roqIdx), y, x), x), y
      )
    })
    val result = Wire(Valid(new Redirect))
    result.valid := oldest.valid
    result.bits := oldest.redirect
    (result, oldest.idx)
L
LinJiawei 已提交
95 96
  }

L
ljw 已提交
97 98 99 100 101
  for((ptr, redirect) <- io.stage1FtqRead.map(_.ptr).zip(
    io.exuMispredict.map(_.bits.redirect) :+ io.loadReplay.bits
  )){ ptr := redirect.ftqIdx }

  def getRedirect(exuOut: Valid[ExuOutput]): ValidIO[Redirect] = {
L
LinJiawei 已提交
102
    val redirect = Wire(Valid(new Redirect))
L
ljw 已提交
103 104
    redirect.valid := exuOut.valid && exuOut.bits.redirect.cfiUpdate.isMisPred
    redirect.bits := exuOut.bits.redirect
L
LinJiawei 已提交
105
    redirect
L
ljw 已提交
106
  }
L
LinJiawei 已提交
107

L
ljw 已提交
108 109 110 111 112 113 114 115
  val jumpOut = io.exuMispredict.head
  val aluOut = VecInit(io.exuMispredict.tail)
  val (oldestAluRedirect, oldestAluIdx) = selectOldestRedirect(aluOut.map(getRedirect))
  val (oldestExuRedirect, jumpIsOlder) = selectOldestRedirect(Seq(
    oldestAluRedirect, getRedirect(jumpOut)
  ))
  val oldestExuOutput = Mux(jumpIsOlder.asBool(), jumpOut, aluOut(oldestAluIdx))
  val (oldestRedirect, _) = selectOldestRedirect(Seq(io.loadReplay, oldestExuRedirect))
116

L
ljw 已提交
117
  val s1_isJump = RegNext(jumpIsOlder.asBool(), init = false.B)
L
LinJiawei 已提交
118
  val s1_jumpTarget = RegEnable(jumpOut.bits.redirect.cfiUpdate.target, jumpOut.valid)
L
ljw 已提交
119 120
  val s1_imm12_reg = RegEnable(oldestExuOutput.bits.uop.ctrl.imm(11, 0), oldestExuOutput.valid)
  val s1_pd = RegEnable(oldestExuOutput.bits.uop.cf.pd, oldestExuOutput.valid)
L
LinJiawei 已提交
121 122
  val s1_redirect_bits_reg = Reg(new Redirect)
  val s1_redirect_valid_reg = RegInit(false.B)
L
ljw 已提交
123
  val s1_aluIdx = RegEnable(oldestAluIdx, oldestAluRedirect.valid)
L
LinJiawei 已提交
124 125

  // stage1 -> stage2
L
ljw 已提交
126 127
  when(oldestRedirect.valid && !oldestRedirect.bits.roqIdx.needFlush(io.stage2Redirect, io.flush)){
    s1_redirect_bits_reg := oldestRedirect.bits
L
LinJiawei 已提交
128 129 130 131
    s1_redirect_valid_reg := true.B
  }.otherwise({
    s1_redirect_valid_reg := false.B
  })
132
  io.stage2Redirect.valid := s1_redirect_valid_reg && !io.flush
L
LinJiawei 已提交
133 134 135 136 137
  io.stage2Redirect.bits := s1_redirect_bits_reg
  io.stage2Redirect.bits.cfiUpdate := DontCare
  // at stage2, we read ftq to get pc
  io.stage2FtqRead.ptr := s1_redirect_bits_reg.ftqIdx

L
ljw 已提交
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
  val isReplay = RedirectLevel.flushItself(s1_redirect_bits_reg.level)
  val ftqRead = Mux(isReplay,
    io.stage1FtqRead.last.entry,
    Mux(
      s1_isJump,
      io.stage1FtqRead.head.entry,
      VecInit(io.stage1FtqRead.tail.take(exuParameters.AluCnt).map(_.entry))(s1_aluIdx)
    )
  )
  val cfiUpdate_pc = Cat(
    ftqRead.ftqPC.head(VAddrBits - s1_redirect_bits_reg.ftqOffset.getWidth - instOffsetBits),
    s1_redirect_bits_reg.ftqOffset,
    0.U(instOffsetBits.W)
  )
  val real_pc = GetPcByFtq(ftqRead.ftqPC, s1_redirect_bits_reg.ftqOffset,
    ftqRead.lastPacketPC.valid,
    ftqRead.lastPacketPC.bits
  )
  val brTarget = real_pc + SignExt(ImmUnion.B.toImm32(s1_imm12_reg), XLEN)
  val snpc = real_pc + Mux(s1_pd.isRVC, 2.U, 4.U)
L
LinJiawei 已提交
158
  val target = Mux(isReplay,
159
    real_pc, // repaly from itself
L
ljw 已提交
160 161
    Mux(s1_redirect_bits_reg.cfiUpdate.taken,
      Mux(s1_isJump, s1_jumpTarget, brTarget),
L
LinJiawei 已提交
162
      snpc
L
LinJiawei 已提交
163 164
    )
  )
165 166

  // update waittable if load violation redirect triggered
L
ljw 已提交
167 168
  io.waitTableUpdate.valid := RegNext(isReplay && s1_redirect_valid_reg, init = false.B)
  io.waitTableUpdate.waddr := RegNext(XORFold(real_pc(VAddrBits-1, 1), WaitTableAddrWidth))
169 170
  io.waitTableUpdate.wdata := true.B

L
ljw 已提交
171 172 173 174 175 176 177 178 179
  io.stage2FtqRead.ptr := s1_redirect_bits_reg.ftqIdx

  val s2_target = RegEnable(target, enable = s1_redirect_valid_reg)
  val s2_pd = RegEnable(s1_pd, enable = s1_redirect_valid_reg)
  val s2_cfiUpdata_pc = RegEnable(cfiUpdate_pc, enable = s1_redirect_valid_reg)
  val s2_redirect_bits_reg = RegEnable(s1_redirect_bits_reg, enable = s1_redirect_valid_reg)
  val s2_redirect_valid_reg = RegNext(s1_redirect_valid_reg && !io.flush, init = false.B)
  val s2_ftqRead = io.stage2FtqRead.entry

L
LinJiawei 已提交
180 181 182
  io.stage3Redirect.valid := s2_redirect_valid_reg
  io.stage3Redirect.bits := s2_redirect_bits_reg
  val stage3CfiUpdate = io.stage3Redirect.bits.cfiUpdate
L
ljw 已提交
183
  stage3CfiUpdate.pc := s2_cfiUpdata_pc
L
LinJiawei 已提交
184
  stage3CfiUpdate.pd := s2_pd
L
ljw 已提交
185 186 187 188 189
  stage3CfiUpdate.rasSp := s2_ftqRead.rasSp
  stage3CfiUpdate.rasEntry := s2_ftqRead.rasTop
  stage3CfiUpdate.predHist := s2_ftqRead.predHist
  stage3CfiUpdate.specCnt := s2_ftqRead.specCnt
  stage3CfiUpdate.hist := s2_ftqRead.hist
L
LinJiawei 已提交
190
  stage3CfiUpdate.predTaken := s2_redirect_bits_reg.cfiUpdate.predTaken
L
LinJiawei 已提交
191
  stage3CfiUpdate.sawNotTakenBranch := VecInit((0 until PredictWidth).map{ i =>
L
ljw 已提交
192
    if(i == 0) false.B else Cat(s2_ftqRead.br_mask.take(i)).orR()
L
LinJiawei 已提交
193
  })(s2_redirect_bits_reg.ftqOffset)
L
ljw 已提交
194
  stage3CfiUpdate.target := s2_target
L
LinJiawei 已提交
195 196
  stage3CfiUpdate.taken := s2_redirect_bits_reg.cfiUpdate.taken
  stage3CfiUpdate.isMisPred := s2_redirect_bits_reg.cfiUpdate.isMisPred
L
LinJiawei 已提交
197 198
}

Y
Yinan Xu 已提交
199
class CtrlBlock extends XSModule with HasCircularQueuePtrHelper {
200 201 202 203 204 205 206 207
  val io = IO(new Bundle {
    val frontend = Flipped(new FrontendToBackendIO)
    val fromIntBlock = Flipped(new IntBlockToCtrlIO)
    val fromFpBlock = Flipped(new FpBlockToCtrlIO)
    val fromLsBlock = Flipped(new LsBlockToCtrlIO)
    val toIntBlock = new CtrlToIntBlockIO
    val toFpBlock = new CtrlToFpBlockIO
    val toLsBlock = new CtrlToLsBlockIO
Y
Yinan Xu 已提交
208 209 210
    val roqio = new Bundle {
      // to int block
      val toCSR = new RoqCSRIO
211
      val exception = ValidIO(new ExceptionInfo)
Y
Yinan Xu 已提交
212
      // to mem block
213
      val lsq = new RoqLsqIO
Y
Yinan Xu 已提交
214
    }
215
    val csrCtrl = Input(new CustomCSRCtrlIO)
216 217
  })

218 219 220 221 222 223 224 225 226 227 228 229
  val difftestIO = IO(new Bundle() {
    val fromRoq = new Bundle() {
      val commit = Output(UInt(32.W))
      val thisPC = Output(UInt(XLEN.W))
      val thisINST = Output(UInt(32.W))
      val skip = Output(UInt(32.W))
      val wen = Output(UInt(32.W))
      val wdata = Output(Vec(CommitWidth, UInt(XLEN.W))) // set difftest width to 6
      val wdst = Output(Vec(CommitWidth, UInt(32.W))) // set difftest width to 6
      val wpc = Output(Vec(CommitWidth, UInt(XLEN.W))) // set difftest width to 6
      val isRVC = Output(UInt(32.W))
      val scFailed = Output(Bool())
230 231 232
      val lpaddr = Output(Vec(CommitWidth, UInt(64.W)))
      val ltype = Output(Vec(CommitWidth, UInt(32.W)))
      val lfu = Output(Vec(CommitWidth, UInt(4.W)))
233 234 235 236
    }
  })
  difftestIO <> DontCare

L
LinJiawei 已提交
237
  val ftq = Module(new Ftq)
238 239 240
  val trapIO = IO(new TrapIO())
  trapIO <> DontCare

241 242
  val decode = Module(new DecodeStage)
  val rename = Module(new Rename)
243
  val dispatch = Module(new Dispatch)
Y
Yinan Xu 已提交
244 245
  val intBusyTable = Module(new BusyTable(NRIntReadPorts, NRIntWritePorts))
  val fpBusyTable = Module(new BusyTable(NRFpReadPorts, NRFpWritePorts))
L
LinJiawei 已提交
246
  val redirectGen = Module(new RedirectGenerator)
247

L
LinJiawei 已提交
248
  val roqWbSize = NRIntWritePorts + NRFpWritePorts + exuParameters.StuCnt
249
  val roq = Module(new Roq(roqWbSize))
250

L
LinJiawei 已提交
251
  val backendRedirect = redirectGen.io.stage2Redirect
L
LinJiawei 已提交
252
  val frontendRedirect = redirectGen.io.stage3Redirect
253
  val flush = roq.io.flushOut.valid
254
  val flushReg = RegNext(flush)
L
LinJiawei 已提交
255

L
ljw 已提交
256 257 258 259 260 261 262
  val exuRedirect = io.fromIntBlock.exuRedirect.map(x => {
    val valid = x.valid && x.bits.redirectValid
    val killedByOlder = x.bits.uop.roqIdx.needFlush(backendRedirect, flushReg)
    val delayed = Wire(Valid(new ExuOutput))
    delayed.valid := RegNext(valid && !killedByOlder, init = false.B)
    delayed.bits := RegEnable(x.bits, x.valid)
    delayed
L
LinJiawei 已提交
263
  })
L
ljw 已提交
264 265 266
  VecInit(ftq.io.ftqRead.tail.dropRight(1)) <> redirectGen.io.stage1FtqRead
  ftq.io.cfiRead <> redirectGen.io.stage2FtqRead
  redirectGen.io.exuMispredict <> exuRedirect
L
ljw 已提交
267
  redirectGen.io.loadReplay := io.fromLsBlock.replay
268
  redirectGen.io.flush := flushReg
269

L
LinJiawei 已提交
270 271
  ftq.io.enq <> io.frontend.fetchInfo
  for(i <- 0 until CommitWidth){
L
LinJiawei 已提交
272
    ftq.io.roq_commits(i).valid := roq.io.commits.valid(i) && !roq.io.commits.isWalk
L
LinJiawei 已提交
273 274 275
    ftq.io.roq_commits(i).bits := roq.io.commits.info(i)
  }
  ftq.io.redirect <> backendRedirect
276 277 278
  ftq.io.flush := flushReg
  ftq.io.flushIdx := RegNext(roq.io.flushOut.bits.ftqIdx)
  ftq.io.flushOffset := RegNext(roq.io.flushOut.bits.ftqOffset)
L
LinJiawei 已提交
279
  ftq.io.frontendRedirect <> frontendRedirect
L
ljw 已提交
280
  ftq.io.exuWriteback <> exuRedirect
L
LinJiawei 已提交
281

L
ljw 已提交
282
  ftq.io.ftqRead.last.ptr := roq.io.flushOut.bits.ftqIdx
283
  val flushPC = GetPcByFtq(
L
ljw 已提交
284
    ftq.io.ftqRead.last.entry.ftqPC,
285
    RegEnable(roq.io.flushOut.bits.ftqOffset, roq.io.flushOut.valid),
L
ljw 已提交
286 287
    ftq.io.ftqRead.last.entry.lastPacketPC.valid,
    ftq.io.ftqRead.last.entry.lastPacketPC.bits
288 289 290
  )

  val flushRedirect = Wire(Valid(new Redirect))
291
  flushRedirect.valid := flushReg
292 293 294
  flushRedirect.bits := DontCare
  flushRedirect.bits.ftqIdx := RegEnable(roq.io.flushOut.bits.ftqIdx, flush)
  flushRedirect.bits.interrupt := true.B
L
LinJiawei 已提交
295 296 297
  flushRedirect.bits.cfiUpdate.target := Mux(io.roqio.toCSR.isXRet || roq.io.exception.valid,
    io.roqio.toCSR.trapTarget,
    flushPC + 4.U // flush pipe
298
  )
L
LinJiawei 已提交
299

300
  io.frontend.redirect_cfiUpdate := Mux(flushRedirect.valid, flushRedirect, frontendRedirect)
L
LinJiawei 已提交
301
  io.frontend.commit_cfiUpdate := ftq.io.commit_ftqEntry
302 303
  io.frontend.ftqEnqPtr := ftq.io.enqPtr
  io.frontend.ftqLeftOne := ftq.io.leftOne
Y
Yinan Xu 已提交
304

305
  decode.io.in <> io.frontend.cfVec
306 307 308 309 310 311 312
  // currently, we only update wait table when isReplay
  decode.io.waitTableUpdate(0) <> RegNext(redirectGen.io.waitTableUpdate)
  decode.io.waitTableUpdate(1) := DontCare
  decode.io.waitTableUpdate(1).valid := false.B
  // decode.io.waitTableUpdate <> io.toLsBlock.waitTableUpdate
  decode.io.csrCtrl := RegNext(io.csrCtrl)

313

L
LinJiawei 已提交
314
  val jumpInst = dispatch.io.enqIQCtrl(0).bits
L
LinJiawei 已提交
315 316
  val ftqOffsetReg = Reg(UInt(log2Up(PredictWidth).W))
  ftqOffsetReg := jumpInst.cf.ftqOffset
L
LinJiawei 已提交
317
  ftq.io.ftqRead(0).ptr := jumpInst.cf.ftqPtr // jump
L
LinJiawei 已提交
318
  io.toIntBlock.jumpPc := GetPcByFtq(
319 320 321
    ftq.io.ftqRead(0).entry.ftqPC, ftqOffsetReg,
    ftq.io.ftqRead(0).entry.lastPacketPC.valid,
    ftq.io.ftqRead(0).entry.lastPacketPC.bits
L
LinJiawei 已提交
322
  )
L
LinJiawei 已提交
323
  io.toIntBlock.jalr_target := ftq.io.ftqRead(0).entry.target
L
LinJiawei 已提交
324

325 326
  // pipeline between decode and dispatch
  for (i <- 0 until RenameWidth) {
L
LinJiawei 已提交
327
    PipelineConnect(decode.io.out(i), rename.io.in(i), rename.io.in(i).ready,
328
      io.frontend.redirect_cfiUpdate.valid)
329
  }
330

L
LinJiawei 已提交
331
  rename.io.redirect <> backendRedirect
332
  rename.io.flush := flushReg
333 334
  rename.io.roqCommits <> roq.io.commits
  rename.io.out <> dispatch.io.fromRename
335
  rename.io.renameBypass <> dispatch.io.renameBypass
336
  rename.io.dispatchInfo <> dispatch.io.preDpInfo
337

L
LinJiawei 已提交
338
  dispatch.io.redirect <> backendRedirect
339
  dispatch.io.flush := flushReg
340
  dispatch.io.enqRoq <> roq.io.enq
341
  dispatch.io.enqLsq <> io.toLsBlock.enqLsq
Y
Yinan Xu 已提交
342 343
  dispatch.io.readIntRf <> io.toIntBlock.readRf
  dispatch.io.readFpRf <> io.toFpBlock.readRf
Y
Yinan Xu 已提交
344 345
  dispatch.io.allocPregs.zipWithIndex.foreach { case (preg, i) =>
    intBusyTable.io.allocPregs(i).valid := preg.isInt
346
    fpBusyTable.io.allocPregs(i).valid := preg.isFp
Y
Yinan Xu 已提交
347 348 349
    intBusyTable.io.allocPregs(i).bits := preg.preg
    fpBusyTable.io.allocPregs(i).bits := preg.preg
  }
350
  dispatch.io.numExist <> io.fromIntBlock.numExist ++ io.fromFpBlock.numExist ++ io.fromLsBlock.numExist
Y
Yinan Xu 已提交
351
  dispatch.io.enqIQCtrl <> io.toIntBlock.enqIqCtrl ++ io.toFpBlock.enqIqCtrl ++ io.toLsBlock.enqIqCtrl
352
//  dispatch.io.enqIQData <> io.toIntBlock.enqIqData ++ io.toFpBlock.enqIqData ++ io.toLsBlock.enqIqData
353

L
LinJiawei 已提交
354

355 356
  fpBusyTable.io.flush := flushReg
  intBusyTable.io.flush := flushReg
Y
Yinan Xu 已提交
357
  for((wb, setPhyRegRdy) <- io.fromIntBlock.wbRegs.zip(intBusyTable.io.wbPregs)){
358
    setPhyRegRdy.valid := wb.valid && wb.bits.uop.ctrl.rfWen
Y
Yinan Xu 已提交
359 360 361 362 363 364
    setPhyRegRdy.bits := wb.bits.uop.pdest
  }
  for((wb, setPhyRegRdy) <- io.fromFpBlock.wbRegs.zip(fpBusyTable.io.wbPregs)){
    setPhyRegRdy.valid := wb.valid && wb.bits.uop.ctrl.fpWen
    setPhyRegRdy.bits := wb.bits.uop.pdest
  }
Y
Yinan Xu 已提交
365 366
  intBusyTable.io.read <> dispatch.io.readIntState
  fpBusyTable.io.read <> dispatch.io.readFpState
Y
Yinan Xu 已提交
367

L
LinJiawei 已提交
368
  roq.io.redirect <> backendRedirect
369
  roq.io.exeWbResults <> (io.fromIntBlock.wbRegs ++ io.fromFpBlock.wbRegs ++ io.fromLsBlock.stOut)
L
LinJiawei 已提交
370 371 372

  // TODO: is 'backendRedirect' necesscary?
  io.toIntBlock.redirect <> backendRedirect
373
  io.toIntBlock.flush <> flushReg
L
LinJiawei 已提交
374
  io.toFpBlock.redirect <> backendRedirect
375
  io.toFpBlock.flush <> flushReg
L
LinJiawei 已提交
376
  io.toLsBlock.redirect <> backendRedirect
377
  io.toLsBlock.flush <> flushReg
378

379
  if (!env.FPGAPlatform) {
380
    difftestIO.fromRoq <> roq.difftestIO
381
    trapIO <> roq.trapIO
382 383
  }

384 385 386
  dispatch.io.readPortIndex.intIndex <> io.toIntBlock.readPortIndex
  dispatch.io.readPortIndex.fpIndex <> io.toFpBlock.readPortIndex

Y
Yinan Xu 已提交
387 388
  // roq to int block
  io.roqio.toCSR <> roq.io.csr
389
  io.roqio.exception := roq.io.exception
390
  io.roqio.exception.bits.uop.cf.pc := flushPC
Y
Yinan Xu 已提交
391
  // roq to mem block
392
  io.roqio.lsq <> roq.io.lsq
393
}