SpinAsm SOF and SpinAsm OR: Difference between pages

From PedalPCB Wiki
(Difference between pages)
Jump to navigation Jump to search
No edit summary
 
No edit summary
 
Line 1: Line 1:
== SOF ==
==OR==
{| class="wikitable"
{| class="wikitable"
|+
|+
Line 6: Line 6:
!Instruction coding
!Instruction coding
|-
|-
|SOF
|OR
|C * ACC + D
|<nowiki>ACC | MASK </nowiki>
|CCCCCCCCCCCCCCCCDDDDDDDDDDD01101
|MMMMMMMMMMMMMMMMMMMMMMMM000001111
|}
|}


====== Description ======
======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.
OR will perform a bit wise "or" of the current ACC and the 24­bit MASK specified within the instruction word. The instruction might be used to load a constant into ACC provided ACC contains $000000
{| class="wikitable"
{| class="wikitable"
|+Parameters
|+Parameters
Line 19: Line 19:
!Entry formats, range
!Entry formats, range
|-
|-
|C
|M
|16 Bit
|24 Bit
|Real (S1.14)
|Binary
Hex ($0000 ­ $FFFF)
Hex ($000000 - $FFFFFF)
Symbolic
|-
|D
|11 Bit
|Real(S.10)
Symbolic
Symbolic
|}
|}


====== Syntax ======
======Syntax======
SOF C,D
OR M


====== Coding Example ======
======Coding Example======
<syntaxhighlight line="1">
<syntaxhighlight line="1">
Off  EQU  1.0                  ;  
OMASK EQU  $0F0000                          ;  
                                ;  
                                            ;  
; Halve way rectifier ­­­­­­­­
;-------------------------------------------
sof  0,0                       ; Clear ACC  
sof  0,0                                   ; Clear all bits within ACC  
rdax ADCL,1.0                  ; Read from left ADC channel
or $1                                       ; Set LSB
sof  1.0,Off                    ; Subtract offset
or %10000000_00000000_00000000              ; Set MSB
sof 1.0,Off                    ; Add offset
or OMASK                                    ; Set ACC[19..16]
and %S=[15..8]                            ; Set ACC[15..8]
</syntaxhighlight>
</syntaxhighlight>

Revision as of 20:53, 6 January 2023

OR

Mnemonic Operation Instruction coding
OR ACC | MASK MMMMMMMMMMMMMMMMMMMMMMMM000001111
Description

OR will perform a bit wise "or" of the current ACC and the 24­bit MASK specified within the instruction word. The instruction might be used to load a constant into ACC provided ACC contains $000000

Parameters
Name Width Entry formats, range
M 24 Bit Binary

Hex ($000000 - $FFFFFF) Symbolic

Syntax

OR M

Coding Example
OMASK EQU  $0F0000                          ; 
                                            ; 
;-------------------------------------------
sof  0,0                                    ; Clear all bits within ACC 
or $1                                       ; Set LSB 
or %10000000_00000000_00000000              ; Set MSB 
or OMASK                                    ; Set ACC[19..16] 
and  %S=[15..8]                             ; Set ACC[15..8]