Vous êtes sur la page 1sur 69

Introduction to Xilinx System Generator

Introduction To Simulink And System Generator


Simulink
o Developed by MathworksInc. o A Model-based design environment integrated with Matlab o Provides various sets of block libraries to help you create , simulate, and test a complicated system,including control system, communication, image processing, etc.

System Generator
o Developed by Xilinx Corp. o Provides device-optimized DSP block library for Simulink o Let you model DSP algorithm, generate HDL code, and verify FPGA designs for Xilinx devices in a intuitive and efficient way.

System Generator
Type Simulink at the MATLAB command prompt or open the Simulink Library Browser by clicking the corresponding button in the MATLAB toolbar

Simulink Library Browser

Create a new model blank sheet by clicking the Create a new model button in the Simulink Library Browser

Example 1 To read and display an image

Simulink Model
Go to Video and Image processing blocksets Sources Image from file

Xilinx SysGen Model


Go to Video and Image processing blocksets Sources Image from file

Reshape is an operator that is used to convert the dimensions. The parameter one dimensionality is chosen as 1-D array since the XSG accepts 1-D as the inputs.

The number of bits is chosen as 8 since we are using a gray scale image. Quantization and overflow is kept as round and saturate by default.

Buffer size:
If an image of a X b is taken then the buffer size should always be a*b. Eg: 64X64 is the image size then buffer size must be 4096.

Reshape:
At the output the parameters of reshape operator must be: o Dimentionality: Customise o Dimension: it must be 2D since we are converting back to the original image. Hence specify the size of original image

SETTING THE STOP TIME


The run time/ stop time is always calculated as twice the dimension of the matrix. If the image is 64X64 then the stop time= 2*64*64.

Simulation

Stop time

Using Matrix Viewer

Workspace

Output using Workspace


After simulation the output is seen in the workspace.

Output obtained is 1-D array. It has to be converted to 2-D array.

Write the callback function in the editor window and link to the model

Output obtained

NOTE:In order to carry out processing on an image the modules have to be placed between gateway in and gateway out

Example 2 RGB to Gray Conversion

Reading RGB Image

Reading RGB Image

Conversion of RGB to Gray Image I=0.29*R+0.59*G+0.11*B Creating module for conversion

Creating module for conversion

Implementation of RGB Equation

RGB TO GRAY Conversion

RGB TO GRAY Conversion Output from Matrix Viewer

RGB TO GRAY Conversion Output from Workspace

RGB TO GRAY Conversion Output from Workspace

Example 3 Filtering

Filtering
Reading an image

Filtering module

5 x 5 Filter

Filtering

Set the Simulink System Period to 1/5 as 5*5 filter is used.

Filtering Output from Matrix Viewer

Filtering Output from Workspace

Filtering Output from Workspace

Example 3 Enhancement

Enhancement
Reading an image

Enhancement

Enhancement Output from Matrix Viewer

Enhancement Output from Workspace

Enhancement Output from Workspace

Example 4 Negation

Negation
Reading an image

Negation

Negation Output from Matrix Viewer

Negation Output from Workspace

Negation Output from Workspace

Example 4 Binarization

Binarization
Reading an image

Binarization

Binarization Output from Matrix Viewer

Binarization Output from Workspace

Binarization Output from Workspace

Vous aimerez peut-être aussi