How to convert floating-point function to fixed-point version?

1 view (last 30 days)
Hi,
I am working on converting a floating-point MATLAB function to fixed-point version (for potential migration to DSP or FPGA in the future). The function calls a set of sub-functions and the number ranges of variables in these sub-functions vary a lot (from 0.001 to 10000, but quite stable for specific sub-function call). So I think a global fimath will never work in this case without losing too much precision. However, if we let MATLAB smartly figure out the fraction length for each variable, the arithmetics become actually "floating-point" ones and the computation cost is too much. Therefore, both ways of global fimath and automatic numeric type for each variable doesn't work. Thus, I am wondering is there a "standard" or "common" way to deal with this kind of function (many sub-functions, big range of numbers)?
My guess is that one has to instrument each sub-functions and determine the range of inputs, intermediate variables and outputs of them and then set fraction length for each sub-function call separately. Is that right?
I have read the official documents on Fixed-Point Toolbox and watched a few tutorials, however, the sample cases are all quite simple functions or just let MATLAB fi automatically choose a fraction length for a variable.
Thanks for your attention!

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!