module Accelerator.SM86.NumericSemantics family SM86MultiFunction : Type 0 -- SASS MUFU.COS: cosine of the source, radians. constructor SM86Cosine -- SASS MUFU.SIN: sine of the source, radians. constructor SM86Sine -- SASS MUFU.EX2: two raised to the source. constructor SM86ExponentialBase2 -- SASS MUFU.LG2: the base-2 logarithm of the source. constructor SM86LogarithmBase2 -- SASS MUFU.RCP: one divided by the source. constructor SM86Reciprocal -- SASS MUFU.RSQ: one divided by the square root of the source. constructor SM86ReciprocalSquareRoot -- SASS MUFU.SQRT: the square root of the source. constructor SM86SquareRoot -- SASS MUFU.TANH: the hyperbolic tangent of the source. constructor SM86HyperbolicTangent end-family family SM86FloatExtremum : Type 0 -- SASS FMNMX with PT: the smaller of the two operands. constructor SM86FloatMinimum -- SASS FMNMX with !PT: the larger of the two operands. constructor SM86FloatMaximum end-family family SM86NumericOperation : Type 0 constructor SM86NumericMultiFunction field unrestricted sm86NumericMultiFunction : (family SM86MultiFunction) constructor SM86NumericFloatExtremum field unrestricted sm86NumericFloatExtremum : (family SM86FloatExtremum) constructor SM86NumericFloatNegate end-family def sm86MultiFunctionOpcode = (bytes 8 3) def sm86FloatExtremumOpcode = (bytes 9 2) def sm86FloatNegateOpcode = (bytes 33 2) def sm86MultiFunctionSelector = (lambda unrestricted function : (family SM86MultiFunction) . (eliminate SM86MultiFunction (lambda unrestricted value : (family SM86MultiFunction) . Byte) function (branch SM86Cosine . (byte 0)) (branch SM86Sine . (byte 4)) (branch SM86ExponentialBase2 . (byte 8)) (branch SM86LogarithmBase2 . (byte 12)) (branch SM86Reciprocal . (byte 16)) (branch SM86ReciprocalSquareRoot . (byte 20)) (branch SM86SquareRoot . (byte 32)) (branch SM86HyperbolicTangent . (byte 36)))) def sm86FloatExtremumDescriptor = (lambda unrestricted extremum : (family SM86FloatExtremum) . (eliminate SM86FloatExtremum (lambda unrestricted value : (family SM86FloatExtremum) . Bytes) extremum (branch SM86FloatMinimum . (bytes 0 0 128 3)) (branch SM86FloatMaximum . (bytes 0 0 128 7)))) def sm86NumericOperationOpcode = (lambda unrestricted operation : (family SM86NumericOperation) . (eliminate SM86NumericOperation (lambda unrestricted value : (family SM86NumericOperation) . Bytes) operation (branch SM86NumericMultiFunction function . sm86MultiFunctionOpcode) (branch SM86NumericFloatExtremum extremum . sm86FloatExtremumOpcode) (branch SM86NumericFloatNegate . sm86FloatNegateOpcode))) def sm86NumericOperationDescriptor = (lambda unrestricted operation : (family SM86NumericOperation) . (eliminate SM86NumericOperation (lambda unrestricted value : (family SM86NumericOperation) . Bytes) operation (branch SM86NumericMultiFunction function . (bytes-cons (sm86MultiFunctionSelector function) b"")) (branch SM86NumericFloatExtremum extremum . (sm86FloatExtremumDescriptor extremum)) (branch SM86NumericFloatNegate . (bytes 255 0 0 128 1))))