Introduction to C and HDL Code Generation from MATLAB

Similar documents
Model-Based Design for effective HW/SW Co-Design Alexander Schreiber Senior Application Engineer MathWorks, Germany

Hardware Implementation and Verification by Model-Based Design Workflow - Communication Models to FPGA-based Radio

Modeling a 4G LTE System in MATLAB

개발과정에서의 MATLAB 과 C 의연동 ( 영상처리분야 )

Design and Verification of FPGA and ASIC Applications Graham Reith MathWorks

Design and Verification of FPGA Applications

Implementing MATLAB Algorithms in FPGAs and ASICs By Alexander Schreiber Senior Application Engineer MathWorks

Reducing the cost of FPGA/ASIC Verification with MATLAB and Simulink

Accelerating FPGA/ASIC Design and Verification

컴퓨터비전의최신기술 : Deep Learning, 3D Vision and Embedded Vision

Moving MATLAB Algorithms into Complete Designs with Fixed-Point Simulation and Code Generation

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

Optimize DSP Designs and Code using Fixed-Point Designer

Hardware-Software Co-Design and Prototyping on SoC FPGAs Puneet Kumar Prateek Sikka Application Engineering Team

Model-Based Design for Altera FPGAs Using HDL Code Generation The MathWorks, Inc. 1

Accelerate FPGA Prototyping with

Extending Model-Based Design for HW/SW Design and Verification in MPSoCs Jim Tung MathWorks Fellow

Model-Based Design for Video/Image Processing Applications

Designing and Prototyping Digital Systems on SoC FPGA The MathWorks, Inc. 1

2015 The MathWorks, Inc. 1

Embarquez votre Intelligence Artificielle (IA) sur CPU, GPU et FPGA

Connecting MATLAB & Simulink with your SystemVerilog Workflow for Functional Verification

MATLAB to iphone Made Easy

Case Study on DiaHDL: A Web-based Electronic Design Automation Tool for Education Purpose

Early Models in Silicon with SystemC synthesis

Model-Based Design Using Simulink, HDL Coder, and DSP Builder for Intel FPGAs By Kiran Kintali, Yongfeng Gu, and Eric Cigan

Design and Verify Embedded Signal Processing Systems Using MATLAB and Simulink

Model-Based Design: Design with Simulation in Simulink

What's new in MATLAB and Simulink for Model-Based Design

Implementation and Verification Daniel MARTINS Application Engineer MathWorks

Intro to System Generator. Objectives. After completing this module, you will be able to:

Designing and Targeting Video Processing Subsystems for Hardware

Model-Based Design: Generating Embedded Code for Prototyping or Production

Design and Verify Embedded Signal Processing Systems Using MATLAB and Simulink

Making the Most of your MATLAB Models to Improve Verification

Addressing Fixed Point Design Challenges

Introduction to MATLAB application deployment

[Sub Track 1-3] FPGA/ASIC 을타겟으로한알고리즘의효율적인생성방법및신기능소개

MATLAB 에서작업한응용프로그램의공유 : App 에서부터웹서비스까지

Simulink Design Environment

Introducing Simulink R2012b for Signal Processing & Communications Graham Reith Senior Team Leader, UK Application Engineering

MODEL BASED HARDWARE DESIGN WITH SIMULINK HDL CODER

Agenda. Introduction FPGA DSP platforms Design challenges New programming models for FPGAs

Method We follow- How to Get Entry Pass in SEMICODUCTOR Industries for 3rd year engineering. Winter/Summer Training

Optimization and Implementation of Embedded Signal Processing Algorithms Jonas Rutström Senior Application Engineer

MATLAB/Simulink 기반의프로그래머블 SoC 설계및검증

Four Best Practices for Prototyping MATLAB and Simulink Algorithms on FPGAs by Stephan van Beek, Sudhir Sharma, and Sudeepa Prakash, MathWorks

Basic Xilinx Design Capture. Objectives. After completing this module, you will be able to:

What s New in Simulink in R2015b and R2016a

2015 The MathWorks, Inc. 1

Designing and Analysing Power Electronics Systems Using Simscape and SimPowerSystems

다중센서기반자율시스템의모델설계및개발 이제훈차장 The MathWorks, Inc. 2

MATLAB/Simulink in der Mechatronik So einfach geht s!

Overview. Design flow. Principles of logic synthesis. Logic Synthesis with the common tools. Conclusions

Introducing Simulink Release 2012b for Control System Development Mark Walker MathWorks

FPGA for Software Engineers

AccelDSP tutorial 2 (Matlab.m to HDL for Xilinx) Ronak Gandhi Syracuse University Fall

An Overview of a Compiler for Mapping MATLAB Programs onto FPGAs

