ECE 448: Spring 2019 Lab 5 Julia Set Fractal.

Slides:



Advertisements
Similar presentations
Iteration, the Julia Set, and the Mandelbrot Set.
Advertisements

1 RTL Example: Video Compression – Sum of Absolute Differences Video is a series of frames (e.g., 30 per second) Most frames similar to previous frame.
CHAPTER 12 Height Maps, Hidden Surface Removal, Clipping and Level of Detail Algorithms © 2008 Cengage Learning EMEA.
Counters and Registers
Mandelbrot Set the Who Is Mandelbrot?  Benoit Mandelbrot –Mandelbrot was born in Poland in He studied mathematics in France under Gaston Julia.
Mandelbrot Fractals Betsey Davis MathScience Innovation Center.
Fun with Fractals The Mandelbrot Set J Sweeney What is a fractal? Fractals are mathematical structures defined by three properties –Iterative –Self-similar.
Chapter 2 Data Representation. Define data types. Visualize how data are stored inside a computer. Understand the differences between text, numbers, images,
MATH 224 – Discrete Mathematics
Analysis of Algorithm Lecture 3 Recurrence, control structure and few examples (Part 1) Huma Ayub (Assistant Professor) Department of Software Engineering.
1/1/20001 Topic >>>> Scan Conversion CSE Computer Graphics.
Introduction to Experiment 5 VGA Signal Generator ECE 448 Spring 2009.
Intruder Alert System By: Jordan Tymburski Rachita Bhatia.
Department of Mathematics Computer and Information Science1 CS112: Survey of Computer Science Chapter One Review: Introduction, Chapter Two: Number Systems.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
Bellwork Last Nights Homework c. 4 d
Windows, Viewports, and Clipping
Chapter 2 Data Representation.
Data Representation, Number Systems and Base Conversions
Computer Programming Control Structure
Mandelbrot Set Fractal
Data Representation. What is data? Data is information that has been translated into a form that is more convenient to process As information take different.
GEOMETRY AND LINE GENERATION Geometry and Line Generation Chapter 2.
CS-321 Dr. Mark L. Hornick 1 Graphics Displays Video graphics adapter Monitor.
Lecture 11 Text mode video
Direct-Access Color Graphics Chapter 11. Graphics modes C++ provides a different combination of graphics characteristics. These characteristics include.
Lecture 2: 19/4/1435 Graphical algorithms Lecturer/ Kawther Abas CS- 375 Graphics and Human Computer Interaction.
CS552: Computer Graphics Lecture 16: Polygon Filling.
Computer Organization
Fractals and L-Systems
HONR 300/CMSC 491 Computation, Complexity, and Emergence
Computer Graphics: An Introduction
Lec 3: Data Representation
Everything is a number Everything in a computer memory and on storages is a number. Number  Number Characters  Number by ASCII code Sounds  Number.
Applied Discrete Mathematics Week 2: Functions and Sequences
Chaos Theory The theory of non-linear functions, such that small differences in the input of the function can result in large and unpredictable differences.
Week 2 - Monday CS361.
REPETITION CONTROL STRUCTURE
Lesson #6 Modular Programming and Functions.
Flash Interface, Commands and Functions
Lesson #6 Modular Programming and Functions.
Pseudocode Upsorn Praphamontripong CS 1110 Introduction to Programming
Fractal image compression
Chapter Three Part I Output Primitives CS 380.
VGA Display Part 4 Text Generation
Chapter 8 Input/Output I/O basics Keyboard input Monitor output
Microprocessor and Assembly Language
EEL 3705 / 3705L Digital Logic Design
1. Encode binary value using PCM
Lesson #6 Modular Programming and Functions.
ECE 448: Lab 4 VGA Display Mini-Pacman Game.
Copyright © Cengage Learning. All rights reserved.
Programming Funamental slides
Ch2: Data Representation
Introduction to Computer Graphics
Programming Funamental slides
Data Representation Conversion 05/12/2018.
Graphics Hardware: Specialty Memories, Simple Framebuffers
Chaos Theory The theory of non-linear functions, such that small differences in the input of the function can result in large and unpredictable differences.
Chapter 2 Data Representation.
Number Systems Lecture 2.
Graphics Systems Lecture-2
Lesson #6 Modular Programming and Functions.
ECE 448: Spring 2019 Lab 5 Julia Set Fractal.
FPro Video Subsystem: VGA Frame Buffer Core
ECE 448: Spring 2016 Lab 5 Julia Set Fractal.
Using FPro SoC with customized hardware cores
Copyright © Cengage Learning. All rights reserved.
Wadner Joseph • James Haralambides, PhD Abstract
Embedded Image Processing: Edge Detection on FPGAs
Presentation transcript:

