Before generating HDL code, configure the parameters of your model using the
hdlsetup command. This sets up your multirate model for HDL
code generation. This section summarizes settings applied to the model by
hdlsetup that are relevant to multirate code generation.
Solver options that are recommended or required for HDL code generation:
states). Other fixed-step solvers could be
selected, but this option is usually best for simulating discrete
Tasking mode: Must be explicitly set to
SingleTasking. Do not set
Tasking mode to
hdlsetup configures the following
Diagnostics / Sample time
options for all models:
Multitask data transfer:
Single task data transfer:
In multirate models intended for HDL code generation, Rate Transition
blocks must be explicitly inserted when blocks running at different rates
are connected. Set Multitask data transfer and
Single task data transfer to
error to detect illegal rate transitions
before code is generated.
To learn more about the settings that
see Check for model parameters suited for HDL code generation.
HDL Coder™ requires that at least one valid sample rate (sample time > 0) must
exist in the model. If all rates are 0, –1, or –2, the
code generator (
makehdl) and compatibility checker
checkhdl) terminates with an error message.
Use Rate Transition blocks, rather than the following blocks, to create rate transitions in models intended for HDL code generation:
Unit Delay Enabled
The Delay blocks listed should be configured to have the same input and output sample rates.
Zero-Order Hold blocks must be configured with inherited (-1) sample times.