Skip to content

Commit

Permalink
[rocketv] Supplement vector related csr modification.
Browse files Browse the repository at this point in the history
  • Loading branch information
qinjun-li committed Sep 3, 2024
1 parent 7bf6283 commit cdb9f61
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions rocketv/src/CSR.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1703,12 +1703,13 @@ class CSR(val parameter: CSRParameter)
val newVType = Mux1H(
Seq(
(vsetvli || vsetivli) -> io.inst(0)(27, 20),
vsetvl -> io.wbRegRS2.get(7, 0)
vsetvl -> io.wbRegRS2.get
)
)
val newTypMSBValid: Bool = (newVType >> 8).asUInt.orR
// todo: xLen -> vector.elen
val vlmulIllList = Seq(0.U, 1.U, 2.U, 3.U)++ Option.when(xLen>=16)(7.U) ++ Option.when(xLen>=32)(6.U) ++ Option.when(xLen>=64)(5.U)
val vlmulIll: Bool = vlmulIllList.map(_ === newVType(2, 0)).reduce(_ || _)
val vlmulIll: Bool = vlmulIllList.map(_ === newVType(2, 0)).reduce(_ || _) && !newTypMSBValid
// vlmax = vlen * lmul / sew
val vlmax: UInt = (true.B << (log2Ceil(vLen) - 6) << (newVType(2, 0) + 3.U) >> newVType(5, 3)).asUInt
// set vl
Expand Down Expand Up @@ -1743,6 +1744,9 @@ class CSR(val parameter: CSRParameter)
when(decoded_addr(CSRs.vxrm)) {
vector.get.states("vxrm") := wdata
}
when(decoded_addr(CSRs.vxsat)) {
vector.get.states("vxsat") := wdata
}
when(decoded_addr(CSRs.vcsr)) {
vector.get.states("vxrm") := wdata(2, 1)
vector.get.states("vxsat") := wdata(0)
Expand Down

0 comments on commit cdb9f61

Please sign in to comment.