Data type conversion out of matlab function block with HDL Coder

조회 수: 15 (최근 30일)
jarick cammarato
jarick cammarato 2014년 6월 4일
답변: Tim McBrayer 2014년 6월 4일
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?

답변 (1개)

Tim McBrayer
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.

카테고리

Help CenterFile Exchange에서 Code Generation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by