Target Language Compiler | ![]() ![]() |
Signal Connections
The example shows a model and its corresponding BlockOuptuts record and the way SignalSrc
and SignalOffset
with Block records is used to access signals.
The relevant BlockOuptuts and Block records in the model.rtw file and the way the signal feeding the Scope block is accessed are shown below.
BlockOuptuts { ... BlockOutput { Identifier Constant4 Width 5 TestPoint yes SigSrc [0, -1, 0, 0] } BlockOutput { Identifier Constant1 Width 5 TestPoint yes SigSrc [0, -1, 1, 0] } BlockOutput { Identifier Gain2 Width 10 TestPoint yes SigSrc [0, -1, 2, 0] SigConnected [0, 1@4, 0@5] } } ... Block { Type Scope BlockIndex [0, -1, 3] ... RollRegions [0:3] NumDataInputPorts1 DataInputPort { SignalSrc [B2@4] SignalOffset [1:4] Width 4 } }
To access the block I/O signal feeding the Scope
block, we use its DataInputPort
records SignalSrc
and SignalOffset
. SignalSrc
B2@4
refers to the BlockOutput
index `2' and width of 4. BlockOutputs.BlockOutput[2]
. Using SignalOffset[i]
, i going from 0 to 3, we access the 2nd to 5th element in the 10 element vector from Gain2
.(rtB.Gain2[1]
to rtB.Gain2[4]
).
Prior to TLC version 4.1, this was done using SignalSrc[B11:B14
] and this will map throughout the BlockOutputsMap
to the absolute offset in the BlockOutput
record.
![]() | Block I/O Information | Using BlockOutput[i].SigSrc | ![]() |