| Contents | Index |
xPC Target supports reflective (shared) memory boards manufactured by Curtiss-Wright Electronic Systems (http://www.cwcelectronicsystems.com/data_communications.html) – formerly Systran®.
| On this page… |
|---|
The xPC Target software uses a model for reflective memory (also known as shared memory) that includes Simulink blocks for shared memory driver functions and MATLAB structures to define node initialization and shared memory partitions. This topic describes xPC Target support of the Systran SCRAMNet+ SC150 board.
To use the xPC Target Systran SCRAMNet+ SC150 shared memory blocks, you must define shared memory partition structures. A partition structure describes how you want to allocate (partition) the shared memory. The xPC Target software allocates shared memory as segments of data that are packed into memory regions or partitions. Along with the Shared Memory Pack and Shared Memory Unpack blocks, the following SCRAMNet+ SC150 blocks use shared memory partition structures:
After defining the shared memory partitions, you can add SCRAMNet+ SC150 shared memory driver blocks to your Simulink model. See Shared Memory Partition Structure for the complete list of fields in a partition structure.
The following description refers to the completepartitionstruct command. Type
help completepartitionstruct
for more information.
Create a partition structure in one of the following ways. Using the completepartitionstruct command at the MATLAB Command Window, create a default partition structure. For example, type
Partition = completepartitionstruct([],'scramnet')
Partition =
Address: '0x0'
Type: 'uint32'
Size: '1'
Alignment: '4'
RIE: 'off'
TIE: 'off'
ExtTrigger1: 'off'
ExtTrigger2: 'off'
HIPRO: 'off'
Internal: [1x1 struct]At the MATLAB Command Window, create a user-defined partition structure. The easiest way to do this is to create a script file, partially define a structure, load that script into the MATLAB workspace, and supplement the resulting structure with a call to the completepartitionstruct function. For example
Partition(1).Address='0x5000'; Partition(1).Type='int8'; Partition(1).Size='10'; Partition(2).Type='uint16'; Partition(2).Size='5'; Partition(3).Type='double'; Partition(3).Size='3'; Partition(4).Type='uint8'; Partition(4).Size='[2, 3]';
This example defines a partition with four segments.
The Address field is optional. Only specify this field for the first segment of a partition. The elements of a partition are defined as a continuous memory block from the first address. The function extrapolates segment addresses from the first segment definition. If you have or require fragmented memory, use multiple partitions.
The Type and Size fields are required for all segments in the partition structure.
The Alignment value is optional. It is '4' by default. This value forces segments that do not have alignment specifications to start on 4 byte (32–bit) boundaries.
The base addresses of subsequent segments are defined by the data type, size, and alignment of the preceding segment.
Call the completepartitionstruct() command to fully populate the partition structure.
Partition = completepartitionstruct(Partition,'scramnet');
In addition to shared memory partitions, you must also define a node initialization structure before using the SCRAMNet+ SC150 shared memory blocks. A node initialization structure describes the shared memory partitions (see Create Shared Memory Partitions) and the SCRAMNet+ SC150 board configuration, including any interrupt settings if used. The following SCRAMNet+ SC150 block requires a shared memory node initialization structure.
After defining the node initialization structure, you can add SCRAMNet+ SC150 shared memory driver blocks to your Simulink model. See Shared Memory Node Initialization Structure for the complete list of fields in a node initialization.
The following description refers to the completenodestruct command. Type
help completenodestruct
for more information.
Create a node initialization structure in one of the following ways. Using the completenodestruct command at the MATLAB Command Window, create a default node initialization structure. For example, type
node=completenodestruct([],'scramnet')
node =
Interface: [1x1 struct]
Partitions: [1x1 struct]Now modify the structure fields to meet your requirements. For example:
node.interface.NodeID = '128'; node.Partitions = Partition;
A user-defined node structure, created with MATLAB code or from the MATLAB Command Window and supplement the resulting structure with a call to the completenodestruct function. For example:
node.Interface.NodeID = '128'; node.Partitions = Partition; node = completenodestruct(node,'scramnet');
A shared memory partition structure has the following fields. You do not need to use all the fields of a partition or node initialization structure. However, knowing the possible structure fields will be helpful when you are setting up to use shared memory.
Address: '0x0'
Type: 'uint32'
Size: '1'
Alignment: '4'
RIE: 'off'
TIE: 'off'
ExtTrigger1: 'off'
ExtTrigger2: 'off'
HIPRO: 'off'
Internal: [1x1 struct]where
Partition Fields | Description |
|---|---|
Address | Specifies the base address (in hexadecimal) of the memory partition within the node's shared memory space. The default value is '0x0', the first location in shared memory. Note that the base address is byte aligned. |
Type | Specifies the data type of the memory segment. Specify one of the following types:
The default value is 'uint32'. A minimum partition size is 32 bits. |
Size | Specifies the dimension and size of the memory segment. You can enter a scalar value or a value with the [m,n] format. The default value is '1'.
|
Alignment | Specifies the byte alignment of the next partition (if one is defined). Enter alignment value in bytes: 1, 2, 3, 4. The default value is '4', forcing a double word boundary alignment for all elements. See Alignment Examples. |
RIE | Specifies whether or not this partition can receive interrupts (Receive Interrupt Register (RIE)). Specify 'off', 'first', 'all', 'last'. The default value is 'off'. 'off' — Prevents the partition from receiving interrupts 'first' — Allows only the first double word of the memory segment to be marked with the corresponding Auxiliary Control RAM bit. 'all' — Allows all memory locations of the memory segment to be marked with the corresponding Auxiliary Control RAM bit. 'last' — Allows only the last double word of the memory segment to be marked with the corresponding Auxiliary Control RAM bit. |
TIE | Specifies whether or not this partition can transmit interrupts (Transmit Enable (TIE)). Specify 'off', 'first', 'all', 'last'. The default value is 'off'. 'off' — Prevents the partition from transmitting interrupts 'first' — Allows only the first double word of the memory segment to be marked with the corresponding Auxiliary Control RAM bit. 'all' — Allows all memory locations of the memory segment to be marked with the corresponding Auxiliary Control RAM bit. 'last' — Allows only the last double word of the memory segment to be marked with the corresponding Auxiliary Control RAM bit. |
ExtTrigger1 | If this partition receives a write access, specifies whether or not this partition can generate a trigger signal to an external connector. Specify 'off', 'first', 'all', 'last'. The default value is 'off'. 'off' — Prevents the partition from generating signals 'first' — Allows only the first double word of the memory segment to be marked with the corresponding Auxiliary Control RAM bit. 'all' — Allows all memory locations of the memory segment to be marked with the corresponding Auxiliary Control RAM bit. 'last' — Allows only the last double word of the memory segment to be marked with the corresponding Auxiliary Control RAM bit. |
ExtTrigger2 | If this partition receives a write access, specifies whether or not this partition can generate a trigger signal to an external connector. Specify 'off', 'first', 'all', 'last'. The default value is 'off'. 'off' — Prevents the partition from generating signals 'first' — Allows only the first double word of the memory segment to be marked with the corresponding Auxiliary Control RAM bit. 'all' — Allows all memory locations of the memory segment to be marked with the corresponding Auxiliary Control RAM bit. 'last' — Allows only the last double word of the memory segment to be marked with the corresponding Auxiliary Control RAM bit. |
HIPRO | Specifies whether or not the elements in this partition can be transmitted as one network message. Specify 'off', or 'on'. The default value is 'off'. 'off' — Prevents the partition from transmitting the elements as one message 'on' — Allows the partition to transmit the elements as one message |
Internal | Reserved for internal use. |
Alignment Examples. This example shows the shared memory map with default alignment values.
Partition1(1).Type='int32'; Partition1(1).Size='1'; Partition1(2).Type='boolean'; Partition1(2).Size='1'; Partition1(3).Type='uint32'; Partition1(3).Size='1'; Partition1 = completepartitionstruct(Partition1,'scramnet');
![]()
This example shows the shared memory map with alignment value changed from 4 to 1 in the second partition.
Partition1(1).Type='int32'; Partition1(1).Size='1'; Partition1(1).Alignment='4'; Partition1(2).Type='boolean'; Partition1(2).Size='1'; Partition1(2).Alignment='1'; Partition1(3).Type='uint32'; Partition1(3).Size='1'; Partition1 = completepartitionstruct(Partition1,'scramnet');
![]()
This example shows the shared memory map with alignment value changed from 4 to 2 in the second partition.
Partition1(1).Type='int32'; Partition1(1).Size='1'; Partition1(1).Alignment='4'; Partition1(2).Type='boolean'; Partition1(2).Size='1'; Partition1(2).Alignment='2'; Partition1(3).Type='uint32'; Partition1(3).Size='1'; Partition1 = completepartitionstruct(Partition1,'scramnet');
![]()
A node initialization structure has the following fields:
Interface: [1x1 struct]
Partitions: [1x1 struct]where
Node Structure Fields | Description |
|---|---|
Interface | Specifies settings for the board Control/Status Register (CSR). The Interface structure has the following fields. Refer to the SCRAMNet+ SC150 product documentation for a description of the CSR and its operation modes.
|
Partitions | Stores the shared memory segments (see Create Shared Memory Partitions) |
Board Mode. The SCRAMNet+ SC150 board has a number of modes that you can set through the Interface.Mode field. The Interface Mode fields set the corresponding bits in the CSR. To display the board mode fields, type
>> node.Interface.Mode
ans =
NetworkCommunicationsMode: 'TransmitReceive'
InsertNode: 'on'
DisableFiberOpticLoopback: 'on'
EnableWireLoopback: 'off'
DisableHostToMemoryWrite: 'off'
WriteOwnSlotEnable: 'off'
MessageLengthLimit: '256'
VariableLengthMessagesOnNetwork: 'off'
HIPROEnable: 'off'
MultipleMessages: 'on'
NoNetworkErrorCorrection: 'on'
MechanicalSwitchOverride: 'on'
DisableHoldoff: 'on'These modes have the following values:
Field | Values | Default | CSR |
|---|---|---|---|
NetworkCommunications Mode | 'none', 'receiveonly', 'transmitonly', | 'transmit | CSR3[8..15] |
InsertNode | 'off', 'on' | 'on' | CSR0[0..1] |
DisableFiberOptic Loopback | 'off', 'on' | 'on' | CSR2[6] |
EnableWire Loopback | 'off', 'on' | 'off' | CSR2[7] |
DisableHost ToMemory Write | 'off', 'on' | 'off' | CSR2[8] |
WriteOwnSlotEnable | 'off', 'on' | 'off' | CSR2[9] |
Message LengthLimit | '256', '1024' | '256' | CSR2[11] |
Variable Length MessagesOn Network | 'off', 'on' | 'off' | CSR212] |
HIPROEnable | 'off', 'on' | 'off' | CSR2[13] |
Multiple Messages | 'off', 'on' | 'on' | CSR2[14] |
NoNetwork Error Correction | 'off', 'on' | 'on' | CSR2[15] |
Mechanical Switch Override | 'off', 'on' | 'on' | CSR8[11] |
Disable Holdoff | 'off', 'on' | 'on' | CSR8[11] |
Board Timeout. The SCRAMNet+ SC150 board allows you to set the network timeout through the Interface.Timeout field. The Interface Timeout fields set the corresponding bits in the CSR.
To display the timeout fields, type
>> node.Interface.Timeout
ans =
NumOfNodesInRing: '2'
TotalCableLengthInM: '2'These fields have the following values:
Field | Values | Default | CSR |
|---|---|---|---|
NumOfNodes InRing | '0'..'255' | '2' | CSR5 |
TotableCable LengthInM | '0'..'n' | '2' | CSR5 |
Refer to the SCRAMNet+ SC150 product documentation for a description of these fields.
Board Data Filter. The SCRAMNet+ SC150 board allows you to set the data filter operation through the Interface.DataFilter field. The Interface DataFilter fields set the corresponding bits in the CSR.
>> node.Interface.DataFilter
ans =
EnableTransmitDataFilter: 'off'
EnableLower4KBytesForDataFilter: 'off'
>>These fields have the following values:
Field | Values | Default | CSR |
|---|---|---|---|
Enable TransmitData Filter | 'off', 'on' | 'off' | CSR0[10] |
EnableLower4KBytesFor DataFilter | 'off', 'on' | 'off' | CSR0[11] |
Virtual Paging. The SCRAMNet+ SC150 board allows you to set the bits of the Virtual Paging Register operation through the Interface.VirtualPaging field. The Interface VirtualPaging fields set the corresponding bits in the CSR.
>> node.Interface.VirtualPaging
ans =
VirtualPagingEnable: 'off'
VirtualPageNumber: '0'These fields have the following values:
Field | Values | Default | CSR |
|---|---|---|---|
VirtualPagingEnable | 'off', 'on' | 'off' | CSR12[0] |
VirtualPage Number | '0'..'2047' | '0' | CSR12[5..15] |
Board Interrupts. The SCRAMNet+ SC150 board allows you to specify the interrupt sources transmitted and received between the nodes of the network. You can set these bits through the Interface.Interrupts field. The Interface Interrupts fields set the corresponding bits in the CSR.
>> node.Interface.Interrupts
ans =
HostInterrupt: 'off'
InterruptOnMemoryMaskMatch: 'off'
OverrideReceiveInterrupt: 'off'
InterruptOnError: 'off'
NetworkInterrupt: 'off'
OverrideTransmitInterrupt: 'off'
InterruptOnOwnSlot: 'off'
ReceiveInterruptOverride: 'off'
These fields have the following values:
Field | Values | Default | CSR |
|---|---|---|---|
HostInterrupt | 'off', 'on' | 'off' | CSR0[3] |
InterruptOn MemoryMask Match | 'off', 'on' | 'off' | CSR0[5] |
Override Receive Interrupt | 'off', 'on' | 'off' | CSR0[6] |
InterruptOn Error | 'off', 'on' | 'off' | CSR0[7] |
Network Interrupt | 'off', 'on' | 'off' | CSR0[8] |
Override Transmit Interrupt | 'off', 'on' | 'off' | CSR0[9] |
InterruptOn OwnSlot | 'off', 'on' | 'off' | CSR2[10] |
Receive Interrupt Override | 'off', 'on' | 'off' | CSR8[10] |
![]() | GE Intelligent Platforms Shared Memory | Boards and Blocks — Alphabetical List | ![]() |

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