Computer Laboratory

ECAD and Architecture Practical Classes

Fixed point algorithm for TTC


As mentioned earlier, the Mandelbrot set is the set of complex numbers for which the iteration z_{n+1}=z_n^2+z_0 does not diverge. A useful result in determining whether the points diverge that all points |z|>2 diverge, so if at any stage the iterated value >2 then it too must converge.

Since it's impossible to know until for some i |z_i|>2 whether z diverges or not and some points not part of the Mandelbrot set could take many many iterations to become >2, if we are to attempt to decide if a point lies in the Mandelbrot set or not there must also be some cut off point for the maximum number of iterations before we assume it doesn't diverge. Luckily the Mandelbrot set has a structure such that when plotted there are smaller areas of points that take a certain number of iterations before they diverge as that number of iterations increases. Thus the maximum number of iterations corresponds to detail in the final plot and determines, along with numerical precision, how far the plot can be zoomed in while still seeing interesting detail.

Here is a Java program which, when given a complex coordinate will iterate it up to 1000 times and print how many iterations it took to diverge .

Try running the program with some points inside an outside the Mandelbrot set picked from the above plot. Notice the program only makes use of 32 bit signed integers and therefore makes a good basis for fairly direct translation to TTC assembler.

TTC version

Now write a program for the TTC which does the same as mandelbrot_point. The x_0, y_0 values (in 4.28 fixed-point) and the maximum number of iterations should be sent to the TTC on its input channel and the returned value (iter) sent on the output channel. Test (in simulation) your SystemVerilog system against the provided Java.

Previous  |  Contents  |  Next