introduction to field programmable gate arrays
play

Introduction to Field Programmable Gate Arrays Lecture 2/3 CERN - PowerPoint PPT Presentation

Introduction to Field Programmable Gate Arrays Lecture 2/3 CERN Accelerator School on Digital Signal Processing Sigtuna, Sweden, 31 May 9 June 2007 Javier Serrano, CERN AB-CO-HT Outline Digital Signal Processing using FPGAs


  1. Introduction to Field Programmable Gate Arrays Lecture 2/3 CERN Accelerator School on Digital Signal Processing Sigtuna, Sweden, 31 May – 9 June 2007 Javier Serrano, CERN AB-CO-HT

  2. Outline � Digital Signal Processing using FPGAs � Introduction. Why FPGAs for DSP? � Fixed point and its subtleties. � Doing arithmetic in hardware. � Distributed Arithmetic (DA). � COordinate Rotation DIgital Computer (CORDIC).

  3. Outline � Digital Signal Processing using FPGAs � Introduction. Why FPGAs for DSP? � Fixed point and its subtleties. � Doing arithmetic in hardware. � Distributed Arithmetic (DA). � COordinate Rotation DIgital Computer (CORDIC).

  4. Why FPGAs for DSP? (1) Reason 1: FPGAs handle high computational workloads FPGA Conventional DSP Device (Von Neumann architecture) Data In Data In Reg1 Reg2 Reg0 Reg255 Reg C0 C1 C2 C255 .... MAC unit Data Out Data Out 256 Loops needed to process samples All 256 MAC operations in 1 clock cycle

  5. FPGAs are ideal for multi-channel DSP designs 80MHz 20MHz ch1 LPF Samples Samples ch2 LPF LPF ch3 LPF Multi Channel Filter ch4 LPF � Many low sample rate channels can be multiplexed (e.g. TDM) and processed in the FPGA, at a high rate. � Interpolation (using zeros) can also drive sample rates higher.

  6. Why FPGAs for DSP? (2) Reason 2: Tremendous Flexibility A × + Q = (A x B) + (C x D) + (E x F) + (G x H) B C × + + can be implemented in parallel D Q E + × + F G × + H But is this the only way in the FPGA?

  7. Customize Architectures to Suit Your Ideal Algorithms Parallel Semi-Parallel Serial × + + × + + × + D Q + + D Q + × × × + + + × + Speed Optimized for? Cost FPGAs allow Area (cost) / Performance tradeoffs

  8. Why FPGAs for DSP? (3) Reason 3: Integration simplifies PCBs Hundreds of Termination Resistors A/D SDRAM AFE A/D MACs MACs DSP ASSP SSTL3 Procs. C C Quad Translators P P Control DDC DDC Control r r DDC DDC TRx e e w w o o P P FPGA DDC DDC Network DDC DDC Quad SDRAM TRx Card FPGA D/A DUC DUC DUC DUC DSP Card D/A DUC DUC DUC DUC A/D SDRAM ASSP A/D Control PL4 Pow erPC Pow erPC 3.125 Gbps MACs, DUCs, D/A DDCs, Logic Pow erPC Pow erPC D/A SDRAM Control CORBA

  9. Outline � Digital Signal Processing using FPGAs � Introduction. Why FPGAs for DSP? � Fixed point and its subtleties. � Doing arithmetic in hardware. � Distributed Arithmetic (DA). � COordinate Rotation DIgital Computer (CORDIC).

  10. Unsigned integers: positive values only

  11. 2’s complement

  12. Fixed point binary numbers Example: 3 integer bits and 5 fractional bits

  13. Fixed point truncation vs. rounding Note that in 2’s complement, truncation is biased while rounding isn’t.

  14. Outline � Digital Signal Processing using FPGAs � Introduction. Why FPGAs for DSP? � Fixed point and its subtleties. � Doing arithmetic in hardware. � Distributed Arithmetic (DA). � COordinate Rotation DIgital Computer (CORDIC).

  15. The Full Adder (FA)

  16. Add/subtract circuit S = A+B when Control=‘0’ S = A-B when Control=‘1’

  17. Saturation You can’t let the data path become arbitrarily wide. Saturation involves overflow detection and a multiplexer. Useful in accumulators (like the one in the PI controller we use in the lab).

  18. Multiplication: pencil & paper approach

  19. A 4-bit unsigned multiplier using Full Adders and AND gates Of course, you can use embedded multipliers if your chip has them!

  20. Constant coefficient multipliers using ROM For “easy” coefficients, there are smarter ways. E.g. to multiply a number A by 31, left-shift A by 5 places then subtract A.

  21. Division: pencil & paper � Uses add/subtract blocks presented earlier. � MSB produced first: this will usually imply we have to wait for whole operation to finish before feeding result to another block. � Longer combinational delays than in multiplication: an N by N division will always take longer than an N by N multiplication.

  22. Pipelining the division array

  23. Square root � Take a division array, cut it in half (diagonally) and you have square root. Square root is therefore faster than division! � Although with less ripple through, this block suffers from the same problems as the division array. � Alternative approach: first guess with a ROM, then use an iterative algorithm such as Newton-Raphson.

  24. Outline � Digital Signal Processing using FPGAs � Introduction. Why FPGAs for DSP? � Fixed point and its subtleties. � Doing arithmetic in hardware. � Distributed Arithmetic (DA). � COordinate Rotation DIgital Computer (CORDIC).

  25. Distributed Arithmetic (DA) 1/2 Digital filtering is about sums of products: − N 1 ∑ = ⋅ y c [ n ] x [ n ] = n 0 c[n] constant (prerequisite to use DA) Let’s assume: x[n] input signal B bits wide ⎛ ⎞ − − N 1 B 1 x b [n] is bit number b ∑ ∑ = ⎜ ⋅ ⋅ ⎟ b y c [ n ] x b n [ ] 2 Then: of x[n] (either 0 or 1) ⎝ ⎠ = = n 0 b 0 ⎛ ⎞ − − B 1 N 1 ∑ ∑ = ⋅ ⋅ ⎜ ⎟ And after some b y c n x n 2 [ ] [ ] b ⎝ ⎠ rearrangement of terms: = = b 0 n 0 This can be implemented with an N-input LUT

  26. Distributed Arithmetic (DA) 2/2 ⎛ ⎞ − − B 1 N 1 ∑ ∑ = ⋅ ⎜ ⋅ ⎟ b y 2 c [ n ] x [ n ] b ⎝ ⎠ = = b 0 n 0 …… x B [0] x 1 [0] x 0 [0] …… x B [1] x 1 [1] x 0 [1] y …….... …….... …….... LUT + Register …… x B [N-1] x 1 [N-1] x 0 [N-1] 2 -1 Generates a result every B clock ticks. Replicating logic one can trade off speed vs. area, to the limit of getting one result per clock tick.

  27. Outline � Digital Signal Processing using FPGAs � Introduction. Why FPGAs for DSP? � Fixed point and its subtleties. � Doing arithmetic in hardware. � Distributed Arithmetic (DA). � COordinate Rotation DIgital Computer (CORDIC).

  28. COrdinate Rotation DIgital Computer

  29. Pseudo-rotations

  30. Basic CORDIC iterations

  31. Angle accumulator

  32. The scaling factor

  33. Rotation Mode

  34. Example: calculate sin and cos of 30º

  35. Vectoring Mode Vector magnitude

  36. Circular coordinate system

  37. Other coordinate systems

  38. Generalized CORDIC equations

  39. Summary of CORDIC functions

  40. Precision and convergence

  41. FPGA implementation

  42. Iterative bit-serial design

  43. Acknowledgements � Many thanks to Jeff Weintraub (Xilinx University Program) and Bob Stewart (University of Strathclyde) for many of these slides.

Recommend


More recommend