Skip to Main Content Skip to Search
Product Documentation

Create an HDL Verifier MATLAB Component Function

Overview to Coding an HDL Verifier Component Function

Coding a MATLAB function that is to visualize an HDL module or component requires that you follow specific coding conventions. You must also understand the data type conversions that occur, and program data type conversions for operating on data and returning data to the HDL simulator.

To code a MATLAB function that is to verify an HDL module or component, perform the following steps:

  1. Learn the syntax for a MATLAB HDL Verifier component function (see Syntax of a Component Function.).

  2. Understand how HDL Verifier software converts data from the HDL simulator for use in the MATLAB environment (see Data Type Conversions).

  3. Choose a name for the MATLAB component function (see Invoke matlabcp to Bind MATLAB Component Function Calls).

  4. Define expected parameters in the component function definition line (see MATLAB Function Syntax and Function Argument Definitions).

  5. Determine the types of port data being passed into the function (see MATLAB Function Syntax and Function Argument Definitions).

  6. Extract and, if applicable to the simulation, apply information received in the portinfo structure (see Gaining Access to and Applying Port Information).

  7. Convert data for manipulation in the MATLAB environment, as applicable (see Converting HDL Data to Send to MATLAB).

  8. Convert data that needs to be returned to the HDL simulator (see Converting Data for Return to the HDL Simulator).

Syntax of a Component Function

The syntax of a MATLAB component function is

function [iport, tnext] = MyFunctionName(oport, tnow, portinfo)

The input/output arguments (iport and oport) for a MATLAB component function are the reverse of the port arguments for a MATLAB test bench function. That is, the MATLAB component function returns signal data to the outputs and receives data from the inputs of the associated HDL module.

Initialize the function outputs to empty values at the beginning of the function as in the following example:

tnext = [];
oport = struct();

See MATLAB Function Syntax and Function Argument Definitions for an explanation of each of the function arguments. For more information on using tnext and tnow for simulation scheduling with matlabcp, see Scheduling Component Functions Using the tnext Parameter.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS