Variant Subsystem
Template subsystem containing Subsystem blocks as variant choices
Libraries:
Simulink /
Ports & Subsystems
HDL Coder /
Ports & Subsystems
Alternative Configurations of Variant Subsystem Block:
Variant Model | Variant Assembly Subsystem
Description
The Variant Subsystem block enables you to include multiple implementations of a component in a separate hierarchy.
For example, suppose you want to simulate a model that represents a vehicle with three possible engine configurations: 2-cylinder gas, 4-cylinder gas, and 8-cylinder gas. You could implement each engine model as a separate subsystem inside the Variant Subsystem block and then switch between the subsystems based on the Types of Variant Control Modes in Variant Blocks you select. For more information, see Introduction to Variant Controls.
Note
Only one implementation of a Variant Subsystem block is active during simulation.
The Variant Subsystem block is a template preconfigured to contain two or more blocks to use as variant choices. These choices represent multiple implementations of a system. Only one child block is active during model execution. The active child block is referred to as the active variant.
Each variant choice inside the Variant Subsystem block is associated with a Variant control mode and a Variant activation time. The variant control mode determines how to select the active variant. The variant activation time determines a time to activate the choices and to decide whether to include only the active choice or both active and inactive choices in the generated code.
A Variant Subsystem block can contain a mixture of Subsystem blocks, Model blocks, or Subsystem Reference blocks as variant choices. A Variant Subsystem block with only Model blocks as choices is called a Variant Model block. For more information, see Implement Variations in Separate Hierarchy Using Variant Subsystems. A Variant Subsystem block with Model or Subsystem Reference blocks as choices that can be added or removed only from external files and not within the block is called a Variant Assembly Subsystem block.
Apart from the variant choices, you can include Inport, control port (Enable, Trigger, Reset, and Function-Call), Outport, or Connection Port (Simscape) blocks inside a Variant Subsystem block. There are no drawn connections between the blocks that are inside the Variant Subsystem blocks. The software automatically wires the active variant to the Inport and Outport blocks of the Variant Subsystem during model compilation. The blocks representing variant choices can have input and output ports that differ in number from the input and output ports in the parent Variant Subsystem block. For more information, see Map Input and Output Ports of Variant Choices in Variant Subsystem.
Using Variant Subsystem block allows you to:
Mix Subsystem, Model, and Subsystem Reference blocks as variant choices.
Model components that do not have similar interface. You can have different numbers of inports and outports for multiple variant choices inside a Variant Subsystem. However, the conditions listed in Map Input and Output Ports of Variant Choices in Variant Subsystem must be met.
Establish a hierarchical block diagram, where the Variant Subsystem block is on one layer and the variant choices are on another layer.
Keeps functionally related blocks together.
Reduce the complexity of your model.
During model compilation, the software eliminates inactive blocks throughout the model, depending on the variant activation time you select.
The color and icon of the variant badge on the block icon changes depending on the values of the Variant activation time, Variant control mode, and Propagate conditions outside of variant subsystem parameters set on the block. For more information, see Variant Badges.
Examples
Implement Variations in Separate Hierarchy Using Variant Subsystems
Learn basic functionality of variant subsystems.
Ports
During simulation, the software disables the inactive ports in a Variant Subsystem block.
Input
In_1 — Input port corresponding to root-level Inport blocks in variant
subsystem
same data types accepted by Inport blocks
Each Subsystem, Model, or Subsystem Reference block contained within a Variant Subsystem represents one variant choice. The variant choices can contain Inport, control port (Enable, Trigger, Reset, and Function-Call), or Connection Port (Simscape) blocks at its input. The variant choices can have input ports that differ in number from the input ports in the parent Variant Subsystem block. However, the conditions described in Map Input and Output Ports of Variant Choices in Variant Subsystem must be met.
Output
Out_1 — Output port corresponding to root-level Outport blocks contained in variant
subsystem
same data types accepted by Outport blocks
Each Subsystem, Model, or Subsystem Reference block contained within a Variant Subsystem represents one variant choice. The variant choices can contain Outport or Connection Port (Simscape) blocks at its output. The variant choices can have output ports that differ in number from the output ports in the parent Variant Subsystem block. However, the conditions described in Map Input and Output Ports of Variant Choices in Variant Subsystem must be met.
The unconnected output ports (inactive output ports) of a Variant Subsystem block output a ground value. To output a value other than ground, select the Specify output when source is unconnected parameter of the Outport block and specify a value.
Map Input and Output Ports of Variant Choices in Variant Subsystem
A Variant Subsystem block allows you to use a combination of Subsystem, Model, or Subsystem Reference blocks as variant choices. The inputs that the Variant Subsystem block receives from upstream model components map to the input and output ports of the variant choices.
The blocks that represent variant choices can have input and output ports that differ in number from the input and output ports in the parent Variant Subsystem block. However, the following conditions must be met:
The variant choices must have same set of input ports as the Variant Subsystem container block or it must be a subset of ports on the container block.
The variant choices must have same set of output ports as the Variant Subsystem container block or it must be a subset of ports on the container block.
If the Variant Subsystem container block has control ports:
The type of control port blocks in all the variant choices must be same as the Variant Subsystem block. For example, you cannot use Enabled Subsystem and Function-Call Subsystem blocks as choices within a Variant Subsystem block.
The control port on the Variant Subsystem block and the corresponding control ports on its variant choices must have the same name. For example, if the name of the control port on the Variant Subsystem block is
fcn
, then the name of the corresponding control ports on all its variant choices must also befcn
.
Parameters
To access these parameters, right-click the variant badge on the block icon and select Block Parameters. For more information, see Variant Badges.
Variant control mode — Variant control mode
expression
(default) | label
| sim codegen switching
The variant control that determines the active variant choice can be any of these types.
expression
— The software chooses the active variant based on the evaluation of the variant conditions. When a condition expression evaluates totrue
, the corresponding variant choice becomes active. When a condition expression evaluates tofalse
, the corresponding variant choice becomes inactive. See Switch Between Choices Using Condition Expressions in Variant Blocks.label
— The software chooses the active variant based on the name of the variant. The variant control is a string and does not require you to create any variable in any workspaces. See Switch Between Choices Using Labels in Variant Blocks.sim codegen switching
— Automatically switch between the variants for simulation and code generation workflows without creating any workspace variable. When you simulate a model, the software automatically chooses thesim
branch as the active choice. Similarly, when you do a software-in-the-loop (SIL) or processor-In-Loop (PIL) simulation, generate code, or use external mode, the software automatically chooses thecodegen
branch. See Switch Between Choices for Simulation and Code Generation Workflows Without Using Control Variables in Variant Blocks.
For more information on variant control modes, see Introduction to Variant Controls. For a comparison between different types of variant control modes, see Compare Different Types of Variant Control Modes in Variant Blocks.
Dependencies
The availability of different variant activation times depends on the type of the Variant control mode that you specify. The Variant activation time parameter determines the time when the software sets the active choice. The parameter also determines which variability to include in the generated code. This table explains the variant activation time supported by each variant control mode.
Variant activation time | ||||
---|---|---|---|---|
Variant control mode | update diagram | update diagram analyze all
choices | code compile | startup |
expression | ✓ | ✓ | ✓ | ✓ |
label | ✓ | x | x | x |
sim codegen switching | ✓ | ✓ | x | x |
Programmatic Use
Block Parameter:
VariantControlMode
|
Type: character vector |
Values:
'expression' | 'label' | 'sim
codegen switching' |
Default:
'expression'
|
Variant activation time — Time when software chooses active variant choice
update diagram
(default) | update diagram analyze all choices
| code compile
| startup
| inherit from Simulink.VariantControl
This parameter determines which variability to include in the simulation and code generation workflows. For more information, see Activate Variant During Different Stages of Simulation and Code Generation Workflow.
update diagram
— When you execute the model, only the active choice is included in the simulation and the code generation workflow. Generated code contains only the active choice.update diagram analyze all choices
— When you execute the model, both active and inactive choices are analyzed for consistency across the model. However, only the active choice is included in the simulation and the code generation workflow. Generated code contains only the active choice.code compile
— When you execute the model, both active and inactive choices are analyzed for consistency across the model, and all choices are included in the simulation and the code generation workflow. Generated code contains both the active and inactive choices enclosed in the preprocessor conditionals#if
and#elif
. However, the executable built from the generated code contains only active choice.startup
— When you execute the model, both active and inactive choices are analyzed for consistency across the model, and all choices are included in the simulation and the code generation workflow. With this option, you can improve the speed of iterative simulations using fast restart. For more information, see Run Iterative Simulations Without Recompiling Model for Variant Systems Using Fast Restart. Code generated from the model contains both the active and inactive choices that are enclosed in regularif
conditions. The executable built from the generated code also contains both active and inactive choices.inherit from Simulink.VariantControl
— When you execute the model, the block inherits the activation time from its variant control variables of typeSimulink.VariantControl
. If a variant block has multiple variant control variables of typeSimulink.VariantControl
, then all those variables must have the same activation time.
Dependencies
The availability of different variant activation times depends on the type of the variant control mode that you specify. The Variant activation time parameter determines when the software sets the active choice. The parameter also determines which variability to include in the generated code. This table explains the variant activation time supported by each variant control mode.
Variant activation time | ||||
---|---|---|---|---|
Variant control mode | update diagram | update diagram analyze all
choices | code compile | startup |
expression | ✓ | ✓ | ✓ | ✓ |
label | ✓ | x | x | x |
sim codegen switching | ✓ | ✓ | x | x |
Programmatic Use
Block Parameter:
VariantActivationTime
|
Type: character vector |
Values:
'update diagram' | 'update diagram analyze all
choices' | 'code compile' |
'startup'
|
Default:
'update diagram'
|
Variant control variable — Variable to determine active variant choices
Simulink.VariantControl
object | scalar variable | Simulink.Parameter
object | struct
When you specify a variable of type listed in Types of Variant Control Variables (Operands) in Variant Blocks, the
software generates variant control expressions for the variant choices of the
Variant Assembly Subsystem block. The Variant
control variable that you specify here is on the left side and
the members of the Variant enumeration choice are on the
right side of the generated expressions. Both the sides are related by
==
.
The variant control variable acts as a switch to change the active variant
choice. You specify a value for a variant control variable and run the
simulation. During simulation, the software evaluates the variant control
expressions to determine the active variant choice. When an expression evaluates
to true
, the corresponding variant choice is set active. To
change the active variant, change the value of the variant control variable such
that the corresponding variant control expression evaluates to
true
turns active.
Dependencies
This parameter is available only in Variant Assembly
Subsystem block. To enable this parameter, set Variant
control mode to expression
.
Programmatic Use
Block Parameter:
VariantControlVariable
|
Type: character vector |
Values:
Simulink.VariantControl object, scalar variable,
Simulink.Parameter object,
struct |
Default:
'' |
Variant choices enumeration — Enumeration class to add variant choices
enumeration class with model or subsystem filenames as its members
To add Model or Subsystem Reference blocks as
variant choices to a Variant Assembly Subsystem block, specify an
enumeration class name that contains the corresponding model or subsystem
filenames as its members. You can then validate the enumeration class using the
Refresh button in the Variant choices table. On a
successful validation, the members of the enumeration class are added as variant
choices to the Variant Assembly Subsystem block. Each choice has
a variant control expression with Variant control
variable on its left side and the members of the
Variant choices enumeration that you specify here on
its right side. Both the sides of the expression are related by
==
. The newly added variant choices and their
corresponding control expressions are displayed in the Variant
choices table.
To remove variant choices from a Variant Assembly Subsystem block, remove the corresponding members from the enumeration class that you specify here. You cannot manage the variant choices from inside the Variant Assembly Subsystem block.
The enumeration class that you specify must be on the search path of your
current MATLAB® session. For information on how to add files or folders to the
search path, see addpath
.
For more information on how to add choices using the Variant choices enumeration parameter, see Add or Remove Variant Choices of Variant Assembly Subsystem Blocks Using External Files.
Dependencies
This parameter is available only in Variant Assembly
Subsystem block. To enable this parameter, set Variant
control mode to expression
.
Programmatic Use
Block Parameter:
VariantChoicesEnumeration
|
Type: character vector |
Values: enumeration class defined using
classdef or
Simulink.defineIntEnumType |
Default:
'' |
Variant choices specifier — MATLAB expression to add variant choices
any MATLAB expression that evaluates to a one-dimensional cell array of model
or subsystem filenames, or filename patterns that match the model or subsystem
filenames or an array of strings
To add Model or Subsystem Reference blocks as variant choices to a Variant Assembly Subsystem block, specify the corresponding model or subsystem filenames. The filenames must be specified as a MATLAB expression that returns a one-dimensional cell array of character vectors when evaluated or an array of strings. You can then validate the expression using the Refresh button in the Variant choices table. On a successful validation, the blocks that correspond to the specified files are added as variant choices to the Variant Assembly Subsystem block. For each choice, a variant control label is generated. The name of the variant control label is same as the name of the choice. The newly added variant choices and their corresponding control labels are displayed in the Variant choices table.
To remove variant choices from a Variant Assembly Subsystem block, modify the expression specified in this parameter. You cannot manage the variant choices of a Variant Assembly Subsystem block from inside the block.
The MATLAB expression that you specify must contain either of these:
Model or subsystem filenames that are on the search path of your current MATLAB session. For example, if you specify
{'model1.slx', 'subsystemRef1.slx'}
as a specifier, the blocks that correspond to themodel1.slx
andsubsystemRef1.slx
files are added as variant choices of the Variant Assembly Subsystem block.File name patterns that match the model or subsystem filenames on the MATLAB path. The paths in the pattern can be absolute or relative to the parent folder of the model that contains the Variant Assembly Subsystem block. For example, if you specify
{'folder_1/*.slx', 'folder_2/*.slx'}
as a specifier, the software passes the character vectorsfolder_1/*
andfolder2/*
to thedir
function. The function then returns the model and the subsystem files that are located inside thefolder1
andfolder2
folders. The blocks that correspond to the returned files are added as variant choices of the Variant Assembly Subsystem block.
For information on how to add files or folders to the search
path, see addpath
.
For more information on how to specify choices in the Variant choices specifier parameter, see Add or Remove Variant Choices of Variant Assembly Subsystem Blocks Using External Files.
Dependencies
This parameter is available only in Variant Assembly
Subsystem block. To enable this parameter, set Variant
control mode to label
.
Programmatic Use
Parameter:
VariantChoicesSpecifier
|
Type: character vector |
Value: Any MATLAB expression that evaluates to a one-dimensional cell array of filenames or filename patterns. |
Default:
'' |
Variant choices (table of variant systems) — Table of variant choices, variant controls, and conditions
empty table (default)
The table has a row for each variant choice contained in the variant subsystem. If there are no variant choices, the table is empty.
You can use buttons to the left of the Variant choices table to modify the elements in the table.
To... | Click... |
---|---|
Create and add a new subsystem choice: Create a new Subsystem block as a variant choice and add an entry for the new choice in the table. | |
Create and add a new model variant choice: Create a new Model block as a variant choice and add an entry for the new choice in the table. | |
Delete selected variant choices: Delete variant choices permanently. |
|
Create/Edit selected variant
object: Create or edit a
Note For a model that uses the base workspace, this
operation creates the
| |
Open selected variant choice block: Open the Subsystem block for the selected row. | |
Refresh dialog information from Variant Subsystem contents: Update the Variant choices table according to the variant choices and values of the variant control in the global workspace. |
Dependencies
The Variant Assembly Subsystem block allows you to only open the selected variant choice and refresh the list of variant choices using the buttons in this section. To add new variant choices to the Variant Assembly Subsystem block, see Add or Remove Variant Choices of Variant Assembly Subsystem Blocks Using External Files.
Name (read-only) — Variant choice name
Subsystem
and
Subsystem1
(default) | name of choices contained in Variant Subsystem
This parameter is read-only.
This parameter displays the
name of the choices. Each choice has a variant control in the form of labels,
expressions, or switches. For Variant Assembly Subsystem in the
label
mode, no separate variant control is
available. The name of the choice is used as a variant control to set the active
choice.
Variant control label — Name of choice in label
mode
true
or false
(default) | string
A name for a choice, specified as a string.
Dependencies
To enable this parameter, set Variant control mode to
label
.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
To get the block parameter value
programmatically, use the get_param
function.
Parameter: | VariantControl |
Values: | variant control that is associated with the variant choice |
Data Types: | char |
Example: set_param(gcb, 'VariantControl', 'V == 3')
,
where gcb
is the variant choice of the Variant
Subsystem block.
Example: get_param(gcb, 'VariantControl')
, where
gcb
is the variant choice of the Variant
Subsystem block.
Variant control switch — Variant choices for simulation and code generation workflows
(sim)
| (codegen)
Specify (sim)
to activate the corresponding variant choice
during simulation. Specify (codegen)
to activate the
corresponding variant choice while performing code generation workflows such as
SIL, PIL, external mode, and so on.
Dependencies
To enable this parameter, set Variant control mode to
sim codegen switching
.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
To get the block parameter value
programmatically, use the get_param
function.
Parameter: | VariantControl |
Values: | variant control that is associated with the variant choice |
Data Types: | char |
Example: set_param(gcb, 'VariantControl', '(sim)')
,
where gcb
is the variant choice of the Variant
Subsystem block.
Example: get_param(gcb, 'VariantControl')
, where
gcb
is the variant choice of the Variant
Subsystem block.
Variant control expression — Condition expression that determines the active choice
true
or false
(default) | boolean condition expression | a Simulink.VariantExpression
object representing a boolean condition
expression | (default)
Specify the condition expression to determine the active choice. When a condition
expression evaluates to true
, the software activates the
corresponding variant choice. When a condition expression evaluates to
false
, the software deactivates the corresponding variant
choice.
The variant controls can be:
Boolean condition expression for rapid prototyping. For example,
A == 1
,A ~= B
,A && B == 1
, and so on.A
Simulink.VariantExpression
object that contains a condition expression for condition reuse. See Simulink.VariantExpression Objects for Variant Condition Reuse of Variant Blocks.Default Variant Choice if none of the choices evaluates to
true
.
Here, A
and B
are operands called
as variant control variables. ==
,
~=
, and &&
are operators in the
condition expression. The condition expression can contain one or more such variant
control variables and operators. For information on supported types and storage location
of variant control variables, see Types of Variant Control Variables (Operands) in Variant Blocks and Storage Locations for Variant Control Variables (Operands) in Variant Blocks. For information
on operators, see Types of Operators in Variant Blocks for Different Activation Times.
For more information, see Switch Between Choices Using Condition Expressions in Variant Blocks.
In Variant Assembly Subsystem block, this parameter is a list of
auto-generated boolean expressions with Variant control variable on
the left-hand side and the members of the Variant enumeration
choice are on the right-hand side of the expressions. Both the sides of
the expressions are connected with ==
. This parameter is
read-only.
Programmatic Use
To set the block parameter value programmatically, use
the set_param
function.
To get the block parameter value
programmatically, use the get_param
function.
Variant Subsystem block:
Parameter: | VariantControl |
Values: | variant control that is associated with the variant choice |
Data Types: | char |
Example: set_param(gcb, 'VariantControl', 'V == 3')
, where
gcb
is the variant choice of the Variant
Subsystem block.
Example: get_param(gcb, 'VariantControl')
, where
gcb
is the variant choice of the Variant
Subsystem block.
Variant Source and Variant Sink blocks:
Parameter: | VariantControls |
Values: | variant controls that are associated with variant choices |
Data Types: | char |
Example: set_param(gcb, 'VariantControls', {'A == 1','A ==
2'})
, where gcb
is the Variant
Sink or Variant Source block.
Example: get_param(gcb, 'VariantControls')
, where
gcb
is the Variant Sink or Variant
Source block.
Condition (read-only) — Condition expression in Simulink.VariantExpression
object
N/A
(default)
This parameter is read-only.
This parameter displays the condition expression specified as
Simulink.VariantExpression
object. To change or edit the condition
expression, use the Simulink.VariantExpression
parameter dialog box
that appears when you double-click the object in the workspace.
Note
The operands that you specify in a condition expression of type
Simulink.VariantExpression
must be defined in the base
workspace or a data dictionary. Specifying operands that are defined in the mask
or model workspace is not supported.
Label mode active choice — Name of active choice in label
mode
true (Subsystem)
(default) | false (Subsystem1)
This list contains the labels of all the variant choices. To set an active choice, select a label from the list. The corresponding choice becomes active. Alternatively, to change the active choice in label mode, you can follow the approaches described in Set Active Choices Using Variant Control Labels.
Dependencies
To enable this parameter, set Variant control mode to
label
.
Programmatic Use
Parameter:
LabelModeActiveChoice
|
Type: character vector |
Value: If no label mode active choice is specified, the value is empty. If a label mode active choice is specified, the value is the variant control label for the active choice. |
Default: '' |
Allow zero active variant controls — Whether to allow zero active variant choices
off
(default) | on
off
— The software generates an error when there is no active variant choice.on
— When you select this option and if there is no active variant choice, the software simulates the model without any active variant choice in the Variant Subsystem. The software disconnects all the blocks connected to the input and output stream of Variant Subsystem block, thus removing the variant regions completely from the model. The inactive outports of the subsystem output a ground value. To output a value other than ground, select the Specify output when source is unconnected parameter of the Outport block and specify a value of your choice.
Dependencies
This parameter is available only if there are no
default
variant choices in the Variant
Subsystem and if you set Variant control
mode to expression
.
Programmatic Use
Parameter:
AllowZeroVariantControls
|
Type: character vector |
Value:
'off' | 'on' |
Default:
'off' |
Propagate conditions outside of variant subsystem — Option to choose if components outside of the variant subsystem must be informed of the active and inactive state of underlying blocks
off
(default) | on
When you select the Propagate conditions outside of variant subsystem parameter, the software propagates the variant condition of the underlying blocks to the Variant Subsystem container block so the subsystem can adapt its interface to the state of the underlying blocks. Ports that are mapped to the ports on the active choice becomes active. Ports that are not mapped to the ports on the inactive choice becomes inactive. Selecting this option ensures that the components outside of the Variant Subsystem are aware of the active and inactive state of blocks within the Variant Subsystem block. For more information, see Propagate Variant Conditions to Define Variant Regions Outside Variant Subsystems to Promote Consistency and Reduce Errors and Propagate Variant Conditions to Control Execution of Conditional Subsystems
Variant conditions do not propagate outside a Variant Subsystem block if all variant choices within the block have the same interface.
Programmatic Use
Parameter:
PropagateVariantConditions
|
Type: character vector |
Value:
'off' | 'on' |
Default:
'off' |
Allow flexible interface — Option to choose to make interface of the variant subsystem flexible
on
(default) | off
Specify whether to make the interface of a variant subsystem flexible.
on
— Simulate with variant choices that have input and output ports that differ in number from the input and output ports of the Variant Subsystem block.off
— When you simulate with this option, if there is inconsistency in the interface, the software will generate errors with fix-it actions to match the ports of the variant choices to the Variant Subsystem block.
Programmatic Use
Parameter:
AllowFlexibleInterface
|
Type: character vector |
Value:
'off' | 'on' |
Default:
'on' |
Block Characteristics
Alternative Configurations
Variant Model — Template subsystem containing Model blocks as variant choices
The Variant Model block is a template that contains Model blocks.
Libraries:
Simulink /
Ports & Subsystems
Variant Assembly Subsystem — Template subsystem that supports adding or removing variant choices from external sources without model modification
A Variant Assembly Subsystem block enables you to add or remove its variant choices from external sources without modifying the model. A Variant Assembly Subsystem block can contain Model blocks, Subsystem Reference blocks, or both as its variant choices. You specify the source of variant choices in the block parameter dialog box once and then modify the source to add or remove the variant choices from the block. Unlike the Variant Subsystem block, you cannot manage the variant choices from inside the Variant Assembly Subsystem block. For more information, see Add or Remove Variant Choices of Variant Assembly Subsystem Blocks Using External Files.
When you load a model with a Variant Assembly Subsystem
block that has variant choices stored in subsystem files, by default, only
the active choice is loaded to optimize the loading time for models.
However, if you initialize a model programmatically using the
find_system
, get_param
, or
set_param
function, some inactive choices can also
get loaded. You can move or resize the Model or
Subsystem Reference blocks inside the Variant
Assembly Subsystem block.
To convert a Variant Subsystem block to a Variant Assembly Subsystem block, follow the steps in Convert Variant Subsystem to Variant Assembly Subsystem.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Actual data type or capability support depends on block implementation.
HDL Code Generation
Generate VHDL, Verilog and SystemVerilog code for FPGA and ASIC designs using HDL Coder™.
HDL Coder™ provides additional configuration options that affect HDL implementation and synthesized logic. Actual data type or capability support depends on block implementation.
Architecture | Description |
---|---|
Module (default) | Generate code for the subsystem and the blocks within the subsystem. HDL Coder generates code for all the variant choices. |
BlackBox | Generate a black-box interface. That is, the generated HDL code includes only the input/output port definitions for the subsystem. In this way, you can use a subsystem in your model to generate an interface to existing manually written HDL code. The black-box interface generated for subsystems is similar to the interface generated for Model blocks, but without generation of clock signals. |
| Remove the subsystem from the generated code. You can use the subsystem in simulation but treat it as a “no-op” in the HDL code. |
For the BlackBox
architecture, you
can customize port names and set attributes of the external component
interface. See Customize Black Box or HDL Cosimulation Interface (HDL Coder).
General | |
---|---|
AdaptivePipelining | Automatic pipeline insertion based on the synthesis tool, target frequency, and
multiplier word-lengths. The default is |
BalanceDelays | Detects introduction of new delays along one path and inserts
matching delays on the other paths. The default is |
ClockRatePipelining | Insert pipeline registers at a faster clock rate instead of the slower data rate. The
default is |
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
|
DistributedPipelining | Pipeline register distribution,
or register retiming. The default is |
DSPStyle | Synthesis attributes for multiplier mapping. The default is |
FlattenHierarchy | Remove subsystem hierarchy from generated HDL code. 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
|
SharingFactor | Number of functionally equivalent resources to map to a single shared resource. The default is 0. See also Resource Sharing (HDL Coder). |
StreamingFactor | Number of parallel data paths, or vectors, that are time multiplexed to transform into serial, scalar data paths. The default is 0, which implements fully parallel data paths. See also Streaming (HDL Coder). |
Target Specification
This block cannot be the DUT, so the block property settings in the Target Specification tab are ignored.
The DUT cannot be a Variant Subsystem.
Fixed-Point Conversion
Design and simulate fixed-point systems using Fixed-Point Designer™.
Actual data type or capability support depends on block implementation.
Version History
Introduced in R2010bR2024a: Automated port synchronization
The software provides options to add missing ports and delete unused ports in Variant Subsystem and Variant Assembly Subsystem blocks to match the ports of the underlying variant choices. During simulation, if the software encounters a port mismatch between a Variant Subsystem or Variant Assembly Subsystem block and its variant choices, the resulting error message now provides these the options of adding missing ports and add and delete ports to resolve the issue.
R2024a: Use adapted rate-based model blocks as choices
You can use adapted rate-based model blocks as variant choices in a Variant Subsystem block. When you add adapted rate-based models as variant choices, the inports in the variant subsystem are matched to the port names of the respective rate-based models.
R2024a: Access the mask of the active variant choice on Variant Subsystem block
You can access the mask of the active variant choice of the Variant Subsystem directly without having to navigate inside the Variant Subsystem block with the following conditions :
If the Variant Subsystem block is unmasked, double-clicking on the block opens the mask of its active choice. Clicking on the Look under mask badge or selecting the corresponding option from the context menu of the Variant Subsystem block takes you directly inside the active choice.
If the Variant Subsystem block is masked and the active choice also has a mask, then the mask of the Variant Subsystem block gets the preference and double-clicking on the block will open the Variant Subsystem mask.
R2024a: Specify variant choices as an array of strings
You can specify Variant choices specifier as an array of strings in Variant Assembly Subsystem block.
MATLAB-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)