| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Simulink Fixed Point |
| Contents | Index |
extern fxpStorageContainerCategory ssGetDataTypeStorageContainCat(SimStruct *S, DTypeId dataTypeId)
SimStruct representing an S-function block.
Data type ID of the registered data type for which you want to know the container category.
This function returns the storage container category of the data type designated by dataTypeId. The container category returned by this function is used to store input and output signals, run-time parameters, and DWorks during Simulink simulations.
During simulation, fixed-point signals are held in one of the types of containers shown in the following table. Therefore in many cases, signals are represented in containers with more bits than their actual word length.
Fixed-Point Storage Containers
Container Category | Signal | Container Word Length | Container Size |
|---|---|---|---|
FXP_STORAGE_INT8 (signed) | 1 to 8 bits | 8 bits | 1 byte |
FXP_STORAGE_INT16 (signed) | 9 to 16 bits | 16 bits | 2 bytes |
FXP_STORAGE_INT32 (signed) | 17 to 32 bits | 32 bits | 4 bytes |
FXP_STORAGE_ CHUNKARRAY | 33 to FXP_MAX_BITS | FXP_MAX_BITS | FXP_NUM_CHUNKS* sizeof(FXP_CHUNK_T) |
FXP_STORAGE_OTHER_SINGLE_WORD | 33 to word length of long data type | Length of long data type | Length of long data type |
FXP_STORAGE_MULTIWORD | Greater than the word length of long data type to 128 bits | Multiples of length of long data type to 128 bits | Multiples of length of long data type to 128 bits |
As shown by the last case in the table, any signal with a word size greater than 32 bits is held in a "chunk array," which is composed of an integer number of "chunks."
When the number of bits in the signal word length is less than the size of the container, the word length bits are always stored in the least significant bits of the container. The remaining container bits must be set to specific values:
If the signal is stored in a chunk array, the remaining bits must be cleared to zero.
If the signal is not stored in a chunk array, then the word length bits must be sign extended to fit the bits of the container:
If the data type is unsigned, then the sign-extended bits must be cleared to zero.
If the data type is signed, then the sign-extended bits must be set to one for strictly negative numbers, and cleared to zero otherwise.
The ssGetDataTypeStorageContainCat function can also return the following values.
Other Storage Containers
Container Category | Description |
|---|---|
FXP_STORAGE_UNKNOWN | Returned if the storage container category is unknown |
FXP_STORAGE_SINGLE | Container type for a Simulink single |
FXP_STORAGE_DOUBLE | Container type for a Simulink double |
FXP_STORAGE_SCALEDDOUBLE | Container type for a data type that has been overridden with Scaled doubles |
This function errors out when ssGetDataTypeIsFxpFltApiCompat returns FALSE.
To use this function, you must include fixedpoint.h and fixedpoint.c. For more information, see Structure of the S-Function.
C
Because the mapping of storage containers in simulation to storage containers in code generation is not one-to-one, the TLC functions for storage containers in TLC are different from those in simulation. Refer to Storage Container TLC Functions for more information:
FixPt_DataTypeNativeType
FixPt_DataTypeStorageDouble
FixPt_DataTypeStorageSingle
FixPt_DataTypeStorageScaledDouble
FixPt_DataTypeStorageSInt
FixPt_DataTypeStorageUInt
FixPt_DataTypeStorageSLong
FixPt_DataTypeStorageULong
FixPt_DataTypeStorageSShort
FixPt_DataTypeStorageUShort
ssGetDataTypeStorageContainerSize

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2010- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |