1 / 19

DISP 2003 Lecture 5 – P art 2

DISP 2003 Lecture 5 – P art 2. Digital Filters 2 Implementation of FIR Filters IIR Filters Properties, Design and Implementation. Philippe Baudrenghien, AB-RF. Basic Structure for FIR. Tapped-delay line (N-1) delays N multipliers 1 adder (N inputs). Structure for symmetric FIR.

Télécharger la présentation

DISP 2003 Lecture 5 – P art 2

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. DISP 2003Lecture 5 – Part 2 Digital Filters 2 Implementation of FIR Filters IIR Filters Properties, Design and Implementation Philippe Baudrenghien, AB-RF

  2. Basic Structure for FIR • Tapped-delay line (N-1) delays • N multipliers • 1 adder (N inputs) P Baudrenghien AB/RF

  3. Structure for symmetric FIR • Tapped-delay line (N-1) delays • (N+1)/2 multipliers • (N-1)/2 adders (2 inputs) • 1 adder (N+1)/2 inputs We save on multipliers (~50 %) P Baudrenghien AB/RF

  4. An hardware example: LF3320 (1) 83 MSPS introduced in 1998 Used in the Feed-forward and Feed-back on the SPS 200 MHz cavities and in the SPS longitudinal damper. P Baudrenghien AB/RF

  5. An hardware example: LF3320 (2) 12 bits Data in Delay line out for cascading 12 bits Coefficients 2x8 coeff. -> 16 (32) taps (x 256) 23 bits at multiplier output 32 bits after overall sum • Rounding • Limit • Select 16 bits output P Baudrenghien AB/RF

  6. Better hardware under development … 165 MSPS not available yet … P Baudrenghien AB/RF

  7. How about FPGA (CPLD) ? introduced in 2002 >200 MSPS! Used in the SPS transverse damper.Foreseen in the SNS and LHC Low Level RF. P Baudrenghien AB/RF

  8. IIR Design based on pole-zero plot • Idea: Deduce the location of the poles and zeros from the desired frequency response. • Example 3: Comb Filter • want periodic resonances at 0, W0, 2 W0, …, (N-1) W0 • realized by a series of equispaced poles, on a circle of radius r, and at angles 0, 2p W0,,4p W0, ,…, 2p (N-1) W0 P Baudrenghien AB/RF

  9. Comb Filter used in accelerators (1) • Transfer function (assuming that N.W0= 1 ) • Poles • Difference equation: y(n) = a y(n-N) + x(n) • Let W0 = 1/N = Frev/Fs with Frev the accelerator revolution frequency -> Periodic Band-pass filter with Pass bands at multiple of the revolution frequency and Stop bands in between Widely used in Low Level RF systems to filter out the periodic transient due to the passage of the beam in the RF cavity(transient beam loading). P Baudrenghien AB/RF

  10. Comb Filter (2) • Implementation • 1 adder • 1 multiplier • 1 N samples delay line • Examples: • SPS LLRF Fs=40 MHz, N = 924. Implemented with FIFO (IDT722x5 or CY7C42x5) and ALU (IDT7381 or L4C381) • LHC LLRF Fs = 40 MHz (or 80 MHz), N = 3564 (or 7128). Implemented with FPGA (Logic cells plus embedded memory) P Baudrenghien AB/RF

  11. IIR Design based on Analog Prototype • Idea: Transform an analog prototype (Butterworth, Chebyshev, Elliptic) into a digital filter • The transformation from s-plane to z-plane must • Map the [–jpFs , +jpFs] portion of the imaginary axis (s-plane) on the unit circle in the z-plane • Preserve stability • The analog features are kept • Digital Butterworth are monotonic in both the Pass band and Stop band • Digital Chebyshev have ripple in the Pass band but are monotonic in the Stop band (or vice versa) • Digital Elliptic are equiripple in both Pass band and Stop band P Baudrenghien AB/RF

  12. Example 4: Elliptic LP IIR (1) Numerator: 0.108106225554593 -0.225674608761028 0.312898868850319 -0.225674608761028 0.108106225554593 Denominator: 1.000000000000000 -2.846667053723339 3.458441598722129 -2.013976284146102 0.484098739290319 LPF example(as before): • Pass band End Fpass = 0.1 • Pass band Ripple Dpass=0.05 (5%=0.45 dB) • Stop band Start Fstop= 0.13 • Stop band Attenuation Dstop = 0.1 (=20dB) • Specifications can be achieved with a minimum fourth-order elliptic filter • Transfer function is the ratio of two fourth-order polynomials Only 10 coefficients needed!!! P Baudrenghien AB/RF

  13. Example 4: Elliptic LP IIR (2) • Achieved frequency response on log scale (blue trace) • Very non-linear phase response (in green) • Exact zeros in the stop band (Elliptic) P Baudrenghien AB/RF

  14. Example 4: Elliptic LP IIR (3) • Pole-Zero plot in the z-plane • Poles inside the unit circle (stability) at azimuth in the Pass band • Zeros on the unit circle (elliptic) at azimuth in the Transition band and Stop band • 2 poles very close to the unit circle (to get a steep transition band) -> caution ! • Pole-zero cancellation -> caution! P Baudrenghien AB/RF

  15. Example 4: Elliptic LP IIR (4) • Impulse response lasts forever (IIR!) • Comparison with FIR design: • Significant reduction in the computational complexity: 10Multiply/Add compared to 31 (+) • Very sensitive to quantization effects. See next lecture (-) P Baudrenghien AB/RF

  16. Basic Structure for IIR • Tapped-delay line (N or M) delays • N + M + 1 multipliers • 2 adders (N and M+1 inputs) • D/N structure (or poles/zeros structure) also called Direct Form II Very sensitive to the effects of coefficients quantization if N or M are large!!! (next lecture) P Baudrenghien AB/RF

  17. Cascade of biquads • biquad= second-order filter (2 zeros and 2 poles) • Elliptic biquad: zeros on the unit circle -> b0 = b2= 1 -> remains elliptic after coefficients quantization (see next lecture) • Split the high-order filter into a cascade of biquads Much less sensitive to the effects of coefficients quantization (next lecture) P Baudrenghien AB/RF

  18. { Cascaded IIR Biquad Sections (Direct Form II or Transposed Direct Form I) w(n) = x(n) + a1*w(n-1) + a2*w(n-2) beware of signs here! y(n) = w(n) + b1*w(n-1) + b2*w(n-2) (single biquad structure) Each section consists of: b2,b1,a2,a1,w(n-1),w(n-2) Notice that coefs have been normalized such that b0=1.0 Calling Parameters --- cascaded_biquad --- l0, l1, l8 = 0 m1, m8 = 1 f8 = first x(n) r0 = number of biquad sections (filter order / 2) b0 = address of delay line buffer b8 = address of coefficient buffer --- cascaded_biquad_init --- l0 = 0 r0 = number of biquad sections (filter order / 2) b0 = address of delay line buffer Returned Values f8 = last y(n) cascaded_biquad delay line zeroed cascaded_biquad_init Register File Usage: f2, f3, f4, f8, f12 cascaded_biquad f2 cascaded_biquad_init Data Address Generator Usage i0, b1, i1, i8, m1, m8 cascaded_biquad i0 cascaded_biquad_init Benchmark 6 + 4*(sections) cycles cascaded_biquad 5 + 2*(sections) cycles cascaded_biquad_init (incl. non-delayed rts) How about using a DSP ? (1) • Analog Devices assembly code for calling their cascaded_biquad subroutine (DSP 21XXX family) • biquad section • performances • per output sample we have (6 + 4 x nbr biquads) cycles • with the 10 ns instruction cycle of the AD2116x we get 2 (biquads) x 4 (cycles) x 10 ns = 80 ns + 60 ns per sample for our fourth order elliptic IIR. The throughput is on the order of 6 MSPS (optimistic!) • but you have floating point arithmetics! P Baudrenghien AB/RF

  19. How about using a DSP ? (2) Memory Usage --- cascaded_biquad --- 10 words instructions in PM 4*(sections) coefficients in PM 2*(sections) delay line storage in DM --- cascaded_biquad_init --- 5 words instructions in PM 2*(sections) delay line storage in DM "cascade.asm" Analog Devices, Inc. DSP Applications P.O.Box 9106 Norwood, MA 02062 Christoph D. Cavigioli ... 25-Apr-1991 } .GLOBAL cascaded_biquad, cascaded_biquad_init; .EXTERN coefs, dline; .SEGMENT /PM pm_code; cascaded_biquad_init: { --- call this once to set up initial conditions --- } f2=0; lcntr=r0, do clear until lce; {for each section, do:} dm(i0,1)=f2; {clear w`` storage} clear: dm(i0,1)=f2; {clear w` storage} rts; { --- comments for subroutine called cascaded_biquad --- } {TERMINOLOGY: w` = w(n-1), w`` = w(n-2), NEXT = "of next biquad section"} { #1 clear f12, rd w``, rd a2 loop prologue } { #2 for each section, do: } { #3 w``a2, 1st=x+0,else=y, rd w`, rd a1 loop body } { #4 w`a1, x+w``a2, wr new w`, rd b2 loop body } { #5 w``b2, new w, rd NEXT w``, rd b1 loop body } { #6 w`b1, new w+(w``b2), wr new w, rd NEXT a2 loop body } { #7 calc last y after dropping out of loop loop epilogue } cascaded_biquad: { --- call this for every sample to be filtered --- } b1=b0; f12=f12-f12, f2=dm(i0,m1), f4=pm(i8,m8); { #1 } lcntr=r0, do quads until lce; { #2 } f12=f2*f4, f8=f8+f12, f3=dm(i0,m1), f4=pm(i8,m8); { #3 } f12=f3*f4, f8=f8+f12, dm(i1,m1)=f3, f4=pm(i8,m8); { #4 } f12=f2*f4, f8=f8+f12, f2=dm(i0,m1), f4=pm(i8,m8); { #5 } quads: f12=f3*f4, f8=f8+f12, dm(i1,m1)=f8, f4=pm(i8,m8); { #6 } rts (db), f8=f8+f12; { #7 } nop; nop; .ENDSEG; • cascaded_biquad subroutine • loop body 4 cycles/biquad • plus 6 cycles overhead per sample Be cautious: website quotes 20 ns per IIR biquad for AD21161. It is NOT wrong but … P Baudrenghien AB/RF

More Related