ssGetDataTypeStorageContainCat

Return storage container category of registered data type

Syntax

extern fxpStorageContainerCategory
ssGetDataTypeStorageContainCat(SimStruct *S, DTypeId dataTypeId)

Arguments

S

SimStruct representing an S-function block.

dataTypeId

Data type ID of the registered data type for which you want to know the container category.

Description

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
Word Length

Container Word Length

Container Size

FXP_STORAGE_INT8 (signed)
FXP_STORAGE_UINT8 (unsigned)

1 to 8 bits

8 bits

1 byte

FXP_STORAGE_INT16 (signed)
FXP_STORAGE_UINT16 (unsigned)

9 to 16 bits

16 bits

2 bytes

FXP_STORAGE_INT32 (signed)
FXP_STORAGE_UINT32 (unsigned)

17 to 32 bits

32 bits

4 bytes

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

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 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 double

This function errors out when ssGetDataTypeIsFxpFltApiCompat returns FALSE.

Requirement

To use this function, you must include fixedpoint.h and fixedpoint.c. For more information, see Structure of the S-Function.

Languages

C

TLC Functions

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

Was this topic helpful?