SpinAsm XOR and SpinAsm SOF: Difference between pages

From PedalPCB Wiki
(Difference between pages)
Jump to navigation Jump to search
(Created page with "==XOR== {| class="wikitable" |+ !Mnemonic !Operation !Instruction coding |- |XOR |ACC ^ MASK |MMMMMMMMMMMMMMMMMMMMMMMM000010000 |} ======Description====== XOR will perform a bit wise "xor" of the current ACC and the 24­bit MASK specified within the instruction word. The instruction will invert ACC provided MASK equals $FFFFFF. (see also the pseudo opcode section) {| class="wikitable" |+ !Name !Width !Entry formats, range |- |M |24 Bit |Binary Hex ($000000 - $FFFFFF) Sy...")
 
No edit summary
 
Line 1: Line 1:
==XOR==
== SOF ==
{| class="wikitable"
{| class="wikitable"
|+
|+
Line 6: Line 6:
!Instruction coding
!Instruction coding
|-
|-
|XOR
|SOF
|ACC ^ MASK
|C * ACC + D
|MMMMMMMMMMMMMMMMMMMMMMMM000010000
|CCCCCCCCCCCCCCCCDDDDDDDDDDD01101
|}
|}


======Description======
====== Description ======
XOR will perform a bit wise "xor" of the current ACC and the 24­bit MASK specified within the instruction word. The instruction will invert ACC provided MASK equals $FFFFFF. (see also the pseudo opcode section)
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 ======
{| class="wikitable"
{| class="wikitable"
|+
|+
Line 19: Line 21:
!Entry formats, range
!Entry formats, range
|-
|-
|M
|C
|24 Bit
|16 Bit
|Binary
|Real (S1.14)
Hex ($000000 - $FFFFFF)
Hex ($0000 ­ $FFFF)
Symbolic
|-
|D
|11 Bit
|Real(S.10)
Symbolic
Symbolic
|}
|}


======Syntax======
====== Syntax ======
XOR M
SOF C,D


======Coding Example======
====== Coding Example ======
<syntaxhighlight line="1">
<syntaxhighlight line="1">
XMASK EQU  $AAAAAA                          ;  
Off  EQU  1.0                  ;  
                                            ;  
                                ;  
;-------------------------------------------
; Halve way rectifier ­­­­­­­­
sof  0,0                                   ; Clear all bits within ACC  
sof  0,0                       ; Clear ACC  
xor  $0                                     ; Set all ACC bits
rdax ADCL,1.0                   ; Read from left ADC channel
xor %01010101_01010101_01010101            ; Invert all even numbered bits
sof 1.0,Off                    ; Subtract offset
xor XMASK                                  ; Invert all odd numbered bits
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