Video and Image Processing Suite User Guide

ID 683416
Date 4/04/2022
Document Table of Contents


For every BFM that is instanced in testbench.qsys, there must be a systemVerilog BFM driver object declared. The declaration handles all the interfacing between the BFM and the class library.

The declaration methodology in follows a specific template. The format below shows an example of the Avalon-ST sink BFM code in the file:

1 `define SINK st_sink_bfm_0 
2 `define SINK_STR "st_sink_bfm_0" 
4 `include "" 
5 `define CLASSNAME c_av_st_video_sink_bfm_`SINK 
7 `undef CLASSNAME 
9 mailbox #(c_av_st_video_item) m_video_items_for_src_bfm[1][1];
11 initial
12 begin
13 m_video_items_for_sink_bfm[0][0] = new(0); 
14 st_sink_bfm_0  = new(m_video_items_for_sink_bfm[0]); 
15 end 

The code template breaks down as follows.

In lines 1-2, the name of the sink BFM in the Platform Designer testbench is defined, together with its hierarchical path in the netlist in line 3. (The code requires the name of the sink and hierarchy to be defined prior to the code being included. The prior definition ensures that the driver can find the BFM in the design hierarchy.

A bespoke class is declared and an object with the sink name instanced in line 6.

In line 9, a 1x1 mailbox array of video items is declared—the first element of which is constructed in line 13.

In line 14, the 1D mailbox element array is passed to constructor of the new sink object—this is the mechanism by which video items (video packet, control packets and user packets) are passed to the user’s test code.

A similar methodology is used for Avalon-MM interface. The example below shows a code that can be found at the beginning of the file:

1 `define IF_MEM_MASTER_RD
2 `define SLAVE_NAME mm_slave_bfm_for_vfb_reads
3 `define SLAVE_HIERARCHICAL_LOCATION testbench.mm_slave_bfm_for_vfb_reads
4 `include ""
5 av_mm_slave_bfm_mm_slave_bfm_for_vfb_reads #(32, 32/8, 0) slave_bfm_mm_slave_bfm_for_vfb_reads;
6 mailbox #(av_mm_transaction #(32,  32/8, 0)) mbox_slave_bfm_mem_master_rd_drv;
7 mailbox #(av_mm_transaction #(32,  32/8, 0)) mbox_slave_bfm_mem_master_rd_reply_drv;
8 initial begin
9 mbox_slave_bfm_mem_master_rd_drv = new(0);
10 mbox_slave_bfm_mem_master_rd_reply_drv = new(0);
11 slave_bfm_mm_slave_bfm_for_vfb_reads = new(mbox_slave_bfm_mem_master_rd_drv, mbox_slave_bfm_mem_master_rd_reply_drv);
12 end
13 `undef IF_MEM_MASTER_RD
14 `undef SLAVE_NAME                              
15 `undef SLAVE_HIERARCHICAL_LOCATION             

In lines 5 and 6, mailboxes of control register objects are declared and constructed.

The control register class has an address field and a value field together with other information. These mailboxes are passed to the control BFM class in line 8, and are used to send register writes and to receive register reads, as described in the following section.