Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
11 years ago

Avalon BFM - Test Program

Hi,

I just succesfully generated my first Avalon BFM testbench with Qsys 14. I have a component that consist of my avalon entity and an additional library file that contains some system wide constants.

The Qsys "generate" procedure generated a big file structure with a testbenchfile that I suppose to use in some kind of "test program" that uses the BFM API described in the document "Introduction to Avalon Verification IP Suite".

I'm currently stuck where I have to set up a little tcl script that compiles my testbench design in modelsim. The script looks like this and is based on the BFM example found here: http://www.altera.com/support/examples/design-flow/exm-avalon-verification-ip.html (http://www.altera.com/support/examples/design-flow/exm-avalon-verification-ip.html)


#  setup variables for simulation script
set system_name      ads1158_bfm_test_tb
set QSYS_SIMDIR      $system_name/simulation
set TOP_LEVEL_NAME   tb
source $QSYS_SIMDIR/mentor/msim_setup.tcl
#  compile system
dev_com
com
#  compile testbench and test program
# vcom test_program_pkg.vhd
# vcom test_program.vhd
# vcom tb.vhd
#  load and run simulation
# elab_debug
# do wave.do
# run 50ns
#  alias to re-compile changes made to test program, load and run simulation
# alias rerun {
#    vcom test_program_pkg.vhd
#    vcom test_program.vhd
#    elab_debug
#    do wave.do
#    run 50ns
# }

If I call this in modelsim, the output is as follows:


do run_ads_1158_bfm_simulation.tcl
#  ads1158_bfm_test_tb
#  ads1158_bfm_test_tb/simulation
#  tb
#   file_copy 
#  List Of Command Line Aliases 
#  
#  file_copy                     -- Copy ROM/RAM files to simulation directory 
#  
#  dev_com                       -- Compile device library files 
#  
#  com                           -- Compile the design files in correct order 
#  
#  elab                          -- Elaborate top level design 
#  
#  elab_debug                    -- Elaborate the top level design with novopt option 
#  
#  ld                            -- Compile all the design files and elaborate the top level design 
#  
#  ld_debug                      -- Compile all the design files and elaborate the top level design with -novopt 
#  
#  
#  
#  List Of Variables 
#  
#  TOP_LEVEL_NAME                -- Top level module name. 
#  
#  SYSTEM_INSTANCE_NAME          -- Instantiated system module name inside top level module. 
#  
#  QSYS_SIMDIR                   -- Qsys base simulation directory. 
#  
#  QUARTUS_INSTALL_DIR           -- Quartus installation directory. 
#   dev_com 
#   com 
#  Model Technology ModelSim ALTERA vlog 10.1e Compiler 2013.06 Jun 12 2013
#  
#  Top level modules:
#  	--none--
#  Model Technology ModelSim ALTERA vlog 10.1e Compiler 2013.06 Jun 12 2013
#  
#  Top level modules:
#  	--none--
#  Model Technology ModelSim ALTERA vlog 10.1e Compiler 2013.06 Jun 12 2013
#  
#  Top level modules:
#  	--none--
#  Model Technology ModelSim ALTERA vlog 10.1e Compiler 2013.06 Jun 12 2013
#  
#  Top level modules:
#  Model Technology ModelSim ALTERA vlog 10.1e Compiler 2013.06 Jun 12 2013
#  
#  Top level modules:
#  Model Technology ModelSim ALTERA vcom 10.1e Compiler 2013.06 Jun 12 2013
#  -- Loading package STANDARD
#  -- Loading package TEXTIO
#  -- Loading package std_logic_1164
#  -- Loading package NUMERIC_STD
#  ** Error: (vcom-11) Could not find work.rts_data_transfer.
#  ** Error: ads1158_bfm_test_tb/simulation/submodules/ads1158_interface.vhd(39): (vcom-1195) Cannot find expanded name "work.rts_data_transfer".
#  ** Error: ads1158_bfm_test_tb/simulation/submodules/ads1158_interface.vhd(39): Unknown expanded name.
#  ** Error: ads1158_bfm_test_tb/simulation/submodules/ads1158_interface.vhd(41): VHDL Compiler exiting
#  ** Error: /opt/altera/14.0/modelsim_ase/linux/vcom failed.
#  Error in macro ./run_ads_1158_bfm_simulation.tcl line 9
#  /opt/altera/14.0/modelsim_ase/linux/vcom failed.
#      while executing
#  "vcom     "$QSYS_SIMDIR/submodules/ads1158_interface.vhd"                                                           -work ads1158_interface_0          ..."
#      ("eval" body line 8)
#      invoked from within
#  "com"

I really don't know, where I should point the modelsim software to into the filestructure that Qsys created by generating my BFM testbench.

I guess that modelsim complains that it does not find my little library file (that contains my systemwide constants). I don't know, how I can fix this issue and honestly, I don't know how to proceed from there if it is fixed.

I know from the examples that I need an additional program file that actualle calls the BFM API, but i don't know how to implement a small program that e.g. starts the clock of my testbench ticking.

Can somebody provide a little guidance on that? And of course a solution for the above shown modelsim error?

Thank you!

Maik

14 Replies