MATLAB function block doesn't generate synthesizable HDL.
显示 更早的评论
I developed an algorithm by using MATLAB function block and it responses properly. But, when I try to generate HDL code through HDL coder, then fail to do so with following errors.
"Signals of type double will not generate synthesizable HDL. For synthesizble code, consider enabling native floating point mode and retyping double typed signals to single".
Please help
采纳的回答
更多回答(5 个)
Bharath Venkataraman
2021-8-5
0 个投票
It appears that you have floating point values in your MATLAB code.
If you want to retain floating point numerics for your HDL, configure HDL Coder to generate floating point as shown in this page.
Another option is to convert these floating point variables to fixed point using the fi construct with signedness, wordlength and fraction length, and generate fixed-point HDL code.
Kiran Kintali
2021-8-6
0 个投票
Try the attached sample model which shows how to MATLAB function block with floating point single precision code using native floating point.

Kiran Kintali
2021-8-6
编辑:Kiran Kintali
2021-8-6
0 个投票
I am attaching R2018a version of the model for viewing the contents of the MATLAB function. I recommend upgrading to latest releases for HDL code generation. There are significant improvements in floating point code generation. Floating point code generation for MATLAB function block is available from 19b release.
https://www.mathworks.com/help/hdlcoder/release-notes.html
2 个评论
Khakoo Mal
2021-8-12
Walter Roberson
2021-8-12
"Floating point code generation for MATLAB function block is available from 19b release." implies to me that you need to upgrade to do what you want.
Kiran Kintali
2021-8-12
0 个投票
R2019b
New Features, Bug Fixes
Model and Architecture Design
HDL code generation for MATLAB Function block in native floating-point mode
In R2019b, HDL Coder™ supports code generation for the MATLAB Function block by using floating-point data types in Native Floating Point mode. You can use a wider subset of MATLAB® functions to develop complex floating-point algorithms.
By default, floating-point support in HDL Coder uses a new MATLAB datapath architecture of the MATLAB Function block. This architecture treats the MATLAB Function block like a Subsystem block. The generated HDL code with the MATLAB datapath architecture is more readable.

Kiran Kintali
2021-8-19
0 个投票
An operator or a block in Simulink can support all floating point types (for input, output and intermediate settings) that are set to same type (single, double, half). Check documentation on available floating point usage.
Consider using our automated tools to convert double to single or do manual conversion necessary to comply with supported usecases.
Please share your model for any further assistance.
类别
在 帮助中心 和 File Exchange 中查找有关 Native Floating Point 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
