An Algorithm for Converting Floatingpoint Computations to Fixedpoint in MATLAB Based FPGA Design - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

An Algorithm for Converting Floatingpoint Computations to Fixedpoint in MATLAB Based FPGA Design

Description:

quantize() : applies ... and assignment operation with a quantized computation ... quantizer whose impact on quantization error is smallest, and ... – PowerPoint PPT presentation

Number of Views:79
Avg rating:3.0/5.0
Slides: 14
Provided by: carl290
Category:

less

Transcript and Presenter's Notes

Title: An Algorithm for Converting Floatingpoint Computations to Fixedpoint in MATLAB Based FPGA Design


1
An Algorithm for Converting Floating-point
Computations to Fixed-point in MATLAB Based FPGA
Design
  • Sanghamitra Roy
  • Prith Banerjee
  • June 9, 2004

Department of Electrical and Computer Engineering
2
Introduction
  • FPGA designs of DSP applications limited to
    fixed-point owing to cost and complexity of
    floating point hardware
  • First step in the flow to map MATLAB applications
    to hardware conversion of
    floating-point MATLAB algorithm to fixed-point
    using MATLAB quantizers
  • Automated method for floating to fixed point
    conversion reduces design time considerably,
    bridges gap between algorithm and hardware design
  • Error-constrained area minimization problem is
    NP-hard

3
MATLAB Quantizers
  • MATLAB quantization functionality comes withthe
    filter design and analysis toolbox
  • quantizer object with two method functions
  • quantizer() constructor for quantizer object
  • quantize() applies quantizer to numbers

4
Autoquantization Algorithm
  • We use profiling of expected inputsto estimate
    errors
  • The algorithm attempts to minimize hardware
    resources while constraining quantization error
    within a specified limit
  • Consists of the following passes
  • Levelization
  • Scalarization
  • Computation of ranges of variables
  • Generate fixed-point MATLAB code
  • Autoquantization

5
Autoquantization Algorithm
  • Levelization Take complex expressions on right
    side, convert to single operator form
  • Scalarization Take a vectorized statement,
    convert it to scalar form using FOR loops
  • Computation of Ranges Assign max, min values to
    input variables from input files Forward
    propagate ranges to LHS variables

6
Generation of Fixed-point MATLAB Code
  • Replace each arithmetic and assignment operation
    with a quantized computation
  • Set each quantizer to a default maximum precision
    quantizer(fixed, floor, wrap, 40,32)
  • q1quantizer(fixed, floor, wrap, 40, 32)
  • .
  • q5quantizer(fixed, floor, wrap, 40, 32)
  • bquantize(q1,load(file1))
  • cquantize(q2,load(file2))
  • dquantize(q3,load(file3))
  • for i11100
  • temp1(i)quantize(q4,(c(2i-1)d(i)))
  • end
  • for i11100
  • a(i)quantize(q5,(b(i) temp1(i)))
  • end

7
Autoquantization Step
  • Fix Integral ranges of quantizers
  • For each quantizer qi the integral range mi is
    calculated using
  • mi floor(log2(maxi))2,
  • where maxi max(abs(Maxi), abs(Mini)
  • Coarse Optimize to get coarse precisions of
    quantizers
  • Fine Optimize to get fine precisions of quantizers

8
Coarse Optimization Step
  • Follows a divide-and-conquer approach
  • Starts with lowest precision (0/4) bit and
    highest precision32 bit quantizers
  • Moves quickly to the Coarse Optimal Point where
    all quantizers have equal precisions

9
Fine Optimization Step
  • Starts from Coarse Optimal Point , moves to Fine
    Optimal Point
  • Find a quantizer whose impact on quantization
    error is smallest, and reduce its precision by 1
    bit as long as error is within EMmax
  • Find a quantizer whose impact on error is largest
    and increase its precision by 1 bit, while
    simultaneously reducing 2 bits in a quantizer
    with smallest impact on the error, as long as
    error is within EMmax

10
Autoquantization in Sample Code
EMmax0.1
  • q1quantizer(fixed, floor, wrap, 8p1,
    p1) m8
  • q2quantizer(fixed, floor, wrap, 10,
    p2) m10
  • q3quantizer(fixed, floor, wrap, 9p3,
    p3) m9
  • q4quantizer(fixed, floor, wrap, 18p4,
    p4) m18
  • q5quantizer(fixed, floor, wrap, 18p5,
    p5) m18
  • q1quantizer(fixed, floor, wrap, 11, 3)
  • q2quantizer(fixed, floor, wrap, 13, 3)
  • q3quantizer(fixed, floor, wrap, 12, 3)
  • q4quantizer(fixed, floor, wrap, 21, 3)
  • q5quantizer(fixed, floor, wrap, 21, 3)
  • q1quantizer(fixed, floor, wrap, 8,0)
  • q2quantizer(fixed, floor, wrap, 13, 3)
  • q3quantizer(fixed, floor, wrap, 12, 3)
  • q4quantizer(fixed, floor, wrap, 18, 0)
  • q5quantizer(fixed, floor, wrap, 18, 0)

11
Use of Training Sets
  • A small percentage of the actual inputs is used
    by our algorithm to generate optimal set of
    quantizers Training
  • A larger set of actual inputs is used to test our
    system and verify that actual quantization error
    is within acceptable limit Testing
  • Factor of safety for EM constraint

12
Experimental Results on int_fir Benchmark in
MATLAB
13
Conclusions and Future Work
  • We presented an automatic quantization algorithm
    for MATLAB based FPGA design
  • Based on input profiling
  • Future Work
  • Full Automation
  • Autoquantization with power optimization
  • Autoquantization in non-MATLAB environments
  • Improved search algorithms for faster convergence
  • Compiler approaches for precision propagation
Write a Comment
User Comments (0)
About PowerShow.com