Main Content

Export TLM Component

Identify Generated Files

After code generation completes, go to your working folder. There you can find the following folder: model_name_VP/. This folder contains the files generated for the TLM component. The files appear under the subfolders described in the following table.

Directory NameFilesDescription
model_name
include/model_name*.h
src/model_name.cpp

Files relative to the behavior of the model. These files are independent of the TLM options. HDL Verifier™ provides a makefile for you to build a static library from these source files.

If another TLM component is generated from the same model, these files are regenerated (if the model has not changed, the files will be identical). If you generate a second TLM version of the same model with a different tag the TLM files are added to the _VP folder with the new tag. It is possible for the _VP folder to contain multiple TLM variations of the same model all using the same behavior files.

model_name_usertag_tlm
include/model_name_usertag_tlm.h
src/model_name_usertag_tlm.cpp



include/model_name_usertag_tlm_def.h

These files contain the TLM interface to wrap the core behavior.





This file contains addresses and definitions to communicate with the component through the TLM target port using a TLM generic payload.

The files are sorted in subdirectories by source and header.

HDL Verifier provides a makefile for you to build a static library from these source files.

model_name_usertag_tlm_tb
include/model_name_usertag _tlm_tb.h
src/model_name_usertag_
   tlm_tb.cpp



src/model_name_usertag_
   tlm_tb_main.cpp

These files contain the core behavior of the testbench.






This file instantiates and binds the component and the testbench together.

The files are sorted in subdirectories by source and header.

HDL Verifier software provides a makefile for you to build an executable from these source file and the component static library. This executable requires the following:

  • Certain MATLAB® libraries the executable needs to be built and run. These MATLAB libraries are the static libraries libmat.a and libmx.a and their dynamic counterparts.

  • The vector .mat files generated when you click the Verify TLM Component button. Before building the component and testbench on the virtual platform, verify that the TLM component includes these files.

model_name_usertag_tlm_doc/
html/model_name_codegen_rpt.html

This file is the entry point of the HTML documentation.

Create Static Library with TLM Component

Create a static library that contains the generated TLM component by following the steps described for Linux® or Windows®. Execute these steps for the operating system where you will run the TLM component.

Note

This feature requires the ASIC Testbench for HDL Verifier add-on.

Linux Users

  1. Open a Linux console window.

  2. Navigate to the model_name_VP/model_name_usertag_tlm/ folder.

  3. Execute the following command to start the library compilation:

    make -f makefile.gnu all

    If you want to obtain symbols for source code debugging, use the all-debug target instead of all.

  4. When the system finishes compiling, locate a library file named libmodel_name_usertag_tlm.a in the model_name_VP/model_name_usertag_tlm/lib/ folder.

Windows Users

If you have not already, make sure that MATLAB\version\bin\win32 or MATLAB\version\bin\win64 has been added to your user path.

You can choose one of the following ways to compile your project:

  • Compile in Visual Studio® (open the model_name_usertag_tlm.vcproj project in Visual Studio and follow the application instructions for compiling your project).

  • Compile in a console window.

    1. Open a system console window.

    2. Load the compilation tool chain by entering the following at the system prompt:

      Win32 users:

      X:\>"%VS80COMNTOOLS%\..\..\VC\vcvarsall" x86

      Win64 users:

      X:\>"%VS80COMNTOOLS%\..\..\VC\vcvarsall" x64

      If you have a later version of Visual Studio, you may need to enter "%VS100COMNTOOLS%...", "%VS90COMNTOOLS%..." or "%VS80COMNTOOLS%..." instead. Type set at the system prompt for a list of environment variables; in that list you can find the environment variable pointing to where the tool chain is installed.

    3. In the same system console, navigate to the model_name_VP/model_name_usertag_tlm/ folder.

    4. Execute the following command to start the library compilation:

      X:\>nmake /f makefile.mk all

      If you want to obtain symbols for source code debugging, use the all-debug target instead of all.

    5. When the system finishes compiling, locate a library file named model_name_usertag_tlm.lib in the model_name_VP/model_name_usertag_tlm/lib/ folder.

    Note

    The temporary object files reside in the model_name_VP/model_name_usertag_tlm/obj/ folder.

Create Standalone Executable with TLM Component

You can create a standalone TLM executable in the command shell by following the steps for Linux or Windows. Execute these steps for the operating system where you will run the TLM component.

Linux Users

  1. Open a Linux console window.

  2. Navigate to the model_name_VP/model_name_usertag_tlm_tb/ folder.

  3. Execute the following command to start the library compilation:

    make -f makefile_tb.gnu all

    If you want to obtain symbols for source code debugging, use the all-debug target instead of all.

    Note

    Executing this command also automatically builds a static library with the TLM component source files.

  4. When the system finishes compiling, locate an executable file named model_name_usertag_tlm_tb.exe in the model_name_VP/model_name_usertag_tlm_tb/ folder.

Windows Users

If you have not already, make sure that MATLAB\version\bin\win32 or MATLAB\version\bin\win64 has been added to your user path.

You can choose one of the following ways to compile your project:

  • Compile in Visual Studio (open the model_name_usertag_tlm.vcproj project in Visual Studio and follow the application instructions for compiling your project).

  • Compile in a console window.

    1. Open a system console window.

    2. Load the compilation tool chain by entering the following at the system prompt:

      Win32 users:

      X:\>"%VS80COMNTOOLS%\..\..\VC\vcvarsall" x86

      Win64 users:

      X:\>"%VS80COMNTOOLS%\..\..\VC\vcvarsall" x64

      If you have a later version of Visual Studio, you may need to enter "%VS100COMNTOOLS%...", "%VS90COMNTOOLS%..." or "%VS80COMNTOOL%..." instead. Type set at the system prompt for a list of environment variables; in that list you can find the environment variable pointing to where the tool chain is installed.

    3. In the same system console, navigate to the model_name_VP/model_name_usertag_tlm_tb/ folder.

    4. Execute the following command to start the library compilation:

      X:\>nmake /f makefile.mk all

      If you want to obtain symbols for source code debugging, use the all-debug target instead of all.

      Note

      Executing this command also automatically builds a static library with the TLM component source files.

    5. When the system finishes compiling, locate an executable file named model_name_usertag_tlm_tb.exe in the model_name_VP/model_name_usertag_tlm_tb/ folder.