News:

;) This forum is the property of Proton software developers

Main Menu

Two/three-word format Fast Floating-Point from AD?

Started by trastikata, Jul 01, 2024, 07:19 PM

Previous topic - Next topic

trastikata

Hello,

recently came to a very interesting document with assembler code (attached here) from Analog Devices for their DSP's where they describe a two-word 32b or 48b floating point representation and operations.

Point is, there's the assembler code and looks quite fast.

Anyone familiar with this FP format? Any thoughts?

top204

A good article, but with smaller floating point comes less accuracy, so you are probably better off with signed 16:16 fixed point. The float format will mean larger values can be stored, but, again, with less accuracy.

With the 16-bit devices, the 32-bit floating point routines are very fast because of the device's good mnemonics used in them, and the 64-bit floating point I added gives excellent accuracy, and is still quite fast.

For faster processing, I would recommend using one of the dsPIC33xxCK devices, because they can happily operate up to 200MHz (and greater), and with the 2:1 clock ratio in the 16-bit devices, that means you will get 100 MIPS (Million Instructions Per Second), which is mostly too fast, and programs often have to be slowed down a bit. :-)

If the instructions of the DSP device were understood a little, the assembler procedures in the article could easily be converted to PIC24 or dsPIC because they look as though they are mostly moving high and low bytes of a register (Rx) or shifting bytes of a register (Rx).

trastikata

Quote from: top204 on Jul 02, 2024, 10:09 AMIf the instructions of the DSP device were understood a little, the assembler procedures in the article could easily be converted to PIC24 or dsPIC because they look as though they are mostly moving high and low bytes of a register (Rx) or shifting bytes of a register (Rx).

Indeed this is what took my attention and that's how I came to the "Sub" bug I reported  :). I am having fun with the dsPICs and their special mnemonics. Especially the cycle-less loop DO mnemonic, swap, Euclidean distance and MAC, the rest I am still trying to figure where would be useful.

I've been trying some assembler routines and measured the cycle count - I am very impressed - there's an order or two of magnitude decrease in cycles for certain operations.

Most of the time no high precision is required and 16x16 floating point would be extremely fast where can be used - that's why I looked at it.

Whereas fixed point looks more complex with all the scaling and check for normalization, I still have to read about that out.

top204

When I was first writing the 8-bit compiler, all of those years ago, I did start creating 16-bit floating point for it, as well as 32-bit floating point, because of the low RAM and slow operating speeds on the earlier devices. However, after tests, it showed how inaccurate it is, so I dropped it because the compiler would get the blame and not the floating point format, as has happened somtimes with 32-bit floating point and certain values that cannot be condensed correctly in it, and the, general, inaccuracy of the floating point format mechanisms.