Main Content

cgsl_0105: Modeling local shared memory using data stores

ID: Titlecgsl_0105: Modeling local shared memory using data stores
DescriptionWhen using data store blocks as local shared memory:
AExplicitly create the data store using a Data Store Memory block.
BClear block parameter Data store name must resolve to Simulink signal object.
CConsider following a naming convention for local Data Store Memory blocks.

Use configuration parameter Duplicate data store names to help detect unintended identifier reuse. For models intentionally using local data stores, set the diagnostic to warning. Verify that only intentional data stores are included.

Data store blocks are realized as global memory in the generated code. If they are not assigned a specific storage class, they are included in the DWork structure. In the model, the data store is scoped to the defining subsystem and below. In the generated code, the data store has file scope.

RationaleA, BData store block is treated as a local instance of the data store
CProvides graphical feedback that the data store is local
See Also
Last ChangedR2011b

In some instances, such as a library function, reuse of a local data store is required. In this example, the local data store is defined in two subsystems.

The instance of localFlag is in scope within the subsystem LocalDataStore_1 and its subsystems.

In the generated code, the data stores are part of the global DWork structure for the model. Embedded Coder® automatically assigns them unique names during the code generation process.