Example: confidence

Fixed-Point Arithmetic: An Introduction

STechnical ReferenceFixed-Point arithmetic : An Introduction1 (13) YatesAugust 23, 2007 11:05PA5 arithmetic : An IntroductionRandy YatesAugust 23, 2007ss i g n a lp r o c e s s i n gs y s t e m using LATEX2 Digital Signal LabsPublic InformationsTechnical ReferenceFixed-Point arithmetic : An Introduction2 (13) YatesAugust 23, 2007 11:05PA5 Introduction32 Fixed-Point Binary Unsigned Fixed-Point Rationals .. 43 The Operations of One s Complement and Two s Complement54 Signed Two s Complement Fixed-Point Rationals55 Fundamental Rules of Fixed-Point Unsigned Wordlength .. Signed Wordlength .. Unsigned Range .. Signed Range .. Addition Operands .. Addition Result .. Unsigned Multiplication .. Signed Multiplication .. Unsigned Division.

Fixed-Point Arithmetic: An Introduction 4 (13) Author Date Time Rev No. Reference Randy Yates August 23, 2007 11:05 PA5 n/a fp.tex The salient point is that there is no meaning inherent in a binary word, although most people are tempted to think of

Tags:

  Points, Fixed, Arithmetic, Fixed point arithmetic

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Transcription of Fixed-Point Arithmetic: An Introduction

1 STechnical ReferenceFixed-Point arithmetic : An Introduction1 (13) YatesAugust 23, 2007 11:05PA5 arithmetic : An IntroductionRandy YatesAugust 23, 2007ss i g n a lp r o c e s s i n gs y s t e m using LATEX2 Digital Signal LabsPublic InformationsTechnical ReferenceFixed-Point arithmetic : An Introduction2 (13) YatesAugust 23, 2007 11:05PA5 Introduction32 Fixed-Point Binary Unsigned Fixed-Point Rationals .. 43 The Operations of One s Complement and Two s Complement54 Signed Two s Complement Fixed-Point Rationals55 Fundamental Rules of Fixed-Point Unsigned Wordlength .. Signed Wordlength .. Unsigned Range .. Signed Range .. Addition Operands .. Addition Result .. Unsigned Multiplication .. Signed Multiplication .. Unsigned Division.

2 Signed Division .. Wordlength Reduction .. Shifting .. Literal Shift .. Multiplying/Dividing By A Power of Two .. Modifying Scaling .. Virtual Shift .. 86 Dimensional Analysis in Fixed-Point Arithmetic97 Concepts of Finite Precision Precision .. Resolution .. Range .. Accuracy .. Dynamic Range .. 118 Fixed-Point Analysis An Example119 Acknowledgments1210 Terms and Abbreviations1311 Revision History1312 References13 List of FiguresList of Tables1 Revision History .. 13 Digital Signal LabsPublic InformationsTechnical ReferenceFixed-Point arithmetic : An Introduction3 (13) YatesAugust 23, 2007 11:05PA5 IntroductionThis document presents definitions of signed and unsigned Fixed-Point binary number representations and develops basicrules and guidelines for the manipulation of these number representations using the common arithmetic and logicaloperations found in Fixed-Point DSPs and hardware there is nothing particularly difficult about this subject, I found little documentation either in hardcopy or on theweb.

3 What documentation I did find was disjointed, never putting togetherallof the aspects of Fixed-Point arithmeticthat I think are important. I therefore decided to develop this material and to place it on the web not only for my ownreference but for the benefit of others who, like myself, find themselves needing a complete understanding of the issuesin implementing Fixed-Point algorithms on platforms utilizing integer the writing of this paper, I was developing assembly language code for the Texas Instruments TMS320C50 Digital Signal Processor, thus my approach to the subject isundoubtedly biased towards this processor in terms ofthe operation of the fundamental arithmetic operations. For example, the C50 performs adds and multiplies as if thenumbers are simple signed two s complement integers.

4 Contrast this against the Motorola 56k series which performstwo s complement fractional arithmetic , with values always in the range 1 x <+ is my hope that this material is clear, accurate, and helpful. If you find any errors or inconsistencies, please email meat the reader may be interested in the author s related paper [1] on the application of Fixed-Point arithmetic to theimplementation of FIR Fixed-Point Binary RepresentationsA collection ofN(Na positive integer) binary digits (bits) has2 Npossible states. This can be seen from elementarycounting theory, which tells us that there are two possibilities for the first bit, two possibilities for the next bit, andsoon until the last bit, resulting in2 2 .. 2 Ntimes= the most general sense, we can allow these states to represent anything conceivable.

5 In the case of anN-bit binaryword, some examples are up to2N:1. students at a university;2. species of plants;3. atomic elements;4. integers;5. voltage from set theory and elementary abstract algebra, one could view a representation as an onto mapping betweenthe binary states and the elements in the representation set(in the case of unassigned binary states, we assume thereis an unassigned element in the representation set to which all such states are mapped).Digital Signal LabsPublic InformationsTechnical ReferenceFixed-Point arithmetic : An Introduction4 (13) YatesAugust 23, 2007 11:05PA5 salient point is that there is no meaning inherent in a binary word, although most people are tempted to think ofthem (at first glance, anyway) as positive integers ( , thenatural binaryrepresentation, defined in the next section).

