Sample Control Bus
Wireless HDL Toolbox™ blocks use a nonvirtual bus data type, samplecontrol
, for
control signals associated with serial data. The bus contains three
boolean
signals indicating the validity of a sample and the
boundaries of the frame. You can easily connect one block to another, because all
Wireless HDL Toolbox blocks use this bus for input and output. To convert frames into a sample
stream and a samplecontrol
bus, use the Frame To Samples
block. This block serializes fixed-size frames. If your frames vary in size, use the
whdlFramesToSamples
function to convert the frames to a data vector in
MATLAB®, and then import the data into Simulink®.
Signal | Description | Data Type |
---|---|---|
start | true for the first sample in the frame | Boolean |
end | true for the last sample in the frame | Boolean |
valid | true for any valid sample | Boolean |
Troubleshooting:
When you generate HDL code from a Simulink model that uses this bus, you may need to declare an instance of
samplecontrol
bus in the base workspace. If you encounter the
error Cannot resolve variable 'samplecontrol'
when you generate HDL
code in Simulink, use the samplecontrolbus
function to create an
instance of the bus type. Then try generating HDL code again.
To avoid this issue, the Wireless HDL Toolbox model template includes this line in the InitFcn
callback.
evalin('base','samplecontrolbus')