Error: The class uint64 does not map to a 64-bit C type.

19 次查看(过去 30 天)
I've updated Matlab from 2017b to 2020b - because of my tool chain I'm restricted to certain releases and 2020b is the newest relase I can use at the moment. In my Simulink file I've implemented a Matlab function containing the bin2dec command. Everything worked fine in the 2017b release, but now, after the update, I get the error
"For code generation, integer input or result classes for TYPECAST must map directly to a C type in the target hardware. The class uint64 does not map to a 64-bit C type."
Why does this error occur and how can I resolve this issue?
I tried using the 'Bit to Integer Converter' Block from the Communications toolbox but this one doesn't work in my code because I get the value from an FPGA and in the communication interface I don't have the option to specify the number of bits. Hence, at the input, the value has the type 'double' and I have to convert it to a 12bit signed int.

回答(3 个)

Andy Bartlett
Andy Bartlett 2022-4-22
If this error is happening when you are explicitly attempting to generated code with MATLAB Coder, Simulink Coder, or Embedded Coder, then the following may solve the problem.
Make sure Hardware Implementation target provides 64 bit integer type.
Make sure your model's Hardware Implementation target provides a 64 bit integer type. Either
  • long is 64-bits
or
  • long long is 64 bits
  • Support long long is checked.
Some screenshots can be found here.
If this error is occuring due to implicit code generation such as simulating with a MATLAB function block or simulating with accelerator mode then I would not expect the previsous suggestion to solve the problem.

chrisw23
chrisw23 2022-4-21
Try to use the .net System.Convert class methods. i.e.
System.Convert.ToInt64( <yourVal> )
  3 个评论
chrisw23
chrisw23 2022-4-21
编辑:chrisw23 2022-4-21
The System class is usable by default as far as I know, but you can try to import it explicitly by
import System.*
The Matlab Command Window should provide the class interface by intellisense if you press the TAB key after the dot System.Convert.<TAB>
...and I'm talking about Matlab not Simulink :)
Gerd Fuchs
Gerd Fuchs 2022-4-21
Probably my question was not stated clear enough. My troubles are concering my Simulink model (in which I also use Matlab functions).

请先登录,再进行评论。


Ayush Modi
Ayush Modi 2024-3-14

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

标签

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by