Toolbox to check Enumeration cast from uint16
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi all
I am running a simulation wherein I am using a Simulink Enumerated type. So I have defined a limited amount of enumerated values inside this Enum variable. I am now doing a bit operation on this enumerated type, which cannot be performed on an enum datatype. So I change the data type to a uint16, I perform the bit operation and then cast again to the enumerated type.
I have now noticed that the model builds, but during runtime the model generates an error because the uint16 value cannot be mapped on a value inside the enumerated type. I corrected my mistake and the algorithm now works as intended.
I understand that casting to an enumerated type from a uint16 can be dangerous, but I was wondering if there is a certain testing toolbox which can detect this before compiling the code? I intend to generate embedded code from this model. Do I need Polyspace Code Prover to be 100% sure that these errors do not occur during runtime? Or how can I have guaranteed working code with enums?
Many thanks,
Jonas
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Bug Finder Analysis in Simulink in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!