Create bus from input signals
Simulink / Commonly Used Blocks
Simulink / Signal Routing
HDL Coder / Signal Routing
The Bus Creator block combines a set of input signals into a bus. You can connect any signal types to the input ports, including other buses. You can access signals in a bus by using a Bus Selector block.
Elements of a bus must have unique names. By default, each element of the bus inherits
the name of the signal connected to the Bus Creator block. If duplicate
names are present, the Bus Creator block appends the port number to all
input signal names. For signals that do not have names, the Bus Creator
block generates names in the form signaln
, where n
is the port number connected to the signal. You can refer to signals by name when you
search for their sources or select signals for connection to other blocks. For signal
naming guidelines, see Signal Names and Labels.
Port_1
— Input signal to include in busInput signal to include in the bus, specified as a scalar, vector, matrix, N-D array, or bus.
The number of input ports is driven by the Number of inputs parameter.
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| Boolean
| fixed point
| enumerated
| bus
Complex Number Support: Yes
Port_1
— Output busOutput bus composed of the combined input signals, specified as a virtual or nonvirtual bus. For more information on the types of buses, see Types of Composite Signals.
Data Types: bus
Number of inputs
— Number of input signalsNumber of input signals, not fewer than two, specified as an integer. Increasing the number of inputs adds empty input ports to the block. Before you simulate the model, make sure that an input signal is connected to each input port.
When you modify the Number of inputs parameter, click Refresh to update the list of signals.
If all input ports are already connected, you can add an input port to the Bus Creator block by connecting another signal line to it.
Interactively adding a port updates the Number of inputs parameter and adds the new signal to the list of signals in the bus.
Block Parameter:
Inputs |
Type: character vector |
Values: integer greater than or equal to 2, comma-separated list of signal names |
Default:
'2' |
By default, the Inputs
parameter specifies the
number of inputs. When you use it to specify the names of signals in the
bus, the number of inputs matches the number of signal names you
specify.
Signals in the bus
— List of input signalsList of input signals to combine into a bus. You can view all signals entering the block, including the signals contained in nested buses. An arrow next to a signal indicates that an input signal is a bus. To display the contents of that bus, click the arrow.
To rearrange the signals in the output bus, use the Up and Down buttons. You can select multiple top-level adjacent signals in the Signals in the bus list to reorder or remove.
To find the source of any signal entering the block, select the signal in the Signals in the bus list and click the Find button. Simulink® highlights the icon of the source, opening the subsystem that contains the signal source, if necessary.
If you change a signal name while the Block Parameters dialog box is open, you can see the updated name by clicking Refresh.
Block Parameter:
Inputs |
Type: character vector |
Values: integer greater than or equal to 2, comma-separated list of signal names |
Default:
'2' |
By default, the Inputs
parameter specifies the
number of inputs. When you use it to specify the names of signals in the
bus, the number of inputs matches the number of signal names you
specify.
Filter by name
— Search term for filtering displayed input signalsSearch term for filtering displayed input signals, specified as text. Do not enclose the search term in quotation marks. The filter does a partial string search.
To access the filtering options, click the Show filtering
options
button to the right of the Filter by
name box.
Enable regular expression
— Option to filter displayed input signals by regular expressionOption to filter the displayed input signals by regular expression.
When this parameter is enabled, entering t$
in the
Filter by name box displays all signals whose names
end with a lowercase t
(and their immediate parents). For
details, see Regular Expressions (MATLAB).
To access this parameter, click the Show filtering
options
button to the right of the Filter by
name box.
Show filtered results as a flat list
— Option to display filtered results as a flat listOption to display filtered results as a flat list that uses dot notation to reflect the hierarchy of buses. By default, the filtered signals appear in a hierarchical tree.
To access this parameter, click the Show filtering
options
button to the right of the Filter by
name box.
Output data type
— Data type of output bus'Inherit: auto'
(default) | 'Bus: <object name>'
| <data type expression>
Data type of the output bus.
If you select 'Bus: <object name>'
, specify
a Simulink.Bus
object. The
Bus
object must be accessible when you update the
diagram or simulate the model. To define a Bus
object using
the Bus
Editor, click the Show data type assistant
button , and then click the
Edit button.
If you select '<data type expression>'
,
specify an expression that evaluates to a data type. Do not specify a
Bus
object as the expression.
Block Parameter:
OutDataTypeStr |
Type: character vector |
Values:
'Inherit: auto' | 'double'
| 'single' | 'int8' |
'uint8' | 'int16' |
'uint16' | 'int32' |
'uint32' |
'int64' 'uint64' 'boolean'
| 'fixdt(1,16,0)' |
'fixdt(1,16,2^0,0)' | 'Enum:
<class name>' | 'Bus: <object
name>' |
Default:
'Inherit: auto' |
Require input signal names to match signals above
— Check that input signal names match names listed in dialog boxCheck that the input signal names match the names listed in the Block Parameters dialog box. If the signal names do not match, Simulink returns an error.
The Require input signal names to match signals above parameter might be removed in a future release. To enforce strong data typing, consider using the Override bus signal names from inputs parameter.
If you select Override bus signal names from inputs, the Simulink software ignores the Require input signal names to match signals above setting.
If you change the Number of inputs
programmatically, this parameter reverts to
'off'
.
Rename selected signal
— New name for selected input signal''
(default) | character vectorNew name for the selected input signal. See Signal Names and Labels for signal name guidelines.
To display this parameter, enable the Require input signal names to match signals above parameter.
Override bus signal names from inputs
— Option to override names from Simulink.Bus object with input signal namesBy default, the Bus Creator block overrides the names
specified by the Simulink.Bus
object and uses the input
signal names as the output bus element names.
To inherit bus element names from the Bus
object, clear
this parameter. Clearing the parameter:
Enforces strong data typing.
Avoids having to enter a signal name multiple times: in the
Bus
object and in the model. Entering the name
multiple times can accidentally create signal name
mismatches.
Supports the array of buses requirement to have consistent signal names across array elements.
Alternatively, you can enforce strong data typing by checking that input
signal names match the Bus
object element names.
Keep the Override bus signal names from inputs check box selected.
Set the Element name mismatch
configuration parameter to error
.
To display this parameter, set the Output data
type parameter to a Bus
object.
Block Parameter:
InheritFromInputs |
Type: character vector |
Values:
'on' | 'off' |
Default:
'on' |
Output as nonvirtual bus
— Output nonvirtual busOutput a nonvirtual bus instead of a virtual bus.
All signals in a nonvirtual bus must have the same sample time, even if
the elements of the associated Bus
object specify inherited
sample times for some elements. Any operation resulting in a nonvirtual bus
containing signals with different sample rates generates an error. To change
the sample time of a signal or bus that has a different sample time than the
other nonvirtual bus input signals, use a Rate Transition block. For
details, see Modify Sample Times for Nonvirtual Buses.
To generate code that uses a C structure to define the structure of the bus that this block creates, enable this parameter.
To display this parameter, set the Output data
type parameter to a Bus
object.
Block Parameter:
NonVirtualBus |
Type: character vector |
Values:
'on' | 'off' |
Default:
'off' |
Data Types |
|
Direct Feedthrough |
|
Multidimensional Signals |
|
Variable-Size Signals |
|
Zero-Crossing Detection |
|
For buses at subsystem and model interfaces, you can use Out Bus Element blocks instead of a Bus Creator block with an Outport block. Out Bus Element blocks:
Reduce signal line complexity and clutter in a block diagram.
Make it easier to change the interface incrementally.
Actual data type or capability support depends on block implementation.
HDL Coder™ provides additional configuration options that affect HDL implementation and synthesized logic.
To learn more about using buses for HDL code generation, see Buses (HDL Coder) and Use Bus Signals to Improve Readability of Model and Generate HDL Code (HDL Coder).
This block has a single, default HDL architecture.
ConstrainedOutputPipeline | Number of registers to place at
the outputs by moving existing delays within your design. Distributed
pipelining does not redistribute these registers. The default is
|
InputPipeline | Number of input pipeline stages
to insert in the generated code. Distributed pipelining and constrained
output pipelining can move these registers. The default is
|
OutputPipeline | Number of output pipeline stages
to insert in the generated code. Distributed pipelining and constrained
output pipelining can move these registers. The default is
|
Actual data type or capability support depends on block implementation.
Bus Assignment | Bus Selector | Bus to Vector | Out Bus Element