SpinAsm LOG and SpinAsm EXP: 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:
==LOG==
==EXP==
{| class="wikitable"
{| class="wikitable"
|+
|+
Line 6: Line 6:
!Instruction coding
!Instruction coding
|-
|-
|LOG
|EXP
|<nowiki>C * LOG(|ACC|) + D</nowiki>
|C * EXP(ACC) + D
|CCCCCCCCCCCCCCCCDDDDDDDDDDD01011
|CCCCCCCCCCCCCCCCDDDDDDDDDDD01100
|}
|}


======Description======
======Description======
LOG will multiply the Base2 LOG of the current absolute value in ACC with C and add the constant D to the result.  
EXP will multiply 2^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.  
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.  


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 is intended to allow the linear ACC to be offset by a constant in the range from –1 to +0.9990234375
 
D an offset to be added to the logarithmic value in the range of –16 to + 15.999998.
{| class="wikitable"
{| class="wikitable"
|+Parameters
|+Parameters
Line 28: Line 26:
|16 Bit
|16 Bit
|Real (S1.14)
|Real (S1.14)
Hex ($0000 ­ $FFFF)
Hex ($0000 ­ $FFFF)  
 
Symbolic  
Symbolic  
|-
|-
|D
|D
|11 Bit
|11 Bit
|Real(S4.6)
|Real(S.10)
Symbolic
Symbolic
|}
|}


======Syntax======
======Syntax======
LOG C, D
EXP C, D


======Coding Example======
======Coding Example======
<syntaxhighlight line="1">
<syntaxhighlight line="1">
log  1.0,0
exp 0.8,0
</syntaxhighlight>
</syntaxhighlight>

Revision as of 20:54, 6 January 2023

EXP

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)  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.

D is intended to allow the linear ACC to be offset 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

EXP C, D

Coding Example
exp 0.8,0