Optimize DSP Designs and Code using Fixed-Point Designer

Similar documents
Addressing Fixed Point Design Challenges

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

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

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

Modeling a 4G LTE System in MATLAB

Introduction to C and HDL Code Generation from MATLAB

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

Design and Verify Embedded Signal Processing Systems Using MATLAB and Simulink

Model-Based Design for Video/Image Processing Applications

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

Accelerating FPGA/ASIC Design and Verification

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

Accelerate FPGA Prototyping with

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

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

Making the Most of your MATLAB Models to Improve Verification

Design and Verify Embedded Signal Processing Systems Using MATLAB and Simulink

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

Design and Verification of FPGA and ASIC Applications Graham Reith MathWorks

Design and Verification of FPGA Applications

Designing and Targeting Video Processing Subsystems for Hardware

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

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

Introduction to DSP/FPGA Programming Using MATLAB Simulink

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

Implementation and Verification Daniel MARTINS Application Engineer MathWorks

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

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

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

MATLAB/Simulink in der Mechatronik So einfach geht s!

Real-Time Testing in a Modern, Agile Development Workflow

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

Model-Based Design: Design with Simulation in Simulink

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

Simulink Matlab To Vhdl Route For Full Custom Fpga Rapid

Connecting MATLAB & Simulink with your SystemVerilog Workflow for Functional Verification

ECE 450:DIGITAL SIGNAL. Lecture 10: DSP Arithmetic

Hardware and Software Co-Design for Motor Control Applications

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

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

Developing a Data Driven System for Computational Neuroscience

Agenda. How can we improve productivity? C++ Bit-accurate datatypes and modeling Using C++ for hardware design

2015 The MathWorks, Inc. 1

What s New in Simulink in R2015b and R2016a

Modeling and Verifying Mixed-Signal Designs with MATLAB and Simulink

Targeting Motor Control Algorithms to System-on-Chip Devices

Fixed-Point Math and Other Optimizations

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

Simulation, prototyping and verification of standards-based wireless communications

2015 The MathWorks, Inc. 1

Ted N. Booth. DesignLinx Hardware Solutions

Evolution of CAD Tools & Verilog HDL Definition

ARCHITECTURAL DESIGN OF 8 BIT FLOATING POINT MULTIPLICATION UNIT

Hardware and Software Co-Design for Motor Control Applications

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

Reuse MATLAB Functions and Simulink Models in UVM Environments with Automatic SystemVerilog DPI Component Generation

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

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

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

RTL Coding General Concepts

OUTLINE RTL DESIGN WITH ARX

From Design to Production

CAD SUBSYSTEM FOR DESIGN OF EFFECTIVE DIGITAL FILTERS IN FPGA

Wordlength Optimization

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

Simulink 를이용한 효율적인레거시코드 검증방안

Platform Selection Motivating Example and Case Study

Model to Code, Made Simple and Easy Sebastien Dupertuis Application Engineer Applications Engineering Group MathWorks Switzerland June 11, 2015

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

Early Models in Silicon with SystemC synthesis

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

An Overview of a Compiler for Mapping MATLAB Programs onto FPGAs

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

Chapter 1 Overview of Digital Systems Design

MODEL BASED HARDWARE DESIGN WITH SIMULINK HDL CODER

Multi-Gigahertz Parallel FFTs for FPGA and ASIC Implementation

A Deterministic Flow Combining Virtual Platforms, Emulation, and Hardware Prototypes

Design Once with Design Compiler FPGA

Quixilica Floating Point FPGA Cores

Chapter 5: ASICs Vs. PLDs

Hardware Design Environments. Dr. Mahdi Abbasi Computer Engineering Department Bu-Ali Sina University

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers

A Rapid Prototyping Methodology for Algorithm Development in Wireless Communications

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

Modeling and implementation of dsp fpga solutions

Ein Modell - viele Zielsysteme

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

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

A Library of Parameterized Floating-point Modules and Their Use

CO SIMULATION OF GENERIC POWER CONVERTER USING MATLAB/SIMULINK AND MODELSIM

