Floating Point Library for PropBasic
Christof Eb.
Posts: 1,237
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
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
Comments
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
Best Regards, Christof
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
FPU_LCD.pbas
Cheers, Fried
Hanno
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
Nope, That doesn't work. But I will work on getting it working for the next release.
Bean