Block Masks and Parameter Passing - 2025.2 English - UG1483

Vitis Model Composer User Guide (UG1483)

Document ID
UG1483
Release Date
2025-11-20
Version
2025.2 English

The same scoping and parameter passing rules that apply to ordinary Simulink blocks apply to HDL blocks. Consequently, blocks in the AMD HDL Blockset can use MATLAB variables and expressions for parameterization. This capability makes possible highly parametric designs that take advantage of the expressive and computational power of the MATLAB language.

Block Masks

Simulink uses a mechanism called masking to parameterize blocks. In essence, you can assign mask variables. You can specify their values through dialog box prompts or calculate them in mask initialization commands. A mask workspace stores variables. This is local to the blocks under the mask and is not accessible by external blocks.

Note: It is possible for a mask to access global variables and variables in the base workspace. To access a base workspace variable, use the MATLAB evalin function. For more information on the MATLAB and Simulink scoping rules, refer to the manuals titled Using MATLAB and Using Simulink from The MathWorks, Inc.

Parameter Passing

It is often desirable to pass variables to blocks inside a masked Subsystem. Doing so allows the block’s configuration to be determined by parameters on the enclosing Subsystem. You can apply this technique to parameters on blocks in the AMD HDL blockset whose values are set using a listbox, radio button, or checkbox. For example, when building a Subsystem with a multiply and accumulate block, you can add a parameter to control truncation or rounding of the result. In the following figure, this parameter is called trunc_round.

Figure 1. Creating a Parameter

The Block Parameters dialog for the accumulator and multiplier blocks includes radio buttons for selecting either the Truncate or Round option. The following figure shows these options.

Figure 2. Editing a Parameter