The same scoping and parameter passing rules that apply to ordinary Simulink blocks apply to HDL blocks. Consequently, blocks in the Xilinx HDL Blockset can be parameterized using MATLAB variables and expressions. This capability makes possible highly parametric designs that take advantage of the expressive and computational power of the MATLAB language.
In Simulink, blocks are parameterized through a mechanism called masking. In essence, a block can be assigned mask variables whose values can be specified by a user through dialog box prompts or can be calculated in mask initialization commands. Variables are stored in a mask workspace. A mask workspace is local to the blocks under the mask and cannot be accessed by external blocks.
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. This technique can be applied to parameters on blocks in the Xilinx HDL blockset whose values are set using a listbox, radio button, or checkbox. For example, when building a Subsystem that consists of a multiply and accumulate block, you can create a parameter on the Subsystem that allows you to specify whether to truncate or round the result. This parameter will be called trunc_round as shown in the figure below.
As shown in the following figure, in the parameter editing dialog for the accumulator and multiplier blocks, there are radio buttons that allow either the Truncate or Round option to be selected.