diff --git a/t1/src/mask/MaskCompress.scala b/t1/src/mask/MaskCompress.scala index 8287f3cad..4f7f7dd56 100644 --- a/t1/src/mask/MaskCompress.scala +++ b/t1/src/mask/MaskCompress.scala @@ -54,6 +54,7 @@ class MaskCompressInterFace(parameter: CompressParam) extends Bundle { val newInstruction: Bool = Input(Bool()) val ffoInstruction: Bool = Input(Bool()) val writeData: UInt = Output(UInt(parameter.xLen.W)) + val stageValid: Bool = Bool() val om = Output(Property[AnyClassType]()) } @@ -239,10 +240,13 @@ class MaskCompress(val parameter: CompressParam) ) compressMask := Mux(compressTailValid, compressTailMask, (-1.S(out.mask.getWidth.W)).asUInt) + val validInputPipe = initRegEnable(in.bits.validInput, in.fire) + val readFromScalarPipe = initRegEnable(in.bits.readFromScalar, in.fire) + val mvMask = Mux1H(eew1H, Seq(1.U, 3.U, 15.U)) - val mvData = in.bits.readFromScalar + val mvData = readFromScalarPipe - val ffoMask: UInt = FillInterleaved(parameter.datapathWidth / 8, in.bits.validInput) + val ffoMask: UInt = FillInterleaved(parameter.datapathWidth / 8, validInputPipe) outWire.data := Mux1H( Seq( @@ -303,6 +307,8 @@ class MaskCompress(val parameter: CompressParam) }.elsewhen(mvRd) { ffoIndex := source1SigExtend } - outWire.ffoOutput := completedLeftOr | Fill(parameter.laneNumber, ffoValid) - out := RegNext(outWire, 0.U.asTypeOf(outWire)) + 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 } diff --git a/t1/src/mask/MaskUnit.scala b/t1/src/mask/MaskUnit.scala index a1905a8b8..21bec0485 100644 --- a/t1/src/mask/MaskUnit.scala +++ b/t1/src/mask/MaskUnit.scala @@ -1148,7 +1148,7 @@ class MaskUnit(val parameter: T1Parameter) val executeStageInvalid: Bool = Mux1H( unitType(3, 1), Seq( - !compressUnit.io.out.compressValid, + !compressUnit.io.out.compressValid && !compressUnit.io.stageValid, reduceUnit.io.in.ready, true.B )