Error: The class uint64 does not map to a 64-bit C type.
Afficher commentaires plus anciens
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.
Réponses (3)
Andy Bartlett
le 22 Avr 2022
1 vote
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
le 21 Avr 2022
0 votes
Try to use the .net System.Convert class methods. i.e.
System.Convert.ToInt64( <yourVal> )
3 commentaires
Gerd Fuchs
le 21 Avr 2022
Modifié(e) : Gerd Fuchs
le 21 Avr 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
le 21 Avr 2022
Ayush Modi
le 14 Mar 2024
0 votes
Hi Gerd,
I found similar question in the community.
Hope this helps!
Catégories
En savoir plus sur Simulink Coder dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!