Integrating MATLAB Analytics into Business-Critical Applications Marta Wilczkowiak Senior Applications Engineer MathWorks

NEW FPGA DESIGN AND VERIFICATION TECHNIQUES MICHAL HUSEJKO IT-PES-ES

Targeting Motor Control Algorithms to System-on-Chip Devices

2015 The MathWorks, Inc. 1

Sharing and Deploying MATLAB Programs Sundar Umamaheshwaran Amit Doshi Application Engineer-Technical Computing

Better than Hand Generating Highly Optimized Code using Simulink and Embedded Coder

Simulation, prototyping and verification of standards-based wireless communications

Developing a Data Driven System for Computational Neuroscience

The Lekha 3GPP LTE Turbo Decoder IP Core meets 3GPP LTE specification 3GPP TS V Release 10[1].

Simulink Matlab To Vhdl Route For Full Custom Fpga Rapid

2015 The MathWorks, Inc. 1

What s New with the MATLAB and Simulink Product Families. Marta Wilczkowiak & Coorous Mohtadi Application Engineering Group

Codegenerierung für Embedded Systeme leicht gemacht So geht s!

Ein Modell - viele Zielsysteme

Modelling and Simulation Made Easy with Simulink Tiffany Liang Application Engineer MathWorks

A Matlab/Simulink Simulation Approach for Early Field-Programmable Gate Array Hardware Evaluation

Getting Started with MATLAB Francesca Perino

Programmable Logic Devices HDL-Based Design Flows CMPE 415

Speeding up MATLAB Applications Sean de Wolski Application Engineer

Modeling and Verifying Mixed-Signal Designs with MATLAB and Simulink

Cover TBD. intel Quartus prime Design software

Hardware and Software Co-Design for Motor Control Applications

Signal Processing Algorithms into Fixed Point FPGA Hardware Dennis Silage ECE Temple University

FPGA design with National Instuments

How Real-Time Testing Improves the Design of a PMSM Controller

MOJTABA MAHDAVI Mojtaba Mahdavi DSP Design Course, EIT Department, Lund University, Sweden

Hardware and Software Co-Design for Motor Control Applications

81920**slide. 1Developing the Accelerator Using HLS

Advanced Design System DSP Synthesis

ISim Hardware Co-Simulation Tutorial: Accelerating Floating Point FFT Simulation

USING THE SYSTEM-C LIBRARY FOR BIT TRUE SIMULATIONS IN MATLAB

Optimizing and Accelerating Your MATLAB Code

Multi-Gigahertz Parallel FFTs for FPGA and ASIC Implementation

Advanced Software Development with MATLAB

Cadence SystemC Design and Verification. NMI FPGA Network Meeting Jan 21, 2015

Introduction to DSP/FPGA Programming Using MATLAB Simulink

FIR Compiler User Guide

INTRODUCTION TO CATAPULT C

What s New in MATLAB and Simulink

Park Sung Chul. AE MentorGraphics Korea

FPGA Based Digital Design Using Verilog HDL

The Lekha 3GPP LTE FEC IP Core meets 3GPP LTE specification 3GPP TS V Release 10[1].

Transcription:

Introduction to C and HDL Code Generation from MATLAB 이웅재차장 Senior Application Engineer 2012 The MathWorks, Inc. 1

Algorithm Development Process Requirements Research & Design Explore and discover Design Gain insight into problem Evaluate options, trade-offs Implementation Elaborate Test Test & Verification Desktop.dll.exe.c, C,.cpp C++ Embedded C, C C++ VHDL / Verilog Structured Text Design Elaborate Test 2

The Algorithm Design Challenge How can we: Implement designs faster? MATLAB Algorithm Design Reuse designs on a variety of hardware? FPGA MCU ASIC DSP FPGA ASIC 3

Solution: C and HDL Code Generation Design, execute, and verify algorithms in MATLAB MATLAB Algorithm Design Automatically generate C or HDL code Deploy generated code on hardware MATLAB Coder Generate HDL Coder Generate C VHDL/Verilog FPGA MCU ASIC DSP FPGA ASIC 4

Code Generation Products for C/C++ Embedded Coder Embedded Coder Automatically generate C and C++ optimized for embedded systems Simulink Coder Simulink Coder Automatically generate C and C++ from Simulink models and Stateflow charts MATLAB Coder MATLAB Coder Automatically generate C and C++ from MATLAB code 5

Code Generation Products for VHDL/Verilog HDL Coder HDL Coder Automatically generate VHDL or Verilog from MATLAB code and Simulink Model MATLAB Coder MATLAB Coder Automatically generate C and C++ from MATLAB code 6

