This Operation comes directly from the instruction owner; the page does not rewrite its behavior.
34
5pure func E4M3NumericFormatDescriptor() => NumericFormatDescriptor6begin7 return NumericFormatDescriptor {8 available = TRUE, kind = NumericFormatKind_FixedBinary,9 carrier_bits = 8, lane_bits = 8, lanes_per_carrier = 1,10 sign_bits = 1, sign_bit = 7,11 exponent_bits_min = 4, exponent_bits_max = 4,12 fraction_bits_min = 3, fraction_bits_max = 3,13 exponent_bias_available = TRUE, exponent_bias = 7,14 required_low_zero_bits = 0, required_high_zero_bits = 0,15 has_zero = TRUE, has_signed_zero = TRUE, has_subnormal = TRUE,16 has_infinity = FALSE, has_quiet_nan = TRUE,17 has_signaling_nan = FALSE18 };19end;20
21pure func E4M3FiniteDecomposition(value: bits(8))22 => (boolean, boolean, Word, integer {-1074..1023})23begin24 let exponent = value[6:3];25 let fraction = value[2:0];26 if exponent == Ones{4} && fraction == Ones{3} then27 return (FALSE, FALSE, Zeros{PTO_XLEN}, 0);28 elsif exponent == Zeros{4} then29 if fraction == Zeros{3} then30 return (TRUE, value[7] == '1', Zeros{PTO_XLEN}, 0);31 else return (TRUE, value[7] == '1',32 ZeroExtend{PTO_XLEN}(fraction), -9);33 end;34 else return (TRUE, value[7] == '1',35 LSL(Zeros{PTO_XLEN} + 1, 3) +36 ZeroExtend{PTO_XLEN}(fraction),37 (UInt(exponent) - (7 + 3))38 as integer {-1074..1023});39 end;40end;41pure func ClassifyE4M3(value: bits(8)) => NumericValueClass42begin43 let exponent = value[6:3];44 let fraction = value[2:0];45 if exponent == Ones{4} && fraction == Ones{3} then46 return NumericValue_QuietNaN;47 end;48 return NumericValueClassFromFiniteSign(value[7],49 exponent == Zeros{4} && fraction == Zeros{3},50 exponent == Zeros{4} && fraction != Zeros{3});51end;52
53pure func E4M3CanonicalNaN() => Word54begin55 return Zeros{PTO_XLEN} + 0x7f;56end;57
58pure func E4M3SignedZeroEncodings() => (Word, Word)59begin60 return (Zeros{PTO_XLEN}, Zeros{PTO_XLEN} + 0x80);61end;
View the complete ASL owner
1234
5pure func E4M3NumericFormatDescriptor() => NumericFormatDescriptor6begin7 return NumericFormatDescriptor {8 available = TRUE, kind = NumericFormatKind_FixedBinary,9 carrier_bits = 8, lane_bits = 8, lanes_per_carrier = 1,10 sign_bits = 1, sign_bit = 7,11 exponent_bits_min = 4, exponent_bits_max = 4,12 fraction_bits_min = 3, fraction_bits_max = 3,13 exponent_bias_available = TRUE, exponent_bias = 7,14 required_low_zero_bits = 0, required_high_zero_bits = 0,15 has_zero = TRUE, has_signed_zero = TRUE, has_subnormal = TRUE,16 has_infinity = FALSE, has_quiet_nan = TRUE,17 has_signaling_nan = FALSE18 };19end;20
21pure func E4M3FiniteDecomposition(value: bits(8))22 => (boolean, boolean, Word, integer {-1074..1023})23begin24 let exponent = value[6:3];25 let fraction = value[2:0];26 if exponent == Ones{4} && fraction == Ones{3} then27 return (FALSE, FALSE, Zeros{PTO_XLEN}, 0);28 elsif exponent == Zeros{4} then29 if fraction == Zeros{3} then30 return (TRUE, value[7] == '1', Zeros{PTO_XLEN}, 0);31 else return (TRUE, value[7] == '1',32 ZeroExtend{PTO_XLEN}(fraction), -9);33 end;34 else return (TRUE, value[7] == '1',35 LSL(Zeros{PTO_XLEN} + 1, 3) +36 ZeroExtend{PTO_XLEN}(fraction),37 (UInt(exponent) - (7 + 3))38 as integer {-1074..1023});39 end;40end;41pure func ClassifyE4M3(value: bits(8)) => NumericValueClass42begin43 let exponent = value[6:3];44 let fraction = value[2:0];45 if exponent == Ones{4} && fraction == Ones{3} then46 return NumericValue_QuietNaN;47 end;48 return NumericValueClassFromFiniteSign(value[7],49 exponent == Zeros{4} && fraction == Zeros{3},50 exponent == Zeros{4} && fraction != Zeros{3});51end;52
53pure func E4M3CanonicalNaN() => Word54begin55 return Zeros{PTO_XLEN} + 0x7f;56end;57
58pure func E4M3SignedZeroEncodings() => (Word, Word)59begin60 return (Zeros{PTO_XLEN}, Zeros{PTO_XLEN} + 0x80);61end;6263