Introducing Fixed-Point Conversion from MATLAB and Simulink Cynthia Cudicini Senior Application Engineer

Similar documents
Integrating MATLAB into your C/C++ Product Development Workflow Andy Thé Product Marketing Image Processing Applications

Product Development Flow Including Model- Based Design and System-Level Functional Verification

Binary Number System. 16. Binary Numbers. Base 10 digits: Base 2 digits: 0 1

Converting Models from Floating Point to Fixed Point for Production Code Generation

Schnell und effizient durch Automatische Codegenerierung

LMS is a simple but powerful algorithm and can be implemented to take advantage of the Lattice FPGA architecture.

ECE 0142 Computer Organization. Lecture 3 Floating Point Representations

Eli Levi Eli Levi holds B.Sc.EE from the Technion.Working as field application engineer for Systematics, Specializing in HDL design with MATLAB and

Introduction to Xilinx System Generator Part II. Evan Everett and Michael Wu ELEC Spring 2013

Echtzeittesten mit MathWorks leicht gemacht Simulink Real-Time Tobias Kuschmider Applikationsingenieur

This 3-digit ASCII string could also be calculated as n = (Data[2]-0x30) +10*((Data[1]-0x30)+10*(Data[0]-0x30));

Computers. Hardware. The Central Processing Unit (CPU) CMPT 125: Lecture 1: Understanding the Computer

2010/9/19. Binary number system. Binary numbers. Outline. Binary to decimal

CS321. Introduction to Numerical Methods

Digital Hardware Design Decisions and Trade-offs for Software Radio Systems

Model-based system-on-chip design on Altera and Xilinx platforms

Binary Numbering Systems

The string of digits in the binary number system represents the quantity

Data Storage 3.1. Foundations of Computer Science Cengage Learning

Floating Point Fused Add-Subtract and Fused Dot-Product Units

Software Development with Real- Time Workshop Embedded Coder Nigel Holliday Thales Missile Electronics. Missile Electronics

CSI 333 Lecture 1 Number Systems

All Programmable Logic. Hans-Joachim Gelke Institute of Embedded Systems. Zürcher Fachhochschule

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)

Radar Processing: FPGAs or GPUs?

Data Storage. Chapter 3. Objectives. 3-1 Data Types. Data Inside the Computer. After studying this chapter, students should be able to:

Float to Fix conversion

Automatic Floating-Point to Fixed-Point Transformations

Divide: Paper & Pencil. Computer Architecture ALU Design : Division and Floating Point. Divide algorithm. DIVIDE HARDWARE Version 1

Simulink Modeling Guidelines for High-Integrity Systems

Attention: This material is copyright Chris Hecker. All rights reserved.

Embedded Vision on FPGAs The MathWorks, Inc. 1

Measures of Error: for exact x and approximation x Absolute error e = x x. Relative error r = (x x )/x.

7a. System-on-chip design and prototyping platforms

Pemrograman Dasar. Basic Elements Of Java

Infinite Impulse Response Filter Structures in Xilinx FPGAs

Design and Implementation of Fast Fourier Transform Algorithm in FPGA

White Paper Video and Image Processing Design Using FPGAs

Entwicklung und Testen von Robotischen Anwendungen mit MATLAB und Simulink Maximilian Apfelbeck, MathWorks

The new 32-bit MSP432 MCU platform from Texas

Programming languages - C - Extensions to support embedded processors

A Master-Slave DSP Board for Digital Control

Introduction to MATLAB Gergely Somlay Application Engineer

LSN 2 Number Systems. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology

This Unit: Floating Point Arithmetic. CIS 371 Computer Organization and Design. Readings. Floating Point (FP) Numbers

What is a System on a Chip?

Number Representation

How To Design An Image Processing System On A Chip

THE BINARY NUMBER SYSTEM

Architekturen und Einsatz von FPGAs mit integrierten Prozessor Kernen. Hans-Joachim Gelke Institute of Embedded Systems Professur für Mikroelektronik

AN FPGA IMPLEMENTATION OF THE LMS ADAPTIVE FILTER FOR ACTIVE VIBRATION CONTROL

FPGAs for High-Performance DSP Applications

White Paper Video Surveillance Implementation Using FPGAs

Power inverters: Efficient energy transformation through efficient TargetLink code