Overview. CSE372 Digital Systems Organization and Design Lab. Hardware CAD. Two Types of Chips

Cover TBD. intel Quartus prime Design software

FPGA Technology and Industry Experience

Melon S3 FPGA Development Board Product Datasheet

Model-Based Embedded System Design

Digital Signal Processing Introduction to Finite-Precision Numerical Effects

Designing and Analysing Power Electronics Systems Using Simscape and SimPowerSystems

Programmable Logic Devices HDL-Based Design Flows CMPE 415

Applications of Program analysis in Model-Based Design

Transcription:

Optimize DSP Designs and Code using Fixed-Point Designer MathWorks Korea 이웅재부장 Senior Application Engineer 2013 The MathWorks, Inc. 1

Agenda Fixed-point concepts Introducing Fixed-Point Designer Overview of floating-point to fixed-point workflows Workflow demos Simulink Based MATLAB Based Code generation from fixed-point design C and HDL Summery 2

Real Workflow Story 1 TMS320C6000 Word Floating Point C Use IDE or makefile Debug using break points and watch variables in memory Verify using File Input / File Output Multiple teams, single location Share Word documents, C code 3

Real Workflow Story 2 TMS320C6000 PDF MATLAB MATLAB Floating Point C Floating Point C Fixed-Point C CCS for compile link download Debug: break points, watch windows Verify using MATLAB test data Multiple teams across the globe Share PDF, MATLAB Code, C code 4

Design Challenges Demand for higher performance drives increasing complexity 30%+ of time spent on verification 25%+ of design time spent on fixedpoint conversion 5

Introduction Variety of Measurements & Scales E.g., Fahrenheit vs Celsius Room temperature measurement 50 60 deg F 10 15.5 deg C F = (C*9/5) + 32 9/5: Scaling, 32: Bias (offset) Characteristics of Representation in Digital Systems Representations in digital systems is only an approximation of real world values Range: Limits of representation Precision: Distance between successive numbers 6

What is floating-point? Characterized by SIGN bit, MANTISSA(Fraction) and EXPONENT IEEE 754 Single Precision format (Normalized): 32 bits word size(single) Use of three separate fields increases both range (Exponent size) and precision (Fraction size) of floating point numbers Above picture from http://en.wikipedia.org/wiki/single_precision_floating-point_format 7

What is fixed-point? Characterized by single WORD with fixed RADIX Point Use fractional numbers without floating point For a fixed size, trade-off between Precision and Range 8

Fixed-Point Targets Digital Signal Processors (TI, Analog Devices, etc.) Fixed-point DSPs are considerably less expensive than floating-point DSPs Fixed-point DSPs use less power and are good for battery powered applications Clock speeds for fixed-point DSPs are much higher Fixed word lengths Field Programmable Gate Arrays (Xilinx, Altera, etc.) In fixed-point FPGA implementations every bit of increased word length results in more silicon area used and increased power usage Designer can select word lengths 9

Fixed Point Tradeoff Consideration Fixed Point Floating Point RAM and ROM consumption Small Large Execution time Faster Slower Hardware power consumption Low High Embedded Hardware Cost Lower Higher Development time Long Short Implementation complexity Error Prone More. Need to keep track of word lengths, fractional scaling. Write your own rounding methods and saturation code Harder to develop. More prone to quantization and overflow errors due to smaller range. More prone to programming errors Less Easier to develop 10

Fixed Point Drawbacks & Solutions Drawback Longer development time Solution Using Simulation, automated verification and automated scaling tools will shorten development time and resources Drawback Error prone due to implementation complexity Solution Using rapid prototyping, in-the-loop testing, and production code generation helps reduce errors significantly Drawbacks Quantization errors due to smaller dynamic range Solution Quantization errors can be reduced by selecting appropriate SCALING (position of Radix Point) and WORD SIZE (limited by Hardware) 11

How Does Fixed-Point Work on my DSP? The chip does integer math, not fixed-point. Fixed-point is a do-it-yourself world. Addition and subtraction: You align the binary point (using >> or <<), then add. Multiplication: Integer multiply, then you interpret binary point of product. Division: You probably can t use /. You write a function or make a library function call. Sqrt: Can t use standard math library. You write another function. Rounding and/or saturation: You want it? You do it. 12