MATLAB Coder Capabilities 2012 The MathWorks, Inc. 7

Why Engineers translate MATLAB to C today? Integrate MATLAB algorithms w/ existing C environment using source code and static/dynamic libraries Prototype MATLAB algorithms on desktops as standalone executables Accelerate user-written MATLAB algorithms Implement C code on processors or hand-off to software engineers 8

Challenges with Manual Translation from MATLAB to C iterate Algorithm Design in MATLAB Re-code in C/C++ verify / accelerate Separate functional and implementation specification Leads to multiple implementations that are inconsistent Hard to modify requirements during development Difficult to keep reference MATLAB code and C code in-sync Manual coding errors Time consuming and expensive 9

Automatic Translation of MATLAB to C iterate Algorithm Design and Code Generation in MATLAB verify / accelerate With MATLAB Coder, design engineers can Maintain one design in MATLAB Design faster and get to C quickly Test more systematically and frequently Spend more time improving algorithms in MATLAB 10

MATLAB Coder Key Features Code generation for MATLAB Portable ANSI/ISO C code Floating-point or Fixed-point (requires Fixed-Point Toolbox) Processors specific optimizations (requires Embedded Coder) Verification Generates MEX test-benches Design and Build Automated compile and build for desktop execution Ability to cross-compile and build for execution on other platforms MATLAB Algorithm Design MATLAB Coder FPGA MCU Generate HDL C ASIC DSP 11

Using MATLAB Coder: 3-Step Workflow Prepare your MATLAB algorithm for code generation Make implementation choices Use supported language features Test if your MATLAB code is compliant Validate that MATLAB program generates code Accelerate execution of user-written algorithm Generate source code or MEX for final use Iterate your MATLAB code to optimize Implement as source, executable or library 12

Example c = a*b Coder UI Testbench Code Generation options Generate code Browse through report >> Demo 13

Demo: Newton/Rhapson Algorithm workflow example Preparing your MATLAB code Pre-allocate Identify more efficient constructs Building options x 1 = x 0 f(x 0) f (x 0 ) Test & Generate >> Demo 14

MATLAB Language Support for Code Generation visualization Java global sparse complex nested functions classes graphics variable-sized data struct malloc System objects functions numeric fixed-point arrays persistent 15

Embedded Coder for Optimized Code Embedded Coder extends MATLAB Coder with: Processor-specific code generation Built-in support for select processors Open APIs for use with any processor Speed, memory, and code appearance advanced features 16

HDL Coder Capabilities 2012 The MathWorks, Inc. 17

HDL Coder Generate VHDL and Verilog Code for FPGA and ASIC designs MATLAB HDL Coder Simulink New: MATLAB to HDL Automatic floating-point to fixed-point conversion HDL resource optimizations and reports Algorithm-to-HDL traceability Verilog and VHDL Integration with simulation & synthesis tools 18

Which benefits Engineers get from MATLAB to HDL? Automate for implementing HDL without direct RTL hand-coding Less LOC by using MATLAB TestBench and Reusing it through Entire Design Process Easy conversion from Floating-Point to Fixed-Point Fast to simulate compare with using HDL DUT/TB in the HDL simulator environment 19

HDL Coder Key Features Code Generation for MATLAB and Simulink Target-independent RTL level HDL Code IEEE 1376 compliant VHDL IEEE 1364-2001 compliant Verilog Automate Fixed-Point conversion Verification Generate HDL test-bench Generate Scripts for Synthesis tool & HDL simulator Design automation Synthesize and P&R using integrated Xilinx and Altera synthesis tool interface Optimize for area or speed MATLAB Algorithm Design HDL Coder VHDL/Verilog FPGA Generate ASIC 20

Using HDL Coder: 5-Step Workflow Prepare Fixed-Point Generate Simulate Synthesis, P&R *_FixPt.m *_wrapper_fixpt.m *_tb_fixpt.m *.vhd, *.v *.do, *.tcl *.wlf, *.txt *.edf, *.edn *.bit Prepare your MATLAB algorithm for code generation Use supported language features Make implementation choices Fixed-Point MATLAB code generation from your floating-point design using your MATLAB TestBench Accelerate TestBench for fast simulation Automatically propose Fixed-Point type Iterate data-type customization to optimize Verify Fixed-Point code against original Floating-Point code. Generate synthesizable RTL & TestBench code from Fixed-Point MATLAB code for final use Iterate your MATLAB code to optimize Implement as source, executable or library Simulation the generated HDL code with test vectors from the test bench using the specified simulation tool Synthesis, Place and Route the generated RTL code by creating project with ISE/Quartus II Check timing analysis report to optimize 21

