1 / 18

Outline

“An Automated System for Floating- to Fixed-Point Conversion of High Performance of MATLAB Algorithms in FPGAs and ASICs” Eric Cigan and Robert Anderson September 2004. Outline. Motivation For FPGA / ASIC implementation For fixed-point arithmetic Alternatives

lindley
Download Presentation

Outline

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. “An Automated System for Floating- to Fixed-Point Conversion of High Performance of MATLAB Algorithms in FPGAs and ASICs” Eric Cigan and Robert Anderson September 2004

  2. Outline • Motivation • For FPGA / ASIC implementation • For fixed-point arithmetic • Alternatives • Related approaches methods used • Changshun Shi – performance criteria and optimization • Approach used • MATLAB-based algorithmic synthesis • Heuristic-based approach • Advantages of approach • Single design source • Verification flow • Example • FIR filter

  3. Rationale for DSP Algorithms in Silicon

  4. Fixed-Point Implications • Increases in performance (throughput, frequency, etc.) • In communications a 1 dB increase in the link power budget results in a 25% increase in coverage • Power consumption • Word size = silicon area/memory => Cost Source: The MathWorks, 2003

  5. Previous Work • Rule-of-thumb methods • Ad-hoc methods such as rounding and truncation. • Manual scaling to and from integer representations. • Recoding the source code in a hardware description language and then verifying performance in the RTL code. • Substitution of floating-point functions with fixed-point equivalents, such as in C fixed-point libraries. • Recent research • Keding, et al (RWTH Aachen, 1998) • Algorithm described in C/C++ • Oriented toward minimizing all wordlengths at same time • Can require large number of iterations • Shi and Brodersen (UC Berkeley, 2002-2004) • Algorithm described in graphical design tool • Optimization-based methodology • Requires Monte Carlo simulation runs

  6. MATLAB-Based Algorithmic Synthesis Flow Algorithm Exploration Floating Point Design DSP IP Libraries Fixed Point Models SignalProcessing System-Level Verification Automated Fixed Point Model Generation Project Directory Communications Fixed-Point Model Generation Report Model Export Implementation Exploration Verification Report IC Design Tools RTL Model Final IC Design Verification Place & Route Algorithmic Synthesis Environment Implementation Optimization

  7. Synthesizable MATLAB Coding Basics • MATLAB script file applies input vectors to the design function in a loop called the “streaming loop” • The design to be synthesized needs to exist in a function called the design function • Additional MATLAB files or external data files may exist

  8. Tool supports two fixed point datatypes Fixed 2’s complement Required for negative numbers Much easier to multiply (don’t have to worry about sign bit) ufixed (unsigned) Provides a greater range with same hardware when numbers are all positive To optimize the dynamic range of a number Use a minimal # of integer bits to accommodate the range of possible values Use a minimal # of fraction bits to accommodate acceptable precision Fixed-Point Quantization

  9. Automated Quantization Method • Quantization performed on floating-point MATLAB • Bit widths are derived from • Stimulus waveforms • Text files loaded to initialize constants • Bit growth propagated from arithmetic operations • MATLAB quantizer statements in M-file • Explicit quantizer directives

  10. Fixed-Point Generation Process • Process is automated, yet requires designer’s knowledge…

  11. Generated Fixed-Point MATLAB Files • Tool generates fixed-point M-files from source floating point M-files • The MATLAB “quantize” and “quantizer” functions are inserted into the original source code • Optimization of quantizer functions reduces simulation overhead of fixed-point simulation – up to 100x faster Floating Point MATLAB Generated Fixed-Point Output

  12. The Quantize Directive • The Quantize directive allows users to override the automatic quantization • Applying directive allows use of unmodified MATLAB source • Directives can be typed at the command line or added to an “.add” directives file • AccelChip will create this file automatically when “Save -> Project” is executed Directives file located here Quantize directives can be applied interactively from the design browser SetDirective Variables.indatabuf -quantize {fixed floor wrap {32 16}}

  13. Auto-Quantization Report MATLAB Editor All variables in a design are displayed in a single, flat format Directives Editor Double-Click Specifies the source of the directive Flags directives that are set to maximum Double-Click

  14. Overflow and Underflow • An underflow is defined as a number that is nonzero before it is quantized, and zero after it is quantized. • Example of an underflow: X = quantize(quantizer(‘ufixed’,’floor’,’wrap’,[2 2]), 0.1); 00b = 0 01b = 0.25 10b = 0.50 11b = 0.75 • An overflow occurs when the magnitude of a number exceeds the dynamic range allowable by the integer bits as defined by the quantizer • Example of an overflow: X = quantize(quantizer(‘ufixed’,’floor’,’wrap’,[2 0]), 5); 00b = 0 01b = 1 10b = 2 11b = 3 • A fidelity error is caused by either an overflow or an underflow • Overflow errors tend to be severe distortions • Underflow errors tend to be minor distortions X will be zero because the smallest non-zero number will be too large X will be one because the binary representation of 5, “101” will be wrapped to “01”

  15. Managing Underflow and Overflow Issues • Often a design has a large number of underflows and only a few overflows. • Displaying overflow and underflow messages together often makes it difficult to locate the overflows • Recommended Practice: • Begin the debug process by setting “Show Underflows” to False • Once overflows are addressed then set “Show Underflows” to True and address any remaining fidelity issues Project options are available to selectively disable displaying overflow or underflow message

  16. Constants are represented in binary form with maximum accuracy This can lead to unnecessary bit growth Constants used directly in expressions can’t be quantized directly Change in coding style allows bit growth management Addressing Bit Growth Due to Constants A constant introduced here Will affect all downstream hardware Will affect all downstream hardware Y = x + quantize( quantizer(‘ufixed','floor','wrap',[ 10,9]), 1.3 ) or Y = x + 1.3 Const = 1.3 Y = x + cost Recommended

  17. Improving Hardware through Quantization • Quantization can have a dramatic affect on performance and area • Tool will attempt to auto-quantize to preserve signal fidelity • A maximum of 53 bits will be used for internal variables • Consistent with abscissa of MATLAB “double” number • A maximum of 32 bits will be used for IO ports • Start by reviewing the fractional bits of the default quantization assigned to constants and the input data stream • Tool will use as much precision as necessary to represent number • E.g., 0.375 = <binary pt>011 and 0.3 = <binary pt>01100110011001100110011001100110011001100110011001100 • Designer uses tool directives to trim bits Example – 16-tap FIR filter * Default quantization used 53 bits

  18. Conclusion • Algorithmic synthesis tool enables MATLAB design to be design source throughout process • Tool aids in automating process of converting floating point designs to fixed-point • Provides design exploration to increase performance and reduce size/power MATLAB Domain (Pure algorithmicnon-implementation-specific) “m” language (used by MATLAB) More abstract, lessimplementation-specific Untimed C Domain (non-implementation-specific) Standard C (used by Catapult C) Handel-C Timed C Domain (implementation-specific) SystemC Less abstract, moreimplementation-specific RTL Domain (implementation-specific) Verilog and/or VHDL Different levels of synthesis abstraction[source: Mentor Graphics white paper, “Catapult C Synthesis-based Design Flow,” October 2003]

More Related