Basic Guidelines for Modeling HDL Algorithm in Simulink - MATLAB & Simulink (original) (raw)

Use these guidelines to develop your HDL algorithm in Simulink®. The guidelines include using HDL-supported blocks when modeling your design and how to partition your design when developing the algorithm.

Each guideline has a severity level that indicates the level of compliance requirements. To learn more, see HDL Modeling Guidelines Severity Levels.

Use HDL-Supported Blocks

Guideline ID

1.1.1

Severity

Strongly Recommended

Description

When you create your Simulink model, use blocks from the > library. Several blocks in this library are pre-configured for HDL code generation. Blocks in this library are available with Simulink. If you do not have HDL Coder™, you can simulate the blocks in your model, but cannot generate HDL code.

You can find additional HDL-supported blocks in these Simulink block libraries:

To display only HDL-supported blocks in the Library Browser:

To restore the library browser to the default view, enter this command:

Note

The set of supported blocks will change in future releases, so you should rebuild your supported blocks library each time you install a new version of this product.

Partition Model into DUT and Test Bench

Guideline ID

1.1.2

Severity

Recommended

Description

When you create your Simulink model for HDL code generation, the Subsystem that you want to generate HDL code for is the Design-Under-Test (DUT). This Subsystem contains Simulink blocks that can be implemented on your target FPGA or ASIC device. You can further partition the logic inside the DUT into smaller subsystems based on functionality, sample rates in your design, and so on. When you generate HDL code, the DUT becomes the top-level module or entity, and the Subsystems inside the DUT become submodules or smaller entities.

Blocks outside the DUT Subsystem become part of the test bench. The test bench can consist of blocks that are not supported for HDL code generation. Simulate the test bench to:

For example, if you open the Simulink model template Blank_DUT, this model opens in the Simulink Editor.

HDL_DUT default model in Simulink Editor

In this model, HDL_DUT Subsystem is the DUT and blocks outside this Subsystem form the test bench. You can develop your HDL algorithm inside the HDL_DUT Subsystem. This template model is preconfigured for HDL code generation.

Note

You can also generate HDL code for the entire model instead of the DUT Subsystem. Replace the input signals and Constant blocks withInport blocks. Replace the output signals and Scope blocks with Outport blocks.

Avoid Using Double-Byte Characters

Guideline ID

1.1.3

Severity

Strongly Recommended

Description

Downstream synthesis and simulation tools do not support double-byte characters such as Japanese and Chinese characters. HDL Coder does not support using:

Document Model Features and Attributes

Guideline ID

1.1.4

Severity

Recommended

Description

To make the generated HDL code easier to manage, you can document reference information as part of your model settings in these ways:


LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
USE IEEE.numeric_std.ALL;

ENTITY Vector_FFT IS

See Also

Functions

Modeling Guidelines

Topics