|ID: Title||cgsl_0105: Modeling local shared memory using data stores|
|Description||When using data store blocks as local shared memory:|
|A||Explicitly create the data store using a Data Store Memory block.|
|B||Deselect the block parameter option Data store name must resolve to Simulink signal object.|
|C||Consider following a naming convention for local Data Store Memory blocks.|
Use the diagnostic 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.
|Rationale||A, B||Data store block is treated as a local instance of the data store|
|C||Provides graphical feedback that the data store is local|
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.