Forum Discussion

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

How 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

51 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Dave,

    I need information about burst write operation in avalon bfm. Below i mentioned the task which i am using.

    In that burst_size is 3 and burst_count in each burst is 2.So totally 6 data transaction will happen.But In my case i am getting only three data transacation and

    and address is also not incrementing(Adress is zero for all transaction).

    Please help me ... I am new to protocol..

    ////////////////////////////////Task //////////////////////////////////////

    task data_init(output bit[511:0] data [int]);

    for(int i=0; i<6; i++)

    data = {$random(), $random()};

    endtask

    task avalon_write ([34:0] addr, bit[511:0] data [int]);

    // construct the bfm request

    `bfm.set_command_request(req_write);

    `bfm.set_command_idle(0, 0);

    `bfm.set_command_init_latency(0);

    `bfm.set_command_address(addr);

    `bfm.set_command_burst_size(3);

    `bfm.set_command_burst_count(2);

    for(int i=0; i<6; i++)

    begin

    `bfm.set_command_data(data, i);

    `BFM.set_command_byte_enable(48'hffff_ffff_ffff,i) ;

    end

    // Queue the command

    `BFM.push_command();

    // Wait until the transaction has completed

    while (`BFM.get_response_queue_size() != 1)

    @(posedge `BFM.clk);

    // Dequeue the response and discard

    `BFM.pop_response();

    endtask

    bit[511:0] wdata[int];

    /////////////////////////////

    initial

    begin

    data_init(wdata);

    avalon_write('d0,wdata);

    end

    ///////////////////////////////

    Thanks

    Venkat