How can I generate VHDL code with fixed point values from matlab code?
1 view (last 30 days)
Show older comments
Hello all,
I am trying to generate a matlab file into vhdl code. It generates correctly, however, I need to use only fixed point values. The matlab code has some mathematical functions that when vhdl code is generated, some "real" signals are created, so I cannot synthesize the vhdl code.
Do you how can I generate vhdl code without creating "real" datatype?
Thanks in advance,
0 Comments
Answers (1)
Tim McBrayer
on 24 May 2013
Are you generating code from a MATLAB Function block in Simulink, or from MATLAB code directly? If you are generating HDL directly from MATLAB code (available first in HDL Coder 3.0), the flow has a guided float-to-fixed data type conversion step, documented at http://www.mathworks.com/help/hdlcoder/floating-point-to-fixed-point-conversion.html. For successful conversion you need to use only functions that are both supported by HDL Coder and have fixed-point implementations. More information on these functions is available at http://www.mathworks.com/help/hdlcoder/ug/fixed-point-run-time-library-support.html.
If you are generating your HDL code from Simulink, the conversion from float to fixed is not automated. You can used the Fixed-Point Advisor (if you have it) to help guide you in your data type choices. Successful conversion also relies on any funtions you call having a fixed-point version, just like when generating code from MATLAB.
0 Comments
See Also
Categories
Find more on HDL Coder in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!