1-4. matlab과 simulink를 이용한 프로그래머블 soc 설계€¦ · top-level system model...

42
1

Upload: others

Post on 30-Apr-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

1

Page 2: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

2© 2016 The MathWorks, Inc.

MATLAB과 Simulink를이용한프로그래머블 SoC 설계

이웅재부장Application Engineering Group

Page 3: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

3

Agenda

§ Introduction– What is Zynq?– Design Challenges

§ ZYNQ Design Process– MBD on Programmable SoC– Code Generation– Workflow

§ Verification & Partitioning– Parameter Tuning– UDP Interface– Processor In the Loop

§ Advanced Features§ Conclusions

Page 4: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

4

Page 5: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

5

What is Zynq?

§ New product family from Xilinx®

– All Programmable System on Chip (SoC)

§ FPGA Fabric + ARM® on one a single chip– Enables high-performance system development– Reduces BOM cost over multi-chip solutions

ARMProcessor

Dual CoreCortex™-A9

InterfaceFPGAFabric

7-series fabric

Page 6: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

6

Zynq Design Challenges

§ FPGA Designers not familiar with programming processors

§ DSP/Processor programmers not familiar with FPGAs

§ What should run on the FPGA vs. what should run on the ARM?

§ No established rules for hooking up the interface between FPGA

and ARM processor

ARMProcessor

C/C++Software

InterfaceFPGAFabricHDL CodeHardware

Page 7: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

7

How can I address these challenges and get my project onto Zynq quickly?

§ Model-Based Design provides a single environment from requirements to prototype seamlessly

§ A guided workflow for hardware and software development

Page 8: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

8

Hardware platform to prototyping

• Board Name: ZedBoard™

Zynq-7000 AP SoC XC7Z020-CLG484 • Memory:

ü 512 MB DDR3 ü 256 Mb Quad-SPI Flash ü 4 GB SD card

• Onboard USB-JTAG Programming • 10/100/1000 Ethernet • USB OTG 2.0 and USB-UART • PS & PL I/O expansion (FMC, Pmod™, XADC) • Multiple displays (1080p HDMI, 8-bit VGA, 128 x 32 OLED) • I2S Audio CODEC

Page 9: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

9

System configuration for prototyping

GPIO

GPIO

Display Controller

HDMI Video

VGA Video

ZedBoard Linux Shell

Linux Kernel

ZedBoard Web Linux Application

User Switch Script

User LED Script Startup

ScriptWeb Content

Programmable Logic (PL)

Processing System (PS)

AXI4-Lite

User LED Control

User Switch Control

SD Card

USB Peripherals

User Switch Input

User LED Output

BrowserNetwork

HDMI Display

OLED Display

VGA Display

Programmable Logic IP

Drivers/Application Examples (Linux)

Page 10: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

10

Support Package Installer

Page 11: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

11

Agenda

§ Introduction– What is Zynq?– Design Challenges

§ ZYNQ Design Process– MBD on Programmable SoC– Code Generation– Workflow

§ Verification & Partitioning– Parameter Tuning– UDP Interface– Processor In the Loop

§ Advanced Features§ Conclusions

Page 12: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

12

IMPLEMENTATION

Zynq TemplateXilinx Embedded System Integration

DESIGN

Real-Tim

e Parameter Tuning and Verification

RESEARCH REQUIREMENTS

ARM FPGA

HDL Coder™Embedded Coder®

Top-Level System Model

Software Model Hardware Model

User defines partitioning

MathWorks automates code and interface-modelgeneration

MathWorks automates the build and downloadthrough the Xilinx tools

Model-Based Design for Zynq

Page 13: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

13

HDL Coder

EmbeddedCoder

HDLGPIO

GPIO

Display Controller

HDMI Video

VGA Video

ZedBoard Linux Shell

Linux Kernel

ZedBoard Web Linux Application

Programmable Logic (PL)

Processing System (PS)

AXI4-Lite

CIMPLEMENTATION

Zynq TemplateXilinx Embedded System Integration

DESIGN

