Getting Started Design With FPAG (ZYNC-ZED)

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 104

Getting Started

Design with FPGA


(Zedboard)

October 19, 2015


Radar & Antenna Lab
Chung-Ang University
Purpose

Design of Radar Signal Processor


 Matlab

 Simulink

 System Generator

 Vivado

 Porting to Zedboard (ZYNQ)

 Design Verification
Zedboard

PS AXI PL
PC uart ARM A GPIO
Address

X IP Core
ARM I
Data (real &
imag)
(System
Generation
designed)
Simple Logic Design Example

 Signal generation

 Single Frequency Sine signal

 AWG
AWG (NLFM)

Matlab Program of NLFM

System Generator
Xilinx Memory Block

Vivado work  Bitstream file

Xilinx SDK  Porting to Zedboard

Zedboard Run  Data Capture (data.txt)

Matlab  Data Loading and Plotting


AWG (NLFM)

1 2 3 4
System Vivado Xilinx SDK Matlab
Generator
(Generate the (Modify the C (Plot the figure
(Design the bitstream file) program and after receiving
Logic Flow obtain the the data)
by using data)
Matlab file)
Matlab Programming (Signal Generation)

 After opening the m-file “nlfm_marine.m” given


previously, run it.
 And then we can see the NLFM signal intuitively.
 Parameters will be formed and saved automatically in
the workplace of Matlab.

Important parameters will be used later.


 Ts
 Nsample_signal
 Signal to be generated
= Complex Signal
= (Real, Imag)
System Generator (In Simulink Environment)
The main window in System Generator

Button: Simulink Library

Determine the path in which


the file is saved
M-file of NLFM
signal generation

• When opening the main window in System Generator, it is almost the same to the Matlab.
• However, you will find some more function blocks in Simulink libraries’ list after you click the
“Simulink Library” .
• Firstly, the m-file of NLFM signal generation have to be saved in one folder which you will use.
Logic Design for Data Loading (Writing)
ADDRS 1 Data 1
2 Data 2
Real Data of NLFM
3 Data 3
ROM .
.
.
.
. .
N Data N

1 Data 1
2 Data 2
Imag Data of NLFM
ROM 3
.
Data 3
.
. .
. .
N Data N
Logic Design for Data Loading (Writing)
1 Data 1
2 Data 2
3 Data 3 Real Data of NLFM
. .
. .
. .
N Data N

Courter
1 Data 1
2 Data 2
3 Data 3 Imag Data of NLFM
. .
. .
. .
N Data N
The final design of our aim is shown as above in the Simulink.
Next let us find each block in the Simulink library and set each parameter step by step.
Detailed Steps for System Generator
Logic Design
Xilinx Token

Libraries  Xilinx Blockset  Basic Elements:


System Generator

Firstly of all, We have to set up the “Xilinx System Generator” environment.


• Double click the icon “System
Generator”.
• Let us set up the parameters.

Chung-Ang University Microwave & Antenna Lab


• Compilation  IP Catalog
• Port  Zynq  xc7z020  -1  clg484

Simulation system period (sec): Ts

Chung-Ang University Microwave & Antenna Lab


Libraries  Xilinx Blockset  Memory:
ROM

“ROM” is the key block in this example, and widely used in FPGA design.
Here this block is added in the subsystem.
ROM Setting

Basic:
Depth: Nsample_signal
Initial value vector: real(xref_sp2)

Output:
Number of bits: 16
Binary points: 15
ROM Setting
ROM Setting
ROM Setting

Basic:
Depth: Nsample_signal
Initial value vector: imag(xref_sp2)

Output:
Number of bits: 16
Binary points: 15
Other Blocks Settings

The remained blocks are easily found and added in the design.

Libraries  Xilinx Blockset  Basic Elements:


Convert, Reinterpret
Convert

The settings of Convert is


defaults, need not be
changed.
Reinterpret

Reinterpret:
Tick “Force Binary Point”
Verification

Libraries  Simulink  Sources:


Counter limited

Double
Click

