Altera Avalon-MM Master BFM Tutorial - VHDL BFM wrapper package
---------------------------------------------------------------

6/22/2015 D. W. Hawkins (dwh@caltech.edu)

This folder contains a slight variable on the VHDL testbench.
The Altera Avalon-MM Master BFM procedures used in the testbench

   hdl/avalon_bfm_master/test/qsys_system_tb.vhd

were extracted into a package and the testbench was updated to use
the procedures in that package, i.e., the files

   hdl/avalon_bfm_master_vhdl_pkg/test/avalon_bfm_master_pkg.vhd
   hdl/avalon_bfm_master/test/qsys_system_tb.vhd

The Avalon-MM procedures in the package are slightly different than
the procedures used in the original testbench, as the packaged
procedures needed additional arguments for the BFM ID and the
request signal (which could not be accessed directly as a global).

The run this version of the testbench, run the VHDL testbench for the
original testbench, eg., start Modelsim and

  ModelSim> cd {C:\temp\altera_avalon_bfm_master\hdl\avalon_bfm_master}
  ModelSim> source scripts/sim.tcl

compile the new package and modified testbench via

  ModelSim> vcom -2008 ../avalon_bfm_master_vhdl_pkg/test/avalon_bfm_master_pkg.vhd
  ModelSim> vcom -2008 ../avalon_bfm_master_vhdl_pkg/test/qsys_system_tb.vhd

and then re-run the simulation

  ModelSim> restart -f; run -a

The simulation start message will change to:

# ==============================================================================
# Qsys system testbench (using the VHDL BFM package)
# ==============================================================================

so you will know that you are running the modified testbench.

Why place the BFM procedures into a testbench (and require two additional
arguments to the read/write procedures)?

The use of a package saves you copy-and-pasting the BFM wrapper procedures
into every VHDL testbench. Using a package allows you to use a common set
of procedures across multiple testbenches.

-------------------------------------------------------------------------------
Notes:

1. The BFM ID argument could be avoided by using a generic package where
   the BFM ID is a generic.

2. The BFM request signal argument cannot be avoided. See the notes in
   client_server_pkg_v1.txt and client_server_pkg_v2.txt

   Compilation of v1.txt via
   vcom -2008 ../avalon_bfm_master_vhdl_pkg/client_server_pkg_v1.txt
   generates errors related to driving the global request signal

   Compilation of v2.txt via
   vcom -2008 ../avalon_bfm_master_vhdl_pkg/client_server_pkg_v2.txt
   shows the errors are gone if the request signal is a procedure
   argument.

   The solution for v2 is what was used by Altera for their Avalon-MM
   Master BFM procedures, and re-used in my wrapper code.

