Skip to content

Commit

Permalink
[rtl] Pipe result in MaskCompress.
Browse files Browse the repository at this point in the history
  • Loading branch information
qinjun-li committed Dec 19, 2024
1 parent b30dceb commit 7c34e2e
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions t1/src/mask/MaskCompress.scala
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class MaskCompress(parameter: T1Parameter) extends Module {
val writeRD = in.bits.uop === BitPat("b?11")
val ffoType = in.bits.uop === BitPat("b11?")

val outWire: CompressOutput = Wire(new CompressOutput(parameter))

val eew1H: UInt = UIntToOH(in.bits.eew)(2, 0)
val compressInit: UInt = RegInit(0.U(log2Ceil(parameter.vLen).W))
val compressVec: Vec[UInt] = Wire(Vec(maskSize, UInt(compressInit.getWidth.W)))
Expand Down Expand Up @@ -142,11 +144,11 @@ class MaskCompress(parameter: T1Parameter) extends Module {
}
val compressResult: UInt = Mux1H(eew1H, compressDataVec)
val lastCompressEnq: Bool = in.fire && in.bits.lastCompress
when(newInstruction || lastCompressEnq || out.compressValid) {
when(newInstruction || lastCompressEnq || outWire.compressValid) {
compressTailValid := lastCompressEnq && compress
}

when(newInstruction || out.compressValid) {
when(newInstruction || outWire.compressValid) {
compressWriteGroupCount := Mux(newInstruction, 0.U, compressWriteGroupCount + 1.U)
}

Expand Down Expand Up @@ -177,7 +179,7 @@ class MaskCompress(parameter: T1Parameter) extends Module {

val ffoMask: UInt = FillInterleaved(parameter.datapathWidth / 8, in.bits.validInput)

out.data := Mux1H(
outWire.data := Mux1H(
Seq(
compress -> compressResult,
viota -> viotaResult,
Expand All @@ -187,7 +189,7 @@ class MaskCompress(parameter: T1Parameter) extends Module {
)

// todo: compressMask
out.mask := Mux1H(
outWire.mask := Mux1H(
Seq(
compress -> compressMask,
viota -> viotaMask,
Expand All @@ -197,8 +199,8 @@ class MaskCompress(parameter: T1Parameter) extends Module {
)

// todo
out.compressValid := (compressTailValid || (compressDeqValid && in.fire)) && !writeRD
out.groupCounter := Mux(compress, compressWriteGroupCount, in.bits.groupCounter)
outWire.compressValid := (compressTailValid || (compressDeqValid && in.fire)) && !writeRD
outWire.groupCounter := Mux(compress, compressWriteGroupCount, in.bits.groupCounter)

when(newInstruction && ffoInstruction) {
ffoIndex := -1.S(parameter.datapathWidth.W).asUInt
Expand Down Expand Up @@ -235,5 +237,6 @@ class MaskCompress(parameter: T1Parameter) extends Module {
}.elsewhen(mvRd) {
ffoIndex := source1SigExtend
}
out.ffoOutput := completedLeftOr | Fill(parameter.laneNumber, ffoValid)
outWire.ffoOutput := completedLeftOr | Fill(parameter.laneNumber, ffoValid)
out := RegNext(outWire, 0.U.asTypeOf(out))
}

0 comments on commit 7c34e2e

Please sign in to comment.