Code Generation Reports

HDL Coder™ produces a code generation report that helps you to:

  • Debug code generation issues and verify that your MATLAB® code is suitable for code generation.

  • View generated HDL code.

  • See how the code generator determines and propagates type information for variables and expressions in your MATLAB code.

  • Access additional reports.

Report Generation

When you enable report generation, the code generator produces a code generation report. To control generation and opening of a code generation report, use app settings, codegen options, or configuration object properties.

In the HDL Coder app:

  1. Open the HDL Coder Workflow Advisor.

  2. In the HDL Code Generation step options, on the Coding Style tab, under Generated Code Comments, select the Generate report check box.

At the command line, use codegen options:

  • To generate a report, use the -report option.

  • To generate and open a report, use the -launchreport option.

Alternatively, use configuration object properties:

  • To generate a report, set GenerateReport to true.

  • If you want codegen to open the report for you, set LaunchReport to true.

Report Location

The code generation report is named report.mldatx. It is located in the html subfolder of the code generation output folder. If you have MATLAB R2018a or later, you can open the report.mldatx file by double-clicking it.

Errors and Warnings

View code generation error, warning, and information messages on the All Messages tab. To highlight the source code for an error or warning, click the message. It is a best practice to address the first message because subsequent errors and warnings can be related to the first message.

Files and Functions

The report lists MATLAB source functions and generated files. In the MATLAB Source pane, the Function List view organizes functions according to the containing file. To visualize functions according to the call structure, use the Call Tree view.

To view a function in the code pane of the report, click the function in the list. Clicking a function opens the file that contains the function. To edit the selected file in the MATLAB Editor, click Edit in MATLAB or click a line number in the code pane.

Specialized Functions or Classes

When a function is called with different types of inputs or a class uses different types for its properties, the code generator produces specializations. In the MATLAB Source pane, numbered functions (or classes) indicate specializations. For example:

MATLAB Source

To view a MATLAB function in the code pane, click the function in the MATLAB Source pane. To see information about the type of a variable or expression, pause over the variable or expression.

In the code pane, syntax highlighting of MATLAB source code helps you to identify MATLAB syntax elements. Syntax highlighting also helps you to identify certain code generation attributes such as whether a function is extrinsic or whether an argument is constant.

Extrinsic Functions

In the MATLAB code, the report identifies an extrinsic function with purple text. The information window indicates that the function is extrinsic.

Constant Arguments

In the MATLAB code, orange text indicates a compile-time constant argument to an entry-point function or a specialized function. The information window includes the constant value.

Knowing the value of the constant arguments helps you to understand generated function signatures. It also helps you to see when code generation created function specializations for different constant argument values.

To export the value to a variable in the workspace, click .

MATLAB Variables

The Variables tab provides information about the variables for the selected MATLAB function. To select a function, click the function in the MATLAB Source pane.

The variables table shows:

  • Class, size, and complexity

  • Properties of fixed-point types

This information helps you to debug errors, such as type mismatch errors, and to understand type propagation.

Visual Indicators on the Variables Tab

This table describes symbols, badges, and other indicators in the variables table.

Column in the Variables TableIndicatorDescription
NameexpanderVariable has elements or properties that you can see by clicking the expander.
Name{:}Heterogeneous cell array (all elements have the same properties)
Name{n}nth element of a heterogeneous cell array
Classv > nv is reused with a different class, size, and complexity. The number n identifies each unique reuse (a reuse with a unique set of properties). When you pause over a renamed variable, the report highlights only the instances of this variable that share the class, size, and complexity.
Classcomplex prefixComplex number
Class

Fixed-point type

To see the fixed-point properties, click the badge.

Additional Reports

The Summary tab can have links to these additional reports:

Report Limitations

  • The entry-point summary shows individual elements of varagin and vargout, but the variables table does not show them.

  • The report does not show full information for unrolled loops. It displays data types of one arbitrary iteration.

  • The report does not show information about dead code.

Related Topics