用途与范围
HF32 是 PTO 已分配的数值格式。本页帮助读者把载体布局、有限值分解和值分类联系起来;确切契约仍由 ASL 所有者中的 HF32NumericFormatDescriptor、HF32FiniteDecomposition 和 ClassifyHF32 定义。
PTO-ARCH-DATA-TYPES-FORMAT-HF32下面是该指令所有者中的 Operation;页面没有重写这段行为。
// PTO-REQ-HARDWARE-NUMERIC-001: exact HF32 encoding and finite values.
pure func HF32NumericFormatDescriptor() => 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 = 11, fraction_bits_max = 11, exponent_bias_available = TRUE, exponent_bias = 127, required_low_zero_bits = 12, 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 HF32FiniteDecomposition(value: bits(32)) => (boolean, boolean, Word, integer {-1074..1023})begin if value[11:0] != Zeros{12} then return (FALSE, FALSE, Zeros{PTO_XLEN}, 0); end; let exponent = value[30:23]; let fraction = value[22:12]; if exponent == Ones{8} then return (FALSE, FALSE, Zeros{PTO_XLEN}, 0); elsif exponent == Zeros{8} then if fraction == Zeros{11} then return (TRUE, value[31] == '1', Zeros{PTO_XLEN}, 0); else return (TRUE, value[31] == '1', ZeroExtend{PTO_XLEN}(fraction), -137); end; else return (TRUE, value[31] == '1', LSL(Zeros{PTO_XLEN} + 1, 11) + ZeroExtend{PTO_XLEN}(fraction), (UInt(exponent) - (127 + 11)) as integer {-1074..1023}); end;end;
pure func HF32EncodingValid(value: bits(32)) => booleanbegin return value[11:0] == Zeros{12};end;pure func ClassifyHF32(value: bits(32)) => NumericValueClassbegin let exponent = value[30:23]; let fraction = value[22:12]; if exponent == Ones{8} then if fraction == Zeros{11} then if value[31] == '1' then return NumericValue_NegativeInfinity; else return NumericValue_PositiveInfinity; end; elsif fraction[10] == '1' then return NumericValue_QuietNaN; else return NumericValue_SignalingNaN; end; end; return NumericValueClassFromFiniteSign(value[31], exponent == Zeros{8} && fraction == Zeros{11}, exponent == Zeros{8} && fraction != Zeros{11});end;
pure func HF32CanonicalNaN() => Wordbegin return Zeros{PTO_XLEN} + 0x7fc00000;end;
pure func HF32SignedZeroEncodings() => (Word, Word)begin return (Zeros{PTO_XLEN}, Zeros{PTO_XLEN} + 0x80000000);end;// PTO-UNIT: {"id":"PTO-ARCH-DATA-TYPES-FORMAT-HF32","surface":"arch","classification":["data-types","formats","hf32"],"depends_on":["PTO-ARCH-DATA-TYPES-FORMAT-DESCRIPTOR"]}// DOC-BEGIN: operation// PTO-REQ-HARDWARE-NUMERIC-001: exact HF32 encoding and finite values.
pure func HF32NumericFormatDescriptor() => 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 = 11, fraction_bits_max = 11, exponent_bias_available = TRUE, exponent_bias = 127, required_low_zero_bits = 12, 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 HF32FiniteDecomposition(value: bits(32)) => (boolean, boolean, Word, integer {-1074..1023})begin if value[11:0] != Zeros{12} then return (FALSE, FALSE, Zeros{PTO_XLEN}, 0); end; let exponent = value[30:23]; let fraction = value[22:12]; if exponent == Ones{8} then return (FALSE, FALSE, Zeros{PTO_XLEN}, 0); elsif exponent == Zeros{8} then if fraction == Zeros{11} then return (TRUE, value[31] == '1', Zeros{PTO_XLEN}, 0); else return (TRUE, value[31] == '1', ZeroExtend{PTO_XLEN}(fraction), -137); end; else return (TRUE, value[31] == '1', LSL(Zeros{PTO_XLEN} + 1, 11) + ZeroExtend{PTO_XLEN}(fraction), (UInt(exponent) - (127 + 11)) as integer {-1074..1023}); end;end;
pure func HF32EncodingValid(value: bits(32)) => booleanbegin return value[11:0] == Zeros{12};end;pure func ClassifyHF32(value: bits(32)) => NumericValueClassbegin let exponent = value[30:23]; let fraction = value[22:12]; if exponent == Ones{8} then if fraction == Zeros{11} then if value[31] == '1' then return NumericValue_NegativeInfinity; else return NumericValue_PositiveInfinity; end; elsif fraction[10] == '1' then return NumericValue_QuietNaN; else return NumericValue_SignalingNaN; end; end; return NumericValueClassFromFiniteSign(value[31], exponent == Zeros{8} && fraction == Zeros{11}, exponent == Zeros{8} && fraction != Zeros{11});end;
pure func HF32CanonicalNaN() => Wordbegin return Zeros{PTO_XLEN} + 0x7fc00000;end;
pure func HF32SignedZeroEncodings() => (Word, Word)begin return (Zeros{PTO_XLEN}, Zeros{PTO_XLEN} + 0x80000000);end;// DOC-END: operation
HF32 是 PTO 已分配的数值格式。本页帮助读者把载体布局、有限值分解和值分类联系起来;确切契约仍由 ASL 所有者中的 HF32NumericFormatDescriptor、HF32FiniteDecomposition 和 ClassifyHF32 定义。
描述符使用 32 位载体、32 位逻辑 lane,并且每个载体包含 1 个 lane。lane 的符号位位于 31,具有 8 个指数位、11 个尾数位,指数偏置为 127。
11:0 位必须为零。11 个已存储尾数位占据 22:12;若低位非零,载体会在有限值分解前被判为无效。
HF32FiniteDecomposition 先报告有限值分解是否可用;可用时返回符号、整数有效数和二进制指数。ClassifyHF32 则独立地把原始 lane 归入该格式所支持的零、次正规数、正规数、无穷大或 NaN 类别。
在有效载体中,它具有带符号零、次正规数、无穷大、静默 NaN 和信号 NaN。全 1 指数不提供有限值分解。
0x00000000 和 0x80000000 分别是正零与负零;0x7fc00000 是规范静默 NaN。
有限值分解函数在返回的元组中报告可用性;值分类是另一个函数的独立结果。
下面的示例只演示如何阅读这些函数,不增加编码规则。
例如,0x00001000 分解为正的有效数 1 和指数 -137;0x00000001 设置了必须为零的低位,因此无效。
正文来自 owning ASL。拖拽或按钮只临时改变当前页面显示顺序。
No NDF clause is attached to this unit.
8 matching entries
PTO-AVS-ARCH-DATA-TYPES-FORMAT-HF32-STATIC-001tests/asl/arch/data-types/formats/hf32/arch-static-hf32-contract-001.asl9cbafb775c43cc14d474abb2309168402303fa8820a9b3ae3e3e2b1aa4dc1e14PTO-AVS-ARCH-HF32-DECOMP-001tests/asl/arch/data-types/formats/hf32/arch-bound-hf32-decomp-001.aslcef393390518bc68c53ecaf8e61e663dfedb39fe6be9b185d658678334f674e7PTO-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",
"hf32"
],
"documentation": "docs/arch/data-types/formats/hf32.md",
"id": "PTO-ARCH-DATA-TYPES-FORMAT-HF32",
"mnemonic": null,
"readiness_subjects": [
"ADR-0048"
],
"semantic_tests": [
"PTO-AVS-ARCH-HF32-DECOMP-001"
],
"source": "asl/arch/data-types/formats/hf32.asl",
"surface": "arch",
"tests": [
"PTO-AVS-ARCH-DATA-TYPES-FORMAT-HF32-STATIC-001",
"PTO-AVS-ARCH-HF32-DECOMP-001"
]
}0.58.5 · 候选发布7dc8b7e5b121d2b2499a2273bebff29e2cd86812ac1c302260f2ba312ef7930822d3e4be7f3abc262b4b5a6d1a57ccdac4f95597f9e730d8d03e0f0492c376f2234f5d2e7daea7d8e5a50e6f9ef6feea00d76ef8asl/arch/data-types/formats/hf32.asl