Skip to content

Commit

Permalink
[rtl] fix float reduce & compress.
Browse files Browse the repository at this point in the history
  • Loading branch information
qinjun-li committed Dec 30, 2024
1 parent 9fe9a7a commit cf0eaf1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions t1/src/mask/MaskCompress.scala
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,12 @@ class MaskCompress(val parameter: CompressParam)
changeUIntSize(compressInitPipe, maxCountWidth)
}

val tailCountForMask: UInt = {
val minElementSizePerSet = parameter.laneNumber * parameter.datapathWidth / 8
val maxCountWidth = log2Ceil(minElementSizePerSet)
changeUIntSize(compressInit, maxCountWidth)
}

val compressDataReg = RegInit(0.U((parameter.laneNumber * parameter.datapathWidth).W))
val compressTailValid: Bool = RegInit(false.B)
val compressWriteGroupCount: UInt = RegInit(0.U(parameter.groupNumberBits.W))
Expand Down Expand Up @@ -232,7 +238,7 @@ class MaskCompress(val parameter: CompressParam)
val dataByte = 1 << sewInt
val elementSizePerSet = parameter.laneNumber * parameter.datapathWidth / 8 / dataByte
VecInit(Seq.tabulate(elementSizePerSet) { elementIndex =>
val elementValid = elementIndex.U < tailCount
val elementValid = elementIndex.U < tailCountForMask
val elementMask = Fill(dataByte, elementValid)
elementMask
}).asUInt
Expand Down Expand Up @@ -310,5 +316,5 @@ class MaskCompress(val parameter: CompressParam)
val ffoOutPipe: UInt = initRegEnable(completedLeftOr | Fill(parameter.laneNumber, ffoValid), in.fire)
outWire.ffoOutput := ffoOutPipe
out := RegNext(outWire, 0.U.asTypeOf(outWire))
io.stageValid := stage2Valid || in.valid
io.stageValid := stage2Valid || in.valid || compressTailValid
}
2 changes: 1 addition & 1 deletion t1/src/mask/MaskReduce.scala
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class MaskReduce(val parameter: MaskReduceParameter)

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

Expand Down

0 comments on commit cf0eaf1

Please sign in to comment.