Error with HDL Coder

12 views (last 30 days)
sabrina
sabrina on 25 Sep 2014
Edited: Tim McBrayer on 15 Oct 2014
Please I have some error with HDl coder
I try to translate a simulink model to HDL, but with HDL workflow, in step 2.3 for the check block compatibility i have errors:
*Message: Single-precision types are not supported; the generated HDL will use double-precision instead.
Error: Memory block is supported only if Inherit Sample Time property is checked and neither input nor output are continuous.
Error: Unhandled mixed double and non-double datatypes at ports of block*
Please could you gave me some orientations to solve this Pb
Many thanks in advance

Accepted Answer

Tim McBrayer
Tim McBrayer on 25 Sep 2014
Edited: Tim McBrayer on 15 Oct 2014
There are three fairly clear messages reported here.
1) Single-precision types are not supported. This is just a message, not an error, stating that HDL Coder will use double precision. This is because VHDL and Verilog do not have a native type that can represent single-precision floating point numbers. As a side point, you do not in general want to use floats in a design targeted for HDL code generation. Fixed-point is typically used instead, as it is much more efficient in hardware.
2) If you use a Memory block, your Simulink solver must use discrete time, where the sample time of this block is set to Inherit. HDL designs most appropriately use a discrete, not a continuous, solver, because this most accurately models clocked digital logic. The memory block in a design using the correct solver will generate a D flip-flop, identical to the Unit Delay block.
There is a utility called hdlsetup that ships with HDL Coder that sets many common Simulink parameters to the recommended settings. Among other settings it will set your solver to discrete time, fixed-step. You might want to investigate using this to give you the best settings for HDL code generation.
3) You have a block (commonly a Data Type Conversion block) that has both a double type signal and a non-double type signal on its inputs/outputs. This operation is not supported for HDL Code generation. This goes back to the point I made in point 1); don't use floating point data types unless you really know what you are doing and are specifically targeting a need to use doubles.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!