Setting up the simulation environment, Running the simulation – Altera Avalon Verification IP Suite User Manual

Page 172

Advertising
background image

Chapter 2: Qsys Tutorial

2–5

Verifying Avalon-ST DUT

May 2011

Altera Corporation

Avalon Verification IP Suite User Guide

Setting up the Simulation Environment

To set up the simulation environment for your test program, open your ModelSim
script file (.tcl or .do) and set the hierarchy variables used in the Qsys-generated
simulation script (msim_setup.tcl). The ModelSim script file (load_sim.tcl) included
with this tutorial has the correct hierarchy variable settings. However, if you would
like to know how to set up the correct hierarchical variables used in the
Qsys-generated simulation model, refer to

Table 2–5

for the coding examples.

The hierarchy variables enable the ModelSim script to source the Qsys-generated
simulation script (msim_setup.tcl) and use the command aliases defined in the
Qsys-generated simulation script to compile the device library files and
SystemVerilog design files (test_program.sv and top.sv) that instantiate the test
program and the Qsys-generated testbench simulation model. The ModelSim script
(load_sim.tcl) then uses the command alias to elaborate the top-level simulation
design and loads the wave.do file that sets up the waveform view in the ModelSim-
Altera software.

Running the Simulation

In this section, you run a simulation in the ModelSim-Altera software on the testbench
that you created. To complete this simulation, use the test program provided in the
design files to provide simulation stimulus.

To run the simulation, follow these steps:

1. Start the ModelSim-Altera software.

2. On the File menu click Change Directory.

3. Navigate to <working_directory>\ug_avalon_verification\qsys\

user_test_program

directory, and click OK.

4. On the Compile menu, click Compile Options.

5. Click the Verilog & System Verilog tab.

6. In the Language Syntax box, select Use SystemVerilog and click OK.

7. On the File menu, click Load.

Table 2–5. Coding Examples to Set Hierarchy Variables

Hierarchy Variables Coding Example

Description

set TOP_LEVEL_NAME “top”

Sets the name of the top level file
that instantiates the
Qsys-generated testbench system
and the test program.

set QSYS_SIMDIR”../st_bfm_qsys_tutorial/testbench

Sets the Qsys simulation path to
the directory where the ModelSim
script file is located. You must set
this path when your ModelSim
script file (msim_setup.tcl) and
test program are located in
different directories.

Advertising