Main Content

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®.

SignalDescriptionData Type
starttrue for the first sample in the frameBoolean
endtrue for the last sample in the frameBoolean
validtrue for any valid sampleBoolean

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')
You can also call this command from the MATLAB command line.

See Also

Blocks

Related Topics