Main Content

Model Referencing for HDL Code Generation

Model referencing in your DUT subsystem enables you to:

For more information on model references, see Model Reference Behavior and Capabilities.

Generating HDL Code for Referenced Models

You can generate HDL code for the referenced model using the GUI or the command line.

Using GUI

  1. Right-click the Model block and select HDL Code > HDL Block Properties.

  2. In HDL Block Properties dialog box, set the Architecture property to ModelReference.

  3. Generate HDL code from your DUT subsystem.

Using Command Line

  1. Set the Architecture property of the Model block to ModelReference. For example, suppose that you have a DUT subsystem named mydut, that includes a model reference, referenced_model. Enter this command:

    hdlset_param('mydut/referenced_model', ... 
                  'Architecture', 'ModelReference');

  2. Generate HDL code for your DUT subsystem.

    makehdl('mydut');

Note

By default, the code generates VHDL code in multiple libraries. However, when you select the Generate VHDL or SystemVerilog code for model references into a single library configuration parameter, the code generator generates VHDL code in a single library. In this case, you must set the ScalarizePorts property to off before generating HDL code.

Generate Code for Model Arguments

To generate a single Verilog® or SystemVerilog module or VHDL® entity for instances of a referenced model with different model argument values, see Generate Parameterized Code for Referenced Models.

Limitations

  • Model blocks must use the default values for the block parameters.

  • If there are multiple model references to the same model, they must maintain identical HDL block properties.

  • HDL Coder™ cannot move registers across a model reference. Therefore, you cannot use these optimizations with models that contain model references:

    • Distributed pipelining

    • Constrained output pipelining

    • Streaming

    • Clock-rate pipelining

  • To optimize a referenced model for resource sharing, the model reference must have the same final rate after any optimizations and rate propagation. You cannot apply this optimization if the model references have differing final rates.

  • When generating HDL code from model references, the generated model, validation model, and cosimulation model may encounter compile or simulate errors. To fix these issues, ensure that you load the models and they are on the search path.

See Also

Model Settings

Topics