Skip to content

Commit

Permalink
[rtl] fix widen reduce.
Browse files Browse the repository at this point in the history
  • Loading branch information
qinjun-li committed Nov 13, 2024
1 parent e4e5295 commit 32d2b80
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
18 changes: 10 additions & 8 deletions t1/src/mask/MaskReduce.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class MaskReduce(parameter: T1Parameter) extends Module {

// todo: uop decode
val order: Bool = in.bits.uop === "b101".U
val reqWiden: Bool = in.bits.uop === "b001".U
val reqWiden: Bool = in.bits.uop === "b001".U || in.bits.uop(2, 1) === "b11".U

val eew1H: UInt = UIntToOH(in.bits.eew)(2, 0)
val nextFoldCount: Bool = eew1H(0) && !reqWiden
Expand Down Expand Up @@ -72,7 +72,8 @@ class MaskReduce(parameter: T1Parameter) extends Module {
val floatType: Bool = reqReg.uop(2) || reqReg.uop(1, 0).andR
val NotAdd: Bool = reqReg.uop(1)
val widen: Bool = reqReg.uop === "b001".U || reqReg.uop(2, 1) === "b11".U
val needFold: Bool = eew1HReg(0) || (eew1HReg(1) && !widen)
//eew1HReg(0) || (eew1HReg(1) && !widen)
val needFold: Bool = false.B
val writeEEW: UInt = reqReg.eew + widen
val writeEEW1H: UInt = UIntToOH(writeEEW)(2, 0)
val writeMask: UInt = Fill(2, writeEEW1H(2)) ## !writeEEW1H(0) ## true.B
Expand Down Expand Up @@ -120,12 +121,13 @@ class MaskReduce(parameter: T1Parameter) extends Module {
}
}

val enqWriteMask: UInt = Fill(2, in.bits.eew(1)) ## in.bits.eew.orR ## true.B
val widenEnqMask: UInt = Fill(2, in.bits.eew.orR) ## true.B ## true.B
val normalMask: UInt = Fill(2, in.bits.eew(1)) ## in.bits.eew.orR ## true.B
val enqWriteMask: UInt = Mux(reqWiden, widenEnqMask, normalMask)
val updateInitMask: UInt = FillInterleaved(8, enqWriteMask)
val updateMask: UInt = FillInterleaved(8, writeMask)
when(newInstruction) {
// todo: update reduceInit when first in.fire
reduceInit := in.bits.readVS1 & updateInitMask
reduceInit := Mux(pop, 0.U, in.bits.readVS1 & updateInitMask)
crossFoldCount := 0.U
lastFoldCount := nextFoldCount
}
Expand Down Expand Up @@ -171,7 +173,7 @@ class MaskReduce(parameter: T1Parameter) extends Module {
adder.request.src := VecInit(Seq(reduceInit, source2Select))
adder.request.opcode := reqReg.aluUop
adder.request.sign := reqReg.sign
adder.request.vSew := reqReg.eew
adder.request.vSew := 2.U

floatAdder.foreach { fAdder =>
fAdder.io.a := reduceInit
Expand Down Expand Up @@ -203,7 +205,7 @@ class MaskReduce(parameter: T1Parameter) extends Module {
Mux(NotAdd, logicUnit.resp, adder.response.data)
)

out.valid := outValid
out.valid := outValid && !pop
out.bits.data := Mux(updateResult, reduceResult, reduceInit)
out.bits.mask := writeMask & Fill(4, validInst && !pop)
out.bits.mask := writeMask & Fill(4, validInst)
}
6 changes: 3 additions & 3 deletions t1/src/mask/MaskUnit.scala
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ class MaskUnit(parameter: T1Parameter) extends Module {
val noSource: Bool = mv || viota

val allGroupExecute: Bool = maskDestinationType || unitType(2) || compress || ffo
val useDefaultSew: Bool = unitType(0)
val useDefaultSew: Bool = unitType(0) && !gather16
// todo: decode ?
// Indicates how many times a set of data will be executed
// 0 -> 4 times
Expand All @@ -258,7 +258,7 @@ class MaskUnit(parameter: T1Parameter) extends Module {
useDefaultSew -> instReg.sew,
// extend
(unitType(3) && subType(2)) -> 0.U,
(unitType(3) && subType(1)) -> 1.U,
(unitType(3) && subType(1) || gather16) -> 1.U,
allGroupExecute -> 2.U
)
)
Expand Down Expand Up @@ -369,7 +369,7 @@ class MaskUnit(parameter: T1Parameter) extends Module {
val dataSourceSew: UInt = Mux(
unitType(3),
instReg.sew - instReg.decodeResult(Decoder.topUop)(2, 1),
instReg.sew
Mux(gather16, 1.U, instReg.sew)
)
val dataSourceSew1H: UInt = UIntToOH(dataSourceSew)(2, 0)

Expand Down

0 comments on commit 32d2b80

Please sign in to comment.