Maximum word length
Maximum word length for generated multiword type definitions
Model Configuration Pane: Code Generation / Interface
Description
The Maximum word length parameter specifies a maximum word length, in bits, for which the code generator produces system-defined multiword type definitions.
Dependencies
This parameter requires an Embedded Coder® license when generating code.
To enable this parameter, set the Multiword type definition parameter to
User defined
.
Settings
Specify a maximum word length, in bits, for which the code generator defines multiword types in the file multiword_types.h
. For models configured with an GRT-based system target file, the default is 256
. For models configured with an ERT-based system target file, the default is 2048
.
The code generator defines multiword types up to and including specified number of bits. If you specify 0, the code generator does not define multiword types 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 you set the maximum word length for multiword types to 0 or too small, an error occurs when you compile the generated code. 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, multiword_types.h
might contain unused type definitions. Unused type definitions do not consume target environment 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 tomultiword_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 in the target environment. If you use multiword variables with a maximum word length that is 0 or smaller than required, you are alerted with an error when you compile the generated code.
Recommended Settings
Application | Setting |
---|---|
Debugging | No impact |
Traceability | No impact |
Efficiency | No impact |
Safety precaution | No recommendation |
Programmatic Use
Parameter: MultiwordLength |
Type: integer |
Value: valid quantity of bits representing a word size |
Default: 2048 for GRT targets, 256 for ERT targets |
Version History
Introduced in R2015b