Operation – Altera Embedded Systems Development Kit, Cyclone III Edition User Manual

Page 64

Advertising
background image

Altera Corporation

Development Board Version 1.0.

9–6

July 2010

Altera Embedded Systems Development Kit, Cyclone III Edition

Using the Nios II C2H Compiler

8.

To change the color palette used in the final image simply press the
Color

button followed by the Continue button. See

Figure 9–4

.

1

While the menu is being displayed, all rendering will be paused
as well. If you opened the menu and wish to continue without
changing any settings press the Continue button.

Whether the design is rendering data using hardware or software,
benchmark data is being collected and displayed to the screen.

When hardware rendering is selected the benchmark data is updated
at every 5 frames.

When software rendering is selected the benchmark data is updated
at every frame.

The benchmark data is displayed in the bottom right of the screen and it
represents the instantaneous frames per second being rendered and
displayed. Consider the implications of what you have observed: What
one would traditionally do with an expensive, power hungry GHz
processor was just accomplished using a Cyclone III FPGA, running at
100 MHz. Such is the power of hardware acceleration using FPGAs.

Operation

The design performs panning and zooming on the complex plane which
gives a video like effect. Every time a new frame is rendered, a new set of
coordinates must be calculated. These coordinates contain a center point,
zoom factor, and maximum number of iterations. Knowing the center
point and zoom factor the top left point of the screen is then determine
and passed to the Mandelbrot algorithm. The maximum number of
iterations is used to determine how much effort is spent per coordinate
before it is determined that the point is included in the Mandelbrot set
(these points appear as black pixels). The pixel calculation is based on the
following software segment:

inline int int_mandelbrot(long long cr, long long ci,
int max_iter)
{
long long xsqr=0, ysqr=0, x=0, y=0;
int iter=0;
// go ahead and shift these up to the new decimal
offset
ci = ci<<28;
cr = cr<<28;

while( ((xsqr + ysqr) < 0x0400000000000000LL) &&
(iter < max_iter) )
{

Advertising