MATLAB function block doesn't generate synthesizable HDL.
Mostrar comentarios más antiguos
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
Respuesta aceptada
Más respuestas (5)
Bharath Venkataraman
el 5 de Ag. de 2021
0 votos
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.
1 comentario
Khakoo Mal
el 6 de Ag. de 2021
Kiran Kintali
el 6 de Ag. de 2021
0 votos
Try the attached sample model which shows how to MATLAB function block with floating point single precision code using native floating point.

1 comentario
Khakoo Mal
el 6 de Ag. de 2021
Kiran Kintali
el 6 de Ag. de 2021
Editada: Kiran Kintali
el 6 de Ag. de 2021
0 votos
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 comentarios
Khakoo Mal
el 12 de Ag. de 2021
Walter Roberson
el 12 de Ag. de 2021
"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
el 12 de Ag. de 2021
0 votos
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.

1 comentario
Khakoo Mal
el 19 de Ag. de 2021
Kiran Kintali
el 19 de Ag. de 2021
0 votos
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.
Categorías
Más información sobre Native Floating Point en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
