DSP Assignment
DSP Assignment
DSP Assignment
ASSIGNMENT 01
SIGN MAGNIYUDE FORM:In sign magnitude representation, the most significant bit is set to 1 to represent the negative sign. As an eg. the decimal number -1.75 is representation as 11.110000 and 1.75 is represent as 01.110000. In sign magnitude form, the no. zero has two representations, i.e. 00.000000 or 10.000000 with b bits only (2b-1) numbers can be represented. ONES-COMPLIMENT FORM In ones-compliment form, the positive no. is represented as in the sign magnitude notations. However the negative no. can be obtained by complimenting all the bits of the positive numbers. Example: -0.875 can be represented as under: (0.875) 10 = (0.111000)2 (-0.875)10 = (1.000111)2 Note that this is the same as subtracting the magnitude from 2-2b, where b is the number of bits (without sign bits) 2-2b = 10.000000-0.000001 = 1.111111 Now subtract 0.875= (0.111000)2
1.111111 0.111000 1.000111 = (-0.875)10 in ones-compliment form In ones- compliment form, the magnitude of the negative no. is given as 1-bi=1 ci2-i 2-b
TWOS COMPLIMENT FORM In twos compliment representation, positive numbers are represented as in sign magnitude form and ones compliment. However, the negative no. can be obtained by complimenting all the bits of the positive no. and adding one to the least significant bit. As an eg. we have (0.875)10 = (0.111000)2
1.000111 + 0.000001 (-0.875)10 = (1.001000)2 This is same as subtracting the magnitude from 2 2.0 = 10.000000 -0.111000 1.001000 = (-0.875)10 in twos compliment form The magnitude of the negative number is given as follows: 1-bi=1ci2-i If the MSB of binary is one then no. is negative. However, if the MSB is zero, no. is positive fraction. So MSB is called sign bit.
TRUNCATION
Truncation is a process of discarding all bits less significant than least significant bits that is retained. Suppose, if we truncated the following binary no. from 8 bit to 4 bits, we obtain 0.00110011 to 0.0011 8 bits 4 bits
When we truncate the number, the signal value is approximated by the highest quantized level which is not greater than signal.
ROUNDING
Rounding of a number of b bits is accomplished by choosing the rounded result as the b bits number closest to the original number unrounded. As an example, 0.11010 rounded to three bits is either 0.110 or 0.111.
Equation (01) holds for both sign magnitude, ones compliment and twos compliment if x> 0. If x<0 we have to find whether the equation (01) holds good for all types of representations. Now let us consider first the twos compliment representation. From equation (01) the magnitude of the negative no. is:
x = 1-
ci2-i
xT x >=0
........... (02)
From the (02), it may be observed that the truncation increase the magnitude, which implies that the error is negative and satisfy the following inequality: 0 xT x -2-b ........... (03)
For ones compliment representation, the magnitude of negative number with b bits is given as: x = 1 - bi=1 ci2-i 2-b when number is truncated to N bits, then we have xT = 1-Ni=1 ci2-i 2-N the change in magnitude due to truncation will be xT x = bi=N ci2-i (2-N 2-b) xT x < 0 Therefore, the magnitude decreases with truncation which implies that error is positive and satisfy the following inequality 0 xT-x < 2-b If x=2c.M then we have XT = 2c.MT Error e = xT-x = 2c (MT-M)
Using equation (03) with twos compliment representation of mantissa, we have 0MT-M>-2-b
................. (04)
now equation can be written as follows: 0 x > -2-b2c 0 2cM > -2-b2c 0 M > -2-b If M= the relative error is maximum. Therefore we have 0 > -2.2-b If M= - the relative error range will be 0 < 2.2-b In ones compliment representation: 0 MT-M > -2-b 0 e > -2-b2c e = 2cM For negative mantissa values error will be 0 MT-M < -2-b 0 e < -2-b2c. If M= - the maximum relative error range will be 0 > 2.2-b Which is the same as positive M.
Using (05) eq. (06) can be written as: (-2c)-2-b/2 xT x 2-b/ 2(2c) (-2c)-2-b/2 x 2-b/ 2(2c) We have x = 2cM Then (-2c)-2-b/2 2cM 2-b/ 2(2c)
Which gives -2-b/2 M 2-b/ 2 The mantissa satisfies M< 1 If M= the maximum range of relative error is : -2-b < 2-b.