Documentation bug for LOG on page 37 of the SpinAsm Manual?

Software questions and issues with the FV-1

Moderator: frank

Post Reply
dinosaur
Posts: 1
Joined: Sat Jan 10, 2015 8:15 pm

Documentation bug for LOG on page 37 of the SpinAsm Manual?

Post by dinosaur »

Hi Everyone! My first post, so please take it easy on me ;)

In the SpinASM User Manual PDF (page 37), the 2nd parameter in the LOG command is D: "an offset to be added to the logarithmic value in the range of –16 to + 15.999998" in 11bit S4.6 format.

However on the website http://www.spinsemi.com/knowledge_base/ ... x.html#LOG it says the 2nd parameter in the LOG command is 11bit from -1.0 to +0.999.

What's even stranger, is that SpinAsm IDE accepts from -16 to 15.999, but the values seem to overflow @ offsets of 2, 4, 6, etc.

Here's a concrete example showing what I mean by overflowing. All six of these lines compile to the exact same machine code [2000000B]:

Code: Select all

LOG 0.5,-14
LOG 0.5,-2.0
LOG 0.5,0
LOG 0.5,2.0
LOG 0.5,4.0
LOG 0.5,6.0
These two lines compile to machine code [2000800] with no errors:

Code: Select all

LOG 0.5,1.0
LOG 0.5,-1.0
The diagram on the website seems to hint that D should indeed be limited to -1.0 to 0.999, since the log operation is already divided by 16.

Can anybody confirm?
frank
Posts: 1244
Joined: Wed Oct 19, 2005 12:26 pm
Contact:

Post by frank »

Hmmm, something got confused in the docs somewhere. Will need to look into this and get back to you but will be a while, NAMM is next week and people have already started to arrive for meetings.

For now, use the example in http://www.spinsemi.com/knowledge_base/ ... x.html#LOG for programming. Technically both are correct depending on how you look at the binary point placement but as SpinAsm appears to not map +/-16 properly it is probably best to treat the LOG result as being divided by 16 and adding an offset of +/-1. Same result in either case it just depends where you consider the binary point to be located.
Frank Thomson
Experimental Noize
pharaohamps
Posts: 34
Joined: Thu Nov 09, 2006 6:58 am
Contact:

Post by pharaohamps »

I've been wrestling with this myself.

LOG 0.5, 1.75

is the same as

LOG 0.5, -0.25

It LOOKS like the range for this "D" offset value is actually 0x000 to 0x7FF, or just those 11 bits. Anything over 1.9990 or below -2 overflows and starts again. Even though the documentation mentions the sign bit, the assembler doesn't set it in the way you'd expect.

I'd love to find out exactly what the assembler is doing for each possible input value, what the FV-1 expects and needs, etc.
Digital Larry
Posts: 338
Joined: Mon Nov 12, 2012 1:12 pm
Contact:

Post by Digital Larry »

I'm just starting to dig into the LOG and EXP instructions myself.

I'd like to get more insight beyond simply "what it does" and explore more of "how you should use it" for specific applications.
Post Reply