Customizing 16-bit floating point instructions on a NIOS II processor for FPGA image and media processing

HOMEWORK # 2 SOLUTIO

Video/Image Processing on FPGA

Binary Division. Decimal Division. Hardware for Binary Division. Simple 16-bit Divider Circuit

Real-Time Challenges and Opportunities in SoCs

System-on-Chip Design Verification: Challenges and State-of-the-art

A DA Serial Multiplier Technique based on 32- Tap FIR Filter for Audio Application

Speed up numerical analysis with MATLAB

MATLAB/Simulink Based Hardware/Software Co-Simulation for Designing Using FPGA Configured Soft Processors

Correctly Rounded Floating-point Binary-to-Decimal and Decimal-to-Binary Conversion Routines in Standard ML. By Prashanth Tilleti

Non-Data Aided Carrier Offset Compensation for SDR Implementation

Fast Logarithms on a Floating-Point Device

Using Nios II Floating-Point Custom Instructions Tutorial

Parallel Computing with MATLAB

Number of bits needed to address hosts 8

13. Publishing Component Information to Embedded Software

Current and Future Trends in Medical Electronics

A New, High-Performance, Low-Power, Floating-Point Embedded Processor for Scientific Computing and DSP Applications

PowerPlay Power Analysis & Optimization Technology

Numerical Matrix Analysis

Fast Arithmetic Coding (FastAC) Implementations

MathWorks Products and Prices North America Academic March 2013

Altera SDK for OpenCL

Oct: 50 8 = 6 (r = 2) 6 8 = 0 (r = 6) Writing the remainders in reverse order we get: (50) 10 = (62) 8

Why Adopt Model-Based Design for Embedded Control Software Development?

Systems I: Computer Organization and Architecture

9/14/ :38

Numbering Systems. InThisAppendix...

High-Level Synthesis for FPGA Designs

Binary search tree with SIMD bandwidth optimization using SSE

Fastest Path to Your Design. Quartus Prime Software Key Benefits

How To Calculate Kinematics Of A Parallel Robot

A Programming Language for Processor Based Embedded Systems

AND9035/D. BELASIGNA 250 and 300 for Low-Bandwidth Applications APPLICATION NOTE

THE EXACT DOT PRODUCT AS BASIC TOOL FOR LONG INTERVAL ARITHMETIC

Design and Implementation of an On-Chip timing based Permutation Network for Multiprocessor system on Chip

Introduction to Digital System Design

A High-Performance 8-Tap FIR Filter Using Logarithmic Number System

1 Introduction. Freescale Semiconductor Application Note. Document Number: AN3031 Rev. 1, 04/2010

Monday January 19th 2015 Title: "Transmathematics - a survey of recent results on division by zero" Facilitator: TheNumberNullity / James Anderson, UK

Transcription:

Introducing Fixed-Point Conversion from MATLAB and Simulink Cynthia Cudicini Senior Application Engineer 2014 The MathWorks, Inc. 1

Fixed-Point Concepts What is fixed-point? Fixed-point targets Design Challenges Introducing Fixed-Point Designer Fixed-Point Designer tools Floating-Point to Fixed-Point Conversion Workflows Using the Fixed-Point Tool in Simulink Using the Fixed-Point Conversion Tool in MATLAB Using the separation of algorithm from data types in MATLAB and SIMULINK Code Generation from fixed-point design C and HDL 2

Fixed-Point Concepts What is fixed-point? Fixed-point targets Design Challenges Introducing Fixed-Point Designer Fixed-Point Designer tools Floating-Point to Fixed-Point Conversion Workflows Using the Fixed-Point Tool in Simulink Using the Fixed-Point Conversion Tool in MATLAB Using the separation of algorithm from data types in MATLAB Code Generation from fixed-point design C and HDL 3

What is fixed-point? Floating-point: Sign bit Exponent width (determines range) Mantissa / Fraction bits (determines precision) Floating radix / decimal point Same word size, we can increase both precision and range IEEE 754 single-precision binary floating-point format: binary32* Fixed-point: Sign bit Whole number part (determines range) Fractional part (determines precision) Fixed radix / decimal point Fixed size, trade-off between precision and range *Picture from http://en.wikipedia.org/wiki/single_precision_floating-point_format 4

