FPGA Mandelbrot With Code!

FPGA Mandelbrot With Code!
by on (#74021)
Well, it's not entirely NES related, but I thought I'd post a bit about this anyways since there might be some interested in it.

A few weeks ago, I created an FPGA mandelbrot set / julia set rendering engine on the FPGA. It produces real time sets which you can zoom and pan via an NES or SNES controller. I have a video of it in action here:

http://www.youtube.com/watch?v=KWmxb-9vjyA

The thing uses two verilog files; a "rendering core" which is mandelbrot.v, and the main controller which coordinates the cores and ouputs pixels which is video.v.

And to keep it somewhat NES related, it uses 6502 code to calculate the coordinates and step size. My arbitrary bit size math functions might be useful for NES games. I dunno. (source for these is below)

Anyways, have fun with it, and if you get it going on an FPGA board I would like to see the output. If a larger FPGA is used, more rendering cores can be easily dropped in to speed it up even more, though with 7 it is pretty fast and can typically pull 10-25fps or so without a problem.
If more cores are used, it could theoretically output a higher resolution with the same framerate but more mods would have to be done. Right now, it's NES resolution naturally. (256*240)

If you wish to play around with it, here is how to use it:

The video.v file instantiates mandelbrot.v, and it outputs pixels to a frame buffer. The video.v outputs addresses and RGB pixel data, 4 pixels at a time. So to use it, you need to make a small frame buffer object using a synchronous SRAM (which are included on almost all of the FPGA dev boards).

anyways, here is the source code:

http://blog.kevtris.org/blogfiles/mandelbrot.v
http://blog.kevtris.org/blogfiles/video.v
http://blog.kevtris.org/blogfiles/MANDEL.ASM

have fun. If there's some interest I might be persuaded to release other code sometime.

by on (#75334)
This is freakin sick! So my question is...how did you figure out how to do this? Haha. Did you use some existing verilog code that you found online or did you just do everything from scratch?? O.o Or did you study the algorithms from a book or...?

This is really impressive. I'm surprised you have no replies...I guess maybe because there aren't many FPGA'ers on these forums...? Still kind of odd. I was thinking about puttin this baby on a giant Virtex-5 that I have and upping the number of cores. What clock rate were you running at?

Pz!

Jonathon

by on (#75356)
jwdonal wrote:
This is freakin sick! So my question is...how did you figure out how to do this? Haha. Did you use some existing verilog code that you found online or did you just do everything from scratch?? O.o Or did you study the algorithms from a book or...?

This is really impressive. I'm surprised you have no replies...I guess maybe because there aren't many FPGA'ers on these forums...? Still kind of odd. I was thinking about puttin this baby on a giant Virtex-5 that I have and upping the number of cores. What clock rate were you running at?

Pz!

Jonathon


I came up with it all on my own. I wrote it all from scratch in about 2-3 days.

The Mandelbrot algo is quite simple- you just iterate a function until the bailout condition is met, and when it is you use the number of iterations to set the colour for that pixel.

I spent some time working out the fixed point representation for it that would give me the most bang for the buck.

I ran the cores at around 70MHz from what I recall. When I ran faster, I got errors in the multiplies due to propagation delays. The interesting thing to me is that the errors were fractal in nature! It ended up making complex loops and curves in the black part of the mandelbrot/julia sets.

If you wish to increase core depth I can help with that. But the basics are you just add more mandelbrot instances and adjust the selector in the case statement to add the results from the cores, and up the core counter.

I have NOT tried increasing bit depth of the cores- that functionality is untested but should work. <cough>. the cores are 36 bit inputs because this is a multiple of the width of the hardware multipliers (18*18 bits on this chip).

by on (#75988)
had to google what fpga was. this is amazing. i try to collect as many of those old art matix mandlebrot/julia set videos as i can. mandlebrot set on nes possibility?

edit: want to restate that this is truly fucking awesome

by on (#76002)
There's one for NES here: http://www.nesdev.com/bbs/viewtopic.php?t=4212

by on (#76020)
yesyesyall wrote:
had to google what fpga was. this is amazing. i try to collect as many of those old art matix mandlebrot/julia set videos as i can. mandlebrot set on nes possibility?

edit: want to restate that this is truly fucking awesome


Thanks for the good words. I remember art matrix too. I had two t-shirts by them (long gone now unfortunately) and at least 1 videotape. Not sure if I still have the tape or not. I got them back around 1993 or thereabouts from a friend here in town that used to sell their stuff.

by on (#76475)
That video was really cool. i like how it looks and the sound in the background. five out of five stars.