Real-Tim

e Parameter Tuning and Verification

RESEARCH REQUIREMENTS

ARM FPGA

HDL Coder™Embedded Coder®

Top-Level System Model

Software Model Hardware Model

Model-Based Design for Zynq

Page 14: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

14

Code Generation SchemeMulti-Domain, Multi-Target Technology

MATLAB Function

MultipleDomains

Stateflow

Simulink

Multiple Targets

Analysis/Transform

Analysis/Transform

IntermediateRepresentation (IR)

IR

Target Language Backend

C

C++

HDL

Simscape

Multiple analyses and optimizations

PLC

Page 15: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

15

Code Generation Products for C/C++

MATLAB® Coder™

Automatically generate C and C++ from MATLAB code

Simulink® Coder™

Automatically generate C and C++ from Simulink models and Stateflow charts

Embedded Coder™

Automatically generate C and C++ optimized for embedded systems

SimulinkCoder

Embedded Coder

MATLAB Coder

Page 16: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

16

Optimize the C/C++ code for performance

• SIMD intrinsics• Fixed-point intrinsics• Assembly• Optimized libraries

1. Optimize the generated C/C++ code2. Use the ARM NEON Media Processing Engine

Page 17: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

17

Code Generation Products for VHDL/Verilog

MATLAB® Coder™

Automatically generate C and C++ from MATLAB code

MATLAB Coder

HDL CoderHDL Coder™

Automatically generate synthesizable RTL code (VHDL or Verilog) from MATLABcode and Simulink Model

Page 18: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

18

HDL Coder Key Features

§ Code Generation– Target-independent Synthesizable RTL

Code– IEEE 1376 compliant VHDL®– IEEE 1364-2001 compliant Verilog®

§ Verification– Generate HDL test-bench– Co-simulate with ModelSim and Incisive*

§ Design automation– Synthesize using integrated Xilinx and

Altera synthesis tool interface– Optimize for area-speed– Program Xilinx and Altera boards

* HDL Verifier required for co-simulation and FPGA-in-the-loop verification

Page 19: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

19

MATLAB® and Simulink®

Algorithm and System Design

Zynq Model-Based Design Workflow

ARM

FPGAAXI AXI

Page 20: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

20

Zynq Model-Based Design Workflow

HDL IP CoreGeneration

MATLAB® and Simulink®

Algorithm and System Design

Simulink Model

SW

HW

Programmable Logic IP Core

Algorithmfrom

MATLAB/Simulink

AXI LiteAccessibleRegisters

AXI4-Stream Video In

AXI4-Stream Video Out

External Ports

HDL IP CoreGeneration

Page 21: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

21

Zynq Model-Based Design Workflow

HDL IP CoreGeneration

MATLAB® and Simulink®

Algorithm and System Design

EDK/VivadoIntegration

Zynq Platform

FPGA Bitstream

Programmable Logic IP Core

Algorithmfrom

MATLAB/Simulink

AXI LiteAccessibleRegisters

AXI4-Stream Video In

AXI4-Stream Video Out

External Ports

EDK Project

AXI4

-Lite

ProcessingSystem

Programmable Logic IP Core

Algorithmfrom

MATLAB/Simulink

AXI LiteAccessibleRegisters

AXI Video DMA

AXI4-Stream Video In

AXI4-Stream Video Out

External Ports

EDK/VivadoIntegration

Page 22: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

22

Zynq Model-Based Design Workflow

HDL IP CoreGeneration

MATLAB® and Simulink®

Algorithm and System Design

EDK Integration

Zynq Platform

FPGA Bitstream

SW Interface Model Generation

SW Build

Simulink Model

SW

HW

SW Interface Model

SW

SW I/O DriverBlocks

SW Interface Model Generation

Page 23: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

23

Zynq Model-Based Design Workflow

HDL IP CoreGeneration

MATLAB® and Simulink®

Algorithm and System Design

EDK Integration SW Interface Model Generation

SW BuildFPGA Bitstream

External Mode /PIL / UDP

