FINITE word length effect in fixed point processing

Slides:



Advertisements
Similar presentations
FINITE WORD LENGTH EFFECTS
Advertisements

Programmable FIR Filter Design
Roundoff and truncation errors
2009 Spring Errors & Source of Errors SpringBIL108E Errors in Computing Several causes for malfunction in computer systems. –Hardware fails –Critical.
Fixed Point Numbers The binary integer arithmetic you are used to is known by the more general term of Fixed Point arithmetic. Fixed Point means that we.
CENG536 Computer Engineering department Çankaya University.
Digital Signal Processing – Chapter 11 Introduction to the Design of Discrete Filters Prof. Yasser Mostafa Kadah
1 IEEE Floating Point Revision Guide for Phase Test Week 5.
Assembly Language and Computer Architecture Using C++ and Java
Mark Allie comp.dsp Signal to Noise and Numeric Range issues for Direct Form I & II IIR Filters on Modern Analog Devices and TI Digital Signal Processors.
ELEN 5346/4304 DSP and Filter Design Fall Lecture 12: Number representation and Quantization effects Instructor: Dr. Gleb V. Tcheslavski Contact:
Data Representation – Binary Numbers
Computer Organization and Architecture Computer Arithmetic Chapter 9.
Computer Arithmetic Nizamettin AYDIN
Number Systems Part 2 Numerical Overflow Right and Left Shifts Storage Methods Subtraction Ranges.
Fixed-Point Arithmetics: Part II
FINITE word length effect in fixed point processing The Digital Signal Processors have finite width of the data bus. The word-length after mathematical.
ECEG-3202: Computer Architecture and Organization, Dept of ECE, AAU 1 Floating-Point Arithmetic Operations.
1 EENG 2710 Chapter 1 Number Systems and Codes. 2 Chapter 1 Homework 1.1c, 1.2c, 1.3c, 1.4e, 1.5e, 1.6c, 1.7e, 1.8a, 1.9a, 1.10b, 1.13a, 1.19.
Round-off Errors and Computer Arithmetic. The arithmetic performed by a calculator or computer is different from the arithmetic in algebra and calculus.
Topic 1 – Number Systems. What is a Number System? A number system consists of an ordered set of symbols (digits) with relations defined for addition,
Ch.5 Fixed-Point vs. Floating Point. 5.1 Q-format Number Representation on Fixed-Point DSPs 2’s Complement Number –B = b N-1 …b 1 b 0 –Decimal Value D.
Computer Arithmetic Floating Point. We need a way to represent –numbers with fractions, e.g., –very small numbers, e.g., –very large.
Finite Precision Numerical Effects
DEPARTMENTT OF ECE TECHNICAL QUIZ-1 AY Sub Code/Name: EC6502/Principles of digital Signal Processing Topic: Unit 1 & Unit 3 Sem/year: V/III.
Floating Point Arithmetic – Part I
Chapter 9 Computer Arithmetic
FINITE word length effect in fixed point processing
William Stallings Computer Organization and Architecture 8th Edition
MATH Lesson 2 Binary arithmetic.
CHAPTER 5: Representing Numerical Data
Floating Point Representations
Department of Computer Science Georgia State University
Unit IV Finite Word Length Effects
Real time DSP Professors: Eng. Diego Barral Mr. Jerónimo Acencio
Digital Logic & Design Dr. Waseem Ikram Lecture 02.
Integer Division.
EEE4176 Applications of Digital Signal Processing
Sampling rate conversion by a rational factor
William Stallings Computer Organization and Architecture 7th Edition
Chapter 6 Floating Point
Outline Introduction Floating Point Arithmetic Adder Multiplier.
IT 0213: INTRODUCTION TO COMPUTER ARCHITECTURE
Errors in Numerical Methods
Data Representation Data Types Complements Fixed Point Representation
Errors in Numerical Methods
Digital Logic & Design Lecture 03.
Quantization in Implementing Systems
Digital Logic & Design Lecture 02.
Approximations and Round-Off Errors Chapter 3
ECEG-3202 Computer Architecture and Organization
Computer Architecture
DEPARTMENT OF INFORMATION TECHNOLOGY DIGITAL SIGNAL PROCESSING UNIT 4
DEPARTMENT OF INFORMATION TECHNOLOGY DIGITAL SIGNAL PROCESSING UNIT 4
Floating Point Numbers
Fixed-point Analysis of Digital Filters
Chapter3 Fixed Point Representation
Presentation transcript:

