Computer Laboratory

ECAD and Architecture Practical Classes

Optional Extensions


Most plots of the Mandelbrot set are not merely Boolean plots of membership, but rather plots the smallest i such that |z_i|>2 (and black for suspected members of the Mandelbrot set). This i can be mapped onto a colour using a palette using a linear or log scale. An aesthetically desirable property for this palette to have is for it to be a gradient, i.e. adjacent colours are similar.

If you have r, g and b each as 8 bit values vid_set_pixel(x, y, (r << 16) | (g << 8) | b, display); will set the pixel at (x, y) to have the RGB colour (r, g, b). Note however, that the lower two bits of r, g and b will be ignored since the LCD screen only support 6-bits per colour channel.


Probably the simplest palette to generate is a palette of varying intensity. This can be implemented by going from linearly interpolating between RGB (0, 0, 0) and RGB (255, 255, 255): black and white. Or you could fade between blue and green on a linear or log scale.


A rather more interesting palette is one of varying hue. This can be generated by varying red, green and blue according to the diagram.

Generation speed

It is possible to improve upon the current generation speed.

Improve TTC

An easy way to increase throughput from the current system is to increase the number of TTCs in the system. At some point when following this strategy, the fitter will no longer be able to fit the design since it uses too many resources. The simplest solution to this is to reduce the TTC's resource usage as much as possible. Since it's replicated many times, relatively small savings per unit will translate into larger savings design wide. Improvements to the communication ring may also be needed.

Replace TTC

It would be possible to implement the Mandelbrot iteration accelerators as completely dedicated, single purpose hardware.

Replace Nios-II

If you follow the previous approaches as some point the Nios-II will become a bottleneck. At this point, more of the Nios-II's work should be moved into hardware.


The current viewer will only plot one view of the plot. Given the detail and self-similarity of the Mandelbrot set can only be seen at larger magnifications, it would be wise to add a feature to zoom.


Given the accuracy of the touchscreen, having zooming be done by pressing and dragging out a new viewport might not work very well. Something like a constant x2 zoom centered wherever the screen is touched should probably work fairly well though. Zooming out could be done in response to double tapping.


A nice way of implementing panning is so that if the user drags part of the screen, the whole viewpoint follows cf iPhone, Android.

To implement this together with zooming, you will need to provide some way to switch tools, perhaps a button drawn over part of the Mandelbrot plot.

Continuous zooming

If you have managed to increase generation speed significantly enough, you may be able to render continuous zooming of part of the Mandelbrot set in real-time. One approach may be to have the magnification increase by some fixed factor each frame then allow the user to pan this during zoom. You may also like to look into making the frame-buffer double-buffered to make this effect more seamless.


It may be nice overlay some status information over the plot. In particular, the current viewport window is probably of interest. As is frames per second if applicable.

Previous  |  Contents  |  Next