Upper limit: Nsample_signal-1


Sample time: Ts

Every design element is picked up and all the parameters are set.
Gateway In Setting

Arithmetic type: Unsigned


Libraries  Xilinx Blockset  Basic Elements: Number of bits: 13
Gateway In Binary point: 0
Sample period: Ts
Gateway In Setting

Double
Click
Gateway Out Setting

Libraries  Xilinx Blockset  Basic Elements:


Gateway out
Libraries  Simulink  Sinks  Scope

If we want to see and check the signals from m-fine by the


Simulink, Scope is added better.
Logic Design for Data Loading (Writing)
Run this Simulink program, and the signals
can be checked by the scope.
Double Click
“System Generator”

Click “Generate”

The last step of this section is to generate the IP catalog which we


design and will be used in the next section.
The IP catalog is generated successful.
Flowchart
1 2 3 4
System Vivado Xilinx SDK Matlab
Generator
(Generate the (Modify the C (Plot the figure
(Design the bitstream file) program and after receiving
Logic Flow obtain the the data)
by using data)
Matlab file)

Chung-Ang University Microwave & Antenna Lab


Next Section is coming…

Double click the icon


“Vivado 2014.2”

Double click “Create New


Project”

Chung-Ang University Microwave & Antenna Lab


Create New Project

Chung-Ang University Microwave & Antenna Lab


Create New Project

Chung-Ang University Microwave & Antenna Lab


Create New Project

Chung-Ang University Microwave & Antenna Lab


Click “Boards” Create New Project

Choose “ZedBoard Zynq Evaluation and


Development”

Chung-Ang University Microwave & Antenna Lab


The main widow of Vivado 2014.2

Click “Create Block Design”


Name the new design

Chung-Ang University Microwave & Antenna Lab


Add IP  ZNYQ

Chung-Ang University Microwave & Antenna Lab


1. Input “ZNYQ”.
2. Choose the first one “ZNYQ7 Processing
System”, and click it.

3. Double click “ZNYQ” , and settings have


to be done.

Chung-Ang University Microwave & Antenna Lab


1. Presets  Zedboard
2. Click “Peripheral I/O Pins”

Chung-Ang University Microwave & Antenna Lab


1. Click “Peripheral I/O Pins”
2. Tick two parts:
 UART 1
 GPIO MIO
3. Click “OK”

Chung-Ang University Microwave & Antenna Lab


1. Run Block Automation
 /Processing_System7_0
2. Click “OK”

Chung-Ang University Microwave & Antenna Lab


Successfully the most important IP part has been set.

Chung-Ang University Microwave & Antenna Lab


Add IP  GPIO

1. Input “GPIO”.
2. Choose “AXI GPIO”, and click
it.

Chung-Ang University Microwave & Antenna Lab


Double Click “GPIO”, and settings have to
be done.

Chung-Ang University Microwave & Antenna Lab


Re-customze IP :AXIO GPIO setting
Board:
 Generate board based on IO Constraints

Re-customze IP :AXIO GPIO setting


IP Configuration:
 All Outputs
GPIO Width: 13
 Enable Dual Channel
 All Inputs
GPIO Width: 32

Chung-Ang University Microwave & Antenna Lab


Add IP  Concat

1. Input “Concat”.
2. Choose “Concat”, and click it.
3. There are not any other
settings for “Concat”,all are
defaulted.

Chung-Ang University Microwave & Antenna Lab


Add IP  IP Catalog

IP Settings
Repository Manager  Add Repository

Chung-Ang University Microwave & Antenna Lab


1. Click “/NLFM_TEST  netlist  IP”
2. Click “Select”

Chung-Ang University Microwave & Antenna Lab


Click “Add IP…”

Chung-Ang University Microwave & Antenna Lab


Click “OK”

Chung-Ang University Microwave & Antenna Lab


Click “OK”, and the IP we designed is added successfully.

Chung-Ang University Microwave & Antenna Lab


The added IP which we designed could be checked here.

Chung-Ang University Microwave & Antenna Lab


