Altera_Forum
Honored Contributor
14 years agoHow to use Avalon-MM Master BFM?
Hello, all.
I want to use Avalon Verification IP Suite to check a Qsys custom componet, which have an Avalon salve interface and a Avalon conduit interface connecting a LSI. I wrote this program to test if the custom component can give right response to the Avalon Master BFM.
//Console messaging level
`define VERBOSITY VERBOSITY_INFO
//BFM hierachy
`define CLK_BFM top.tb.clock_source
`define RST_BFM top.tb.reset_source
`define MM_MASTER top.tb.avalon_mm_master
`define CONDUIT_BFM top.tb.conduit_bfm
module test_program();
import verbosity_pkg::*;
import avalon_mm_pkg::*;
event start_test;
event end_test;
//----------------------------------------------------------------------------------
// Set verbosity before the test starts
// Qsys-generated testbench activates clock and reset BMFs
//----------------------------------------------------------------------------------
initial begin
set_verbosity(`VERBOSITY);
// initialize BFMS
`MM_MASTER.init();
end
//----------------------------------------------------------------------------------
// Main test block
//----------------------------------------------------------------------------------
initial begin
// wait for reset inactive
wait(`RST_BFM.reset == 1);
-> start_test;
end
initial begin
@ start_test;
// start write access
`MM_MASTER.set_command_request(REQ_WRITE);
`MM_MASTER.set_command_address(16'h0);
`MM_MASTER.set_command_idle(2,0);
`MM_MASTER.set_command_init_latency(0);
`MM_MASTER.set_command_data(32'h0,0);
`MM_MASTER.push_command();
end
endmodule
Although this program can be compiled by ModelSim with no error, but it seems the write access was not started. Can you give me some hints or some examples about how to test custom components wit Avalon IP verification suite? Regards, feng