1// PTO-UNIT: {"id":"PTO-ARCH-DATA-TYPES-FP19","surface":"arch","classification":["data-types","fp19"],"depends_on":["PTO-ARCH-DATA-TYPES-NUMERIC-CLASSIFICATION"]}2// FP19 is the architectural scalar/vector parameter carrier used by B.FPATR.3// NDF-BEGIN: PTO-FP19-PARAMETER-CARRIER-0014// ndf: kind=contract level=L1 layer=architecture status=accepted5// FP19 MUST use one sign bit, an eight-bit bias-127 exponent, and a ten-bit6// fraction. B.FPATR scales MUST be positive normal values; activation7// parameters MUST be positive zero or positive normal values. Subnormal and8// non-finite FP19 parameter carriers are illegal before architectural effects.9// NDF-END: PTO-FP19-PARAMETER-CARRIER-0011011purefuncFP19PowerOfTwo(exponent:integer{-136..127})=>real12begin13var result:real=1.0;14if exponent >0then15for step =1to exponent looplimit127do16 result = result *2.0;17end;18elsif exponent <0then19for step =1to-exponent looplimit136do20 result = result /2.0;21end;22end;23return result;24end;2526purefuncFP19ValueClass(value:bits(19))=> NumericValueClass27begin28let exponent = value[17:10];29let fraction = value[9:0];30if exponent ==Ones{8}then31if fraction ==Zeros{10}then32if value[18]=='1'then33return NumericValue_NegativeInfinity;34else35return NumericValue_PositiveInfinity;36end;37elsif fraction[9]=='1'then38return NumericValue_QuietNaN;39else40return NumericValue_SignalingNaN;41end;42end;43returnNumericValueClassFromFiniteSign(44 value[18],45 exponent ==Zeros{8}&& fraction ==Zeros{10},46 exponent ==Zeros{8}&& fraction !=Zeros{10});47end;4849purefuncFP19FiniteValue(value:bits(19))=>real50begin51let exponent =UInt(value[17:10]);52let fraction =UInt(value[9:0]);53assert exponent !=255;54var magnitude:real=0.0;55if exponent ==0then56 magnitude =Real(fraction)*FP19PowerOfTwo(-136);57else58 magnitude =(1.0+Real(fraction)/1024.0)*59FP19PowerOfTwo((exponent -127)asinteger{-126..127});60end;61if value[18]=='1'thenreturn-magnitude;end;62return magnitude;63end;6465purefuncFP19ScaleLegal(value:bits(19))=> boolean66begin67returnFP19ValueClass(value)== NumericValue_PositiveNormal;68end;6970purefuncFP19ActivationParameterLegal(value:bits(19))=> boolean71begin72let value_class =FP19ValueClass(value);73return value_class == NumericValue_PositiveZero ||74 value_class == NumericValue_PositiveNormal;75end;7677purefuncFP32ToFP19(value: Word)=>bits(19)78begin79let source = value[31:0];80let source_class =ClassifyFP32(source);81ifNumericValueClassIsNaN(source_class)then82return'0111111111100000000';83end;84var exponent:integer{0..256}=UInt(source[30:23]);85var fraction:integer{0..1024}=UInt(source[22:13]);86let discarded =UInt(source[12:0]);87let halfway =0x1000;88if discarded > halfway ||89(discarded == halfway && fraction MOD 2==1)then90assert fraction <=1023;91 fraction =(fraction +1)asinteger{0..1024};92if fraction ==0x400then93 fraction =0;94if exponent <255then95 exponent =(exponent +1)asinteger{0..256};96end;97end;98end;99var result =Zeros{19};100assert exponent <=255;101assert fraction <=1023;102 result[18]= source[31];103 result[17:10]=Zeros{8}+(exponent asinteger{0..255});104 result[9:0]=Zeros{10}+(fraction asinteger{0..1023});105return result;106end;107
Architecture behavior
purpose scope
Purpose and scope
FP19 is the 19-bit scalar and vector parameter carrier consumed by B.FPATR; this unit fixes its representation, legal parameter domains, finite interpretation, and conversion from FP32.
The carrier is defined here so scale and activation legality can be checked before an instruction produces architectural effects.
concepts state
Concepts and visible state
The layout is one sign bit, an eight-bit exponent with bias 127, and a ten-bit fraction.
FP19ValueClass classifies zero, subnormal, normal, infinity, quiet NaN, and signaling NaN using the 19-bit fields.
FP19FiniteValue interprets finite carriers; FP32ToFP19 narrows FP32 by retaining the upper ten fraction bits and rounding discarded bits to nearest with ties to even.
rules interactions
Rules and interactions
FP19ScaleLegal accepts only NumericValue_PositiveNormal.
FP19ActivationParameterLegal accepts NumericValue_PositiveZero or NumericValue_PositiveNormal.
FP32ToFP19 maps any FP32 NaN to the fixed carrier 0111111111100000000 and handles fraction carry into the exponent.
boundaries
Architectural boundaries
Subnormal, negative, infinity, and NaN carriers are outside the legal scale domain. Activation additionally permits positive zero, but no other extra class.
FP19FiniteValue asserts that the exponent is not 255; non-finite inputs must be classified and rejected before calling it.
example usage
illustrative reading example
A positive normal scale passes FP19ScaleLegal; the same bit pattern with the sign bit set does not, even though it still represents a finite value.
For an activation parameter, positive zero is legal while negative zero is not. The exact result follows the value-class check in the ASL owner.
Bodies come from owning ASL. Dragging or buttons change only this page-session view order.
surfaceARCH
ownerPTO-ARCH-DATA-TYPES-FP19
categoryFP19-PARAMETER-CARRIER
case001
Normative contract
contract · L1 · 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.