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

18 views (last 30 days)
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.

Answers (3)

Andy Bartlett
Andy Bartlett on 22 Apr 2022
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 on 21 Apr 2022
Try to use the .net System.Convert class methods. i.e.
System.Convert.ToInt64( <yourVal> )
  3 Comments
chrisw23
chrisw23 on 21 Apr 2022
Edited: chrisw23 on 21 Apr 2022
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 on 21 Apr 2022
Probably my question was not stated clear enough. My troubles are concering my Simulink model (in which I also use Matlab functions).

Sign in to comment.


Ayush Modi
Ayush Modi on 14 Mar 2024

Categories

Find more on Simulink Coder in Help Center and File Exchange

Tags

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!