Documentation

Bus Selector

Select signals from incoming bus

  • Library:
  • Simulink / Commonly Used Blocks

    Simulink / Signal Routing

Description

The Bus Selector block outputs a specified subset of the elements of the bus at its input. The block can output the specified elements as separate signals or as a new bus.

By default, Simulink® implicitly converts a nonbus signal to a bus signal to support connecting the signal to a Bus Selector block. To prevent Simulink from performing that conversion, set the Non-bus signals treated as bus signals diagnostic to warning or error.

When the block outputs multiple elements, it outputs each element from a separate port from top to bottom of the block. See Port Location After Rotating or Flipping for a description of the port order for various block orientations.

In the Simulink Editor, as you draw a new signal line close to output side of a Bus Selector block and all output ports are already connected, Simulink Editor:

  • Adds a port

  • Prompts you to specify the signal to be selected

You cannot use this automatic port addition approach in either of these cases if:

  • There is no bus input signal connected to the Bus Selector block.

  • You do not specify a signal in response to the prompt that appears when you draw a signal line close to the Bus Selector block icon.

  • You select the Output as bus parameter.

Tip

For models that include bus signals composed of many bus elements that feed subsystems, consider using the In Bus Element and Out Bus Element blocks. You can use these bus element port blocks instead of Inport with Bus Selector blocks for inputs, and Outport with Bus Creator blocks for outputs. These bus element port blocks:

  • Reduce signal line complexity and clutter in a block diagram.

  • Make it easier to change the interface incrementally.

  • Allow access to a bus element closer to the point of usage, avoiding the use of a Bus Selector and Goto block configuration.

Ports

Input

expand all

Input bus signals can have real or complex values of any data type supported by Simulink except for arrays of buses. To work with an array of buses signal, select with a Selector block the index for the bus element that you want to use with the Bus Selector block. Then use that selected bus element with the Bus Selector block.

Output

expand all

Output selected bus element signals of an input bus signal.

When the block outputs separate elements, it outputs each element from a separate port from top to bottom of the block. See Port Location After Rotating or Flipping for a description of the port order for various block orientations.

If you select the Output as bus parameter, the output bus is virtual. To produce nonvirtual bus output, insert a Signal Conversion block after the Bus Selector block. Set the Signal Conversion block Output parameter to Nonvirtual bus and use a Simulink.Bus bus object for the Data type parameter. For an example, see the Signal Conversion documentation.

Parameters

expand all

List of bus element signals of the input bus, from which to select signals to output. To select a signal to output, click the signal in the list and then click Select>>.

To refresh the display to reflect modifications to the bus connected to the block, click Refresh.

To find the source of a signal entering the block, select the signal in the list and click Find. The Simulink software highlights the signal source in the block diagram.

Programmatic Use

Block Parameter:InputSignals
Type:matrix
Values:signal name
Default:{'[]'}

Specify a search term to use for filtering a long list of input signals. Do not enclose the search term in quotation marks. The filter does a partial string search. To access filtering options, including using a regular expressionto specify the search term, click the button on the right side of the Filter by name edit box.

Enable the use of MATLAB® regular expressions for filtering signal names. For example, entering t$ in the Filter by name edit box displays all signals whose names end with a lowercase t (and their immediate parents). For details, see Regular Expressions (MATLAB).

Dependencies

To access this parameter, click the button on the right side of the Filter by name edit box.

By default, a tree displays the filtered signals, based on the search text in the Filter by name edit box. Select this parameter to use a flat list format that uses dot notation to reflect the hierarchy of bus signals.

Dependencies

To access this parameter, click the button on the right side of the Filter by name edit box

If an output signal listed in the Selected signals list box is not an input to the Bus Selector block, the signal name starts with three question marks (???).

You can change the list by using the Up, Down, and Remove buttons. To save your changes, click Apply. You can select multiple contiguous signals to move or remove. You cannot rearrange leaf signals within a bus. For example, you can move bus signal Bus1 up or down in the list, but you cannot reorder any of the bus elements of Bus1. Port connectivity is maintained when you change the signal order.

Programmatic Use

Block Parameter:OutputSignals
Type:character vector
Values:character vector in the form of 'signal1',signal2'
Default:none

By default, the block outputs the selected elements as standalone signals, each from an output port that is labeled with the corresponding bus element name. To output the selected bus element signals as a bus, select this parameter.

The output bus is virtual. To produce nonvirtual bus output, insert a Signal Conversion block after the Bus Selector block. Set the Signal Conversion block Output parameter to Nonvirtual bus and use a Simulink.Bus bus object for the Data type parameter. For an example, see the Signal Conversion documentation.

When the Selected signals list includes only one signal and you enable Output as bus, then if the selected signal is:

  • A nonbus signal, it is treated as a nonbus signal (it is not wrapped in a bus).

  • A bus signal, then the output is that bus signal.

Programmatic Use

Block Parameter:OutputAsBus
Type:character vector
Values:'on' | 'off'
Default:'off'

Block Characteristics

Data Types

double | single | Boolean | base integer | fixed point | enumerated | bus

Multidimensional Signals

Yes

Variable-Size Signals

Yes

Extended Capabilities

HDL Code Generation
Generate Verilog and VHDL code for FPGA and ASIC designs using HDL Coder™.

Introduced before R2006a

Was this topic helpful?