ECE 448: Spring 2019 Lab 5 Julia Set Fractal

Hands-on Session on FPro SoC Video Subsystem Example 2

Platform Hardware Organization The main functionality of the subsystem is to generate, process, and display pixel data. An FPro video core inputs a pixel stream, performs computation or adds new contents to the stream, and then outputs the processed pixel stream. The video cores are arranged as a cascading chain and the pixel data travels through the chain stage by stage. The cores in the left are video sources that generate fullscreen pixel data and stream it to the cores in the following stages. The cores in the middle perform certain transformations on the pixels or augment the frame with additional graphics. The stream is eventually routed to the video synchronization circuit, which is the rightmost core in the chain, and displayed on a monitor.

Video Display using VGA Interface

Frame Buffer Driver (vga_core.h) /* methods */ FrameCore(uint32_t frame_base_addr); ~FrameCore(); // not used void wr_pix(int x, int y, int color); /** * clear frame buffer (fill the frame with a specific color) * @param color color to fill the frame * */ void clr_screen(int color); * enable/disable core bypass * @param by 1: bypass current core; 0: not bypass void bypass(int by);

Video Subsystem Application FrameCore frame(FRAME_BASE); GpvCore bar(get_sprite_addr(BRIDGE_BASE, V7_BAR)); GpvCore gray(get_sprite_addr(BRIDGE_BASE, V6_GRAY)); SpriteCore ghost(get_sprite_addr(BRIDGE_BASE, V3_GHOST), 1024); SpriteCore mouse(get_sprite_addr(BRIDGE_BASE, V1_MOUSE), 1024); int main(){ bar.bypass(1); gray.bypass(1); ghost.bypass(1); mouse.bypass(1); frame.bypass(0); frame.clr_screen(0); frame.wr_pix(0, 0, 1); frame.wr_pix(639, 479, 1); }

Introduction to Lab 5 7

Benoit Mandelbrot Mandelbrot was born in Poland in 1924. Father of fractal geometry. He showed how fractals can occur in many different places in both mathematics and elsewhere in nature.

What is a Fractal? Fractals are mathematical structures defined by two properties Iterative Self-similar Zooming in or out on the image reveals deep repetition of patterns

The Julia Set Julia Set was named for the early twentieth century French mathematician Gaston Julia The Julia set is a set of points in the complex plane, the boundary of which forms a fractal. Mathematically, the Julia set can be generated using a very simple iterative formula, called the quadratic recurrence equation, applied to points in complex plane  zn+1 = zn2 + zn + c    we start with z0=0 and apply the iteration repeatedly, The absolute number depends on c, however large n gets.

The Julia Set

