-
-
November 5, 2025 at 2:44 pm
raphael.courousse.1
SubscriberHow do I use the types defined in stdint.h in my models ? Do i have to import them ? If so how do I procede.
-
November 5, 2025 at 3:36 pm
Benjamin Descorps
Ansys EmployeeHello,
To use external definitions (whatever it concerns types, constants or functions), you should use imported code.
As example, you can define a new type and declare it as imported. In the Properties, you can select the Definition file that provides its C definition. Finally, you could define some constraints on this type, expecially if it is a numeric type (useful to allow use of mathematical Scade functions for example):
Use of imported types introduces some constraints. You must also provide:
- an init function for KCG
- copy and comp functions
You can refer to the chapter Design and Model Editing > 3 / Designing Models > Defining Data Types > Setting Imported Types of the USer Manual for further information.
Benjamin
-
November 5, 2025 at 6:02 pm
-
November 6, 2025 at 8:59 am
Benjamin Descorps
Ansys EmployeeHello,
The init function is required to define behavior for initialization. Example:
void int32_t_init(int32_t *kcg_c1)
{
  *kcg_c1= 0;
}This is the minimum required to generate code with KCG.
For Simulation purpose, you will need to provide some additional functions:
- conversion functions are necessary for displaying observable variables of immorted types
- Comparison functions are necessary for evaluating breakpoints and for checking expected values against simulation values
You should refer to the Technical Manual for additional information and for an example.
I will point out that use of imported types shall be reserved to complex cases.
For numeric types, I will rather recommend you to use the native types of the Scade language (integr/float types of the Scade language). For mapping with the C types, you have possibility to map implementation of these numeric types with definition of your stdint.h library. As example, KCG generates the following default definition:
You can the provide your own definition of the macro kcg_int32 and map it to definition of stdint.h.
It could be a way to avoid use of imported types in your Scade model.
Hope this helps,
Benjamin
-
November 7, 2025 at 2:07 pm
raphael.courousse.1
SubscriberThe bypass worked just fine. Thanks a lot !
-
- You must be logged in to reply to this topic.
-
4177
-
1487
-
1363
-
1194
-
1021
© 2025 Copyright ANSYS, Inc. All rights reserved.




