Design Automation for Digital Filters 1 FIR System Specification 1-δ 1 Amplitude f 2 Frequency response determined by coefficient quantization δ 2 SNR = 10log E f 1 2 E( yref ) ( y y ) ( ) 2 ref finite Frequency SNR determined by signal precision i.e. quantization noise 1
FIR Fixed-Point Design Problem y N 1 ( n) = b x( n k ) k= 0 k x(n) z -1 z -1 z -1... b 0 b 1 b 2 b N-1 + + + y(n) Choose # of taps N, quantized coefficients b k satisfy frequency response constraints Multiply-add precision and signal wordlengths satisfy SNR and dynamic range constraints Filter Design Flow Filter Specification Matlab (Frequency Response SNR) Filter Design FIR Filter coefficient (Floating point) DSP Canvas Simulation Cost Function C-Code Finite Precision Optimization Scripts (Architecture dependent) Filter Optimization 2
Architecture Cost Example memory () 0 0.75 () 1 y = 0.25x + x x(0) x(1) barrel shifter 0.25x(0) 0.25x(1) 0.5x(1) shift by 12 0.25x(0)+0.5x(1) 0 accumulator register 0.25x(0)+0.75x(1) 0.25x(0)+0.5x(1) Architectural Parameters memory N-1 = # delays barrel shifter M = signal wordlength accumulator register # cycles example 3
Arithmetic Cost Breakdown Cost in number of unit logic cells barrel shifter log 2 M M 2 accumulator register M + 1 2 M 2 Architecture Cost Function fs cycle_count arch_cost= memory_cost + arith_cost cycle_time memory cost degree of parallelism arithmetic cost arithmetic cost arithmetic cost... 4
FIR Optimization Problem δ 2 coefficient w, d, nz accumulator w, d SNR δ 1 # of cycles datapath width memory cost arithmetic cost architecture cost w = word length, d = precision i.e. LSB = 2 -d, nz= non-zero CSD digits Matlab Floating Point Design 5
Matlab Floating Point Design TrueSim Fixed Point Analysis Number of bits of precision, location of binary point 6
Optimization Script Coefficient CSD optimization loop Signal precision optimization loop Coefficient CSD Optimization 7
Coefficient CSD Optimization Optimization Script Coefficient CSD optimization loop Signal precision optimization loop 8
Signal Precision Optimization Signal Precision Optimization 9
Optimization Results for FIR 0 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5-20 -40-60 Reference Optimized Impulse Response (db) -80-100 -120-140 -160-180 Frequency (normalized) Dynamic Range The numbering system used to represent a particular signal is composed of two elements: The dynamic range Specified by the MSB location The resolution Specified by the LSB location 10
2 s Complement Representation This information is represented in DSP Canvas using the <w,d> specification: w is the total number of bits d is the number of bits shifted to the right of the binary point Dynamic range is given by: -2 w-1. 2 -d to (2 w-1-1). 2 -d Resolution: 2 -d Determining w and d The required resolution (d) is a function of the performance requirement of the system, e.g. required SNR. The relationship is (usually) non-analytical and a solution is obtained through iterative simulations as shown in tutorial example 11
Determining w and d The required dynamic range of a signal is a function of the magnitude of the values assigned to the signal. Dynamic range too large: waste, bits not used. Dynamic range too small: severe performance degradation - MSB information lost Can be determined automatically through signal statistics Signal Statistics Collection Note: Collect statistics on floating-point signal - NOT on quantized fixed-point signal. Place filter section in fixed-point partition: 12
Signal Statistics Collection Specify signals to be: Number type: Float Exception/stats Signal statistics Yes Run simulation in mixed float/fixed mode Signal Statistics Results The statistics will be displayed at the end of the simulation: 13
Signal Statistics Details For each signal the following statistics are output: Minimum: lowest value of signal Minimum location: cycle at which value occurred Maximum: largest value of signal Maximum location: cycle at which value occurred Mean: average of signal Variance: variance of signal - 2 nd moment Skewness: 3 rd moment Kurtosis: 4 th moment Suggested Fixed-Point Specifications DSP Canvas Display results Display suggested fixed-point specs Object 100% Coverage 1*sigma 2*sigma 3*sigma FIR.IN unsigned<x,x-1> twos<x,x+3> twos<x,x+2> twos<x,x+2> 0 -> -0.0302585 -> -0.0614935 -> -0.0927286 -> 1 0.0322116 0.0634467 0.0946817 FIR.OUT twos<x,x> twos<x,x+4> twos<x,x+3> twos<x,x+3> -0.0554085 -> -0.0155803 -> -0.0321373 -> -0.0486943 -> 0.300409 0.0175336 0.0340905 0.0506475 FIR(Coeffs) twos<x,x> twos<x,x+3> twos<x,x+2> twos<x,x+1> -0.0554085 -> -0.0420532 -> -0.0939108 -> -0.145768 -> 0.300409 0.061662 0.11352 0.165377 14
Fixed-Point Specifications There are 4 columns of suggested specifications, each column uses a different value of the minimum and maximum of the dynamic range: 100% Coverage: signal minimum signal maximum 1*sigma: mean - sigma mean + sigma 2*sigma: mean - 2sigma mean + 2sigma 3*sigma: mean - 3sigma mean + 3sigma Select spec based on the signal type, e.g.: Pure data, e.g. coefficient 100% coverage Noisy signal, e.g. accumulator 3*sigma coverage Fixed-Point Specifications Numbering system: 2 s complement: if minimum is negative unsigned: if minimum is positive What is the x in the specification? Resolution of signal can not be determined based on signal statistics - only dynamic range. E.g. an 2s<x,x-3> specification indicates a dynamic range: 3 integer bits, i.e. numbers from -4 to +3 (actually to 4-LSB) 15
FIR tutorial System design Filter design ASIC design DSP Canvas Jetstream Matlab/Mathematica TrueSim/SystemSolve TrueSim/SystemSolve TrueSim HDL generation Co-simulation System simulation coefficient optimization Signal precision optimization Dynamic range analysis Design verification 16