Skip to content

Commit

Permalink
[rtl] fix float reduce.
Browse files Browse the repository at this point in the history
  • Loading branch information
qinjun-li committed Dec 30, 2024
1 parent 3a4b475 commit 9fe9a7a
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions t1/src/mask/MaskReduce.scala
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ class MaskReduce(val parameter: MaskReduceParameter)
when(stateWait) { waitCount := waitCount + 1.U }
val resFire: Bool = stateWait && waitCount === (floatAdderLatency - 1).U
updateResult :=
stateLast || ((stateCross || stateOrder) && sourceValid && !floatAdd) || resFire
stateLast || (stateCross && sourceValid && !floatAdd) || (resFire && sourceValid)
val waiteDeq: Bool = stateWait && resFire

// state update
in.ready := stateIdle
Expand All @@ -159,20 +160,18 @@ class MaskReduce(val parameter: MaskReduceParameter)
}
}

when(stateWait && resFire) {
when(waiteDeq) {
when(groupLastReduce) {
state := Mux(reqReg.lastGroup && needFold, lastFold, idle)
outValid := reqReg.lastGroup && !needFold
}.otherwise {
state := crossFold
state := Mux(order, orderRed, crossFold)
}
}

when(stateOrder) {
when(groupLastReduce) {
state := idle
outValid := reqReg.lastGroup
}
state := waitRes
waitCount := 0.U
}

when(stateLast) {
Expand All @@ -195,7 +194,7 @@ class MaskReduce(val parameter: MaskReduceParameter)

// count update
// todo: stateCross <=> stateOrder ??
when(stateCross || stateOrder || in.fire) {
when((stateCross && !floatType) || waiteDeq || in.fire) {
crossFoldCount := Mux(in.fire, 0.U, crossFoldCount + 1.U)
}

Expand Down

0 comments on commit 9fe9a7a

Please sign in to comment.