Main Content

Multiword type definitions

Whether to define multiword data types as system- or user-defined types

Since R2020a

Model Configuration Pane: Code Generation / Interface

Description

The Multiword type definitions parameter specifies whether the code generator defines multiword data types as system-defined or user-defined type definitions.

Settings

System defined (default) | User defined
System defined

Defines multiword data types as system type definitions. If the code generator detects multiword usage, the code generator places multiword type definitions in the file multiword_types.h.

User defined

Allows you to control how the code generator handles multiword type definitions. Setting the parameter to this value enables the Maximum word length parameter, which allows you to specify a maximum word length, in bits, for which the code generator produces multiword type definitions. The code generator places the multiword type definitions in the file multiword_types.h. The default maximum word length is 256. If you select 0, the code generator does not generate multiword type definitions in the file multiword_types.h.

The maximum word length for multiword types only determines the type definitions generated and does not impact the efficiency of the generated code. If the maximum word length for multiword types is set to 0 or a value that is too small, an error occurs when the generated code is compiled. This error is caused by the generated code using a type that does not have the required type definition. To resolve the error, increase the maximum word length and regenerate the code. If the maximum word length for multiword types is larger than required, then multiword_types.h might contain unused type definitions. Unused type definitions do not consume target resources.

Tips

  • Adding a model to a model hierarchy or changing an existing model in the hierarchy can result in updates to the shared multiword_types.h file during code generation. These updates occur when the new model uses multiword types of length greater than those of the other models. You must then recompile and, depending on your development process, reverify previously generated code. To prevent updates to multiword_types.h, determine a maximum word length sufficiently big to cover the needs of all models in the hierarchy. Configure every model in the hierarchy to use that same maximum word length.

  • The majority of embedded designs do not need multiword types. By setting maximum word length for multiword types to 0, you can prevent use of multiword variables on the target. If you use multiword variables with a maximum word length that is 0 or smaller than required, you are alerted with an error when the generated code is compiled.

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyNo impact
Safety precaution

No recommendation

Programmatic Use

Parameter: MultiwordTypeDef
Type: character vector
Value: 'System defined' | 'User defined'
Default: 'System defined'

Version History

Introduced in R2020a