目的与范围
目的与范围
本单元定义数值格式分派所使用的精确 TF32 载体契约,包括描述符、编码有效性、有限值分解、分类、规范 NaN 和带符号零。
该契约明确区分架构规定的十位小数与任意 32 位宿主浮点值。
PTO-ARCH-DATA-TYPES-FORMAT-TF32下面是该指令所有者中的 Operation;页面没有重写这段行为。
// PTO-REQ-HARDWARE-NUMERIC-001: exact TF32 encoding and finite values.
pure func TF32NumericFormatDescriptor() => NumericFormatDescriptorbegin return NumericFormatDescriptor { available = TRUE, kind = NumericFormatKind_FixedBinary, carrier_bits = 32, lane_bits = 32, lanes_per_carrier = 1, sign_bits = 1, sign_bit = 31, exponent_bits_min = 8, exponent_bits_max = 8, fraction_bits_min = 10, fraction_bits_max = 10, exponent_bias_available = TRUE, exponent_bias = 127, required_low_zero_bits = 13, required_high_zero_bits = 0, has_zero = TRUE, has_signed_zero = TRUE, has_subnormal = TRUE, has_infinity = TRUE, has_quiet_nan = TRUE, has_signaling_nan = TRUE };end;
pure func TF32FiniteDecomposition(value: bits(32)) => (boolean, boolean, Word, integer {-1074..1023})begin if value[12:0] != Zeros{13} then return (FALSE, FALSE, Zeros{PTO_XLEN}, 0); end; let exponent = value[30:23]; let fraction = value[22:13]; if exponent == Ones{8} then return (FALSE, FALSE, Zeros{PTO_XLEN}, 0); elsif exponent == Zeros{8} then if fraction == Zeros{10} then return (TRUE, value[31] == '1', Zeros{PTO_XLEN}, 0); else return (TRUE, value[31] == '1', ZeroExtend{PTO_XLEN}(fraction), -136); end; else return (TRUE, value[31] == '1', LSL(Zeros{PTO_XLEN} + 1, 10) + ZeroExtend{PTO_XLEN}(fraction), (UInt(exponent) - (127 + 10)) as integer {-1074..1023}); end;end;
pure func TF32EncodingValid(value: bits(32)) => booleanbegin return value[12:0] == Zeros{13};end;pure func ClassifyTF32(value: bits(32)) => NumericValueClassbegin let exponent = value[30:23]; let fraction = value[22:13]; if exponent == Ones{8} then if fraction == Zeros{10} then if value[31] == '1' then return NumericValue_NegativeInfinity; else return NumericValue_PositiveInfinity; end; elsif fraction[9] == '1' then return NumericValue_QuietNaN; else return NumericValue_SignalingNaN; end; end; return NumericValueClassFromFiniteSign(value[31], exponent == Zeros{8} && fraction == Zeros{10}, exponent == Zeros{8} && fraction != Zeros{10});end;
pure func TF32CanonicalNaN() => Wordbegin return Zeros{PTO_XLEN} + 0x7fc00000;end;
pure func TF32SignedZeroEncodings() => (Word, Word)begin return (Zeros{PTO_XLEN}, Zeros{PTO_XLEN} + 0x80000000);end;// PTO-UNIT: {"id":"PTO-ARCH-DATA-TYPES-FORMAT-TF32","surface":"arch","classification":["data-types","formats","tf32"],"depends_on":["PTO-ARCH-DATA-TYPES-FORMAT-DESCRIPTOR"]}// DOC-BEGIN: operation// PTO-REQ-HARDWARE-NUMERIC-001: exact TF32 encoding and finite values.
pure func TF32NumericFormatDescriptor() => NumericFormatDescriptorbegin return NumericFormatDescriptor { available = TRUE, kind = NumericFormatKind_FixedBinary, carrier_bits = 32, lane_bits = 32, lanes_per_carrier = 1, sign_bits = 1, sign_bit = 31, exponent_bits_min = 8, exponent_bits_max = 8, fraction_bits_min = 10, fraction_bits_max = 10, exponent_bias_available = TRUE, exponent_bias = 127, required_low_zero_bits = 13, required_high_zero_bits = 0, has_zero = TRUE, has_signed_zero = TRUE, has_subnormal = TRUE, has_infinity = TRUE, has_quiet_nan = TRUE, has_signaling_nan = TRUE };end;
pure func TF32FiniteDecomposition(value: bits(32)) => (boolean, boolean, Word, integer {-1074..1023})begin if value[12:0] != Zeros{13} then return (FALSE, FALSE, Zeros{PTO_XLEN}, 0); end; let exponent = value[30:23]; let fraction = value[22:13]; if exponent == Ones{8} then return (FALSE, FALSE, Zeros{PTO_XLEN}, 0); elsif exponent == Zeros{8} then if fraction == Zeros{10} then return (TRUE, value[31] == '1', Zeros{PTO_XLEN}, 0); else return (TRUE, value[31] == '1', ZeroExtend{PTO_XLEN}(fraction), -136); end; else return (TRUE, value[31] == '1', LSL(Zeros{PTO_XLEN} + 1, 10) + ZeroExtend{PTO_XLEN}(fraction), (UInt(exponent) - (127 + 10)) as integer {-1074..1023}); end;end;
pure func TF32EncodingValid(value: bits(32)) => booleanbegin return value[12:0] == Zeros{13};end;pure func ClassifyTF32(value: bits(32)) => NumericValueClassbegin let exponent = value[30:23]; let fraction = value[22:13]; if exponent == Ones{8} then if fraction == Zeros{10} then if value[31] == '1' then return NumericValue_NegativeInfinity; else return NumericValue_PositiveInfinity; end; elsif fraction[9] == '1' then return NumericValue_QuietNaN; else return NumericValue_SignalingNaN; end; end; return NumericValueClassFromFiniteSign(value[31], exponent == Zeros{8} && fraction == Zeros{10}, exponent == Zeros{8} && fraction != Zeros{10});end;
pure func TF32CanonicalNaN() => Wordbegin return Zeros{PTO_XLEN} + 0x7fc00000;end;
pure func TF32SignedZeroEncodings() => (Word, Word)begin return (Zeros{PTO_XLEN}, Zeros{PTO_XLEN} + 0x80000000);end;// DOC-END: operation
本单元定义数值格式分派所使用的精确 TF32 载体契约,包括描述符、编码有效性、有限值分解、分类、规范 NaN 和带符号零。
该契约明确区分架构规定的十位小数与任意 32 位宿主浮点值。
TF32NumericFormatDescriptor 采用 32 位载体,其中包含一个符号位、八个指数位和十个小数位,指数偏置为 127,低 13 位必须为零。TF32EncodingValid 检查这 13 个低位;随后,TF32FiniteDecomposition 为有效有限值给出精确的符号、整数有效数和二进制指数。ClassifyTF32 根据架构指数和小数字段区分带符号零、次正规数、正规数、无穷大、静默 NaN 和信号 NaN。只要载体的 [12:0] 中有任意一位非零,该载体对 TF32 就无效,即使高 19 位看似有效也不例外。
指数为 0xff 且十位小数全零时表示无穷大;否则由小数位 9 区分静默 NaN 和信号 NaN。
TF32CanonicalNaN 返回 0x7fc00000;TF32SignedZeroEncodings 返回 0x00000000 和 0x80000000。
无效编码、无穷大和 NaN 的有限值分解均报告不可用。可用性为假时,其他返回字段只是占位值,不是数值结果。
架构 32 位载体以上的位不属于本单元;数值格式分派只传入 value[31:0]。
0x3f800000 是可精确分解的有效正规数载体。0x3f800001 的一个保留低位被置位,因此无法通过 TF32EncodingValid。
阅读调用方时,应先检查编码有效性,再把分类或分解字段当作可用的有限值。
正文来自 owning ASL。拖拽或按钮只临时改变当前页面显示顺序。
No NDF clause is attached to this unit.
8 matching entries
PTO-AVS-ARCH-DATA-TYPES-FORMAT-TF32-STATIC-001tests/asl/arch/data-types/formats/tf32/arch-static-tf32-contract-001.asl3a8f1ca2a3ce3a2582099aa5cfa8f295e7c4474b19e3e45c3f7298797db694c4PTO-AVS-ARCH-TF32-DECOMP-001tests/asl/arch/data-types/formats/tf32/arch-bound-tf32-decomp-001.asl2b011596bc0e6d292dcee10a65971c514db4d829beae9d0b438ac7cf098b9e57PTO-EVIDENCE-RELEASE-TRACEABILITYPTO-EVIDENCE-RELEASE-TRACEABILITYspec/evidence/release-traceability-readiness.jsonc7327021d39dc67ac5564bc55073b3870a397d79ac8d9648284d56e33bc14a3ePTO-EVIDENCE-INSTRUCTION-CONTRACT-CLOSUREPTO-EVIDENCE-INSTRUCTION-CONTRACT-CLOSUREspec/evidence/instruction-contract-closure.json3ef2bb62421c79dff8fa77a1c7983923b523244b8090812883ef81286ca8106aPTO-EVIDENCE-ARCHITECTURE-READINESSPTO-EVIDENCE-ARCHITECTURE-READINESSspec/evidence/architecture-readiness.json4b0b85199101251bea744e0f3591cc31906909dc80d5ab651c417a936036a004PTO-EVIDENCE-RELEASE-GATE-READINESSPTO-EVIDENCE-RELEASE-GATE-READINESSspec/evidence/release-gate-readiness.jsona0f4d2b6920c08981ea55fd8ef820708a40d4feb5402c5150e8e9ab532d84ce0PTO-EVIDENCE-RELEASE-MANIFESTPTO-EVIDENCE-RELEASE-MANIFESTspec/release-manifest.json1a64c109ed7a90351c41e2a418b3c0ebaf8ad975838986d2101385186b85c0d8Loading ADR-0048…
ADR-0048docs/status/decisions/0048-numeric-format-value-classification.mdce3ecd1851e22b5517d07076ab8bd2db36b6b4582111c761db19240275853d9c{
"classification": [
"data-types",
"formats",
"tf32"
],
"documentation": "docs/arch/data-types/formats/tf32.md",
"id": "PTO-ARCH-DATA-TYPES-FORMAT-TF32",
"mnemonic": null,
"readiness_subjects": [
"ADR-0048"
],
"semantic_tests": [
"PTO-AVS-ARCH-TF32-DECOMP-001"
],
"source": "asl/arch/data-types/formats/tf32.asl",
"surface": "arch",
"tests": [
"PTO-AVS-ARCH-DATA-TYPES-FORMAT-TF32-STATIC-001",
"PTO-AVS-ARCH-TF32-DECOMP-001"
]
}0.58.5 · 候选发布7dc8b7e5b121d2b2499a2273bebff29e2cd868121b1a14d0d609cc41a312e59df8621a0f3ac711a8589c5e99844aa80fb08858730c322f0f1f702e079f8a1e943d575fbc39f78380349cc3c8f2428918a1ffcfa1asl/arch/data-types/formats/tf32.asl