Professional Documents
Culture Documents
Chapter 3
Chapter 3
Fixed-point Arithmetic
Lecture 3
Dr. Shoab A.
Contents
Floating and Fixed Point Arithmetic
System Design Flow
Requirements and Specifications (R&S)
Coding
Guidelines
2’s Complement Arithmetic
Floating Point Format
Qn.m format for Fixed Point Arithmetic
Addition, Multiplication and Scaling in Qn.m
LTI systems and implementation in Qn.m format
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 2
Khan
Floating & Fixed Point Arithmetic
Two Types of arithmetic
Floating Point Arithmetic
S/W or H/W
S/W H/W
Partition
Fixed Point
Conversion
Fixed Point
Implementatio Functional
S/W or H/W RTL Verilog
Verifiction
n S/W Co-verification Implementation
Synthesis
Timing &
Functional
Verification
System
Layout
Integration
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 4
Khan
System Design Flow
The requirements and specifications of the application are captured
The algorithms are then developed in double precision floating point format
Matlab or C/C++
A signal processing system general consists of hybrid target technologies
DSPs, FPGAs, ASICs
For mapping application developed in double precision is partitioned into
hardware & software
Most of signal processing applications are mapped on Fixed-point Digital
Signal Processors or HW in ASICs or FPGAs
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 5
Khan
1st Step: Requirement & Specification
Characteristics Specification
Gathering R&S is
Output power 2W
the first part of the
system design Spurious emission < 60 dB
Harmonic > 55
System components
and algorithms are dB suppression
Frequency 2 ppm or better
then selected that
stability
meets the
requirements Reliability > 10,000 hours MTBF minimum
Example R&S of a
Handheld
b A. Khan 12V DC nickel metal hydride, nickel
6
Frequency hopping > 600 hops/s, frequency hopping on full hopping band
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 7
Khan
Next Step: Algorithm Development and
Mapping
The R&S related to digital design are forwarded to algorithm
developers and system designers
Algorithms are coded in behavioral modeling tools like Matlab
The Matlab code is then translated into a high level language,
for example, C/C++
System is designed based on R&S
System usually consists of hybrid technologies consisting
of ASICs, DSPs, GPP, and FPGAs
Partitioning of the application into HW/SW parts is
performed
The SW is then developed for the SW part and architectures
are designed and implemented for the HW parts
Integration and testing is performed throughout the design
cycle
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 8
Khan
Guidelines for Coding Algorithms in Matlab
Signal processing applications are mostly developed in Matlab
As the Matlab code is to be mapped in HW and SW so adhering to coding
guidelines is critical
The code must be designed to work for processing of data in chunks
The code should be structured in distinct components
• Well defined interfaces in terms of input and output arguments and
internal data storages
All variables and constants should be defined in data structures
• User defined configurations in one structure
• System design constants in another structure
• Internal states for each block in another structure
Initialization in the start of simulation
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 9
Khan
Processing in Chunks
% BPSK = 1, QPSK = 2, 8PSK = 3, 16QAM = 4
% All-user defined parameters are set in structure USER_PARAMS
USER_PARAMS.MOD_SCH = 2; %select QPSK for current simulation
USER_PARAMS.CHUNK_SZ = 256; %set buffer size
USER_PARAMS.NO_CHUNKS = 100;% set no of chunks for simulation
% generate raw data for simulation
raw_data = randint(1,
USER_PARAMS.NO_CHUNKS*USER_PARAMS.CHUNK_SZ)
% Initialize user defined, system defined parameters and states
PARAMS = MOD_Params_Init(USER_PARAMS);
STATES = MOD_States_Init(PARAMS);
mod_out = [];
% Code should be structured to process data on chunk-by-chunk
basis
for iter = 0:USER_PARAMS.NO_CHUNKS-1
in_data = raw_data
(iter*USER_PARAMS.CHUNK_SZ+1:USER_PARAMS.CHUNK_SZ*(iter+1));
[out_sig,STATES]= Modulator(in_data,PARAMS,STATES);
mod_out = [mod_out out_sig];
end Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 10
Khan
Parameters & Initialization
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. Khan 11
% Initializing the user defined parameters and system design parameters in PARAMS
function PARAMS = MOD_Params_Init(USER_PARAMS)
% Structure for transmitter parameters
PARAMS.MOD_SCH = USER_PARAMS.MOD_SCH;
PARAMS.SPS = 4; % Sample per symbol
% Create a root raised cosine pulse-
shaping filter
PARAMS.Nyquist_filter = rcosfir(.5 ,
5, PARAMS.SPS, 1);
% Bits per symbol, in this case bits per symbols is same as mod scheme
PARAMS.BPS
BPSK_Table =
= USER_PARAMS.MOD_SCH;
[(-1 + 0*j) (1 + 0*j)];
% Lookup tables
QPSK_Table for BPSK,
= [(-.707 QPSK, (-.707
- .707*j) 8-PSK and 16-QAM(.707
+ .707*j) using-gray coding
.707*j) (.707 + .707*j)];
PSK8_Table = [(1 + 0j) (.7071 + .7071i) (-.7071 + .7071i) (0 + i)...
(-1 + 0i) (-.7071 - .7071i) (.7071 - .7071i) (0 - 1i)];
QAM_Table = [(-3 + -3*j) (-3 + -1*j) (-3 + 3*j) (-3 + 1*j) (-1 + -3*j)...
(-1 + -1*j) (-1 + 3*j) (-1 + 1*j) (3 + -3*j) (3 + -1*j)...
(3 + 3*j) (3 + 1*j) (1 + -3*j) (1 + -1*j) (1 + 3*j) (1 + 1*j)];
% Constellation selection according to bits per symbol
if(PARAMS.BPS == 1)
PARAMS.const_Table = BPSK_Table;
elseif(PARAMS.BPS == 2)
PARAMS.const_Table = QPSK_Table;
elseif(PARAMS.BPS == 3)
PARAMS.const_Table = PSK8_Table;
elseif(PARAMS.BPS == 4)
PARAMS.const_Tab QAM_Table;
le =
else constellation size not supported’)
error(‘ERROR!!!
States & Initializations
function STATES =
MOD_States_Init(PARAMS)
% Pulse shaping filter delayline
STATES.filter_delayline =
zeros(1,length(PARAMS.Nyquist_filter)-1);
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 12
Khan
Chunk by chunk processing
Digital
Signal
Processors
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 15
Khan
Representation of Numbers
sign magnitude
two’s complement
Numbers
Positive Negative
Number Number
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 17
Khan
2’s Complement Arithmetic
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 18
Khan
Example
23 22 21 20
-8 + 2 + 1 = -5
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 19
Khan
Equivalent Representation
Many design tools do not display numbers as 2’s complement signed numbers
A signed number is represented as an equivalent unsigned number
Equivalent unsigned value of an N-bit negative number is
2N - |a|
Example
for -5 =
1011
N=
4
a=-5
24 -
|-5|
= 16
– 5=
+11
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 20
Khan
Four-bit representation of two’s complement and equivalent unsigned numbers
Decimal Two′s complement representation Equivalent unsigned
number number
–23 22 21 20
0 0 0 0 0 0
+1 0 0 0 1 1
+2 0 0 1 0 2
+3 0 0 1 1 3
+4 0 1 0 0 4
+5 0 1 0 1 5
+6 0 1 1 0 6
+7 0 1 1 1 7
–8 1 0 0 0 8
–7 1 0 0 1 9
–6 1 0 1 0 10
–5 1 0 1 1 11
–4 1 1 0 0 12
–3 1 1 0 1 13
–2 1 1 1 0 14
Digital Design of Signal Processing
Sys 21
tems, John Wiley & Sons by Dr. Shoab A.
–1 Khan 1 1 1 1 15
Computing Two’s Complement of a Signed
Number
Refers to the negative of a number
Computes by inverting all bits and adding 1 to the least
significant bit (LSB) of the number
This is equivalent to inverting all the bits while moving
from LSB to MSB and leaving the least significant 1 as it
is
From the hardware perspective, adding 1 requires an
adder in the HW and is an expensive preposition
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 22
Khan
Scaling and sign extension
0s
• The number unsigned value remains the same
Negative number: M-N extended bits are filled with
1s,
• Signed value remains the same
• Equivalent unsigned value is changed
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 25
Khan
Floating Point Format
x ( 1) s 1 m
2e b
s represents sign of the number
m is a fraction number >1 and < 2
e is a biased exponent, always positive
• The bias b is subtracted to get the actual exponent
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 26
Khan
IEEE floating point format for single precision 32-
bit floating point number
s e m
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 27
Khan
Example Floating Point Representation
0 10000010 11010000_00000000_0000000
(–1)0 × (1 . 1 1 0 1)2
× 2(130-127)
(+1) × (1.8125)10
× 2(3)
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 28
Khan
Floating-point Arithmetic Addition
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 29
Khan
Example: Floating-point Addition
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 30
Khan
Floating-point Multiplication
S0: Add the two exponents e1 and e2 and subtract the bias
once
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 31
Khan
Fixed-point format
Algorithms in double precision Floating-
point format are converted into Fixed-Point
format for mapping on low cost DSPs and
Application Specific HW designs
32
Qn.m Format for Fixed-point Arithmetic
-21 .
0
2 2-1 2-2 2-3 2-4 2-5 2-6 2-7
Sign Bit
Fraction Bits
Integer Bit
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 33
Khan
Qn.m Positive Number
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 34
Khan
Conversion to Qn.m
(assume 10 bits)
Fractional bits
Sign bit
Integer bit
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 35
Khan
Example
-21 .
20 2-1 2-2 2-3 2-4 2-5 2-6 2-7
01 1101 0000
Sign Bit
Fraction Bits
Integer Bit
In Q2.8 format, the number is :
0x1D0
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 37
Khan
Fixed-point numbers in COTS DSPs
Commercially available off the shelf processors usually
have16 bits to represent a number
In C, a programmer can define 8, 16 or 32 bit numbers as
char, short and int/long respectively
In case a variable requires different precision than what can
be defined in C, the number is defined in higher precision
For example an 18-bit number should be defined as a 32-bits
integer
High precision arithmetic is performed using low precision
arithmetic operations
32-bit addition requires two 16-bit addition
32-bit multiplication requires four 16-bit multiplications
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 38
Khan
Floating Point to Fixed Point Conversion
Serialize the floating-point code to separate all atomic
computations and assignments to variables
Insert range directives after each serial floating-point computation
Runs the serialized implementation with range directives for all
set of possible inputs
Convert all floating point varilables to fixed point format using
the maximum and minimum values for each variable
The integer part for vari is defined as
Floating-Point Algorithm
Range Estimation
Integer part determination
Fixed-Point Algorithm
HW-SW Implementation
Observe
ranges of
values for all
variable
Ranges
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 43
Khan
Matlab Supports Fixed Point Arithmetic
All the attributes of fixed point variable can be
set for fixed point arithmetic
These attributes are shown here
PI =
3.1563 Data
DataType: Fixed
Scaling: Binary Point
Numeric Type
Signed: true
WordLength: 8
FractionLength: 5
RoundMode: round
OverflowMode: saturate Fixed-point
ProductMode: Full Precision math
MaxProductWordLength: 128
SumMode: Full Precision
MaxSumWordLength: 128
CastBeforeSum: true
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 44
Khan
Conversion using C Program
num_fixed_long = (long)(num_float * 215 )
if (num_fixed_long > 0x7fff)
num_fixed_long = 0x7fff
elseif (num_fixed_long <
0xffff8000) num_fixed_long
=0xffff8000
num_fixed_Q15 = (short)
(num_fixed_long & 0xffff)
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 46
Khan
SystemC supports Fixed-point
int sc_main (int argc , char *argv[])
{
sc_fixed <16,10, SC_TRN, SC_SAT> fx_value;
double fp_value;
int i, size;
ofstream fout("fx_file.txt");
ifstream fin("fp_file.txt");
if (fin.is_open())
fin >> size;
else
cout << "Error opening input file!\n";
cout << "size = " << size << endl;
for (i=0; i<size; i++)
{
if (!fin.eof())
{
fin >>
fp_value; fx_value =
fp_value;
cout << "double = " << fp_value"\t fixpt =
"<<fx_value<<endl;
fout << fx_value<< endl;
}
}
}
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 47
Khan
Arithmetic: Addition in Q Format
Example
implied decimal
Qn1.m 1 1 1 1 1 0 = Q4. = -2+1+0.5 = -0.5
1 2
Qn2.m 0 1 1 1 0 1 1 0 = Q4. = 1+2+4+025+0.125 =
2 4 7.375
Qn.m 0 1 1 0 1 1 1 0 = Q4. = 2+4+0.5+0.25+0.125
4 =6.875
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 48
Khan
Multiplication in Q Format
= Q (n1+n2) . (m1+m2)
Q n1.m1 X Q n2.m2
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 50
Khan
Unsigned by Unsigned
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 51
Khan
Signed by Unsigned
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 52
Khan
Unsigned by Signed
The unsigned multiplicand is changed to a signed positive
number
its 2’s complement is computed if the signed number is
negative
The last product is a signed number
1 0 0 1 = 10.01 in Q2.2 = 2.25 (unsigned)
1 1 0 1 = 11.01 in Q2.2 = -0.75 (signed)
1 0 0 1
0 0 0 0 X
1 0 0 1 X X
1 0 1 1 1 X X X 2’s compliment of the positive multiplicand 01001
1 1 1 0 0 1 0 1 = 1110.0101 in Q4.4 i.e.-1.6875
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 53
Khan
Signed by Signed
Sign extend all partial products
Q( n1 + n2 – 1) . ( m1 + m2 + 1 )
1 1 0 = Q1.2 = -0.5 (signed)
0 1 0 = Q1.2 = 0.5 (signed)
0 0 0 0 0 0
1 1 1 1 0 X
0 0 0 0 X X
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 55
Khan
Corner Case:
Signed-Signed Fractional Multiplication
0 0 0 0 0 0
0 0 0 0 0 2’s Compliment
X
0 1 0 0 X
X
0 1 0 0 0 0 Dropping redundant sign bit
results 1000000 = -1 in Q1.5
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 56
Khan
Fixed Point Multiplication
Word32 L_mult(Word16 var1,Word16 var2)
{
Word32 L_var_out;
return(L_var_out)
;
} Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 57
Khan
Fractional and Integer Arithmetic and
truncation
4-bit Integer Q1.3 Fractional Arithmetic
Arithmetic 1.001 =-
1001 = -710 0.87510
0111 = +710 0.111 = 0.87510
11111001 11.111001
1111001X 11.11001X
111001XX 11.1001XX
11001111 = -4910 11.001111 =-
11001111 1111 0.76562510
11.001111 Q1.3 format
-
1(overflow) 1.001 = -0.87510
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 58
Khan
Unified Multiplier
The multiplier a
0
a[15]
0
b
b[15]
supports integer
and fractional Signed/
Mux Mux
Signed/
multiplication Unsigned
Op1
Unsigned
1 16 Op2 1 16
All types of
operands 17 17
Unsigned 0
17 * 17 Multiplier Signed 1
SxS, SxU, UxS, 34 P
Integer
Fractional 1
0
UxU [31:0]
P P[30:0],1'b0
Checks the corner Mux AND
Integer/Fractional
Signed/Unsigned Op1
case of fractional 32
Signed/Unsigned Op2
multiplication
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 59
Khan
Bit Growth in Fixed-point Arithmetic
y[n ]= ay[n-1]+x[n]
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 60
Khan
Bit Growth in Q-format arithmetic
Multiplication of two N1 and N2 bit numbers in Qn1.m1 and
Qn2.m2 results in N1+N2 bit number
Q(n1+n2-1).(m1+m2+1) for SxS and Q(n1+n2).(m1+m2) for
the rest
Where as addition results is
Qn.m= Q max(n1,n2).max(m1.m2)
For LTI system Schwarz’s inequality is used for estimating the bit
growth
yn n x2 n
h2
n n
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 61
Khan
Truncation
In multiplication of two Q format numbers as the
number of bits in the product increases
We sacrifice precision by throwing some low precision
bits of the product
Qn1.m1 is truncated to Qn1.m2 where m2 < m1
Let the product is
8’b01110110 (Q4.4)
4 + 2 + 1 + 0.25 + 0.125 = 7.375
Truncate it to Q4.2 results
6’b011101 = 7.25
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 62
Khan
Rounding with
Truncation
Sometimes we truncate with rounding
Example
3.726 can be rounded off to 3.73
We do similar things in Digital Design that is “First Round off
then Truncate”
Before rounding add 1 to the right side of the truncation point and
then truncate
truncation point
0 1 1 1_0 1 1 1 in Q4.4 is 7.4375
1
0 1 1 1_1 0 0 1
0 1 1 1_1 0 = 7.5 Q4.2 format
add 1 for rounding
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 63
Khan
Equivalent Q formats
In many cases Q format of a number is to be
changed
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 64
Khan
Example
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 65
Khan
Overflow introduces an error equal to the dynamic range of
the number
Q(x)
overflow
overflow 3 011
2 010
1 001
000 x
-4 -3 -2 -1 1 2 3 4 5 6 7
111 111
-1
110 110
-2
101 101
-3
100 100
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 66
Khan
Saturation clamps the value to a maximum positive or
minimum negative level
Q(x)
011
3
2 010
saturation
1 001
000 x
-4 -3 -2 -1 1 2 3
111
-1
110
-2
101
-3
100
saturation
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 67
Khan
Overflow and Saturation
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 68
Khan
2’s Complem ent Interme diate Ove rflow
Property
In an iterative calculation using 2’s complement arithmetic if it is
guaranteed that the final result will be within precision bound of
assigned fixed-point format then any number of intermediate overflows
will not affect the final answer.
1.75 Q2.2 0111 2.50
+1.25 Q2.2 0101 3.50 intermediate overflow
69
Adv Digital design
70
Example use of Intermediate Overflow
property:
CIC Filter
The transfer function of a CIC filter
is:
M
L
D 1 z
H (z) 2 L
1 z
For signed Qn.m input, the output fits in Qn.m format
provided
each input sample is scaled by D, where:
D 1
2 ( )M
L
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 71
Khan
An Mth-order CIC filter for decimating a
signal by a factor of L (here,
M=3)
+ + + ↓L + + +
fs 2-D fs/L
- - -
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 72
Khan
Bit Growth in Q-format arithmetic
yn 2 n 2 n
h x
n n
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 73
Khan
FIR Filter Example
For Q1.m format inputs the outputs will mostly fit in Q1.15 if
the design can guarantee that the sum of all the coefficients of
an FIR filter is 1; that is:
L 1
h n 1
n 0
>> sum(fir1(20,.1))
ans = 1.0000
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 74
Khan
Block Floating Point
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 75
Khan
Block Floating Point
x[n]
……..
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 76
Khan
Example: Block Floating Point in FFT
e=2 e=2-2=0
0
0000_0000_1001 0000_0010 WN 00111001 0000_1110
x[5]
-1 0
WN
0000_1101_1001 0011_0110 01111010 0001_1111
x[3]
-1
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 77
Khan
Filter Structures: DF-I and DF-
II
Many ways to implement an IIR filter with
N
b
Y k 0 kz
k
H
(z)
X M
(z) 1 a k
(z) k kz
1
N M
yn bk x n k ak y n k
k 0 k 1
z-1 z-1
a2 z-1 b2
x[n- x[n-
2] 2]
bM- aN-1
1 aN-1 bN-1
-1 -1
z z
-1
x[n- y[n-N] z
bM aN aN bN
M]
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 79
Khan
TDF-II
Transposed Direct
Form-II is another b0 w[n]
implementation that x[n] y[n]
coefficient
quantization
-1
bM z aN
A filter designed
using double
precision may get
unstable after
quantization
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 80
Khan
Direct Fixed-point Implementation
A double 1
Unquantize coeff
1
24-bit quantize coeff
precision
Imaginary Part
Imaginary Part
0.5 0.5
filter
oncegets unstable
quantized to 0 0
-1
-0.5
-1
precision -1 -0.5 0 0.5
Real Part
1 -1 -0.5 0 0.5
Real Part
1
Each
16-bit quantize coeff 12-bit quantize coeff
1 1
coefficient
Imaginary Part
Imaginary Part
0.5 0.5
quantization 0
-0.5
0
-0.5
effects
Some of allthe
poles
poles -1 -1
-1 0 1 -1 0 1
may move outside Real Part Real Part
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 81
Khan
Second Order Cascaded Sections
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 82
Khan
Parallel Implementation
A parallel form also provides
same
benefits relating to stability C0
w1[n] b01 y1[n]
x[n]
a1
z-1 b11
1
a2
z-1
1
a1
z-1 b12
2
a2
z-1
2
x[n]
a1
z-1 b13
3
a2
z-1
3
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 83
Khan
Second Order Sections
1st Section in Q2.10 2nd Section in Q2.10
0.5 0.5
is designed using 2nd
Imaginary Part
Imaginary Part
0 0
order section -
0.5
-
0.5
-1 -1
0.5 0.5
Imaginary Part
Imaginary Part
24-bit precision 0 0
precision
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 84
Khan
Matlab FDA Tool Box
Matlab FDA tool box can be used to design and
analyze floating and fixed point fitler
The tool can used to port the coefficients in
Matlab
workspace, C/C++ header file or Verilog file
The tool also generates fully parallel implementation in Verilog
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 85
Khan
Folded Structures
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 86
Khan
Contd…
x[n]
z-1
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 87
Khan
Summary
Capturing Requirements & Specifications is the first step in system design
A digital system usually consists of hybrid technologies and uses
GPP, DSPs, FPGAs and ASICs
The algorithms are developed in double precision floating point format
Floating point HW and DSPs are expensive, for DSP applications
Fixed
point arithmetic is preferred
The floating point code is converted to fixed point format and all variables
are defined as Qn.m format numbers
The fixed point arithmetic results in bit growth, the results from arithmetic
computations
In are rounded and truncated
IIR filter implementation order and Parallel forms minimizes
2nd
coefficient quantization
Implementation of LP FIR should use symmetry and anti-
symmetry of
coefficients
Block floating point can improve the precision for block processing of data
Digital Design of Signal Processing Systems, John Wiley & Sons by Dr. Shoab A. 88
Khan