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.
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.
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.