log bug?

Software questions and issues with the FV-1

Moderator: frank

Post Reply
igorp
Posts: 65
Joined: Tue May 19, 2015 6:10 am
Location: RU

log bug?

Post by igorp »

I think. spin asm log function compiling wrong

LOG C * LOG(|ACC|) + D , there D is 4.6 real format

Example

program:

Code: Select all

        LOG         0.5 , 0  
        LOG         0.5 , 0.5 
        LOG         0.5 , -0.5
        LOG         0.5 , 1.5
        LOG         0.5 , -1.5
        LOG         0.5 , 2.5
        LOG         0.5 , -2.5
        LOG         0.5 , 4.5  
        LOG         0.5 , -4.5  
        LOG         0.5 , 8.5  
        LOG         0.5 , -8.5  
        LOG         0.5 , 15.5
        LOG         0.5 , -15.5
.file and binary:

Code: Select all

log_test2_00[] = {
0x20,0x00,0x00,0x0B,
0x20,0x00,0x40,0x0B,
0x20,0x00,0xC0,0x0B,
0x20,0x00,0xC0,0x0B,
0x20,0x00,0x40,0x0B,
0x20,0x00,0x40,0x0B,
0x20,0x00,0xC0,0x0B,
0x20,0x00,0x40,0x0B,
0x20,0x00,0xC0,0x0B,
0x20,0x00,0x40,0x0B,
0x20,0x00,0xC0,0x0B,
0x20,0x00,0xC0,0x0B,
0x20,0x00,0x40,0x0B,
...
as you can see, binary ouput is the same for D=0.5, 1.5, etc.

That is the problem? spin asm version 1.1.31.0
igorp
Posts: 65
Joined: Tue May 19, 2015 6:10 am
Location: RU

Post by igorp »

one more test

Code: Select all

       LOG         0.666 , 0
        LOG         0.666 , 0.5
        LOG         0.666 , 1
        LOG         0.666 , 2
        LOG         0.666 , 4
        LOG         0.666 , 8
        LOG         0.666 , 15
dump:

Code: Select all

0x2A,0x9F,0x00,0x0B,
0x2A,0x9F,0x40,0x0B,
0x2A,0x9F,0x80,0x0B,
0x2A,0x9F,0x00,0x0B,
0x2A,0x9F,0x00,0x0B,
0x2A,0x9F,0x00,0x0B,
0x2A,0x9F,0x80,0x0B,
bit code of argument D is

Code: Select all

D=00000000000  // 0
D=01000000000  // 0.5
D=10000000000  // -1 ???
D=00000000000  // 0
D=00000000000  // 0
D=00000000000  // 0
D=10000000000  // -1 ??
So, the integer part of argument D is compiling wrong, or something like that. But parser working fine, I cant make D higher, than 15.9
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank »

Yeah, looks like a bug in the assembler. Simple work around is to divide the desired value by 16 to use in the instruction and it will map into the instruction bits properly then.

I.e. if you wanted D=-9.3 then enter it as -0.58215 (-9.3/16) in the instruction and it appears to map properly in the instruction.
Frank Thomson
Experimental Noize
igorp
Posts: 65
Joined: Tue May 19, 2015 6:10 am
Location: RU

Post by igorp »

Thanks, Frank!
MacroMachines
Posts: 71
Joined: Fri Dec 12, 2014 10:45 pm
Location: Detroit,MI
Contact:

Post by MacroMachines »

Oh, hmm I wonder if this has been part of my confusion also.

is it valid to use xx/16 in the code for equ or sof etc?
http://MacroMachines.net
Digital Control for your Analog Soul.
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank »

Well, you could use xx/16 any place a constant is used in the code, the assembler should do the division before creating the binary code but there shouldn't be a need to do it for other instructions. As far as I can tell it is only an issue with the assembly of the "D" part of the LOG instruction.
Frank Thomson
Experimental Noize
Post Reply