PDA

View Full Version : Floating Point Library for PropBasic



Christof Eb.
11-14-2011, 06:32 PM
Hi PropBasic - Fans,

this is just an adaption of the first Cog part of "F32Full.spin" as a library for PropBasic. Actually I did spend quite a few hours how to include the Pasm - Part into a Basic task - without trying to understand how it works.... It seems to work, but perhaps it is a good idea to wait a little time, if someone finds a bug, before i put into obex.....

A Cog is started as a floating point coprocesssor, the code runs as cog pasm code with maximum speed.

Unfortunately the compiler can not work with float constants? It would be great, if this could be changed....

Of course my dream is, that the compiler could work with longs and floats automaticly...

Have fun, Christof

Bean
11-15-2011, 10:56 AM
Christof,
I'm a little "under the weather" but I will take a look at these as soon as I'm feeling better.

P.S. I "think" you can using floating point constants if you prefix them with a # as in: value = #1.0

Bean

Christof Eb.
11-15-2011, 06:46 PM
Bean, get well soon!
Best Regards, Christof

FriedV
11-16-2011, 02:17 AM
Hello,
here is my try at this.
It is not a library yet, but a main progran running in cog0 and
a driver for SPI connected to the uM-FPU and a DogM163 3x16 display running in another Cog.
All written in PropBasic.
This is work in progress, up to now no provision for errors or special cases, all maths are assumed
"well behaved". Documentation is also not finalized yet, may contain errors.
Thanks Bean & Hanno for the tools, btw the display of the float numbers works fine in Viewport.
To test I have attached a PropPlug to the FPU, on the PC I use http://www.clearconnex.com/content/clearterminal
to watch the FPU
86898
Cheers, Fried

Hanno
11-16-2011, 02:35 AM
Good job Fried! I really like where PropBasic is going.
Hanno

Christof Eb.
11-16-2011, 06:53 PM
Hi Fried,
isn't it interesting, that both of us have started now towards floating point with PropBasic?
What do you think, is the speed gain of your hardware solution?
I have read, that um-FPU 3.1 would be based on this:
http://ww1.microchip.com/downloads/en/DeviceDoc/70139E.pdf, which has the same pinout and a fast 17*17bit hardware- multiply. On the other hand, you need to get the data into and out of it.
Best regards, Christof

Bean
11-18-2011, 12:41 PM
P.S. I "think" you can using floating point constants if you prefix them with a # as in: value = #1.0


Nope, That doesn't work. But I will work on getting it working for the next release.

Bean