Data type conversion out of matlab function block with HDL Coder
13 次查看(过去 30 天)
显示 更早的评论
I am receiving the following errors:
Error due to multiple causes.
Error using slhdlcoder.SimulinkConnection/initModel (line 11)
Inferred type ('embedded.fi (uint16)') for data 'Ref_level' (#356)
does not match back propagated type ('uint16') from Simulink.
Error using slhdlcoder.SimulinkConnection/initModel (line 11)
An error occurred while propagating data type 'uint16' through
system/port_name'.
These errors are related to a Matlab Function Blocks output and input respectively. I just changed the code by setting all the internal signals to fi data types. If I don't do this the VHDL generated creates real type variables that wont synthesize.
How should I correct these issues?
0 个评论
回答(1 个)
Tim McBrayer
2014-6-4
The error message is saying in essence that uint16 is different from fixdt(0, 16, 0) , which it is. Do you have uint16 data somewhere, perhaps feeding into the MATLAB Function block? If so, you should be able to fix this error by changing all the data types, both in- and outside the function block, to one or the other of the data types, as your needs require.
If you don't need fimath, Simulink will simulate faster if you use uint16. You can do this in the Function block with e.g. uint16(0) wherever yo need to specify the type, as opposed to fi(0, 0, 16, 0). The choice of data type will have no real effect on the generated HDL code.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!