Altera_Forum
Honored Contributor
11 years agoUsing multiple BFMs in VHDL / Problems with use clauses
Hi.
I'm trying to create a VHDL testbench using Altera Verification BFMs. The DUT has an Avalon-MM Slave Interface, an Avalon-ST Sink Interface and an Avalon-ST Source Interface. The generated QSYS system has an Avalon-MM Master BFM, an Avalon-ST Source BFM and an Avalon-ST Sink interface. I can't make it work when I use more than one interface. Consider this [simplified] example:
library ieee;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
library bfm_test_mymodulesink_bfm;
use bfm_test_mymodulesink_bfm.altera_avalon_st_source_bfm_vhdl_pkg.all;
<entity declaration>
<architecture declaration>
process is
begin
set_transaction_channel(channel, id, req_if(id));
set_transaction_data(data, id, req_if(id));
push_transaction(id, req_if(id));
end process;
This works fine and I'm able to see the Source BFM sending data to my module Sink Interface in ModelSim waveform window. However, I can't make it work when I try another interface. If I -> 1) Don't insert any library / use clause in the VHDL file: ModelSim complains it can't find the functions. [That's expected]. This happens even if I write them in the form library.package.function_name. 2) Insert both libraries + use clauses at the beginning of the VHDL file: ModelSim doesn't know from which library it should use the functions.
library ieee;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
library bfm_test_mymodulesink_bfm;
use bfm_test_mymodulesink_bfm.altera_avalon_st_source_bfm_vhdl_pkg.all;
library bfm_test_mymodulesource_bfm;
use bfm_test_mymodulesource_bfm.altera_avalon_st_sink_bfm_vhdl_pkg.all;
library bfm_test_mymoduleavmm_bfm;
use bfm_test_mymoduleavmm_bfm.altera_avalon_mm_master_bfm_vhdl_pkg.all;
<entity declaration>
<architecture declaration>
process is
begin
set_transaction_channel(channel, id, req_if(id));
set_transaction_data(data, id, req_if(id));
push_transaction(id, req_if(id));
end process;
# ** Error: ./../teste_bfm_sys_tb.vhd(568): (vcom-1078) Identifier "req_if" is not directly visible.
[That's also expected]. However if I use the full name, as in library.package.function, I still get an error:
bfm_test_mymodulesink_bfm.altera_avalon_st_source_bfm_vhdl_pkg.req_if(0)
# ** Error: ./../teste_bfm_sys_tb.vhd(568): Illegal expanded name prefix ("bfm_test_mymodulesink_bfm" is not label of block, process, generate, or (for) loop statement).# ** Error: ./../teste_bfm_sys_tb.vhd(568): (vcom-1195) Cannot find expanded name "bfm_test_mymodulesink_bfm.altera_avalon_st_source_bfm_vhdl_pkg".
[This should work, if I'm not mistaken]. 3) Insert both libraries at the top of the file, and the use clauses in separate process (that's what the example test_program_pkg.vhd provided by Altera also does):
library ieee;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
library bfm_test_mymodulesink_bfm;
--use bfm_test_mymodulesink_bfm.altera_avalon_st_source_bfm_vhdl_pkg.all;
library bfm_test_mymodulesource_bfm;
--use bfm_test_mymodulesource_bfm.altera_avalon_st_sink_bfm_vhdl_pkg.all;
library bfm_test_mymoduleavmm_bfm;
--use bfm_test_mymoduleavmm_bfm.altera_avalon_mm_master_bfm_vhdl_pkg.all;
<entity declaration>
<architecture declaration>
source_bfm_process : process is
use bfm_test_mymodulesink_bfm.altera_avalon_st_source_bfm_vhdl_pkg.all;
begin
set_transaction_channel(channel, id, req_if(id));
set_transaction_data(data, id, req_if(id));
push_transaction(id, req_if(id));
end process source_bfm;
<processes for sink / master>
I get the same error as in (2).
"Illegal expanded name prefix"
"Cannot find expanded name" / "Unknown expanded name".
Could anybody explain to me what I'm doing wrong? What's the proper way to instantiate the provided BFMs functions in VHDL testbenches?