Pseudocode In the pseudocode below, Z0=z0x+i·z0y, corresponds to one pixel of the display region. The plotted region should have the following limits -2 ≤ z0x=Re[Z0] < 2 -1.5 < z0y=Im[Z0] ≤ 1.5 for z0y = -1.5+step to 1.5, step 3/480 do for z0x = -2 to 2-step, step 4/640 do { iteration = 0 zx = z0x zy = z0y z and c are complex numbers. One begins by assigning a fixed value to c, letting z = 0 and calculating the output. One then repeatedly recalculates, or iterates, the equation, substituting each new output for z. Some values of c, when plugged into this iterative function, produce outputs that swiftly soar toward infinity. Other values of c produce outputs that eternally skitter about within a certain boundary. This latter group of c‘s, or complex numbers, constitutes the Mandelbrot set.

Pseudocode Cont… // z = z2 + z + c = (zx2 – zy2 +zx + cx) // + i·(2 · zx · zy + zy + cy) while (zx2 + zy2 < 4 && iteration < MAX_ITER ){ zxtemp = zx2 – zy2 + zx + cx zytemp = 2 · zx · zy + zy + cy zx = zxtemp zy = zytemp iteration++ }

Pseudocode Cont… x = x_conv(z0x) // conversion to the x-coordinate of a pixel y = y_conv(z0y) // conversion to the y-coordinate of a pixel if zx2 + zy2 < 4 color(x,y) = fractal_color else color(x,y) = background_color }

VGA Display Area Use a rectangular area of the size 640 x 480 to display the Julia set fractal. Use BTNS to start/pause the computations.

x_conv() and y_conv() The functions x_conv() and y_conv() are used to convert the coordinates of the complex number Z0 into x and y coordinates of the pixel.   x = x_conv(z0x) = (z0x-(-2))*(640/4) = 160*(z0x+2) y = y_conv(z0y) = 480 - (z0y-(-1.5))*(480/3)= 480 – 160*(z0y+1.5)

Fixed Point Representation You can use Q4.28 representation 4 integer bits 28 fractional bits Addition/Subtraction performed as usual Multiplication of two Q4.28 numbers results in a Q8.56 number, which should be converted back to Q4.28

Julia Set Fractal Core

Julia Set Fractal Core The fractal is calculated over a 640x480 pixel area and this area can be divided into tiles, each containing 32x16 pixels. Each tile is then processed by the core to determine which of its pixels are the part of the Julia set. The tiles are represented using the following data sent to the core: • Initial value of the z0x • Initial value of the z0y The algorithm mentioned above is performed for all pixels in each tile mentioned above, and the result should contain 16 32-bit words, with each bit of each word denoting whether a corresponding pixel of the tile belongs to the Julia set. Finally, there should be a flag denoting that the computations are complete for the entire tile.

Bonus Task 1 At the top of the screen display “THE JULIA SET” in the center. At the bottom of the screen display Percentage of the display area, increasing after the Julia set fractal core completes calculations for each subsequent 32x16 pixels tile. Progress bar Total execution time with the step 0.1 s.

VGA Display Outlook THE JULIA SET 33.1 s 95.5%

Bonus Tasks 2 Increase the speed of calculations, by evaluating 4 values of Z0 in parallel. Determine the maximum speed-up possible by evaluating N values of Z0 in parallel, where N is limited only by the available FPGA resources. 

Bonus Task 3 Provide support for changing the color of the fractal and background depending on the settings of switches, as described in the table below:

Lab Exercise 1 32

Text Generation Basics Each character is treated as a tile The patterns of the tiles constitute the font of the character set We use an 8 x 16 font, similar to the one used in early IBM PCs In this font each character is represented as an 8 x 16 pixel pattern The character patterns are stored in the pattern memory, known as font memory For a 7-bit ASCII we need 128 x 16 x 8 = 2kbytes ECE 448 – FPGA and ASIC Design with VHDL

Font Pattern of A 128 ×16=2048 byte array Pixel Pattern Array Content ECE 448 – FPGA and ASIC Design with VHDL

Character coordinates 640 pixels  640/8 = 80 characters 1 2 3 4 5 6 7 8 9 10 75 76 77 78 79 1 2 3 480 pixels  480/16 = 30 characters . . . . . . . . . . . . . . . . . . . 26 27 28 29 ECE 448 – FPGA and ASIC Design with VHDL

Repeated display of all 128 characters 32 chars 31 32 63 64 79 95 4 chars 128 characters 128 characters 128 characters 3 4 128 characters 128 characters 128 characters 7 24 128 characters 128 characters 128 characters 27 28 128 characters 128 characters 128 characters 31 ECE 448 – FPGA and ASIC Design with VHDL