37
1 © 2012 The MathWorks, Inc. Integrated Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC

Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

Embed Size (px)

Citation preview

Page 1: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

1© 2012 The MathWorks, Inc.

Integrated Workflow to Implement Embedded

Software and FPGA Designs on the Xilinx Zynq

Platform

Puneet Kumar

Senior Team Lead - SPC

Page 2: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

2

Agenda

Integrated Hardware / Software Top down Workflow for Zynq,

highlighting:– Automatic Code Generation:

HDL code generation for the FPGA fabric and C-Code generation for the ARM MCU

– Automatic Interface Logic Generation: Generation of the interface logic and software between the FPGA and ARM.

– Integrated Verification: Integrated HDL Verification using HDL Co-simulation and FPGA-in-Loop

Q&A

Page 3: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

3

Demo - Zynq Model-Based Design Workflow

Page 4: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

4

Who is Who???

Who is a System Engineer?

Who is an FPGA/ASIC designer?

Who is using MATLAB?

Who is using Simulink?

Who is converting MATLAB to C or HDL?

Page 5: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

5

Te

st &

Ve

rifica

tion

Implementation

Research & Design

Explore and discover

Gain insight into problem

Evaluate options, trade-offs

Test

Design

Elaborate

Algorithm Development Process

Requirements

Test

Design

ElaborateC, C++

.exe

.dll

Desktop

Structured Text

VHDL / Verilog

C, C++

Embedded

.c, .cpp

C

VHDL / Verilog

Page 6: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

6

Can I generate HDL and C code from my MATLAB and

Simulink models?

Can I generate integrated test-bench to co-simulate it

with HDL Simulators?

Can I Generate the interface logic?

What about porting it on SoC FPGA and verifying the

DUT with the golden MATLAB/Simulink test-bench?

And Many more questions…

You May Have Some Questions?

Page 7: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

7

Solution: C and HDL Code Generation

Design, execute, and verify algorithms in MATLAB

Automatically generate C or HDL code

Deploy generated code on hardware

MATLAB

Algorithm Design

FPGA ASIC

HDL Coder

FPGA ASIC

VHDL/Verilog

Gen

era

te

FPGA ASIC

MATLAB Coder

MCU DSP

C

Gen

era

te

Page 8: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

8

The Algorithm Design Challenge

How can we:

– Implement designs on SoC FPGA’s?

– Partition the HW and SW?

– Generate the Interface Logic?

MATLAB/Simulink

Algorithm Design

FPGA ASICFPGA ASICFPGA ASICMCU DSPSoC FPGA’s

Page 9: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

9

What is SoC FPGA’s?

FPGA + ARM® on one chip

– Enables high-performance system development

– Reduces cost over multi-chip solutions

ARM

ProcessorInterface FPGA

Page 10: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

10

Design Challenge

• Typically programmed in C

• Often runs a Linux operating system

• Well-established workflows exist

CHALLENGES

• FPGA Designers not familiar with programming processors

• What should run on the processor vs. the FPGA?

ARM

ProcessorC-Code

Software

Page 11: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

11

Design Challenge

• Typically programmed in VHDL/Verilog

• Established workflows exist

CHALLENGES

• DSP/Processor programmers not familiar with FPGA Design

• What should run on the FPGA vs. the processor?

FPGAHDL Code

Hardware

Page 12: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

12

Design Challenge

• Zynq uses “standard” AXI4 interface between FPGA and

ARM

CHALLENGES

• No established rules for hooking up the interface

• Different versions of AXI interface for different bandwidth

requirements

Interface

Page 13: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

13

How can I address these challenges

Model-Based Design provides a single environment

from requirements to prototype

A guided workflow for hardware and software

development

Page 14: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

14© 2012 The MathWorks, Inc.

Model-Based Design

Page 15: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

15

Why Model-Based Design?

Requirements Development

Simulation

Code Generation

Continuous Verification

Page 16: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

16

