@@ -7,6 +7,7 @@ import freechips.rocketchip.tile.FType
77import chisel3 ._
88import chisel3 .util ._
99import hardfloat ._
10+ import mxgen .{MxConfig , MxFormat , MxTypeBundle , requiredPEMode }
1011
1112// Bundles that represent the raw bits of custom datatypes
1213case class Float (expWidth : Int , sigWidth : Int , isRecoded : Boolean = false ) extends Bundle {
@@ -630,16 +631,22 @@ object Arithmetic {
630631
631632 override def mac_mx (m1 : MxFloat , m2 : MxFloat , fpProductPrecision : (Int , Int ), fpAccPrecision : MxFloat , activation_mx_format : UInt , weight_mx_format : UInt ): MxFloat = {
632633 require(! m1.isRecoded && ! m2.isRecoded) // mxFloat inputs must be in standard format
633- val macc = Module (new MxFpMul (lut = false )(fpProductPrecision, fpAccPrecision))
634+ val macConfig = MxConfig .mxGemmini.copy(
635+ inActBusWidth = m1.bits.getWidth,
636+ inWeiBusWidth = m2.bits.getWidth,
637+ productFormat = MxFormat (fpProductPrecision._1, fpProductPrecision._2),
638+ accFormat = MxFormat (fpAccPrecision.expWidth, fpAccPrecision.sigWidth)
639+ )
640+ val macc = Module (new mxgen.MxFpMul (macConfig, lut = false ))
634641 val result = Wire (MxFloat (macc.cType.exp, macc.cType.sig, 4 , true ))
635642
636- val typeA = Wire (new MxTypes )
643+ val typeA = Wire (new MxTypeBundle )
637644 typeA.exp := Mux (activation_mx_format === 2 .U , 2 .U ,
638645 Mux (activation_mx_format === 1 .U , 3 .U , 4 .U ))
639646 typeA.sig := Mux (activation_mx_format === 2 .U , 2 .U ,
640647 Mux (activation_mx_format === 1 .U , 3 .U , 4 .U ))
641648
642- val typeW = Wire (new MxTypes )
649+ val typeW = Wire (new MxTypeBundle )
643650 typeW.exp := Mux (weight_mx_format === 2 .U , 2 .U ,
644651 Mux (weight_mx_format === 1 .U , 3 .U , 4 .U ))
645652 typeW.sig := Mux (weight_mx_format === 2 .U , 2 .U ,
0 commit comments