QFormat number representation. Lecture 5 Fixed Point vs Floating Point. How to store Q30 number to 16bit memory? Qformat notation.


 Maude Todd
 1 years ago
 Views:
Transcription
1 Lecture 5 Fixed Point vs Floating Point Objectives: Understand fixed point representations Understand scaling, overflow and rounding in fixed point Understand Qformat Understand TM32C67xx floating point representations Understand relationship between the two in C6x architecture Reference: "What Every Computer cientist hould Know About FloatingPoint Arithmetic" by David GoldbergACM Computing urveys 23, 5 (March 1991). Lecture 5  Fixed point vs Floating point 51 QFormat number representation Nbit fixed point, 2 s complement number is given by: x = b N1 N 1 N 2 1 N 12 + bn b1 2 + b 2 imaginary binary point Difficult to work with due to possible overflow & scaling problems Often normalise number to some fractional representation (e.g. between ± 1) x = b N1 1 N 2 N 1 N 12 + bn b1 2 + b 2 imaginary binary point Lecture 5  Fixed point vs Floating point 52 Qformat notation How to store Q3 number to 16bit memory? Qformat representation: if N=16, 15 bit fractional representation Q15 format Rule: Q m + Q m Q m Q m x Q n Q m+n Assume 16bit data format, Q15 x Q15 Q3 X Q15 Q15 Q toring Q3 number to 16bit memory requires rounding or truncation: Q3 Rounding: if r =, round down, r = 1, round up rounding by addition a '1' here 15 r + 1 MPY A3,A4,A6 ; A3 x A4 A6 NOP ; Delay slot K 4h,A6 ; rounding add HR A6,15,A6 ; truncate bottom 15 bits TH A6,*A7 ; A6 mem[a7] Lecture 5  Fixed point vs Floating point 53 Lecture 5  Fixed point vs Floating point 54
2 Avoid overflow with afe add routine in C to avoid overflow  saturation add instruction Always clip to max (or min) possible et bit 9 of the CR register to indicate saturation has occurred Lecture 5  Fixed point vs Floating point 55 Lecture 5  Fixed point vs Floating point 56 ingle Precsion Floating Point number Easy (and lazy) way of dealing with scaling problem 32bit single precision floating point: single precision x = 8bit exp s exp bit frac 1. frac MB is signbit (same as fixed point) 8bit exponent in bias127 integer format (i.e., add 127 to it) 23bit to represent only the fractional part of the mantissa. The MB of the mantissa is ALWAY 1, therefore it is not stored < x < Double Precision Floating Point number 64bit double precision floating point: double precision bit exp 52bit frac Odd register (e.g. A5) Even register (e.g. A4) x s = < exp frac x < MB is signbit (same as fixed point) 11bit exponent in bias123 integer format (i.e., add 123 to it) 52bit to represent only the fractional part of the mantissa. The MB of the mantissa is ALWAY 1, therefore it is not stored 38 Lecture 5  Fixed point vs Floating point 57 Lecture 5  Fixed point vs Floating point 58
3 Convert 5.75 to P FP Examples 5.75 to binary: x 2 2 exponent in bias127 is = 129 = 1 b The fractional part is after we drop the hidden 1 bit. Answer: = 4B8 (hex) Convert.1 to DP FP.1 to binary: (11 repeats) x 24 exponent in bias123 is = 119 = b The fractional part is after we drop the hidden 1 bit and rounding Answer: = 3FB A (hex). Problems of Qformat Wrong Qformat representation will give totally wrong results Even correct use of Qformat notation may reduce precision For this example, Q12 result is totally wrong, and Q8 result is imprecise: Q Q * Q Q Q Lecture 5  Fixed point vs Floating point 59 Lecture 5  Fixed point vs Floating point 51 Data types used by C6x DPs pecial P numbers IEEE floating point standard has a set of special numbers: pecial ign (s) Exponent (e) Fraction (f) Hex Value Decimal + x.  1 x x3f x4 2. +Inf 255 x7f8 + Inf xff8  NaN x 255 Nonzero x7fff FFFF not a number LFPN 254 All 1 s x7f7f FFFF e+38 FPN 1 All s x e38 Lecture 5  Fixed point vs Floating point 511 Lecture 5  Fixed point vs Floating point 512
4 pecial DP numbers TM32C67x Internal ystem Architecture Double precision floating point special numbers: pecial Exponent (e) Fraction (f) Hex Value Decimal + x.  x x3ff x4 2. +Inf 247 x7ff + Inf 247 xfff  NaN 247 Nonzero x7fff FFFF FFFF FFFF not a number LFPN 246 All 1 s x7fef FFFF FFFF FFFF e+38 FPN 1 All s x e38 External Memory P E R I P H E R A L Regs (AA15/31) Internal Memory Internal Buses.D1.M1.L1.1 CPU.D2.M2.L2.2 Regs (BB15/31) Lecture 5  Fixed point vs Floating point 513 Lecture 5  Fixed point vs Floating point 514 Four functional units for each datapath Mapping of instructions to functional units..l.d.m K 2 AND B CLR EXT C K KH AB LDB LDDW. Unit NOT OR ET HL HR HL UB UB2 XOR ZERO ABP ABDP CMPGTP CMPEQP CMPLTP CMPGTDP CMPEQDP CMPLTDP RCPP RCPDP RQRP RQRDP PDP.D Unit (B/H/W) TB (B/H/W) (B/H/W) UB UBAB (B/H/W) ZERO AB AND CMPEQ CMPGT CMPLT LMBD NORM MPY MPYH MPYLH MPYHL.L Unit NOT P OR DP UBP AT UBDP UB INTP UB INTDP UBC PINT XOR DPINT ZERO PRTUNC DPTRUNC DPP.M Unit MPY MPYH MPYP MPYDP MPYI MPYID No Unit Used NOP IDLE Lecture 5  Fixed point vs Floating point 515 Lecture 5  Fixed point vs Floating point 516
5 Detailed internal datapaths Data path A Data path B Lecture 5  Fixed point vs Floating point 517
This document has been written by Michaël Baudin from the Scilab Consortium. December 2010 The Scilab Consortium Digiteo. All rights reserved.
SCILAB IS NOT NAIVE This document has been written by Michaël Baudin from the Scilab Consortium. December 2010 The Scilab Consortium Digiteo. All rights reserved. December 2010 Abstract Most of the time,
More informationAttention: This material is copyright 19951997 Chris Hecker. All rights reserved.
Attention: This material is copyright 19951997 Chris Hecker. All rights reserved. You have permission to read this article for your own education. You do not have permission to put it on your website
More informationWhat Every Computer Scientist Should Know About FloatingPoint Arithmetic
What Every Computer Scientist Should Know About FloatingPoint Arithmetic DAVID GOLDBERG Xerox Palo Alto Research Center, 3333 Coyote Hill Road, Palo Alto, CalLfornLa 94304 Floatingpoint arithmetic is
More informationMEP Y9 Practice Book A
1 Base Arithmetic 1.1 Binary Numbers We normally work with numbers in base 10. In this section we consider numbers in base 2, often called binary numbers. In base 10 we use the digits 0, 1, 2, 3, 4, 5,
More informationA NEW REPRESENTATION OF THE RATIONAL NUMBERS FOR FAST EASY ARITHMETIC. E. C. R. HEHNER and R. N. S. HORSPOOL
A NEW REPRESENTATION OF THE RATIONAL NUMBERS FOR FAST EASY ARITHMETIC E. C. R. HEHNER and R. N. S. HORSPOOL Abstract. A novel system for representing the rational numbers based on Hensel's padic arithmetic
More informationII9Importing and Exporting Data
Chapter II9 II9Importing and Exporting Data Loading Waves... 141 Load Waves Submenu... 142 Number Formats... 143 The End of the Line... 143 Loading Delimited Text Files... 143 Date/Time Formats... 144
More informationCaml Virtual Machine File & data formats Document version: 1.4 http://cadmium.x9c.fr
Caml Virtual Machine File & data formats Document version: 1.4 http://cadmium.x9c.fr Copyright c 20072010 Xavier Clerc cadmium@x9c.fr Released under the LGPL version 3 February 6, 2010 Abstract: This
More informationKCPSM6 Instruction Set
KPSM6 Instruction Set aaa : 2bit address to FFF kk : 8bit constant to FF pp : 8bit port ID to FF p : 4bit port ID to F ss : 8bit scratch pad location to FF x : Register within bank s to sf y : Register
More informationZ80 Instruction Set. Z80 Assembly Language
75 Z80 Assembly Language The assembly language allows the user to write a program without concern for memory addresses or machine instruction formats. It uses symbolic addresses to identify memory locations
More informationGroup Theory. Contents
Group Theory Contents Chapter 1: Review... 2 Chapter 2: Permutation Groups and Group Actions... 3 Orbits and Transitivity... 6 Specific Actions The Right regular and coset actions... 8 The Conjugation
More informationhow to use dual base log log slide rules
how to use dual base log log slide rules by Professor Maurice L. Hartung The University of Chicago Pickett The World s Most Accurate Slide Rules Pickett, Inc. Pickett Square Santa Barbara, California 93102
More informationHP 35s scientific calculator
HP 35s scientific calculator user's guide H Edition 1 HP part number F2215AA90001 Notice REGISTER YOUR PRODUCT AT: www.register.hp.com THIS MANUAL AND ANY EXAMPLES CONTAINED HEREIN ARE PROVIDED AS IS
More informationGroup Fundamentals. Chapter 1. 1.1 Groups and Subgroups. 1.1.1 Definition
Chapter 1 Group Fundamentals 1.1 Groups and Subgroups 1.1.1 Definition A group is a nonempty set G on which there is defined a binary operation (a, b) ab satisfying the following properties. Closure: If
More informationModbus for Field Technicians
Modbus for Field Technicians Revision 1.0 Any reproduction or retransmission in whole or in part of this work is expressly prohibited without the prior consent of Chipkin Automation Systems Inc. Copyright
More informationWhat's New in Component Pascal?
What's New in Component Pascal? Author: Cuno Pfister Oberon microsystems, Inc. March 2001 Copyright 19942005 by Oberon microsystems, Inc.,. All rights reserved. No part of this publication may be reproduced
More informationWhere s the FEEB? The Effectiveness of Instruction Set Randomization
Where s the FEEB? The Effectiveness of Instruction Set Randomization Ana Nora Sovarel David Evans Nathanael Paul University of Virginia, Department of Computer Science http://www.cs.virginia.edu/feeb Abstract
More information= 2 + 1 2 2 = 3 4, Now assume that P (k) is true for some fixed k 2. This means that
Instructions. Answer each of the questions on your own paper, and be sure to show your work so that partial credit can be adequately assessed. Credit will not be given for answers (even correct ones) without
More informationIf A is divided by B the result is 2/3. If B is divided by C the result is 4/7. What is the result if A is divided by C?
Problem 3 If A is divided by B the result is 2/3. If B is divided by C the result is 4/7. What is the result if A is divided by C? Suggested Questions to ask students about Problem 3 The key to this question
More informationCSCE 310J Data Structures & Algorithms. Dynamic programming 01 Knapsack problem. Dynamic programming. Dynamic Programming. Knapsack problem (Review)
CSCE J Data Structures & Algorithms Dynamic programming  Knapsac problem Dr. Steve Goddard goddard@cse.unl.edu CSCE J Data Structures & Algorithms Giving credit where credit is due:» Most of slides for
More informationThe Backpropagation Algorithm
7 The Backpropagation Algorithm 7. Learning as gradient descent We saw in the last chapter that multilayered networks are capable of computing a wider range of Boolean functions than networks with a single
More informationSUBGROUPS OF CYCLIC GROUPS. 1. Introduction In a group G, we denote the (cyclic) group of powers of some g G by
SUBGROUPS OF CYCLIC GROUPS KEITH CONRAD 1. Introduction In a group G, we denote the (cyclic) group of powers of some g G by g = {g k : k Z}. If G = g, then G itself is cyclic, with g as a generator. Examples
More informationON THE DISTRIBUTION OF SPACINGS BETWEEN ZEROS OF THE ZETA FUNCTION. A. M. Odlyzko AT&T Bell Laboratories Murray Hill, New Jersey ABSTRACT
ON THE DISTRIBUTION OF SPACINGS BETWEEN ZEROS OF THE ZETA FUNCTION A. M. Odlyzko AT&T Bell Laboratories Murray Hill, New Jersey ABSTRACT A numerical study of the distribution of spacings between zeros
More information(0, 0) : order 1; (0, 1) : order 4; (0, 2) : order 2; (0, 3) : order 4; (1, 0) : order 2; (1, 1) : order 4; (1, 2) : order 2; (1, 3) : order 4.
11.01 List the elements of Z 2 Z 4. Find the order of each of the elements is this group cyclic? Solution: The elements of Z 2 Z 4 are: (0, 0) : order 1; (0, 1) : order 4; (0, 2) : order 2; (0, 3) : order
More informationUnderstanding the FiniteDifference TimeDomain Method. John B. Schneider
Understanding the FiniteDifference TimeDomain Method John B. Schneider June, 015 ii Contents 1 Numeric Artifacts 7 1.1 Introduction...................................... 7 1. Finite Precision....................................
More informationGuide for Texas Instruments TI83, TI83 Plus, or TI84 Plus Graphing Calculator
Guide for Texas Instruments TI83, TI83 Plus, or TI84 Plus Graphing Calculator This Guide is designed to offer stepbystep instruction for using your TI83, TI83 Plus, or TI84 Plus graphing calculator
More informationInstruction Set Reference
2015.04.02 Set Reference NII51017 Subscribe This section introduces the Nios II instruction word format and provides a detailed reference of the Nios II instruction set. Word Formats There are three types
More informationDigital vs. Analog Volume Controls
Digital vs. Analog Volume Controls October 2011 AMM ESS 10/11 Summary of this Presentation In a Digital Audio System what is the tradeoff between using a digital or an analog volume control? To answer
More informationDVPPM APPLICATION MANUAL
DVPPM APPLICATION MANUAL Table of Contents Chapter 1: Program Structure of DVPPM 1.1 O100 Main Program... 11 1.1.1 Manual Motion in O100 Main Program... 12 1.2 Structure of OX Motion Subroutine...
More informationThe basic CAP CPU consists of a microprogramming control unit, 4K 16bit words of microcontrol storage, and an 79
5 The Cambridge CAP Computer 5. I Introduction In 1970, Roger Needham and Maurice Wilkes at Cambridge University began a research project to construct a capabilitybased machine. In contrast to the Chicago
More informationA mini course on additive combinatorics
A mini course on additive combinatorics 1 First draft. Dated Oct 24th, 2007 These are notes from a mini course on additive combinatorics given in Princeton University on August 2324, 2007. The lectures
More information