6 However,the meaning of an N-bit binary word depends entirely on itsinterpretation, , on the representation setand the mapping we choose to this section, we consider representations in which the representation set is a particular subset of the rational that the rational numbers are the set of numbers expressible asa/b, wherea, b Z, b6= 0. (Zis the set ofintegers.) The subset to which we refer are those rationals for whichb= 2n. We also further constrain the representationsets to be those in which every element in the set has the same number of binary digits and in which every element inthe set has the binary point at the same position, , the binary point is fixed . Thus these representations are called Fixed-Point . The following sections explain four common binary representations: unsigned integers, unsigned Fixed-Point rationals,signed two s complement integers, and signed two s complement Fixed-Point rationals.

7 We view the integer representa-tions as special cases of the Fixed-Point rational representations, therefore we begin by defining the Fixed-Point rationalrepresentations and then subsequently show how these can simplify to the integer representations. We begin with theunsigned representations since they require nothing more than basic algebra. Section defines the notion of a two scomplement so that we may proceed well-grounded to the discussion of signed two s complement rationals in Unsigned Fixed-Point RationalsAn N-bit binary word, when interpreted as an unsigned Fixed-Point rational, can take on values from a subsetPof thenon-negative rationals given byP={p/2b|0 p 2N 1, p Z}.Note thatPcontains2 Nelements. We denote such a representationU(a, b), wherea=N theU(a, b)representation, thenth bit, counting from right to left and beginning at 0, has a weight of2n/2b= 2n that whenn=bthe weight is exactly 1.

8 Similar to normal everyday base-10 decimal notation, the binary pointis between this bit and the bit to the right. This is sometimesreferred to as theimplied binary (a, b)representation hasainteger bits andbfractional value of a particular N-bit binary numberxin aU(a, b)representation is given by the expressionx= (1/2b)N 1 n=02nxnwherexnrepresents bitnofx. The range of aU(a, b)representation is from 0 to(2N 1)/2b= 2a 2 example, the 8-bit unsigned Fixed-Point rational representationU(6,2)has the 1b 2,where bitbkhas a weight of2k. Note that sinceb= 2the binary point is to the right of the second bit from the right(counting from zero), and thus the number has six integer bits and two fractional bits. This representation has a rangeof from 0 to26 2 2= 64 1/4 = 63 3 Signal LabsPublic InformationsTechnical ReferenceFixed-Point arithmetic : An Introduction5 (13) YatesAugust 23, 2007 11:05PA5 unsigned integer representation can be viewed as a special case of the unsigned Fixed-Point rational representationwhereb= 0.

9 Specifically, an N-bit unsigned integer is identical to aU(N,0)unsigned Fixed-Point rational. Thus therange of an N-bit unsigned integer is0 U(N,0) 2N it has N integer bits and 0 fractional bits. The unsigned integer representation is sometimes referred to as naturalbinary. (6,2). This number has6 + 2 = 8bits and the range is from 0 to26 1/22= The value 8Ah (1000,1010b)is(1/22)(21+ 23+ 27) = ( 2,18). This number has 2 + 18 = 16bits and the range is from 0 to2 2 1/218= Thevalue 04 BCh (0000,0100,1011,1100b) is(1/218)(22+ 23+ 24+ 25+ 27+ 210) = 1212/218= (16,0). This number has16 + 0 = 16bits and the range is from 0 to216 1 = 65,535. The value 04 BCh(0000,0100,1011,1100b) is(1/20)(22+ 23+ 24+ 25+ 27+ 210) = 1212/20= The Operations of One s Complement and Two s ComplementConsider an N-bit binary wordxinterpreted as if in the N-bit natural binary representation ( ,U(N,0)).

10 Theone scomplementofxis defined to be an operation that inverts every bit of the original valuex. This can be performedarithmetically in theU(N,0)representation by subtractingxfrom2N 1. That is, if we denote the one s complementofxas x, then x= 2N 1 two s complement ofx, denoted x, is determined by taking the one s complement ofxand then adding one to it: x= x+ 1= 2N x.(1)Examples:1. The one s complement of the U(8,0) number 03h (0000,0011b) is FCh (1111,1100b).2. The two s complement of the U(8,0) number 03h (0000,0011b) is FDh (1111,1101b).4 Signed Two s Complement Fixed-Point RationalsAn N-bit binary word, when interpreted as a signed two s complement Fixed-Point rational, can take on values from asubsetPof the rationals given byP={p/2b| 2N 1 p 2N 1 1, p Z}.Digital Signal LabsPublic InformationsTechnical ReferenceFixed-Point arithmetic : An Introduction6 (13) YatesAugust 23, 2007 11:05PA5 thatPcontains2 Nelements.


Related search queries