SpinAsm EXP and SpinAsm SOF: Difference between pages

From PedalPCB Wiki
(Difference between pages)
Jump to navigation Jump to search
(Created page with "==EXP== {| class="wikitable" |+ !Mnemonic !Operation !Instruction coding |- |EXP |C * EXP(ACC) + D |CCCCCCCCCCCCCCCCDDDDDDDDDDD01100 |} ======Description====== EXP will multiply 2^ACC with C and add the constant D to the result. Since ACC (in it’s role as the destination for the EXP instruction) is limited to linear values from 0 to +0.99999988, the EXP instruction is limited to logarithmic ACC values (in it’s role as the source operand for the EXP instruction) ...")
 
No edit summary
 
Line 1: Line 1:
==EXP==
== SOF ==
{| class="wikitable"
{| class="wikitable"
|+
|+
Line 6: Line 6:
!Instruction coding
!Instruction coding
|-
|-
|EXP
|SOF
|C * EXP(ACC) + D
|C * ACC + D
|CCCCCCCCCCCCCCCCDDDDDDDDDDD01100
|CCCCCCCCCCCCCCCCDDDDDDDDDDD01101
|}
|}


======Description======
====== Description ======
EXP will multiply 2^ACC with C and add the constant D to the result.
SOF will multiply the current value in ACC with C and will then add the constant D to the result. Please note the absence of an integer entry format for D. This is not by mistake but it should emphasize that D is not intended to become used for integer arithmetic. The reason for this instruction is that the 11 bit constant D would be placed into ACC left justified or in other words 13 bits shifted to the left. D is intended to offset ACC by a constant in the range from –1 to +0.9990234375.


Since ACC (in it’s role as the destination for the EXP instruction) is limited to linear values from 0 to +0.99999988, the EXP instruction is limited to logarithmic ACC values (in it’s role as the source operand for the EXP instruction)  from –16 to 0. Like the LOG instruction, EXP will treat the ACC content as a S4.19 number. Positive logarithmic ACC values will be clipped to +0.99999988 which is the most positive linear value that can be represented within the accumulator.
====== Parameters ======
 
D is intended to allow the linear ACC to be offset by a constant in the range from –1 to +0.9990234375
{| class="wikitable"
{| class="wikitable"
|+
|+
Line 27: Line 25:
|Real (S1.14)
|Real (S1.14)
Hex ($0000 ­ $FFFF)  
Hex ($0000 ­ $FFFF)  
Symbolic  
Symbolic  
|-
|-
Line 36: Line 33:
|}
|}


======Syntax======
====== Syntax ======
EXP C, D
SOF C,D


======Coding Example======
====== Coding Example ======
<syntaxhighlight line="1">
<syntaxhighlight line="1">
exp 0.8,0
Off  EQU  1.0                  ;
                                ;
; Halve way rectifier ­­­­­­­­
sof  0,0                        ; Clear ACC
rdax ADCL,1.0                   ; Read from left ADC channel
sof  1.0,Off                    ; Subtract offset
sof  1.0,Off                    ; Add offset
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 20:54, 6 January 2023

SOF

Mnemonic Operation Instruction coding
SOF C * ACC + D CCCCCCCCCCCCCCCCDDDDDDDDDDD01101
Description

SOF will multiply the current value in ACC with C and will then add the constant D to the result. Please note the absence of an integer entry format for D. This is not by mistake but it should emphasize that D is not intended to become used for integer arithmetic. The reason for this instruction is that the 11 bit constant D would be placed into ACC left justified or in other words 13 bits shifted to the left. D is intended to offset ACC by a constant in the range from –1 to +0.9990234375.

Parameters
Name Width Entry formats, range
C 16 Bit Real (S1.14)

Hex ($0000 ­ $FFFF) Symbolic

D 11 Bit Real(S.10)

Symbolic

Syntax

SOF C,D

Coding Example
Off  EQU  1.0                   ; 
                                ; 
; Halve way rectifier ­­­­­­­­
sof  0,0                        ; Clear ACC 
rdax ADCL,1.0                   ; Read from left ADC channel
sof  1.0,Off                    ; Subtract offset 
sof  1.0,Off                    ; Add offset