HDL Coder generates 'real' types - how to prevent that
3 次查看(过去 30 天)
显示 更早的评论
Hello,
I am generating a large system into VHDL code using the HDL Coder. A lot of the signal types are inherited or allows Matlab to choose the best type. However, when I generate the VHDL code it uses 'real' types in certain places which is not compilable except for simulation purposes.
How do I get Simulink HDL coder to not use real types and default to say double or int32.
0 个评论
回答(2 个)
Tim McBrayer
2011-8-16
There is no way to specify the default data type for Simulink to be anything except 'double'. HDL Coder will generate HDL for your model as it exists.
If you use 'single' or 'double' data types in Simulink, these will be mapped to the 'real' type in VHDL, as you have seen. If you do not wish for real typed signals to appear in your VHDL code you will need to modify your Simulink design to not contain floating point types. You can use the Simulink Fixed-Point Advisor to guide you in your choice of fixed-point types if need be.
In general, if you place Data Type Conversion blocks on your real-valued data inputs before they enter the HDL part of your design, the data type propagation will assign most Simulink signals non-double types.
0 个评论
Siyuan XU
2014-2-13
Hi, You can convert all your blocks which may contain double value to have a fixed-point type output, to do so, double click on your block, at the popped up window, choose the Signal Attributes tag, then choose the Output data type as fixdt(1,16), then click Apply button. As soon as all your data type is configured, this will prevent the 'real' type from showing in your VHDL code.
0 个评论
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!