§ Real-time Parameter Tuning and Verification– External Mode

– Processor-in-the-loop

– UDP

§ More probe and debug capability in the future

Zynq Platform

Page 24: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

24

Communication between ARM & FPGA Synchronization Mode

§ Defines the synchronization behavior between ARM and FPGA

§ Free running mode– No explicit synchronization between ARM and

FPGA

§ Co-processing mode– Explicit blocking synchronization between ARM

and FPGA

§ Choose in HDL Workflow Advisor – xPC/FPGA Turnkey Workflow

– Zynq IP Core Generation

FPGA

0 Ts

HW

ProcessorW R

Coprocessingmode

Processor0 Ts

FPGA

HW

SWR W

Free running mode

Processor/FPGA Synchronization

Page 25: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

25

Agenda

§ Introduction– What is Zynq?– Design Challenges

§ ZYNQ Design Process– MBD on Programmable SoC– Code Generation– Workflow

§ Verification & Partitioning– Parameter Tuning– UDP Interface– Processor In the Loop

§ Additional Features§ Conclusions

Page 26: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

26

Verification Challenges:

§ Design the test bench twice– 10 – to – 1 ratio of Test bench LOC – to – Design LOC (for HDL)

§ Many stimuli-files from MATLAB § How to analyze results?

Page 27: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

27

Parameter tuning through External Mode

HDL IP CoreAXIEthernet

Embedded Software

Simulink

Host Computer Zynq

External Mode

Simulink

PL Subsystem

PS Components

Zynq Model

• Tuning model parameters and evaluate the effects of different parameter values on model results in real time.

• Helping you find the optimal values to achieve desired performance.

Page 28: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

28

Verification through UDP Interface

UDP

Fast prototyping, iteration, and live probing/tuning directly on ZYNQ hardware

IP Core Registers

FPGA IPCoreARM Cortex-A9 MP

(Running Linux)

AXI

4-Li

te

AXI4 Blocks

C Algorithm

Page 29: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

29

Design Partitioning for UDP

Top-Level Model

• From Multimedia File block• To Audio Device block• Resampling, buffering, unbufering, • Data type conversion.• UDP Send and UDP Receive blocks

Data

UDP Send/Receive

PL Subsystem• Equalizer filters• Filter selector

switches• LEDs

Zynq Model

PS components• UDP Send and UDP

Receive blocks• SW Parts

Source Components

Zynq Algorithm

Sink Components

Source Components

Sink Components

UDP Receive

UDP Send

UDP Receive

UDP Send

Zynq Algorithm

demo

Page 30: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

30

Processor-In-the Loop(PIL) Verification

Help you evaluate the behavior of a candidate algorithm on the target both PS/PL and profile the execution times

ZYNQ

CodeGeneration

(C/HDL)

Page 31: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

31

Partitioning Scheme via PIL

PS PS PS PS PS PS

PL PS PS PS PS PS

PL PL PS PS PS PS

PL PL PL PS PS PS

?

?

?

demo

Page 32: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

32

Verification Tradeoffs

Feature External Mode PIL UDP

Real-time execution üYes ûNo üYes

Parameter tuning üYes ûNo ûNo

Test bench options ûLimited üUnlimited üUnlimited

Code verification ûNo üYes ûNo

Execution profiling ûNo üYes ûNo

Single model üYes üYes/No ûNo

Data synchronization ûLimited üYes ûLimited

Page 33: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

33

Agenda

§ Introduction– What is Zynq?– Design Challenges

§ ZYNQ Design Process– MBD on Programmable SoC– Code Generation– Workflow

§ Verification & Partitioning– Parameter Tuning– UDP Interface– Processor In the Loop

§ Advanced Features§ Conclusions

Page 34: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

34

Recently updated features in R2015a/R2015b

Ø R2015a• Internal-interface API in custom reference design• Zynq AXI Stream support• Support Front Digital IO of Speedgoat IO331 board• Save target setting as model properties

Ø R2015b• Command-line API for WFA• Export/Import between API and WFA• Map tunable parameters to AXI interfaces• AXI stream vector mode• Internal-interface API in custom reference design