Open Block Design once more.
Add IP we designed previously.

Chung-Ang University Microwave & Antenna Lab


1. Click “Add IP”
2. Input “nlfm_test1”.
3. Choose “nlfm_test1”, and click it.

Chung-Ang University Microwave & Antenna Lab


All IPs in this block design are
presented here, next let us
connect them.

Chung-Ang University Microwave & Antenna Lab


Connection

3 2
4

Chung-Ang University Microwave & Antenna Lab


Connection

Run Connection Automation /axi_gpio_0/S_AXI

Chung-Ang University Microwave & Antenna Lab


Click
“OK”

Chung-Ang University Microwave & Antenna Lab


Run Connection Automation /GPIO

Chung-Ang University Microwave & Antenna Lab


• Choose “Custom”
• Click “OK”

Chung-Ang University Microwave & Antenna Lab


Run Connection Automation /GPIO2

Chung-Ang University Microwave & Antenna Lab


• Choose “Custom”
• Click “OK”

Chung-Ang University Microwave & Antenna Lab


Connection between these two points

Chung-Ang University Microwave & Antenna Lab


Click here “Regenerate Layout”

Chung-Ang University Microwave & Antenna Lab


The full block design is presented here. In the design there are four important parts including: ZYNQ
processing, GPIO, Concat, and nlfm_test1 which we designed in the system generator previously.

Chung-Ang University Microwave & Antenna Lab


• Tools  Validate Design
• Click “OK”

Chung-Ang University Microwave & Antenna Lab


• Find and Click “Sources  Hierarchy  Design Sources 
design_nlfm_test1”
• Then right click and choose “Generate Output Products…”
• Click “Generate”

Chung-Ang University Microwave & Antenna Lab


Generate Output Products

Chung-Ang University Microwave & Antenna Lab


• Find and Click “Sources  Hierarchy  Design Sources  design_nlfm_test1”
• Then right click and choose “Create HDL Wrapper…”

Chung-Ang University Microwave & Antenna Lab


• Choose “Let Vivado manager wrapper and auto-update ”
• Click “OK”

Chung-Ang University Microwave & Antenna Lab


• Find and click “Program and Debug  Generate
Bitsteam”
• Click “Save” and “Yes”

Chung-Ang University Microwave & Antenna Lab


Now the bitstream file is being generated, and it will spend a little long time. Wait until the bitstream file is
generated successfully.

Chung-Ang University Microwave & Antenna Lab


• When this window is presented, that means the operation of generating the bitstream file has
been finished.
• Please Choose “View Reports” , Click “OK”!

Chung-Ang University Microwave & Antenna Lab


After the bitstream file has been generated, there are two steps remained in this processing.
• File  Export  Export Hardware, and then Click “OK”.
• File  Launch SDK, and then Click “OK”.

Chung-Ang University Microwave & Antenna Lab


After the bitstream file has been generated, there are two steps remained in this processing.
• File  Export  Export Hardware, and then Click “OK”.
• File  Launch SDK, and then Click “OK”.

Chung-Ang University Microwave & Antenna Lab


Welcome to the third processing. XILINX SDK will be opened automatically.

Chung-Ang University Microwave & Antenna Lab


Flowchart
1 2 3 4
System Vivado Xilinx SDK Matlab
Generator
(Generate the (Modify the C (Plot the figure
(Design the bitstream file) program and after receiving
Logic Flow obtain the the data)
by using data)
Matlab file)

Chung-Ang University Microwave & Antenna Lab


The Xilinx SDK is opened. Firstly the new application project need to be built. Three steps will be shown in blow:

• File  New  Application Project


• Input the project name “nlfm_test1” which you want and then Click “Next”.

Chung-Ang University Microwave & Antenna Lab


• There are some choices in the Templates window. Generally “Empty Application” or ”Hello World” is
chosen, here we choose ”Hello World” , and then Click “Finish”.

Chung-Ang University Microwave & Antenna Lab


The main window in Xilinx SDK

Chung-Ang University Microwave & Antenna Lab


