CORDIC BUGZ - A Demo of P2's Cordic Engine
ozpropdev
Posts: 2,793
Hi All,
Sorry to alarm you guys with my use of the B word....
Edit: Modified Title to minimize panic!
This program is a demo of the P2's Cordic engine.
A collection of bugs follow a simple rule:
"If something gets in your way, TURN" .
The code uses the QARCTAN and QSINCOS instructions to calculate
bug trajectory and special awareness of screen edges and other bugs.
The FRAC instruction is also used as a handy way of converting angles to
the 32 bit format required by the Cordic engine.
Their a 3 versions, 1 for Nano boards and 2 for the DE2 boards.
The DE2 versions have more bugs and increased screen resolutions.
Output is VGA 800x600 16 Color and runs in 1 Cog.
FPGA core is current 29th Jan 2014 build.
The bug graphics are quite simplistic (Graphics is not my strong point), but
the characters also use the cordic to rotate and plot outlines.
Just a bit of fun and Happy New Year everyone!
Brian
Latest version here
Sorry to alarm you guys with my use of the B word....
Edit: Modified Title to minimize panic!
This program is a demo of the P2's Cordic engine.
A collection of bugs follow a simple rule:
"If something gets in your way, TURN" .
The code uses the QARCTAN and QSINCOS instructions to calculate
bug trajectory and special awareness of screen edges and other bugs.
The FRAC instruction is also used as a handy way of converting angles to
the 32 bit format required by the Cordic engine.
Their a 3 versions, 1 for Nano boards and 2 for the DE2 boards.
The DE2 versions have more bugs and increased screen resolutions.
Output is VGA 800x600 16 Color and runs in 1 Cog.
FPGA core is current 29th Jan 2014 build.
The bug graphics are quite simplistic (Graphics is not my strong point), but
the characters also use the cordic to rotate and plot outlines.
Just a bit of fun and Happy New Year everyone!
Brian
Latest version here
Comments
Thanks - I will take a look later when heart rate lowers
hehe - clever .... but shouldn't bugs have 6 legs ?
These are custom low power bugs, only 4 legs are required!
Anyway, I downloaded your files and modified the DE2-115 version to work with my latest Prop2/PNut combo, but I can't get it to work. I haven't spent a lot of time on it, but I did make a lot of necessary changes to instruction names and branch syntax (@ instead of # for DJNZ, etc). I want to see this work, so I'll look more into it soon. Right now, I'm trying to get my head around the cache lines after having taken what turned out to be a whole week's break from working. I'm fatter and duller than I was before, so it's yet difficult.
Sorry Chip, Maybe I should have called them BUGZ or CRICKETS!
Hopefully it's not too much work to get it going
Looks good ozpropdev keep up the great work!
Here is an updated version of CORDIC Bugz for the DE2-115 FPGA (Build 26 Jan 2014).
Code is no longer supported on DE0-Nano, as it needs math and 240k hub for video (sorry guys )
This version has more bugz and double screen width.
Cheers
Brian
Edit: just tried on another monitor, rock steady picture! Some of the demo's work fine on monitor 1 (balls) and some on monitor 2 (bugz).
Try changing the "SCHEDULE" register to %%100 from %%10 and in the VGA driver add a NOP or two after the RDWIDE instruction.
Would you be able to post a short video clip of your demo please (for those of us without the DE2)?
Here's a short video of the "BUGZ" in action.
Apologies for my shaky hand and quality of production. (No Oscar nomination here)
Cheers
Brian
P2 Fish Tank! is next...
C.W.
Here is the latest version of CORDIC Bugz.
It has been converted to HUB Execution mode and the latest FPGA Build (28th Jan 2014)
The conversion from code snippet loading to hub exec mode was a lot easier than I expected. Well done Chip!
Code uses 2 cogs now and has more bugz..
Cheers
Brian
Very clean and nice code.
Shows HUBEXEC's possibilitys and power.
Only thing I changed.
That shows me more logicaly what place that code Starts
Thanks Sapieha
I agree it is a bit confusing, maybe we need a simple directive like ORGR or ORGB (Hub ram base address $380 ($E00/4))
Cheers
Brian
One of thet You propose
> directive like ORGR or ORGB (Hub ram base address $380 ($E00/4))
---> BUT that onit first filing of 0000000 in BIN file (BIN file starts with first address thta are present in ORGB-ase
I tweaked CORDIC Bugz a bit to get more bugz(64), screen colors, resolution(800x600) and speed.
Run under 28th Jan DE2-115 FPGA build.
KEY3 restarts bugz
SW0 pauses bugz.
Try increasing number of bugz to say 120 and watch them squeeze into every space!
Cheers
Brian
A few more tweaks for better performance.