This Operation comes directly from the instruction owner; the page does not rewrite its behavior.
34
5pure func HiF8NumericFormatDescriptor() => NumericFormatDescriptor6begin7 return NumericFormatDescriptor {8 available = TRUE, kind = NumericFormatKind_HiF8,9 carrier_bits = 8, lane_bits = 8, lanes_per_carrier = 1,10 sign_bits = 1, sign_bit = 7,11 exponent_bits_min = 0, exponent_bits_max = 4,12 fraction_bits_min = 1, fraction_bits_max = 3,13 exponent_bias_available = FALSE, exponent_bias = 0,14 required_low_zero_bits = 0, required_high_zero_bits = 0,15 has_zero = TRUE, has_signed_zero = FALSE, has_subnormal = TRUE,16 has_infinity = TRUE, has_quiet_nan = TRUE,17 has_signaling_nan = FALSE18 };19end;20
21pure func HiF8DecodeDotField(value: bits(8))22 => (HiF8DotField, integer {0..4}, integer {1..3})23begin24 if value[6:3] == '0000' then25 return (HiF8DotField_Denormal, 0, 3);26 elsif value[6:3] == '0001' then27 return (HiF8DotField_D0, 0, 3);28 elsif value[6:4] == '001' then29 return (HiF8DotField_D1, 1, 3);30 elsif value[6:5] == '01' then31 return (HiF8DotField_D2, 2, 3);32 elsif value[6:5] == '10' then33 return (HiF8DotField_D3, 3, 2);34 else return (HiF8DotField_D4, 4, 1);35 end;36end;37
38pure func HiF8FiniteDecomposition(value: bits(8))39 => (boolean, boolean, Word, integer {-1074..1023})40begin41 if value == '10000000' || value == '01101111' ||42 value == '11101111' then43 return (FALSE, FALSE, Zeros{PTO_XLEN}, 0);44 end;45 let (dot, exponent_bits, fraction_bits) = HiF8DecodeDotField(value);46 case dot of47 when HiF8DotField_Denormal =>48 let mantissa = value[2:0];49 if mantissa == Zeros{3} then50 return (TRUE, FALSE, Zeros{PTO_XLEN}, 0);51 else return (TRUE, value[7] == '1', Zeros{PTO_XLEN} + 1,52 (UInt(mantissa) - 23)53 as integer {-1074..1023});54 end;55 when HiF8DotField_D0 =>56 return (TRUE, value[7] == '1',57 LSL(Zeros{PTO_XLEN} + 1, 3) +58 ZeroExtend{PTO_XLEN}(value[2:0]), -3);59 when HiF8DotField_D1 =>60 var actual_exponent: integer {-15..15} = 1;61 if value[3] == '1' then actual_exponent = -1; end;62 return (TRUE, value[7] == '1',63 LSL(Zeros{PTO_XLEN} + 1, 3) +64 ZeroExtend{PTO_XLEN}(value[2:0]),65 (actual_exponent - 3) as integer {-1074..1023});66 when HiF8DotField_D2 =>67 let magnitude = 2 + UInt(value[3]);68 var actual_exponent: integer {-15..15} = magnitude;69 if value[4] == '1' then actual_exponent = 0 - magnitude; end;70 return (TRUE, value[7] == '1',71 LSL(Zeros{PTO_XLEN} + 1, 3) +72 ZeroExtend{PTO_XLEN}(value[2:0]),73 (actual_exponent - 3) as integer {-1074..1023});74 when HiF8DotField_D3 =>75 let magnitude = 4 + UInt(value[3:2]);76 var actual_exponent: integer {-15..15} = magnitude;77 if value[4] == '1' then actual_exponent = 0 - magnitude; end;78 return (TRUE, value[7] == '1',79 LSL(Zeros{PTO_XLEN} + 1, 2) +80 ZeroExtend{PTO_XLEN}(value[1:0]),81 (actual_exponent - 2) as integer {-1074..1023});82 when HiF8DotField_D4 =>83 let magnitude = 8 + UInt(value[3:1]);84 var actual_exponent: integer {-15..15} = magnitude;85 if value[4] == '1' then actual_exponent = 0 - magnitude; end;86 return (TRUE, value[7] == '1',87 LSL(Zeros{PTO_XLEN} + 1, 1) +88 ZeroExtend{PTO_XLEN}(value[0:0]),89 (actual_exponent - 1) as integer {-1074..1023});90 end;91end;92pure func ClassifyHiF8(value: bits(8)) => NumericValueClass93begin94 if value == '10000000' then return NumericValue_QuietNaN;95 elsif value == '01101111' then return NumericValue_PositiveInfinity;96 elsif value == '11101111' then return NumericValue_NegativeInfinity;97 elsif value == Zeros{8} then return NumericValue_PositiveZero;98 elsif UInt(value[6:0]) <= 7 then99 return NumericValueClassFromFiniteSign(value[7], FALSE, TRUE);100 else return NumericValueClassFromFiniteSign(value[7], FALSE, FALSE);101 end;102end;103
104pure func HiF8CanonicalNaN() => Word105begin106 return Zeros{PTO_XLEN} + 0x80;107end;
View the complete ASL owner
1234
5pure func HiF8NumericFormatDescriptor() => NumericFormatDescriptor6begin7 return NumericFormatDescriptor {8 available = TRUE, kind = NumericFormatKind_HiF8,9 carrier_bits = 8, lane_bits = 8, lanes_per_carrier = 1,10 sign_bits = 1, sign_bit = 7,11 exponent_bits_min = 0, exponent_bits_max = 4,12 fraction_bits_min = 1, fraction_bits_max = 3,13 exponent_bias_available = FALSE, exponent_bias = 0,14 required_low_zero_bits = 0, required_high_zero_bits = 0,15 has_zero = TRUE, has_signed_zero = FALSE, has_subnormal = TRUE,16 has_infinity = TRUE, has_quiet_nan = TRUE,17 has_signaling_nan = FALSE18 };19end;20
21pure func HiF8DecodeDotField(value: bits(8))22 => (HiF8DotField, integer {0..4}, integer {1..3})23begin24 if value[6:3] == '0000' then25 return (HiF8DotField_Denormal, 0, 3);26 elsif value[6:3] == '0001' then27 return (HiF8DotField_D0, 0, 3);28 elsif value[6:4] == '001' then29 return (HiF8DotField_D1, 1, 3);30 elsif value[6:5] == '01' then31 return (HiF8DotField_D2, 2, 3);32 elsif value[6:5] == '10' then33 return (HiF8DotField_D3, 3, 2);34 else return (HiF8DotField_D4, 4, 1);35 end;36end;37
38pure func HiF8FiniteDecomposition(value: bits(8))39 => (boolean, boolean, Word, integer {-1074..1023})40begin41 if value == '10000000' || value == '01101111' ||42 value == '11101111' then43 return (FALSE, FALSE, Zeros{PTO_XLEN}, 0);44 end;45 let (dot, exponent_bits, fraction_bits) = HiF8DecodeDotField(value);46 case dot of47 when HiF8DotField_Denormal =>48 let mantissa = value[2:0];49 if mantissa == Zeros{3} then50 return (TRUE, FALSE, Zeros{PTO_XLEN}, 0);51 else return (TRUE, value[7] == '1', Zeros{PTO_XLEN} + 1,52 (UInt(mantissa) - 23)53 as integer {-1074..1023});54 end;55 when HiF8DotField_D0 =>56 return (TRUE, value[7] == '1',57 LSL(Zeros{PTO_XLEN} + 1, 3) +58 ZeroExtend{PTO_XLEN}(value[2:0]), -3);59 when HiF8DotField_D1 =>60 var actual_exponent: integer {-15..15} = 1;61 if value[3] == '1' then actual_exponent = -1; end;62 return (TRUE, value[7] == '1',63 LSL(Zeros{PTO_XLEN} + 1, 3) +64 ZeroExtend{PTO_XLEN}(value[2:0]),65 (actual_exponent - 3) as integer {-1074..1023});66 when HiF8DotField_D2 =>67 let magnitude = 2 + UInt(value[3]);68 var actual_exponent: integer {-15..15} = magnitude;69 if value[4] == '1' then actual_exponent = 0 - magnitude; end;70 return (TRUE, value[7] == '1',71 LSL(Zeros{PTO_XLEN} + 1, 3) +72 ZeroExtend{PTO_XLEN}(value[2:0]),73 (actual_exponent - 3) as integer {-1074..1023});74 when HiF8DotField_D3 =>75 let magnitude = 4 + UInt(value[3:2]);76 var actual_exponent: integer {-15..15} = magnitude;77 if value[4] == '1' then actual_exponent = 0 - magnitude; end;78 return (TRUE, value[7] == '1',79 LSL(Zeros{PTO_XLEN} + 1, 2) +80 ZeroExtend{PTO_XLEN}(value[1:0]),81 (actual_exponent - 2) as integer {-1074..1023});82 when HiF8DotField_D4 =>83 let magnitude = 8 + UInt(value[3:1]);84 var actual_exponent: integer {-15..15} = magnitude;85 if value[4] == '1' then actual_exponent = 0 - magnitude; end;86 return (TRUE, value[7] == '1',87 LSL(Zeros{PTO_XLEN} + 1, 1) +88 ZeroExtend{PTO_XLEN}(value[0:0]),89 (actual_exponent - 1) as integer {-1074..1023});90 end;91end;92pure func ClassifyHiF8(value: bits(8)) => NumericValueClass93begin94 if value == '10000000' then return NumericValue_QuietNaN;95 elsif value == '01101111' then return NumericValue_PositiveInfinity;96 elsif value == '11101111' then return NumericValue_NegativeInfinity;97 elsif value == Zeros{8} then return NumericValue_PositiveZero;98 elsif UInt(value[6:0]) <= 7 then99 return NumericValueClassFromFiniteSign(value[7], FALSE, TRUE);100 else return NumericValueClassFromFiniteSign(value[7], FALSE, FALSE);101 end;102end;103
104pure func HiF8CanonicalNaN() => Word105begin106 return Zeros{PTO_XLEN} + 0x80;107end;108109