Fixed-Point Design in MATLAB and Simulink

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

Schnell und effizient durch Automatische Codegenerierung

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

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

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

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

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

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

Power inverters: Efficient energy transformation through efficient TargetLink code

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

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

Introduction to MATLAB Gergely Somlay Application Engineer

ECE 0142 Computer Organization. Lecture 3 Floating Point Representations

Embedded Vision on FPGAs The MathWorks, Inc. 1

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

Automating Code Reviews with Simulink Code Inspector

Data Storage 3.1. Foundations of Computer Science Cengage Learning

Simulink Modeling Guidelines for High-Integrity Systems

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

Caterpillar Automatic Code Generation

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

Model Based System Engineering (MBSE) For Accelerating Software Development Cycle

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

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

CSI 333 Lecture 1 Number Systems

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

MathWorks Products and Prices North America Academic March 2013

AUTOSAR Seminar WS2008/ Assignment: Simulation of Automotive Systems in the Context of AUTOSAR

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

Development of AUTOSAR Software Components within Model-Based Design

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

Binary Numbering Systems

Float to Fix conversion

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

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

MathWorks Automotive Conference 2015 Simon Fürst, 2015/09/24. MODEL-BASED SOFTWARE DEVELOPMENT: AN OEM S PERSPECTIVE.

Best Practices for Verification, Validation, and Test in Model- Based Design

Best practices for developing DO-178 compliant software using Model-Based Design

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

CS321. Introduction to Numerical Methods

Radar Processing: FPGAs or GPUs?

Making model-based development a reality: The development of NEC Electronics' automotive system development environment in conjunction with MATLAB

Software Development Principles Applied to Graphical Model Development

Integrated Model-based Software Development and Testing with CSD and MTest

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

SCADE Suite in Space Applications

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

Design and Implementation of Fast Fourier Transform Algorithm in FPGA

Lecture 3 - Model-based Control Engineering

How To Design An Image Processing System On A Chip

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

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

DS1104 R&D Controller Board

I can make just such ones if I had tools, and I could make tools if I had tools. -Eli Whitney

Fastest Path to Your Design. Quartus Prime Software Key Benefits

Hardware in the Loop (HIL) Testing VU 2.0, , WS 2008/09

Model-Based Development of Safety-Critical Software: Safe and Effi cient

VON BRAUN LABS. Issue #1 WE PROVIDE COMPLETE SOLUTIONS ULTRA LOW POWER STATE MACHINE SOLUTIONS VON BRAUN LABS. State Machine Technology

NIOS II Based Embedded Web Server Development for Networking Applications

Automatic Floating-Point to Fixed-Point Transformations

Infinite Impulse Response Filter Structures in Xilinx FPGAs

Video/Image Processing on FPGA

Automotive Software Engineering

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

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

Efficient and Faster PLC Software Development Process for Automotive industry. Demetrio Cortese IVECO Embedded Software Design

Non-Data Aided Carrier Offset Compensation for SDR Implementation

Performance Study based on Matlab Modeling for Hybrid Electric Vehicles

EHOOKS Prototyping is Rapid Again

Die wichtigsten Use Cases für MISRA, HIS, SQO, IEC, ISO und Co. - Warum Polyspace DIE Embedded Code-Verifikationslösung ist.

Lecture 11: Number Systems

A Master-Slave DSP Board for Digital Control

Software Production. Industrialized integration and validation of TargetLink models for series production

Design Data Management in Model-Based Design

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

Product Information CANape Option Simulink XCP Server

Number Representation

Data Analysis with MATLAB The MathWorks, Inc. 1

Attention. restricted to Avnet s X-Fest program and Avnet employees. Any use

Modeling a GPS Receiver Using SystemC

Lecture 9 Modeling, Simulation, and Systems Engineering

Real-Time Challenges and Opportunities in SoCs

9/14/ :38

THE BINARY NUMBER SYSTEM

Introduction to Digital System Design

Fast Logarithms on a Floating-Point Device

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

Networking Remote-Controlled Moving Image Monitoring System

13. Publishing Component Information to Embedded Software

Demo: Real-time Tracking of Round Object

HOMEWORK # 2 SOLUTIO

PowerPlay Power Analysis & Optimization Technology

White Paper Video Surveillance Implementation Using FPGAs

Transcription:

Fixed-Point Design in MATLAB and Simulink Gaurav Dubey Senior Team Lead - Pilot Engineering Gaurav.Dubey@mathworks.in 2013 The MathWorks, Inc. 1

What are you looking for? How can I convert an algorithm from floating-point to fixed-point representation? How can I comparing the floating-point and fixed-point simulation results How can I generate fixed-point C and HDL code for embedded implementations I don t know how to convert a floating point model/ code to a fixed-point model/ code? I hope to maintain one algorithm file for all kind of data type, is this possible? 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 Code Generation from fixed-point design C and HDL 3

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 Code Generation from fixed-point design C and HDL 4

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_floatingpoint_format 5

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 6

Fixed Point Tradeoffs Consideration Floating Point Fixed Point Fixed Point with MathWorks Tools RAM and ROM Consumption Execution Speed Hardware power consumption Embedded Hardware Cost Development time Implementation complexity Error Prone 7

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; Convert variables to integer types Need lots of comments to understand code Prod = galg_in1 * galg_in1; temp = Prod >> 15; Accum = a*lastval + oneminusa*temp; Keep track of binary point location galg_out1 = (short)(accum >> 15); lastval = galg_out1; } No saturation or rounding 8

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 Code Generation from fixed-point design C and HDL 9

Fixed Point ECU Development Process with Model-Based Design System Requirements Simulation System Design Rapid Prototyping Hardware-in-the-Loop Testing Processor-in-the-Loop Testing Vehicle Integration & Calibration Hardware/Software Integration Software Design Software Integration On-Target Rapid Prototyping Software-in-the-Loop Testing Coding Production Code Generation Requirements Traceability Configuration Management Documentation 10

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 11

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

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 Code Generation from fixed-point design C and HDL 13

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

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

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 Code Generation from fixed-point design C and HDL 16

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 17

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

Fixed Point Conversion: Simulink Fixed-Point Advisor The Fixed-Point Advisor facilitates converting a floating-point model or subsystem into a fixed-point representation. 19

Fixed Point Conversion: Simulink Fixed-Point Tool The Fixed-Point Tool is a graphical user interface that automates specifying fixed-point data types in a model. 20

Fixed Point Conversion: Simulink Float- to Fixed- Conversion in FPA and FPT Integrated workflow to accomplish float- to fixed-point conversion of Simulink models in FPA and FPT Streamline workflow from modeling preparation in FPA and autoscaling in FPT Support floating-, fixed-point and mixed data type designs Emphasize design best-practice to achieve production code generation design goals Integrated with features of word length selection, model-wide range analysis and multiple run management support in both FPA and FPT 21

Fixed Point Conversion: Simulink Output Comparison 22

Fixed Point Conversion: Simulink Code Generation 23

Fixed Point Conversion: MATLAB Fixed-Point Converter 24

Fixed Point Conversion: MATLAB Fixed-Point Converter 25

Fixed Point Conversion: MATLAB Output Comparison 26

Fixed Point Code Generation: MATLAB MATLAB Coder 27

28