Article about math at propellerwiki
Ale
Posts: 2,363
Hei all.
I was busy these days writing an article about math at propeller.wikispaces.com/MATH. Deals with binary and BCD math on the propeller, with descriptions and code examples. I'd like some feedback so I thought I'd ask.
- what should I add (FFT will have a separate article with fully functional, and already written code).
- what is covered
- language use
- style
I particularly like the style I used so far, I hope you too.
**** PLEASE: do not edit the page. Let me do the additions (for the time being), so multiple changes do not conflict. ****
thanks in advance.
Ale
I was busy these days writing an article about math at propeller.wikispaces.com/MATH. Deals with binary and BCD math on the propeller, with descriptions and code examples. I'd like some feedback so I thought I'd ask.
- what should I add (FFT will have a separate article with fully functional, and already written code).
- what is covered
- language use
- style
I particularly like the style I used so far, I hope you too.
**** PLEASE: do not edit the page. Let me do the additions (for the time being), so multiple changes do not conflict. ****
thanks in advance.
Ale
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The routines can be compacted, I think quite a bit, but they will lose readability, fast, and their purpose to illustrate how to implement them.
ie.
add x,y wc, wz
Appologies if you've covered it somewhere else!
J
Keep it up!
An appreciative
Graham
Also, aren't the sine tables already in the rom map, too?
Seems like the article was written just for me - someone who is learning assembly and doesn't already have expertise in binary math. A few other topics you could cover; Calculating Cos & Tan.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Concentrate on understanding the problem, not applying the tool
Leon
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Amateur radio callsign: G1HSM
Suzuki SV1000S motorcycle
Post Edited (Leon) : 7/22/2008 6:23:50 PM GMT
- The built-in tables are only useful to calculate using binary numbers and floating point with them is not exposed by me yet. (The float object (in Object Exchange) uses the tables because it uses a binary representation of floating point.) I marginally touch this so far, The tables are 12 or 13 bits of precision, so higher can be achieved with some more help.
For BCD they are not useful ;-/, afaik.
- The plan is to cover both BCD and binary, maybe a bit of linear algebra, too. Everyone loves 3D, I'll add them as soon as I write them, and have "lust" at writing them. Today I was optimizing the square root, I'm down to 70% or so of the current proposed routine (same algorithm).
Thanks for the comments.
Edit: and of course latin
I will like to see the FFT code.
Is there a way to speedup Chip's multiply/divide/sqrt code in the Interpreter without adding too many more bytes (save some if possible)? I'm doing a faster RamInterpreter and this section will probably be the last bit I do, so any help would be appreciated.
To set flags these should work (will test it when I have my development laptop on).
·
The code was developed using the pPropellerSim that I also just updated to CVS (not yet a release). I can release some intermediate if someone needs it, but you can just as easily grab the source from the CVS repository,
Producing that code may not seem much but it required quite a bit of patience and loads of help from the simulator (took me 3 days to debug, and part of the problem was that some instructions were not correctly simulated: rev, negxx and min/max)). Comparing to the C version for correctness was not exactly a walk in the park. I was thinking that a trace function (not the one that says how many times an instruction was fetched) but one that at certain point samples the status of some/all HUB/COG memory and outputs it to a file or displays it could be very helpful (I implemented that for the REV instruction to see if the permutations were correct, in a very simple way). I was thinking in adding something exactly like that, Comparing calculated data in bulk could be more efficient at spotting discrepancies that debugging step-by.-step when you do not know where it bombs.
I hope it is useful for someone, just drop me a line
Ale
Edit: The code in the math article will be updated with shorter and faster versions, that I already wrote and tested.
Post Edited (Ale) : 8/1/2008 6:58:30 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I have a breadboard with a prop, VGA out and a (too) fast ADC, I'll add it to it (512x384 bitmap) and post some photos.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
@Mike: Except for the sqrt, all multiplications are unrolled, but anyways there are ~ 22000 of them for 1024 points.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I made the FFT work with a VGA output and all, so here are some photos. The input signal is the Horizontal sync (PA 17) sampled at 1 Msps, so the resolution is roughly 1 KHz per point, the driver outputs 512x384.
Enjoy.
Edit: Code added, add only VGA_512x384_Bitmap.spin... rename the .pas to spin and you are in business (maybe an AD9382 will help )
Post Edited (Ale) : 8/4/2008 4:36:17 PM GMT