Model-Based Design:

From Concept to Production

• Automate regression testing

• Detect design errors

• Support certification and standards

• Generate efficient code

• Explore and optimize implementation tradeoffs

• Model multi-domain systems

• Explore and optimize system behavior in floating

point and fixed point

• Collaborate across teams and continents

INTEGRATION

IMPLEMENTATION

DESIGN

TE

ST

& V

ER

IFIC

AT

ION

RESEARCH REQUIREMENTS

ARM FPGA

VHDL, VerilogC, C++

Environment Models

Physical Components

Algorithms

Page 17: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

17

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

ARM

ProcessorC-Code

Software

InterfaceFPGAHDL Code

Hardware

Page 18: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

18

IMPLEMENTATION

High-Level Zynq Design Flow

Zynq Template

Xilinx Embedded System Integration

DESIGN

Rea

l-Tim

e P

ara

me

ter T

un

ing

an

d V

erific

atio

n

RESEARCH REQUIREMENTS

ARM FPGA

HDL Coder™Embedded

Coder®

Top-Level System Model

Software Model Hardware Model

User defines partitioning

MathWorks automates code and

interface-model generation

MathWorks automates the build

and download through the Xilinx

tools

Page 19: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

19

Model-Based Design for Zynq

VHDL, Verilog

ASICFPGA

Boards

HDL

CoderEmbedded

Coder

C, C++

Zynq

INTEGRATION

IMPLEMENTATION

DESIGN

TE

ST

& V

ER

IFIC

AT

ION

RESEARCH REQUIREMENTS

ARM DSP FPGA ASIC

Structured TextVHDL, VerilogC, C++

Environment Models

Physical Components

Algorithms

PLC

Page 20: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

20

Demo - Zynq Model-Based Design Workflow

Page 21: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

21

Model-Based Design flow using Simulink from Algorithm to FPGA Implementation

HDL Verifier

FPGA in the Loop

MATLAB® and Simulink®

Algorithm and System Design

Implement Design

Map

Place & Route

Synthesis

Back Annotation

Verification

Static Timing Analysis

Timing Simulation

Functional Simulation

HDL Verifier

HDL Co-Simulation

HDL Coder

RTL Creation

RTL

DESIGN

Algorithm

Development

MATLAB

Simulink

Stateflow

Page 22: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

22

Verification Landscape:

Model VHDL / Verilog FPGA

Requirements

Functional

Equivalence

Coverage

Property Proving

Virtual Platforms

Requirements

Equivalence

Coverage

Assertions

Equivalence

Regression

Timing Analysis

Page 23: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

23

Verification Challenges:Stimuli-Driven Test Bench in HDL Simulators

Digital waveforms are difficult to analyze

– Application specific analysis methods are needed

How to get test vectors to achieve 100% test coverage?

– Formal methods to derive required test cases

Page 24: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

24

HDL cosimulation to verify HDLRe-use System Level Test Bench for HDL Verification

HDL Cosimulation

Integrate with

Modelsim/Questa

and Incisive

Re-use test benches for

equivalence checking

Flexible test bench creation:

closed loop, multi domain

Integrate with HDL code

coverage analysis

Also works with

handwritten code

Page 25: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

25

Verification Landscape Solution:Re-use System Level Test Bench

Model VHDL / Verilog FPGA

Requirements

Functional

Equivalence

Coverage

Property Proving

Virtual Platforms

Requirements

Equivalence

Coverage

Assertions

Equivalence

Regression

Timing Analysis

Page 26: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

26

Demo - Zynq Model-Based Design Workflow

Page 27: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

27

Zynq Model-Based Design Workflow

MATLAB® and Simulink®

Algorithm and System Design

ARM

FPGAAXI AXI

Page 28: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

28

Zynq Model-Based Design Workflow

HDL IP Core

Generation

MATLAB® and Simulink®

Algorithm and System Design

Simulink Model

SW

HW

Programmable Logic IP Core