Example: Fixed-Point C implementation void differentialeq( void ) { /* Implements a fixed point first order difference equation */ Convert variables to integer types int Prod; long Accum; static short lastval=0; short a=0x7eb8; // 0.99 in s16,15 short oneminusa=0x0148; //.01 in s16,15 short temp; Prod = galg_in1 * galg_in1; temp = Prod >> 15; Accum = a*lastval + oneminusa*temp; Need lots of comments to understand code Keep track of binary point location } galg_out1 = (short)(accum >> 15); lastval = galg_out1; No saturation or rounding 13

Introducing Fixed-Point Designer Simulink Fixed Point Unified Fixed-Point Toolbox and Simulink Fixed Point Products Fixed-Point Designer Supports MATLAB and Simulink workflows Fixed-Point Toolbox 14

3 Tools for Converting a Design to Fixed Point Fixed-Point Tool for Simulink Requires: Works on: Fixed-Point Designer Simulink Simulink Blocks Stateflow Charts Fixed-Point Conversion Tool for MATLAB Requires: Fixed-Point Designer MATLAB Coder Works on: MATLAB Code Instrumented Code Generation Report for MATLAB Requires: Works on: Fixed-Point Designer MATLAB Code MATLAB Function Blocks 15

Simulink Workflow for Fixed Point Design Existing model (Floating-Point / Fixed-Point) Prepare for fixed point conversion Collect Range Information Propose Data Types Apply Data Types Compare Result Generate Code Yes Are results satisfactory? No 16

Prepare your model for fixed-point conversion by using Fixed-Point Advisor Select a task in the listed order. Run the task. If passed, move to the next task. If failed, fix the error, run the task again, and move to the next task. If there is a warning, If important, take the recommended action(s), run the task again and move on to the next task when the issue is resolved. If not critical, ignore the warning and move to the next task. Return to Fixed-Point Tool. 17

Workflow Demo 1: Envelop Detector Fixed-Point Tool in Simulink Logging to capture dynamic range of signals Data Type Override to switch between floating- and fixedpoint data types Auto-scale to set fractional precision based on recorded dynamic range 18

MATLAB Workflow for Fixed Point Design Existing Code (Floating-Point) Existing Stimulus (Floating-Point) Prepare for fixed-point conversion Make Project Set Input Type Collect Range Information Type Proposal Generate fixed point MATLAB code Test Numerics Generate Code Yes Are results satisfactory? No 19

Workflow Demo 2: Kalman Filter Fixed-Point Conversion Tool in MATLAB 20

Code Generation for Fixed-Point 23

Benefit of using both C/HDL auto code generation tools Separation between Design and Implementation Target Devices can be chosen at the final stage. Software and Hardware Partitioning can be easily made. 24

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 25

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 26

Simple example: C Code ficodegen7.c fixedcodegen_y.result = (int16_t)((fixedcodegen_u.in1 << 2) + fixedcodegen_u.in2) * fixedcodegen_u.in3; ficodegen7.h /* External Input*/ typedef struct { int8_t In1; int16_t In2; int8_t In3; } ExternalInputs_fixedCodeGen; /* External Output*/ typedef struct { int32_t Result; } ExternalOutputs_fixedCodeGen; 27

Simple example: HDL Code (vhdl case) Entity Part Architecture Body Part Synthesis Result (Precision RTL) 28

Code Generation Demo: LPF Simulink workflow Supports automated code generation to C or HDL C/C++ HDL 29

Code Generation Demo: LPF MATLAB workflow C/C++ MATLAB Code HDL 30

Summary Number System Concepts Fixed-Point Designer MATLAB/Simulink Algorithm Design Fixed Point Designer Fixed-Point Conversion MATLAB Coder Conversion Workflow MATLAB/Simulink Simulink Coder Embedded Coder HDL Coder Code generation Gen Gen Gen Gen C and HDL C/C++ VHDL/Verilog FPGA MCU ASIC DSP FPGA ASIC 31