FINITE word length effect in fixed point processing The Digital Signal Processors have finite width of the data bus. The word-length after mathematical operations, if exceeds the bus width, will have to be omitted. This is the source of Serious Errors. We now discuss attributes that cause such errors.

Causes of word length error The different causes of the errors are: Run time error or, Register Over-flow, Arithmetic & coefficient truncation Data scaling in an attempt to reduce overflow. Zero-input limit cycling.

Fixed point design procedure Ideal floating point Floating Point To Fixed pt Realizable Filter Test & Evaluate Fail !!! causes OPTIONS Pass: Luck 1.Register over flow 2.Coefficient errors 3. Arithmetic Errors. 1, adjust binary point 2. Change architecture 3.Scale Parameters

Run time / over flow error: Definition The input data begins with sign bit followed by MSB to LSB extending to mantissa. When the input data length is larger than the bus width, the sign bit followed by MSB bits etc. overflows the register on sign bit side. Since the significant part is over-flown which causes the “remain” in the register useless.

Solution for Run time / over flow error: For fixed point format, we should prefer the subtraction by of 2’s complement. Here the effect of overflow is least significant. Once the sign bit enters the overflow point of the accumulator and overflow likely detected, a Flag is activated that will clamp the input to the data bus by stopping less significant bits entering. Inaccuracy incurs due to loss of data after clamping. Clamping is saturation.

Scaling to reduce overflow.. Here we scale the input to reduce its dynamic range. It is at the cost of performance of the system. The methods to scale are: RMS scaling: preferred Absolute scaling

Arithmetic truncation Errors When two inputs of length N are multiplied, the net word length can increase to 2N. 2N bit is rounding off to S(<2N) bits. These S bits are added with another S bits and the result is say, T bits. The contents are again rounded off to S bits and fed to accumulator. The output is truncated to M bits, the bus width. These multiple rounding-offs causes additive errors. If M<T< 2N, may cause an arithmetic error. Generally for N=16, 2x16 bit multiplication results in maximum 32 bits while the accumulator has a width of 40 bits.

Implementation of First Order Recursive Filter. Coefficient MULTIPLIER N BIT COEFFICIENT STORAGE REGISTER Adder INPUT xK Output yk= Ayk-1+xk N bit Output Storage register yk-1 Ayk-1 Implementation of First Order Recursive Filter.

Multiply accumulate :MAC unit N-bit i/p 2N bit r/o to s bits   S-bits T- to S- bit r/o S- to M-bit r/o output S-bit Accumulator r/o round off M bit bus

Coefficient Quantization A transfer function is represented by a ratio of Numerator and Denominator polynomials. The binary version of coefficients are not compatible with the data bus width. Requires quantization/truncation. The coefficients of the denominator may be sensitive to instability. Selecting suitable structures may reduce the sensitivity.

Limit Cycling In IIR filters, even though the present input is zero, the output may reveal some undesirable variations due to past signal. It is caused when the response of an unforced LTI system does not decays down to zero in stipulated time. Larger the size of data bus, smaller is the effect of limit cycling.

Methods to control the errors: Scale the input and/or coefficients. Increase the word length and Select an alternative DSP architecture.

Example:1 The binary version of filter coefficients after arithmetical calculations can come out to be non-compatible with the length of data bus. For a data bus of width n, the actual word length of data may be larger. We need to truncate it. Example: H(z) = 1/[1+az-1+b] where a = -1.957 558 and b = 0.995 813.

Truncation contd: Let the bus width be n=8. One bit for sign is dedicated. Balance are 7 bits. If the exponent a > 1; here one bit for exponent has to be spared. Balance are (n-2) =6 bits for mantissa. Round-off of quantization coefficient is to be used. For fixed point data processing:

The result is added by 0.5, when ‘round-off’ is desired. Manipulation: The result is added by 0.5, when ‘round-off’ is desired. For bottom or floor, zero is added. For top or ceiling 1.0 is added.

For fixed point data processing: CASE-1 when the coefficient has an integer before decimal. a = -1.957 558 This ‘a’ is multiplied by 2(n-2) = 64 to yield 125.283712. Add 0.5 for round-off: 125.783712 We obtain its binary equivalent truncated to 8 bits including sign bit. This amounts to 10000011= -125.

Case-1… In practice, we need not convert it in binary. We take integer number and forgo mantissa. We now convert -125 back into the coefficient level by dividing by 26 = 64. The resulting quantized coefficient is a~ = -125/64= -1.953125.