helloworld.c

Chung-Ang University Microwave & Antenna Lab


helloworld.c

Input some codes in “helloworld.c”:

#include "xgpio.h"
#include "xil_printf.h"

XGpio gpio_1;

Chung-Ang University Microwave & Antenna Lab


xparameters.h

Copy “XPAR _GPIO _0 DEVICE_ID ”

Chung-Ang University Microwave & Antenna Lab


helloworld.c

Paste “XPAR _GPIO _0 DEVICE_ID ”


in “helloworld.c”

Input codes:

#define gpio_id_1 XPAR _GPIO _0


DEVICE_ID

Chung-Ang University Microwave & Antenna Lab


xgpio.h

Find “Xgpio_Initiatilize” and


“Xgpio_setDataDirection” in
“xgpio.h”

Chung-Ang University Microwave & Antenna Lab


helloworld.c

Input some codes in “helloworld.c”:

void init_gpio()
{
XGpio_Initialize(&gpio_1,gpio_id_1);
XGpio_SetDataDirection(&gpio_1,1,0);
XGpio_SetDataDirection(&gpio_1,2,0x1fff);
}

Chung-Ang University Microwave & Antenna Lab


xgpio.c

Find “Xgpio_WriteReg””
in “xgpio.c”

Chung-Ang University Microwave & Antenna Lab


helloworld.c

int main()
{
init_platform();
init_gpio();

u32 data_sig;
u16 data_r[5000],data_i[5000];
u32 ii=0;

for(ii=0;ii<5000;ii++)
{
XGpio_DiscreteWrite(&gpio_1,1,ii);
data_sig=XGpio_DiscreteRead(&gpio_1,2);

data_r[ii]=data_sig&0xffff;
data_i[ii]=(data_sig>>16)&0xffff;
xil_printf("%d\r\n",data_r[ii]);
xil_printf("%d\r\n",data_i[ii]);
}

cleanup_platform();

//print("Hello World\n\r");

return 0;
}

Chung-Ang University Microwave & Antenna Lab


• Now please connect the lines between PC and
FPGA board.
• Then Click “Program FPGA”.
• Click “Program”.

Chung-Ang University Microwave & Antenna Lab


Progress Information

Chung-Ang University Microwave & Antenna Lab


Run  Run Configurations…

Chung-Ang University Microwave & Antenna Lab


Chung-Ang University Microwave & Antenna Lab
Chung-Ang University Microwave & Antenna Lab
Please find the Port
connected with
FPGA board from
Device Manager by
your own computer
system.

Chung-Ang University Microwave & Antenna Lab


• Run configuration.
• The data will be received and shown here.
• Copy all the data and save them in one
“txt” file named “data_nlfm_text1.txt”.

Chung-Ang University Microwave & Antenna Lab


Copy all the data and save them in
one “txt” file named
“data_nlfm_text1.txt”.

Chung-Ang University Microwave & Antenna Lab


1 2 3 4
System Vivado Xilinx SDK Matlab
Generator
(Generate the (Modify the C (Plot the figure
(Design the bitstream file) program and after receiving
Logic Flow obtain the the data)
by using data)
Matlab file)

Chung-Ang University Microwave & Antenna Lab


clear all
close all
clc

load data_nlfm_text1.txt data_nlfm_text1.txt


aa=data_nlfm_text1(:,1);

ii=find(aa>2^15);

aa(ii)=aa(ii)-2^16;

figure(1)
nlfm_real=aa(1:2:length(aa)-1);
plot(nlfm_real)
1. Load the txt file to the Matalab program.
2. Input the Matlab codes which is saved from figure(2)
the last step 。 nlfm_imag=aa(2:2:(length(aa)));
plot(nlfm_imag)
3. Run the program, the last results will be
shown in the last slide.

Chung-Ang University Microwave & Antenna Lab


Real part of NLFM Imaginary part of NLFM

Chung-Ang University Microwave & Antenna Lab


The End

Thanks~~

Chung-Ang University Microwave & Antenna Lab

You might also like