Algorithm

from

MATLAB/

Simulink

AXI Lite

Accessible

Registers

AXI4-Stream Video In

AXI4-Stream Video Out

External

Ports

HDL IP Core

Generation

Page 29: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

29

Zynq Model-Based Design Workflow

HDL IP Core

Generation

MATLAB® and Simulink®

Algorithm and System Design

EDK Integration

Zynq Platform

FPGA Bitstream

Programmable Logic IP Core

Algorithm

from

MATLAB/

Simulink

AXI Lite

Accessible

Registers

AXI4-Stream Video In

AXI4-Stream Video Out

External

Ports

EDK Project

AX

I4-L

ite

Processing

System

Programmable Logic IP Core

Algorithm

from

MATLAB/

Simulink

AXI Lite

Accessible

Registers

AXI

Video

DMA

AXI4-Stream Video In

AXI4-Stream Video Out

External

Ports

EDK Integration

Page 30: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

30

Zynq Model-Based Design Workflow

HDL IP Core

Generation

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

Driver

Blocks

SW Interface

Model Generation

Page 31: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

31

Zynq Model-Based Design Workflow

HDL IP Core

Generation

MATLAB® and Simulink®

Algorithm and System Design

EDK IntegrationSW Interface

Model Generation

Zynq Platform

SW BuildFPGA Bitstream

External Mode

PIL

Real-time Parameter

Tuning and Verification

– External Mode

– Processor-in-the-loop

Page 32: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

32

Zynq in Action

Video stream filtered to find and

mark greenish ball

FPGA (HW): Ball Tracking

ARM (SW): Draw marker

Ball Tracking Demo

Motor

FPGA

Ball

Tracking

ARM

Processor

Camera

Motor

Control

DDR3/

VDMA

HDMI IN

Coordinates

Desired Position

Video Mark

Page 33: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

33

Fast Prototyping and Iteration

TCP/IP

Fast prototyping,

iteration, and live

probing/tuning directly

on Zynq hardware

IP Core

Registers

FPGA

IPCoreARM Cortex-A9 MP

(Running Linux)

AX

I4-L

ite

AXI4-Lite

Blocks

C Algorithm

Page 34: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

34

Abstraction is Key

AXI4-Lite Interface

AXI4-Stream Interface

AX

I4-L

ite

Processor

FPGA IP Core

Algorithm

from

MATLAB/

Simulink

AXI Lite

Accessible

Registers

AXI

Video

DMA

AXI4-Stream Video In

AXI4-Stream Video Out

External

Ports

Page 35: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

35

Abstraction is Key

Focus on algorithm and

system design

Stay on higher level of

abstraction

Automatic code generation

and HW/SW integrationAXI4-Lite Interface

AXI4-Stream Interface

AX

I4-L

ite

Processor

FPGA IP Core

Algorithm

from

MATLAB/

Simulink

AXI Lite

Accessible

Registers

AXI

Video

DMA

AXI4-Stream Video In

AXI4-Stream Video Out

External

Ports

Page 36: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

36

Zynq HW/SW Co-design Workflow Summary

Embedded System Project

Simulink Model

SW

HWDesign IP Core

Generation

FPGA IP Core

Algorithm

from

MATLAB and

Simulink

AXI Lite

Accessible

registers

External

Ports

AX

I4-L

ite

Bu

s

Processor

Em

be

dd

ed

Sys

tem

Inte

gra

tio

n

External

Ports

Generate SW

Interface Model

SW Interface Model

SW

SW I/ODriverBlocks

FPGA

BitstreamSW

Build

FPGA IP Core

Algorithm from

MATLAB and

Simulink

AXI Lite

Accessible

registers

Page 37: Integrated Workflow to Implement Embedded Software … Workflow to Implement Embedded Software and FPGA Designs on the Xilinx Zynq Platform Puneet Kumar Senior Team Lead - SPC. 2 Agenda

37

Thank You!