SpinAsm AND and SpinAsm LOG: Difference between pages

From PedalPCB Wiki
(Difference between pages)
Jump to navigation Jump to search
No edit summary
 
(Created page with "==LOG== {| class="wikitable" |+ !Mnemonic !Operation !Instruction coding |- |LOG |<nowiki>C * LOG(|ACC|) + D</nowiki> |CCCCCCCCCCCCCCCCDDDDDDDDDDD01011 |} ======Description====== LOG will multiply the Base2 LOG of the current absolute value in ACC with C and add the constant D to the result. It is important to note that the LOG function returns a fixed point number in S4.19 format instead of the standard S.23 format, which in turn means that the most negative Base2 LO...")
 
Line 1: Line 1:
==AND==
==LOG==
{| class="wikitable"
{| class="wikitable"
|+
|+
Line 6: Line 6:
!Instruction coding
!Instruction coding
|-
|-
|AND
|LOG
|ACC & MASK
|<nowiki>C * LOG(|ACC|) + D</nowiki>
|MMMMMMMMMMMMMMMMMMMMMMMM000001110
|CCCCCCCCCCCCCCCCDDDDDDDDDDD01011
|}
|}


======Description======
======Description======
AND will perform a bit wise "and" 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 $FFFFFF or to clear ACC if MASK equals $000000. (see also the pseudo opcode section)
LOG will multiply the Base2 LOG of the current absolute value in ACC with C and add the constant D to the result.
 
It is important to note that the LOG function returns a fixed point number in S4.19 format instead of the standard S.23 format, which in turn means that the most negative Base2 LOG value is –16.  
 
The LOG instruction can handle absolute linear accumulator values from 0.99999988 to 0.00001526 which translates to a dynamic range of apx. 96dB.
 
D an offset to be added to the logarithmic value in the range of –16 to + 15.999998.
{| class="wikitable"
{| class="wikitable"
|+
|+
Line 19: Line 25:
!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(S4.6)
Symbolic
Symbolic
|}
|}


======Syntax======
======Syntax======
AND M
LOG C, D


======Coding Example======
======Coding Example======
<syntaxhighlight line="1">
<syntaxhighlight line="1">
AMASK EQU $F0FFFF                  ;
log 1.0,0
                                    ;
;------------------------------------
or $FFFFFF                          ; Set all bits within ACC
and  $FFFFFE                        ; Clear LSB
and  %01111111_11111111_11111111    ; Clear MSB
and  AMASK                          ; Clear ACC[19..16]
and  $0                             ; Clear ACC
</syntaxhighlight>
</syntaxhighlight>

Revision as of 20:44, 6 January 2023

LOG

Mnemonic Operation Instruction coding
LOG C * LOG(|ACC|) + D CCCCCCCCCCCCCCCCDDDDDDDDDDD01011
Description

LOG will multiply the Base2 LOG of the current absolute value in ACC with C and add the constant D to the result.

It is important to note that the LOG function returns a fixed point number in S4.19 format instead of the standard S.23 format, which in turn means that the most negative Base2 LOG value is –16.

The LOG instruction can handle absolute linear accumulator values from 0.99999988 to 0.00001526 which translates to a dynamic range of apx. 96dB.

D an offset to be added to the logarithmic value in the range of –16 to + 15.999998.

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

Hex ($0000 ­ $FFFF) Symbolic

D 11 Bit Real(S4.6)

Symbolic

Syntax

LOG C, D

Coding Example
log  1.0,0