P1 Mandelbrot Fractal Program ported to P2 PASM
potatohead
Posts: 10,261
I saw Chip's fun full-color brain wash capable spiral and it make me want to render some fractals with the new math instructions. It wasn't hard, and they are really fast without any real thought at optimizing things. Hanno put one here, and that's what I used.
Honestly, I got stuck on stupid mistakes I miss when I don't have the syntax highlighting I'm so used to more than I did the math part of things. What a sweet turn of events! On P1, complex math is a project in and of itself. On P2, one can more or less parse the expression and type it right in.
The attached program runs on a DE2, composite NTSC display. You don't need the SDRAM capable image to run it. HUB RAM only on this version.
It fires off a monitor on pins 3 & 5, so you can capture the pictures if you want to. Change this, if you want the default pins. There are some basic parameters at the bottom. I was wondering, do the buttons and switches still work on the DE2 with the addition of the SDRAM, SD CARD and DACS?
Load it with Pnut. The driver is 256x192 NTSC 16 bit color.
Honestly, I got stuck on stupid mistakes I miss when I don't have the syntax highlighting I'm so used to more than I did the math part of things. What a sweet turn of events! On P1, complex math is a project in and of itself. On P2, one can more or less parse the expression and type it right in.
The attached program runs on a DE2, composite NTSC display. You don't need the SDRAM capable image to run it. HUB RAM only on this version.
It fires off a monitor on pins 3 & 5, so you can capture the pictures if you want to. Change this, if you want the default pins. There are some basic parameters at the bottom. I was wondering, do the buttons and switches still work on the DE2 with the addition of the SDRAM, SD CARD and DACS?
Load it with Pnut. The driver is 256x192 NTSC 16 bit color.
Comments
Chip, the new features on the Prop2 are awesome!
What I'm really looking forward to is live sensor/feedback visualization, but we kind of need the real chip for that. I think it will be fun to compose custom instruments for all kinds of real-world phenomena. It should bridge the gap between the PC's graphics capabilities and a DSP's real-time response.
Edit: We can make a Propller Tricorder.
Simple would be left-click to zoom, right-click to toggle Julia mode, using the current mouse position as the seed value.
I may multi-cog this tonight. One COG running 200 or so iterations can do the screen in a few seconds, maybe 5, depending on the region being rendered.
Can't wait to get hold a PII....
Nice work! I finally got around to hooking up an NTSC monitor again, and the first thing I tried was your Mandelbrot demo - looks great.
Something like this could be shown using the STR8_RGBI8 video mode to get your byte rate down to 74.25MHz, which would work with the SDRAM driver, no problem. Then, you'd have full 720p resolution and 32 shades of each 8 basic colors. Do you want to try it?
XGA version is coming up shortly...
I've been meaning to try out the STR8_RGBI8 mode...
First, I'll make a 1024x768 VGA version (with 256x192 bitmap) (done, see below)
Then I plan to start experimenting with the SDRAM
Following that... high-resolution here we come!
The nice thing about the fractal code is that I can construct a scan line in the hub, then burst transfer it - I have not yet written "read/write long/word/byte" routines... I need to experiment with your driver before I can make those.
Can You made 800x600 one ?
800 * 600 * 2 * 60 = 57.6MB/sec, well under the 107MB/sec bandwidth limit on the DE2
Well if you don't end up multi-cogging it, I will later. . On that note, are the buttons and switches still functional with the latest DE2 image?
800x600 is a good compute speed target too. With 2 cogs, it should be able to do a screen in a few seconds, maybe 10 at a couple hundred iterations...
Please find the 800x600 driver, with fractal demo, attached.
Update: Added 800x480 driver with fractal demo - note, I could not find any official VESA numbers for this, only a screenshot of a PowerStrip mode line.
I think I'll have some SDRAM drivers running before the weekend - depends on how much "play" time I can free up.
I don't think I'll have time to multi-cog the fractal engine though... so that will probably have to wait for you.
PIC in attachment.
Key1 = mode, which is displayed as little dashes right at the top of the screen. From left to right: scale, vpan, hpan, iterations
key2, 3 = + and - by mode
sw0 up = redraw on button action
sw0 down = no redraw
TV version attached. My VGA is on loan right now. I may tinker with this on the next FPGA image to add modes, tasks, resolution, Component video, etc...
Use F10. It's a small program, simple.
Looks great!
You can get some more performance by changing your MUL32 instructions to MUL.
Saves ~14 clocks per multiply.
Brian
This also shows off how cool tasks are going to be. Refactoring this to employ tasks would result in a cleaner, more efficient program.
Can't wait to try it out. : ]
--Andrew.