Page 35: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

35

Custom Board and Reference Design API for IP Core Generation Workflow

§ Enable fast on-board prototyping and iteration

§ Access to SW interface model generation, AXI driver, External Mode

Define your own Zynq or Altera SoCBoard and Reference Design

R2015a

Algorithm Model

Generic IPacross platforms

HDLIP Core

Algorithm HDL

Simulink/MATLABalgorithm

AXI Interface

Prototyping the generated IP on custom Reference Designs and SoC Boards

Custom Reference Design

HDLIP coreProcessor

Custom Reference Design

HDLIP coreProcessor

Page 36: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

36

Custom Reference design API extension for Internal Interface

§ Define an interface that connects to another IP in the reference design

Reference Design

Processor

AX

I4-L

ite

AXI DMA

HDLIP core

ADCInterface

IPInterface

R2015b

Page 37: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

37

Zynq Streaming Interface Support§ Generate HDL IP core with AXI4-Stream interface§ Enable high speed data transfer § Simplify streaming protocol

R2015a

AX

I4-L

ite

ProcessingSystem

Programmable Logic IP Core

Algorithmfrom

MATLAB/Simulink

AXI LiteAccessibleRegisters

External Ports

IP CoreGeneration

AXI DMA

AXI4-SSlaveAXI4-Stream In

AXI4-SMaster

AXI4-Stream Out

Page 38: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

38

AXI4-Stream Vector Mode

§ Modeling HW and SW together§ Automatic generation of SW DMA driver§ Focus on HW/SW Rapid Prototyping

HDL DUT

SoftwareSubsystem

(vector)

HardwareSubsystem(streaming)

1000Ser

1000DeSer

R2015b

HDL Interface

SoftwareSubsystem

(vector)

1000

1000

Software DMADriver

Software DMADriver

Page 39: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

39

Agenda

§ Introduction– What is Zynq?– Design Challenges

§ ZYNQ Design Process– MBD on Programmable SoC– Code Generation– Workflow

§ Verification & Partitioning– Parameter Tuning– UDP Interface– Processor In the Loop

§ Advanced Features§ Conclusions

Page 40: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

40

Conclusions: Design Concept Summary

AXI4-Lite Interface

AXI4-Stream Interface

AX

I4-L

ite

Processor

FPGA IP Core

Algorithmfrom

MATLAB/Simulink

AXI LiteAccessibleRegisters

AXI Video DMA

AXI4-Stream Video In

AXI4-Stream Video Out

External Ports

§ Focus on algorithm and system design

§ Stay on higher level of abstraction

§ Automatic code generation and HW/SW integration

§ Fast Prototyping and Easy integration with IDE

§ Partitioning through Profiling

Page 41: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

41

Signal Processing with MATLAB Signal Analysis and Algorithm Design (2 days)

Image Processing with MATLAB Image Analysis and Processing (2 days)

Signal Processing with Simulink Signal Processing Based Modeling & Dynamic Simulation (3 days)

Communication System Modeling with Simulink Communication System Modeling & Simulation (1 day)

Stateflow for Logic-Driven SystemModeling Flow Chart and FSM Modeling (2 days)

Interfacing MATLAB with C Interfacing MATLAB and C Code via APIs (1 days)

MATLAB to C with MATLAB Coder Generation of C/C++ from MATLAB code using MATLAB Coder (2 days)

Embedded Coder for Production Code Generation C/C++ code generation for Embedded System from Simulink Model (3 days)

Generating HDL Code from Simulink HDL Code Generation & Verification (2 days)

Programming Zynq with MATLAB and Simulink HW/SW Co-design on Zynq (include ZedBoard) (2 days)

Training Title Details

Conclusions: Related Training Summary

Page 42: 1-4. MATLAB과 Simulink를 이용한 프로그래머블 SoC 설계€¦ · Top-Level System Model Software Model Hardware Model User defines partitioning MathWorks automates code

42© 2016 The MathWorks, Inc.

Thank You