Intel® High Level Synthesis Accelerator Functional Unit Design Example User Guide

ID 683025
Date 7/19/2019
Document Table of Contents
Give Feedback

2.4. Generating the ASE Testbench

After integrating the HLS component into an AFU, you might want to cosimulate the AFU in the Intel AFU Simulation Environment (ASE). Use this cosimulation to quickly confirm the functionality of your HLS component within the AFU.

If you want to skip co-simulating the AFU in the ASE and run the design on hardware, go to Compiling the AF Bitstream.

Before you co-simulate your AFU in the ASE, ensure that your ASE is configured according to the instructions in the Intel Accelerator Functional Unit (AFU) Simulation Environment (ASE) Quick Start User Guide.

You must have a valid license for one of the supported simulators to use the ASE.

Ensure that your simulation software environment variables are set correctly:
  • For Mentor ModelSim* SE* or Mentor Questa* Advanced Simulator:
    $ export MTI_HOME=<path to ModelSim/Questa installation directory>
    $ export PATH=$MTI_HOME/linux_x86_64/:$MTI_HOME/bin/:$PATH
Refer to hls_afu/ to automate these steps.

To generate the ASE testbench:

  1. Navigate to the root of your project (the hls_afu directory) and run this command:
    $ afu_sim_setup --source hw/rtl/filelist.txt build_ase_dir/
  2. Navigate to build_ase_dir directory.
  3. Open Makefile and add the twentynm libraries to the gate level library as follows:
    # Gate level libraries to add to simulation 
    GLS_VERILOG_OPT = $(QUARTUS_HOME)/eda/sim_lib/altera_primitives.v 
    GLS_VERILOG_OPT+= $(QUARTUS_HOME)/eda/sim_lib/220model.v 
    GLS_VERILOG_OPT+= $(QUARTUS_HOME)/eda/sim_lib/sgate.v 
    GLS_VERILOG_OPT+= $(QUARTUS_HOME)/eda/sim_lib/altera_mf.v 
    GLS_VERILOG_OPT+= $(QUARTUS_HOME)/eda/sim_lib/ 
    GLS_VERILOG_OPT+= $(QUARTUS_HOME)/eda/sim_lib/twentynm_atoms.v 
    GLS_VERILOG_OPT+= $(QUARTUS_HOME)/eda/sim_lib/mentor/twentynm_atoms_ncrypt.v
    The twentynm libraries are highlighted in bold text.
  4. Run the following commands:
    $ make
    $ make sim

    When you see the following message, you can build and run the host.

    Take note of the export command in your make sim command output. You need this command to set your environment to run the host program. The export command is highlighted in the following output example:
    #   [SIM]  ASE lock file written in work directory
    #   [SIM]  ** ATTENTION : BEFORE running the software application **
    #   [SIM]  Set env(ASE_WORKDIR) in terminal where application will run (copy-and-paste) =>
    #   [SIM]  $SHELL   | Run:
    #   [SIM]  ---------+---------------------------------------------------
    #   [SIM]  bash/zsh | export ASE_WORKDIR=/home/john/hls_afu/build_ase_dir/work
    #   [SIM]  tcsh/csh | setenv ASE_WORKDIR /home/john/hls_afu/build_ase_dir/work
    #   [SIM]  For any other $SHELL, consult your Linux administrator
    #   [SIM]  
    #   [SIM]  Ready for simulation...
    #   [SIM]  Press CTRL-C to close simulator...

    Leave this terminal window open. This terminal window is referred to in later steps as the ASE terminal window.