目的与范围
FP19 是 B.FPATR 使用的 19 位标量和向量参数载体。本单元固定其表示、合法参数域、有限值解释以及从 FP32 的转换。
将载体集中定义在这里,可以在指令产生架构效果之前检查缩放因子和激活参数是否合法。
PTO-ARCH-DATA-TYPES-FP19下面直接显示完整的 ASL 所有者。
// PTO-UNIT: {"id":"PTO-ARCH-DATA-TYPES-FP19","surface":"arch","classification":["data-types","fp19"],"depends_on":["PTO-ARCH-DATA-TYPES-NUMERIC-CLASSIFICATION"]}// FP19 is the architectural scalar/vector parameter carrier used by B.FPATR.// NDF-BEGIN: PTO-FP19-PARAMETER-CARRIER-001// ndf: kind=contract level=L1 layer=architecture status=accepted// FP19 MUST use one sign bit, an eight-bit bias-127 exponent, and a ten-bit// fraction. B.FPATR scales MUST be positive normal values; activation// parameters MUST be positive zero or positive normal values. Subnormal and// non-finite FP19 parameter carriers are illegal before architectural effects.// NDF-END: PTO-FP19-PARAMETER-CARRIER-001
pure func FP19PowerOfTwo(exponent: integer {-136..127}) => realbegin var result: real = 1.0; if exponent > 0 then for step = 1 to exponent looplimit 127 do result = result * 2.0; end; elsif exponent < 0 then for step = 1 to -exponent looplimit 136 do result = result / 2.0; end; end; return result;end;
pure func FP19ValueClass(value: bits(19)) => NumericValueClassbegin let exponent = value[17:10]; let fraction = value[9:0]; if exponent == Ones{8} then if fraction == Zeros{10} then if value[18] == '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[18], exponent == Zeros{8} && fraction == Zeros{10}, exponent == Zeros{8} && fraction != Zeros{10});end;
pure func FP19FiniteValue(value: bits(19)) => realbegin let exponent = UInt(value[17:10]); let fraction = UInt(value[9:0]); assert exponent != 255; var magnitude: real = 0.0; if exponent == 0 then magnitude = Real(fraction) * FP19PowerOfTwo(-136); else magnitude = (1.0 + Real(fraction) / 1024.0) * FP19PowerOfTwo((exponent - 127) as integer {-126..127}); end; if value[18] == '1' then return -magnitude; end; return magnitude;end;
pure func FP19ScaleLegal(value: bits(19)) => booleanbegin return FP19ValueClass(value) == NumericValue_PositiveNormal;end;
pure func FP19ActivationParameterLegal(value: bits(19)) => booleanbegin let value_class = FP19ValueClass(value); return value_class == NumericValue_PositiveZero || value_class == NumericValue_PositiveNormal;end;
pure func FP32ToFP19(value: Word) => bits(19)begin let source = value[31:0]; let source_class = ClassifyFP32(source); if NumericValueClassIsNaN(source_class) then return '0111111111100000000'; end; var exponent: integer {0..256} = UInt(source[30:23]); var fraction: integer {0..1024} = UInt(source[22:13]); let discarded = UInt(source[12:0]); let halfway = 0x1000; if discarded > halfway || (discarded == halfway && fraction MOD 2 == 1) then assert fraction <= 1023; fraction = (fraction + 1) as integer {0..1024}; if fraction == 0x400 then fraction = 0; if exponent < 255 then exponent = (exponent + 1) as integer {0..256}; end; end; end; var result = Zeros{19}; assert exponent <= 255; assert fraction <= 1023; result[18] = source[31]; result[17:10] = Zeros{8} + (exponent as integer {0..255}); result[9:0] = Zeros{10} + (fraction as integer {0..1023}); return result;end;
FP19 是 B.FPATR 使用的 19 位标量和向量参数载体。本单元固定其表示、合法参数域、有限值解释以及从 FP32 的转换。
将载体集中定义在这里,可以在指令产生架构效果之前检查缩放因子和激活参数是否合法。
127。FP19ValueClass 根据 19 位字段区分零、次正规数、正规数、无穷大、静默 NaN 和信号 NaN。FP19FiniteValue 解释有限载体;FP32ToFP19 保留 FP32 小数的高十位,并对丢弃位执行舍入到最近值、恰好居中时取偶数。FP19ScaleLegal 只接受 NumericValue_PositiveNormal。
FP19ActivationParameterLegal 接受 NumericValue_PositiveZero 或 NumericValue_PositiveNormal。
FP32ToFP19 将任意 FP32 NaN 映射为固定载体 0111111111100000000,并正确处理小数进位到指数的情况。
次正规数、负值、无穷大和 NaN 都不属于合法缩放因子域。激活参数还允许正零,但不额外允许其他类别。
FP19FiniteValue 断言指数不为 255;调用该函数前,必须先对非有限输入完成分类和拒绝。
正正规数缩放因子可以通过 FP19ScaleLegal;相同比特模式若置位符号位,则即使仍是有限值也不能通过。
对于激活参数,正零合法而负零不合法;精确判断以 ASL 归属单元中的数值类别检查为准。
正文来自 owning ASL。拖拽或按钮只临时改变当前页面显示顺序。
FP19 MUST use one sign bit, an eight-bit bias-127 exponent, and a ten-bit fraction. B.FPATR scales MUST be positive normal values; activation parameters MUST be positive zero or positive normal values. Subnormal and non-finite FP19 parameter carriers are illegal before architectural effects.
PTO-FP19-PARAMETER-CARRIER-001asl/arch/data-types/fp19.asl3733d0d930df3f890b4aa5237dfface8f0cc2081f42244f45aae711435865fa6933963f2da6a418a8bb89abf397bd1f33c34df14b804492ff3509011821a153510 matching entries
PTO-AVS-ARCH-DATA-TYPES-FP19-STATIC-001tests/asl/arch/data-types/fp19/arch-static-fp19-contract-001.asl50df6e60423b3392350e3af3ee65daebd30fd5d6b262d73f408aaaddb8ab852ePTO-AVS-ARCH-FP19-ENC-001tests/asl/arch/data-types/fp19/arch-bound-fp19-encoding-001.asl4589d293a72d48a38f0ed10e3ff043b9e40a853c35496e28e57bca7bebf92967PTO-AVS-ARCH-FP19-PARAMETER-DOMAIN-002tests/asl/arch/data-types/fp19/arch-bound-fp19-parameter-domain-002.asl972bd0e343c30dbb0c240c2175f0c276b9b8aa6cf9c0ca5cdb1ec36c5a33175ePTO-AVS-TILE-MATRIX-PARAMS-002tests/asl/tile/model/legality/matrix-postprocess/tile-bound-matrix-params-002.asl9103c56ebc98d0f221d43e774a367f91d6e5c7cd530cfaa2b88dc95daec57f49PTO-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-0085…
ADR-0085docs/status/decisions/0085-numeric-postprocess-and-format-operations.mdd4f1057dcc23ae62c01a08c6c4664b0b6ffa024ae45eafd776f67327d98cb9e9{
"classification": [
"data-types",
"fp19"
],
"documentation": "docs/arch/data-types/fp19.md",
"id": "PTO-ARCH-DATA-TYPES-FP19",
"mnemonic": null,
"readiness_subjects": [
"ADR-0085"
],
"semantic_tests": [
"PTO-AVS-ARCH-FP19-ENC-001",
"PTO-AVS-ARCH-FP19-PARAMETER-DOMAIN-002"
],
"source": "asl/arch/data-types/fp19.asl",
"surface": "arch",
"tests": [
"PTO-AVS-ARCH-DATA-TYPES-FP19-STATIC-001",
"PTO-AVS-ARCH-FP19-ENC-001",
"PTO-AVS-ARCH-FP19-PARAMETER-DOMAIN-002"
]
}0.58.5 · 候选发布7dc8b7e5b121d2b2499a2273bebff29e2cd868123733d0d930df3f890b4aa5237dfface8f0cc2081f42244f45aae711435865fa6ee7c38219022a91dba0d95b1c61e3e424b7a77ae918cd59c3bec320811e05feeasl/arch/data-types/fp19.aslasl/arch/data-types/fp19.asl