For fixed point data processing: CASE-2: when the coefficient is Mantissa. b=0.995 813. This b is multiplied by (2n-1-1). Given b=0.995 813 multiplied by 27-1 = 127, the result = 126.468 251. For round off add 0.5 : 126.96851. 126.96851. when converted in binary and truncated, becomes 0111 1110. It is 126 when taken in decimal. The step is 126. This can be directly taken from 126.468251 by eliminating mantissa.. To reduce to coefficient size,126 is divided by 27=128. The truncated coefficient b is 0.984375.

Final Solution and comments The quantized transfer function is: H’(z) = 1/[1+a’z-1+b’] where a’ = -1.953 125 and b’ = 0,984375. Check it for stability. Try Matlab function: beq = a2dR(d,n) and beq = a2dT(d,n). These function should generate the decimal equivalent of the binary representation/decimal representation in sign-magnitude form of a decimal number with a specified number of bits for the fractional part obtained by rounding off.

Example:02 A Digital Signal Processor takes a word length of 7 bit and 1 sign bit. A set of coefficients have been calculated and tabulated as follows. Quantize the coefficients and find out the values the DSP will accepts in place of the calculated coefficients.

Soln:02 The number of bits excluding sign bit are 7. When treating integer + decimal, the total number of effective bits will be 6. When treating no integer and only decimal, the total number of effective bits will be 7. ADC being successive approximation, flooring scheme is applicable. Hence 0.5 is not added.

Soln_2…. 0.7252 x(27-1) = 92.1004 92: 92/128 = 0.71875 1.1111x(26)= 71.1104  71: 71/64 = 1.1093751. 0.5920X(27 -1) = 75.18475: 75/128=0.5859375 3.1993x26 = 204.7552 204: 204/64 = 3.1875 5.5555x26= 355.5552  355: 355/64 = 5.546875

Results in Tabular Form

Example:03 A filter function is represented by the polynomial: H[z] = 1/ [1 + 1.19z-1 + 0.198 z-2]. The poles are at 0.99 and 0.20. The system is unconditionally stable. The coefficients are quantized by a 6 bit uni-polar round-off quantizer. Whether the system remains stable?

Soln:03 (A)1.19: number of bits for effecting the unipolar bits are 6 that exclude sign bit. Hence 6 –1(integer)=5. 1.19x 25 =38.09  38: 38/25 = 1.1875. (B)0.198: number of bits effecting the unipolar bits are 6 excluding the sign bit. 0.198x(26 -1)+0.5 =12.974  12/26 = 0.1875. The TF becomes: H~(z) = 1/(1+1.1875z-1+ 0.1875z-2 ] TF is marginally stable as roots are[ 1, 0.1875]

Effect of quantization on performance Problem:4 A band-pass digital filter to be used for digital clock recovery at 4.8 kbaud and a sampling frequency of 153.6 kHz. The filter is characterized by H(z) = 1/[1–1.957558z-1 + 0.995913 z-2]. Assess the effect of 8 bit quantization on the (a) pole location of the filter and (b) it’s center frequency.

Soln_4: Given that the TF is a normalized 2nd BPF. The poles are therefore complex conjugate. For the sake of simplicity we represent the TF = 1/[1+az-1+bz-2] Here a = -1.957558 and b = 0.995913. Sampling frequency given is fs = 153.6 kHz. The polar distance p of the pole (magnitude) from the origin =b and is calculated to be p = 0.99795. Its angle  with respect to positive x-axis:   = cos-1{(-1.957558/2)/(0.99795)} = 11.25. Thus the location of poles are 0.99795   11.25

Soln: 4…. The least count per degree of the angle is 153.6 /360 = 0.426666 kHz. The value of 11.25; the un-quantized center frequency is 11.25 x 0.426666 = 4.799999 kHz. While quantization to 8 bits, 1 bit is sign bit. So the effective number of bits are 7 only. The rule is: effective bits will be 6 for integer + fractions, for fraction, the effective bits will be 7.

Soln.4…..; Case 1 : Quantization of a =-1.957558. Keeping apart the sign, it contains an integer. Therefore 1.957558 x 26 = 125.283712 125 It’s quantized equivalent is 125/26 = 1.953125. Case 2: Quantization of b = 0.995913. It’s equivalent integer is 0.995913x(27-1) = 126.480951126 The resulting output is 126/27 = 0.984375.

Soln 4….. The new value of p =0.984375 = 0.992156  = cos-1{(-1.953125/(2 x 0.992156)} = 10.17 The LC per degree of the angle is 0.426666 kHz. The new center frequency is 10.17 x 0.426666 = 4.3399 kHz. Location of quantized poles are 0.992156  10.17