xref: /XiangShan/src/main/scala/xiangshan/backend/rename/BusyTable.scala (revision a2ecedc92043c002bd9a2fef6d6436da988dedcc)
1c6d43980SLemover/***************************************************************************************
2c6d43980SLemover* Copyright (c) 2020-2021 Institute of Computing Technology, Chinese Academy of Sciences
3f320e0f0SYinan Xu* Copyright (c) 2020-2021 Peng Cheng Laboratory
4c6d43980SLemover*
5c6d43980SLemover* XiangShan is licensed under Mulan PSL v2.
6c6d43980SLemover* You can use this software according to the terms and conditions of the Mulan PSL v2.
7c6d43980SLemover* You may obtain a copy of Mulan PSL v2 at:
8c6d43980SLemover*          http://license.coscl.org.cn/MulanPSL2
9c6d43980SLemover*
10c6d43980SLemover* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
11c6d43980SLemover* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
12c6d43980SLemover* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
13c6d43980SLemover*
14c6d43980SLemover* See the Mulan PSL v2 for more details.
15c6d43980SLemover***************************************************************************************/
16c6d43980SLemover
17b034d3b9SLinJiaweipackage xiangshan.backend.rename
18b034d3b9SLinJiawei
198891a219SYinan Xuimport org.chipsalliance.cde.config.Parameters
20b034d3b9SLinJiaweiimport chisel3._
21b034d3b9SLinJiaweiimport chisel3.util._
22b034d3b9SLinJiaweiimport xiangshan._
23d479a3a8SYinan Xuimport utils._
243c02ee8fSwakafaimport utility._
25bc7d6943SzhanglyGitimport xiangshan.backend.Bundles._
264eebf274Ssinsanctionimport xiangshan.backend.datapath.WbConfig._
27bc7d6943SzhanglyGitimport xiangshan.backend.issue.SchdBlockParams
28bc7d6943SzhanglyGitimport xiangshan.backend.datapath.{DataSource}
29bc7d6943SzhanglyGit
302225d46eSJiawei Linclass BusyTableReadIO(implicit p: Parameters) extends XSBundle {
318af95560SYinan Xu  val req = Input(UInt(PhyRegIdxWidth.W))
328af95560SYinan Xu  val resp = Output(Bool())
33ec49b127Ssinsanction  val loadDependency = Vec(LoadPipelineWidth, Output(UInt(LoadDependencyWidth.W)))
348af95560SYinan Xu}
358af95560SYinan Xu
360a7d1d5cSxiaofeibao
374376b525SZiyue Zhangclass VlBusyTableReadIO(implicit p: Parameters) extends XSBundle {
38*a2ecedc9SZiyue Zhang  val is_nonzero = Output(Bool())
394376b525SZiyue Zhang  val is_vlmax = Output(Bool())
404376b525SZiyue Zhang}
414376b525SZiyue Zhang
420a7d1d5cSxiaofeibaoclass BusyTable(numReadPorts: Int, numWritePorts: Int, numPhyPregs: Int, pregWB: PregWB)(implicit p: Parameters) extends XSModule with HasPerfEvents {
43b034d3b9SLinJiawei  val io = IO(new Bundle() {
44b034d3b9SLinJiawei    // set preg state to busy
45b034d3b9SLinJiawei    val allocPregs = Vec(RenameWidth, Flipped(ValidIO(UInt(PhyRegIdxWidth.W))))
469aca92b9SYinan Xu    // set preg state to ready (write back regfile + rob walk)
476624015fSLinJiawei    val wbPregs = Vec(numWritePorts, Flipped(ValidIO(UInt(PhyRegIdxWidth.W))))
48bc7d6943SzhanglyGit    // fast wakeup
490a7d1d5cSxiaofeibao    val wakeUpInt = Flipped(backendParams.intSchdParams.get.genIQWakeUpOutValidBundle)
500a7d1d5cSxiaofeibao    val wakeUpFp = Flipped(backendParams.fpSchdParams.get.genIQWakeUpOutValidBundle)
510a7d1d5cSxiaofeibao    val wakeUpVec = Flipped(backendParams.vfSchdParams.get.genIQWakeUpOutValidBundle)
520a7d1d5cSxiaofeibao    val wakeUpMem = Flipped(backendParams.memSchdParams.get.genIQWakeUpOutValidBundle)
53bc7d6943SzhanglyGit    // cancelFromDatapath
54be9ff987Ssinsanction    val og0Cancel = Input(ExuVec())
5513551487SzhanglyGit    // cancelFromMem
5613551487SzhanglyGit    val ldCancel = Vec(backendParams.LdExuCnt, Flipped(new LoadCancelIO))
57b034d3b9SLinJiawei    // read preg state
588af95560SYinan Xu    val read = Vec(numReadPorts, new BusyTableReadIO)
59b034d3b9SLinJiawei  })
60b034d3b9SLinJiawei
610a7d1d5cSxiaofeibao  val allExuParams = backendParams.allExuParams
62e600b1ddSxiaofeibao-xjtu  val intBusyTableNeedLoadCancel = allExuParams.map(x =>
63e600b1ddSxiaofeibao-xjtu    x.needLoadDependency && x.writeIntRf && x.iqWakeUpSourcePairs.map(y => y.sink.getExuParam(allExuParams).readIntRf).foldLeft(false)(_ || _)
64e600b1ddSxiaofeibao-xjtu  ).reduce(_ || _)
650a7d1d5cSxiaofeibao  val fpBusyTableNeedLoadCancel = false
66e600b1ddSxiaofeibao-xjtu  val vfBusyTableNeedLoadCancel = allExuParams.map(x =>
67e600b1ddSxiaofeibao-xjtu    x.needLoadDependency && x.writeVfRf && x.iqWakeUpSourcePairs.map(y => y.sink.getExuParam(allExuParams).readVecRf).foldLeft(false)(_ || _)
68e600b1ddSxiaofeibao-xjtu  ).reduce(_ || _)
69e600b1ddSxiaofeibao-xjtu  val v0BusyTableNeedLoadCancel = allExuParams.map(x =>
70e600b1ddSxiaofeibao-xjtu    x.needLoadDependency && x.writeV0Rf && x.iqWakeUpSourcePairs.map(y => y.sink.getExuParam(allExuParams).readVecRf).foldLeft(false)(_ || _)
71e600b1ddSxiaofeibao-xjtu  ).reduce(_ || _)
72e600b1ddSxiaofeibao-xjtu  val vlBusyTableNeedLoadCancel = allExuParams.map(x =>
73e600b1ddSxiaofeibao-xjtu    x.needLoadDependency && x.writeVlRf && x.iqWakeUpSourcePairs.map(y => y.sink.getExuParam(allExuParams).readVlRf).foldLeft(false)(_ || _)
74e600b1ddSxiaofeibao-xjtu  ).reduce(_ || _)
75e600b1ddSxiaofeibao-xjtu  val needLoadCancel = pregWB match {
76e600b1ddSxiaofeibao-xjtu    case IntWB(_, _) => intBusyTableNeedLoadCancel
77e600b1ddSxiaofeibao-xjtu    case FpWB(_, _) => fpBusyTableNeedLoadCancel
78e600b1ddSxiaofeibao-xjtu    case VfWB(_, _) => vfBusyTableNeedLoadCancel
79e600b1ddSxiaofeibao-xjtu    case V0WB(_, _) => v0BusyTableNeedLoadCancel
80e600b1ddSxiaofeibao-xjtu    case VlWB(_, _) => vlBusyTableNeedLoadCancel
81e600b1ddSxiaofeibao-xjtu    case _ => throw new IllegalArgumentException(s"WbConfig ${pregWB} is not permitted")
82e600b1ddSxiaofeibao-xjtu  }
83e600b1ddSxiaofeibao-xjtu  if (!needLoadCancel) println(s"[BusyTable]: WbConfig ${pregWB} busyTable don't need loadCancel")
84e600b1ddSxiaofeibao-xjtu  val loadCancel = if (needLoadCancel) io.ldCancel else 0.U.asTypeOf(io.ldCancel)
850a7d1d5cSxiaofeibao  val allWakeUp = io.wakeUpInt ++ io.wakeUpFp ++ io.wakeUpVec ++ io.wakeUpMem
86ef2bf60eSxiaofeibao-xjtu  val wakeUpIn = pregWB match {
870a7d1d5cSxiaofeibao    case IntWB(_, _) => allWakeUp.filter{x => x.bits.params.writeIntRf && (x.bits.params.hasLoadExu || x.bits.params.hasAluFu)}
880a7d1d5cSxiaofeibao    case FpWB(_, _) => allWakeUp.filter{x => x.bits.params.writeFpRf && !x.bits.params.hasLoadExu}
890a7d1d5cSxiaofeibao    case VfWB(_, _) => allWakeUp.filter(_.bits.params.writeVfRf)
900a7d1d5cSxiaofeibao    case V0WB(_, _) => allWakeUp.filter(_.bits.params.writeV0Rf)
910a7d1d5cSxiaofeibao    case VlWB(_, _) => allWakeUp.filter(_.bits.params.writeVlRf)
92ef2bf60eSxiaofeibao-xjtu    case _ => throw new IllegalArgumentException(s"WbConfig ${pregWB} is not permitted")
93ef2bf60eSxiaofeibao-xjtu  }
94ec49b127Ssinsanction  val loadDependency = RegInit(0.U.asTypeOf(Vec(numPhyPregs, Vec(LoadPipelineWidth, UInt(LoadDependencyWidth.W)))))
95ef2bf60eSxiaofeibao-xjtu  val shiftLoadDependency = Wire(Vec(wakeUpIn.size, Vec(LoadPipelineWidth, UInt(LoadDependencyWidth.W))))
960030d978SzhanglyGit  val tableUpdate = Wire(Vec(numPhyPregs, Bool()))
97ef2bf60eSxiaofeibao-xjtu  val wakeupOHVec = Wire(Vec(numPhyPregs, UInt(wakeUpIn.size.W)))
98767bd21fSLinJiawei
9960deaca2SLinJiawei  def reqVecToMask(rVec: Vec[Valid[UInt]]): UInt = {
10060deaca2SLinJiawei    ParallelOR(rVec.map(v => Mux(v.valid, UIntToOH(v.bits), 0.U)))
10160deaca2SLinJiawei  }
10260deaca2SLinJiawei
103ef2bf60eSxiaofeibao-xjtu  shiftLoadDependency.zip(wakeUpIn).map{ case (deps, wakeup) =>
104ef2bf60eSxiaofeibao-xjtu    if (wakeup.bits.params.hasLoadExu) {
105ef2bf60eSxiaofeibao-xjtu      deps.zipWithIndex.map{ case (dep, i) =>
106ef2bf60eSxiaofeibao-xjtu        if (backendParams.getLdExuIdx(wakeup.bits.params) == i) dep := 1.U
107ef2bf60eSxiaofeibao-xjtu        else dep := 0.U
108ef2bf60eSxiaofeibao-xjtu      }
109ef2bf60eSxiaofeibao-xjtu    }
110ef2bf60eSxiaofeibao-xjtu    else {
111ef2bf60eSxiaofeibao-xjtu      deps.zip(wakeup.bits.loadDependency).map{ case (sink, source) =>
112ef2bf60eSxiaofeibao-xjtu        sink := source << 1
113ef2bf60eSxiaofeibao-xjtu      }
11413551487SzhanglyGit    }
11513551487SzhanglyGit  }
11613551487SzhanglyGit
11713551487SzhanglyGit  wakeupOHVec.zipWithIndex.foreach{ case (wakeupOH, idx) =>
11813551487SzhanglyGit    val tmp = pregWB match {
119ef2bf60eSxiaofeibao-xjtu      case IntWB(_, _) => wakeUpIn.map(x => x.valid && x.bits.rfWen  && UIntToOH(x.bits.pdest)(idx) && !LoadShouldCancel(Some(x.bits.loadDependency), loadCancel) && !(x.bits.is0Lat && io.og0Cancel(x.bits.params.exuIdx)))
120ef2bf60eSxiaofeibao-xjtu      case FpWB(_, _)  => wakeUpIn.map(x => x.valid && x.bits.fpWen  && UIntToOH(x.bits.pdest)(idx) && !LoadShouldCancel(Some(x.bits.loadDependency), loadCancel) && !(x.bits.is0Lat && io.og0Cancel(x.bits.params.exuIdx)))
121ef2bf60eSxiaofeibao-xjtu      case VfWB(_, _)  => wakeUpIn.map(x => x.valid && x.bits.vecWen && UIntToOH(x.bits.pdest)(idx) && !LoadShouldCancel(Some(x.bits.loadDependency), loadCancel) && !(x.bits.is0Lat && io.og0Cancel(x.bits.params.exuIdx)))
122ef2bf60eSxiaofeibao-xjtu      case V0WB(_, _)  => wakeUpIn.map(x => x.valid && x.bits.v0Wen  && UIntToOH(x.bits.pdest)(idx) && !LoadShouldCancel(Some(x.bits.loadDependency), loadCancel) && !(x.bits.is0Lat && io.og0Cancel(x.bits.params.exuIdx)))
123ef2bf60eSxiaofeibao-xjtu      case VlWB(_, _)  => wakeUpIn.map(x => x.valid && x.bits.vlWen  && UIntToOH(x.bits.pdest)(idx) && !LoadShouldCancel(Some(x.bits.loadDependency), loadCancel) && !(x.bits.is0Lat && io.og0Cancel(x.bits.params.exuIdx)))
1244eebf274Ssinsanction      case _ => throw new IllegalArgumentException(s"WbConfig ${pregWB} is not permitted")
12513551487SzhanglyGit    }
126ef2bf60eSxiaofeibao-xjtu    wakeupOH := (if (wakeUpIn.nonEmpty) VecInit(tmp.toSeq).asUInt else 0.U)
12713551487SzhanglyGit  }
12860deaca2SLinJiawei  val wbMask = reqVecToMask(io.wbPregs)
12960deaca2SLinJiawei  val allocMask = reqVecToMask(io.allocPregs)
13013551487SzhanglyGit  val wakeUpMask = VecInit(wakeupOHVec.map(_.orR).toSeq).asUInt
131e600b1ddSxiaofeibao-xjtu  val ldCancelMask = loadDependency.map(x => LoadShouldCancel(Some(x), loadCancel))
13213551487SzhanglyGit
13313551487SzhanglyGit  loadDependency.zipWithIndex.foreach{ case (ldDp, idx) =>
134e311c278Ssinsanction    when(wakeUpMask(idx)) {
135ef2bf60eSxiaofeibao-xjtu      ldDp := (if (wakeUpIn.nonEmpty) Mux1H(wakeupOHVec(idx), shiftLoadDependency) else 0.U.asTypeOf(ldDp))
136e311c278Ssinsanction    }
137e311c278Ssinsanction      .elsewhen(ldDp.map(x => x.orR).reduce(_ | _)) {
138ec49b127Ssinsanction        ldDp := VecInit(ldDp.map(x => x << 1))
13913551487SzhanglyGit      }
14013551487SzhanglyGit  }
141d479a3a8SYinan Xu
142bc7d6943SzhanglyGit  /*
143bc7d6943SzhanglyGit  we can ensure that the following conditions are mutually exclusive
1440030d978SzhanglyGit  wakeUp and cancel (same pdest) may arrive at the same cycle
145bc7d6943SzhanglyGit  for a pdest:
1460030d978SzhanglyGit    rename alloc => wakeUp / cancel => ... => wakeUp / cancel => wakeUp
147bc7d6943SzhanglyGit  or
148bc7d6943SzhanglyGit    rename alloc => wbMask  //TODO we still need wbMask because wakeUp signal is partial now
149e311c278Ssinsanction  in wakeUpMask, we filter ogCancel and loadTransCancel at the same cycle
150bc7d6943SzhanglyGit   */
15141dbbdfdSsinceforYy  val table = VecInit((0 until numPhyPregs).zip(tableUpdate).map{ case (idx, update) =>
15237080bd8Ssinsanction    RegEnable(update, 0.U(1.W), allocMask(idx) || ldCancelMask(idx) || wakeUpMask(idx) || wbMask(idx))
15341dbbdfdSsinceforYy  }).asUInt
15441dbbdfdSsinceforYy
155bc7d6943SzhanglyGit  tableUpdate.zipWithIndex.foreach{ case (update, idx) =>
156e311c278Ssinsanction    when(wakeUpMask(idx) || wbMask(idx)) {
157e311c278Ssinsanction      update := false.B                                   //ready
158e311c278Ssinsanction    }
159e311c278Ssinsanction      .elsewhen(allocMask(idx) || ldCancelMask(idx)) {
16013551487SzhanglyGit        update := true.B                                    //busy
16137c998e1Sxiaofeibao-xjtu        if (idx == 0 && pregWB.isInstanceOf[IntWB]) {
16237c998e1Sxiaofeibao-xjtu          // Int RegFile 0 is always ready
16337c998e1Sxiaofeibao-xjtu          update := false.B
16437c998e1Sxiaofeibao-xjtu        }
165e311c278Ssinsanction      }
166e311c278Ssinsanction      .otherwise {
167bc7d6943SzhanglyGit        update := table(idx)
168bc7d6943SzhanglyGit      }
169bc7d6943SzhanglyGit  }
170bc7d6943SzhanglyGit
171bc7d6943SzhanglyGit  io.read.foreach{ case res =>
1720a7d1d5cSxiaofeibao    val readBypass = VecInit(io.allocPregs.map(x => x.valid && x.bits === res.req))
1730a7d1d5cSxiaofeibao    res.resp := !(table(res.req) || readBypass.asUInt.orR)
1740a7d1d5cSxiaofeibao    res.loadDependency := (if (needLoadCancel) loadDependency(res.req) else 0.U.asTypeOf(res.loadDependency))
175bc7d6943SzhanglyGit  }
176bc7d6943SzhanglyGit
1770030d978SzhanglyGit  val oddTable = table.asBools.zipWithIndex.filter(_._2 % 2 == 1).map(_._1)
1780030d978SzhanglyGit  val evenTable = table.asBools.zipWithIndex.filter(_._2 % 2 == 0).map(_._1)
179bc7d6943SzhanglyGit  val busyCount = RegNext(RegNext(PopCount(oddTable)) + RegNext(PopCount(evenTable)))
180bc7d6943SzhanglyGit
1810030d978SzhanglyGit  XSPerfAccumulate("busy_count", PopCount(table))
182cd365d4cSrvcoresjw
1831ca0e4f3SYinan Xu  val perfEvents = Seq(
184e1a85e9fSchengguanghui    ("bt_std_freelist_1_4_valid", busyCount < (numPhyPregs / 4).U                                        ),
185e1a85e9fSchengguanghui    ("bt_std_freelist_2_4_valid", busyCount > (numPhyPregs / 4).U && busyCount <= (numPhyPregs / 2).U    ),
186e1a85e9fSchengguanghui    ("bt_std_freelist_3_4_valid", busyCount > (numPhyPregs / 2).U && busyCount <= (numPhyPregs * 3 / 4).U),
187e1a85e9fSchengguanghui    ("bt_std_freelist_4_4_valid", busyCount > (numPhyPregs * 3 / 4).U                                    )
1881ca0e4f3SYinan Xu  )
1891ca0e4f3SYinan Xu  generatePerfEvent()
1900a7d1d5cSxiaofeibao
191b034d3b9SLinJiawei}
1924376b525SZiyue Zhang
1930a7d1d5cSxiaofeibaoclass VlBusyTable(numReadPorts: Int, numWritePorts: Int, numPhyPregs: Int, pregWB: PregWB)(implicit p: Parameters) extends BusyTable(numReadPorts, numWritePorts, numPhyPregs, pregWB) {
1944376b525SZiyue Zhang
1954376b525SZiyue Zhang  val io_vl_Wb = IO(new Bundle() {
1964376b525SZiyue Zhang    val vlWriteBackInfo = new Bundle {
1974376b525SZiyue Zhang      val vlFromIntIsZero  = Input(Bool())
1984376b525SZiyue Zhang      val vlFromIntIsVlmax = Input(Bool())
1994376b525SZiyue Zhang      val vlFromVfIsZero   = Input(Bool())
2004376b525SZiyue Zhang      val vlFromVfIsVlmax  = Input(Bool())
2014376b525SZiyue Zhang    }
2024376b525SZiyue Zhang  })
2034376b525SZiyue Zhang  val io_vl_read = IO(new Bundle() {
2044376b525SZiyue Zhang    val vlReadInfo = Vec(numReadPorts, new VlBusyTableReadIO)
2054376b525SZiyue Zhang  })
2064376b525SZiyue Zhang
2074376b525SZiyue Zhang  var intSchdVlWbPort = p(XSCoreParamsKey).intSchdVlWbPort
2084376b525SZiyue Zhang  var vfSchdVlWbPort = p(XSCoreParamsKey).vfSchdVlWbPort
2094376b525SZiyue Zhang
210*a2ecedc9SZiyue Zhang  val nonzeroTableUpdate = Wire(Vec(numPhyPregs, Bool()))
2114376b525SZiyue Zhang  val vlmaxTableUpdate = Wire(Vec(numPhyPregs, Bool()))
2124376b525SZiyue Zhang
21309910ab0SZiyue Zhang  val intVlWb = Mux(io.wbPregs(intSchdVlWbPort).valid, UIntToOH(io.wbPregs(intSchdVlWbPort).bits), 0.U)
21409910ab0SZiyue Zhang  val vfVlWb = Mux(io.wbPregs(vfSchdVlWbPort).valid, UIntToOH(io.wbPregs(vfSchdVlWbPort).bits), 0.U)
215*a2ecedc9SZiyue Zhang  // when other ports write back, we cannot know the vl value, so we should set the vl table to busy
216*a2ecedc9SZiyue Zhang  val otherPortsWb = io.wbPregs.zipWithIndex.filter(x => x._2 != intSchdVlWbPort && x._2 != vfSchdVlWbPort).map(x => Mux(x._1.valid, UIntToOH(x._1.bits), 0.U)).reduce(_ | _)
2174376b525SZiyue Zhang
218*a2ecedc9SZiyue Zhang  val nonzeroTable = VecInit((0 until numPhyPregs).zip(nonzeroTableUpdate).map{ case (idx, update) =>
219*a2ecedc9SZiyue Zhang    RegEnable(update, 0.U(1.W), allocMask(idx) || ldCancelMask(idx) || intVlWb(idx) || vfVlWb(idx) || otherPortsWb(idx))
2204376b525SZiyue Zhang  }).asUInt
2214376b525SZiyue Zhang  val vlmaxTable = VecInit((0 until numPhyPregs).zip(vlmaxTableUpdate).map{ case (idx, update) =>
222*a2ecedc9SZiyue Zhang    RegEnable(update, 0.U(1.W), allocMask(idx) || ldCancelMask(idx) || intVlWb(idx) || vfVlWb(idx) || otherPortsWb(idx))
2234376b525SZiyue Zhang  }).asUInt
2244376b525SZiyue Zhang
2254376b525SZiyue Zhang
226*a2ecedc9SZiyue Zhang  nonzeroTableUpdate.zipWithIndex.foreach{ case (update, idx) =>
22709910ab0SZiyue Zhang    when(intVlWb(idx)) {
2284376b525SZiyue Zhang      // int schd vl write back, check whether the vl is zero
229*a2ecedc9SZiyue Zhang      update := io_vl_Wb.vlWriteBackInfo.vlFromIntIsZero
23009910ab0SZiyue Zhang    }.elsewhen(vfVlWb(idx)) {
2314376b525SZiyue Zhang      // vf schd vl write back, check whether the vl is zero
232*a2ecedc9SZiyue Zhang      update := io_vl_Wb.vlWriteBackInfo.vlFromVfIsZero
233*a2ecedc9SZiyue Zhang    }.elsewhen(otherPortsWb(idx) || allocMask(idx) || ldCancelMask(idx)) {
2344376b525SZiyue Zhang      update := true.B
2354376b525SZiyue Zhang    }.otherwise {
236*a2ecedc9SZiyue Zhang      update := nonzeroTable(idx)
2374376b525SZiyue Zhang    }
2384376b525SZiyue Zhang  }
2394376b525SZiyue Zhang
2404376b525SZiyue Zhang  vlmaxTableUpdate.zipWithIndex.foreach{ case (update, idx) =>
24109910ab0SZiyue Zhang    when(intVlWb(idx)) {
2424376b525SZiyue Zhang      // int schd vl write back, check whether the vl is vlmax
2434376b525SZiyue Zhang      update := !io_vl_Wb.vlWriteBackInfo.vlFromIntIsVlmax
24409910ab0SZiyue Zhang    }.elsewhen(vfVlWb(idx)) {
2454376b525SZiyue Zhang      // vf schd vl write back, check whether the vl is vlmax
2464376b525SZiyue Zhang      update := !io_vl_Wb.vlWriteBackInfo.vlFromVfIsVlmax
247*a2ecedc9SZiyue Zhang    }.elsewhen(otherPortsWb(idx) || allocMask(idx) || ldCancelMask(idx)) {
2484376b525SZiyue Zhang      update := true.B
2494376b525SZiyue Zhang    }.otherwise {
2504376b525SZiyue Zhang      update := vlmaxTable(idx)
2514376b525SZiyue Zhang    }
2524376b525SZiyue Zhang  }
2534376b525SZiyue Zhang
2544376b525SZiyue Zhang  io_vl_read.vlReadInfo.zip(io.read).foreach{ case (vlRes, res) =>
255*a2ecedc9SZiyue Zhang    vlRes.is_nonzero := !nonzeroTable(res.req)
2564376b525SZiyue Zhang    vlRes.is_vlmax := !vlmaxTable(res.req)
2574376b525SZiyue Zhang  }
2584376b525SZiyue Zhang}
2590a7d1d5cSxiaofeibao
260