Workflow Advisor Automatic HDL code generation with built-in optimizations Automatically convert floating point to fixedpoint Automatic HDL Verification Integration with FPGA implementation workflows 22

Example: Symmetric FIR Filter >> Demo 23

Demos Generate Modular Code for Functions Fixed-Point Type Conversion and Refinement Distributed Pipelining: Clock Speed Optimization Resource Sharing of Multiplier : Area Optimization 24

MATLAB Language Support for HDL Code Generation struct visualization Java Arithmetic Operators complex Rational Operators vector sparse persistent Logical Operators matrix Control Flow Statement nested functions System objects (limited) fixed-point graphics classes 25

Customer Successes 2012 The MathWorks, Inc. 26

Ono Sokki Reduces Development Time for Speed Measurement Device Using MATLAB Generated Code Challenge Develop a high-precision speedometer for prototype vehicles within a tight schedule Solution Use MathWorks tools for Model-Based Design to develop algorithms, generate production code for an embedded processor, and perform processor-in-theloop verification Results Development time cut significantly Code base reduced dramatically System model reused as a test bench LC-8100 GPS Speedometer System. With MathWorks tools we have a seamless environment for development, simulation, code generation, and processor-in-theloop verification. The advantages of Model-Based Design over handcoding in C can t be overestimated. Kazuhiro Ichikawa Ono Sokki 27

FLIR Accelerates Development of Thermal Imaging FPGA Challenge Accelerate the implementation of advanced thermal imaging filters and algorithms on FPGA hardware Solution Use MATLAB to develop, simulate, and evaluate algorithms, and use HDL Coder to implement the best algorithms on FPGAs Results Time from concept to field-testable prototype reduced by 60% Enhancements completed in hours, not weeks Code reuse increased from zero to 30% Link to user story images after applying filter developed with HDL Coder. With MATLAB and HDL Coder we are much more responsive to marketplace needs. We now embrace change, because we can take a new idea to a real-time-capable hardware prototype in just a few weeks. There is more joy in engineering, so we ve increased job satisfaction as well as customer satisfaction. Nicholas Hogasten FLIR Systems 28

Summary Design using MATLAB Generate C and HDL MATLAB Algorithm Design Deploy code to Processors and Hardware Accelerate simulation speed Easy conversion from floating-point to fixed-point MATLAB Coder Generate HDL C HDL Coder Generate VHDL/Verilog Iterate your designs faster FPGA MCU ASIC DSP FPGA ASIC 29

Additional Information MATLAB Coder Choosing the Right Deployment Solution Working with Simulink HDL Coder Working with Simulink Simulink Design for HDL Code Generation 30

Choosing the Right Deployment Solution MATLAB Coder and MATLAB Compiler MATLAB Compiler MATLAB Coder.exe.dll.exe.lib.dll 31

Choosing the Right Deployment Solution MATLAB Coder and MATLAB Compiler MATLAB Coder MATLAB Compiler Output MATLAB support Runtime requirement Portable and readable C source code Subset of language Some toolboxes None Executable or software component/library Full language Most toolboxes Graphics MATLAB Compiler Runtime (MCR) License model Royalty-free Royalty-free 32

Working With Simulink for C code generation MATLAB Function block in Simulink C 33

Working With Simulink for HDL code generation MATLAB Function block in Simulink HDL 34

Simulink Library Support for HDL HDL Supported Blocks Almost 170 blocks supported Core Simulink Blocks Basic and Array Arithmetic, Look-Up Tables, Signal Routing (Mux/Demux, Delays, Selectors), Logic & Bit Operations, Dual and single port RAMs, FIFOs, CORDICs Signal Processing Blocks NCOs, FFTs, Digital Filters (FIR, IIR, Multirate, Adaptive), Rate Changes (Up &Down Sample), Statistics (Min/Max) Communications Blocks Psuedo-random Sequence Generators, Modulators / Demodulators, Interleavers / Deinterleavers, Viterbi Decoders 35

MATLAB & Stateflow for HDL HDL Supported Blocks MATLAB Relevant subset of the MATLAB language for modeling and generating HDL implementations eml_hdl_design_patterns: Useful MATLAB Function Block Design Patterns for HDL Stateflow Graphical tool for modeling Mealy and Moore Finite State Machines 36

Model-Based Design flow using Simulink from Algorithm to FPGA Implementation MATLAB and Simulink Algorithm and System Design DESIGN HDL Coder RTL Creation HDL Verifier HDL Co-Simulation Algorithm Development MATLAB Simulink Stateflow RTL Back Annotation Implement Design Verification Synthesis Functional Simulation Map Static Timing Analysis Place & Route Timing Simulation HDL Verifier FPGA in the Loop 37