Fixed-Point Targets Fixed-Point DSPs (TI, Analog Devices, etc.) Fixed word lengths Less expensive Use less power - good for battery powered applications Higher clock speeds FPGAs (Xilinx, Altera, etc.) Designer can select word lengths Every bit increased word length - more silicon area and increased power usage 5

Fixed Point Tradeoff Consideration Floating Point Fixed Point Automatic Fixed Point conversion RAM and ROM Consumption Execution Speed Hardware power consumption Embedded Hardware Cost Development time Implementation complexity Error Prone 6

Example: Fixed-Point C hand implementation void differentialeq( void ) { /* Implements a fixed point first order difference equation */ 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; Convert variables to integer types 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 7

Fixed-Point Concepts What is fixed-point? Fixed-point targets Design Challenges Introducing Fixed-Point Designer Fixed-Point Designer tools Floating-Point to Fixed-Point Conversion Workflows Using the Fixed-Point Tool in Simulink Using the Fixed-Point Conversion Tool in MATLAB Using the separation of algorithm from data types in MATLAB Code Generation from fixed-point design C and HDL 8

MATLAB / SIMULINK Algorithm Design FIXED-POINT DESIGNER Fixed-Point Conversion MATLAB CODER SIMULINK CODER EMBEDDED CODER HDL CODER Gen Gen C/C++ VHDL/Verilog FPGA MCU ASIC DSP FPGA ASIC 9

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 Works on: MATLAB Code Instrumented Code Generation Report for MATLAB Requires: Works on: Fixed-Point Designer MATLAB Code MATLAB Function Blocks 10

Fixed-Point Concepts What is fixed-point? Fixed-point targets Design Challenges Introducing Fixed-Point Designer Fixed-Point Designer tools Floating-Point to Fixed-Point Conversion Workflows Using the Fixed-Point Tool in Simulink Using the Fixed-Point Conversion Tool in MATLAB Using the separation of algorithm from data types in MATLAB Code Generation from fixed-point design C and HDL 11

Workflow using Fixed-Point Tool in Simulink: Curve Fitting 1. Prepare for Fixed-Point Conversion 2. Collect Range Information 3. Propose Datatypes 4. Apply Datatypes 5. Compare Results 6. Generate Code 12

Workflow using Fixed-Point Conversion Tool in MATLAB: Kalman Filter 1. Prepare for Fixed-Point Conversion 2. Collect Range Information 3. Propose Datatypes 4. Generate Fixed- Point MATLAB Code 5. Test Numerics 6. Generate Code 13

Separate algorithm from datatype specification Why? Separate database to store large scale data Clarity and readability Portability You can use the same algorithm and switch between different data type specifications Implement in doubles mode for benchmarking Implement in single precision mode for certain micro processors and DSPs Have multiple fixed point implementations for different targets 14

Separate algorithm from datatype specification How? Define Types in MATLAB file airtempsensortype = numerictype(1,16,12) Algorithm in separate file: MATLAB or Simulink Refers to types by name airtempthreshold = fi(145,airtempsensortype) 15

Workflow with separate algorithm from datatypes in MATLAB: FIR Filter 1. Prepare for Fixed-Point Conversion 2. Collect Range Information 3. Propose Datatypes 4. Populate types table with fixedpoint types 5. Compare Results 6. Generate Code 16

Fixed-Point Concepts What is fixed-point? Fixed-point targets Design Challenges Introducing Fixed-Point Designer Fixed-Point Designer tools Floating-Point to Fixed-Point Conversion Workflows Using the Fixed-Point Tool in Simulink Using the Fixed-Point Conversion Tool in MATLAB Using the separation of algorithm from data types in MATLAB Code Generation from fixed-point design C and HDL 17

Code Generation Automatically generate readable, traceable HDL and C code Automatically generate C and HDL code from Simulink, MATLAB and Stateflow Full bi-directional traceability!! Requirements 18

Summary MATLAB / SIMULINK Algorithm Design Fixed-Point Designer Conversion Workflow MATLAB/Simulink SIMULINK CODER EMBEDDED CODER FIXED-POINT DESIGNER Fixed-Point Conversion MATLAB CODER HDL CODER Code generation C and HDL Gen Gen Gen Gen C/C++ VHDL/Verilog FPGA MCU ASIC DSP FPGA ASIC 19

Next Steps Visit the product page for more information www.mathworks.com/products/fixed-point-designer Questions? 21