Altera Video and Image Processing Suite User Manual

Page 279

Advertising
background image

First, the test must define the numbers of bits per channel and channels per pixel, because most of the

classes require this information. Next, the class packages are imported, the clock and reset defined, and

the netlist itself instantiated with connections for clock and reset in place.
Note: The BFM resets are all active high. If an active low reset is required, it may be necessary to invert

the reset at the DUT input.

The final part of the this section of the code creates some objects from the class library which are used

later in the code. The parameterization is standard across all object instances of the classes as the bits per

channel and channels per pixel is constant in any given system.

tb_test.sv

—second section of the code.

// This creates a class with a names specific to `SOURCE0, which is needed
// because the class calls functions for that specific `SOURCE0. A class
// is used so that individual mailboxes can be easily associated with
// individual sources/sinks :

// This names MUST match the instance name of the source in tb.v :
`define SOURCE st_source_bfm_0
`define SOURCE_STR "st_source_bfm_0"
`define SOURCE_HIERARCHY_NAME `NETLIST.`SOURCE
`include "av_st_video_source_bfm_class.sv"

// Create an object of name `SOURCE of class av_st_video_source_bfm_`SOURCE :
`define CLASSNAME c_av_st_video_source_bfm_`SOURCE
`CLASSNAME `SOURCE;
`undef CLASSNAME

// This names MUST match the instance name of the sink in tb.v :
`define SINK st_sink_bfm_0
`define SINK_STR "st_sink_bfm_0"
`define SINK_HIERARCHY_NAME `NETLIST.`SINK
`include "av_st_video_sink_bfm_class.sv"

// Create an object of name `SINK of class av_st_video_sink_bfm_`SINK :
`define CLASSNAME c_av_st_video_sink_bfm_`SINK
`CLASSNAME `SINK;
`undef CLASSNAME

// Create mailboxes to transfer video packets and control packets :
mailbox #(c_av_st_video_item) m_video_items_for_src_bfm = new(0);
mailbox #(c_av_st_video_item) m_video_items_for_sink_bfm = new(0);

// Now create file I/O objects to read and write :
c_av_st_video_file_io #(`BITS_PER_CHANNEL, `CHANNELS_PER_PIXEL) video_file_reader;
c_av_st_video_file_io #(`BITS_PER_CHANNEL, `CHANNELS_PER_PIXEL) video_file_writer;

int r;
int fields_read;

When creating your own tests, ensure that the correct `defines are in place and the

av_st_video_source_

bfm_class.sv

and

av_st_video_sink_bfm_class.sv

files are in the correct directory as required by the

`include

.

After the source and sink BFMs are declared, two mailboxes are declared—

m_video_items_for_src_bfm

and

m_video_items_for_sink_bfm

, each of type c_av_st_video_item. These shall be used to pass video

items from the file reader into the source BFM and from the sink BFM to the file writer.
When creating your own tests, ensure that the correct `defines are in place and the

av_st_video_source_

bfm_class.sv

and

av_st_video_sink_bfm_class.sv

files are in the correct directory as required by the

`include

.

After the source and sink BFMs are declared, two mailboxes are declared—

m_video_items_for_src_bfm

UG-VIPSUITE

2015.05.04

Video File Reader Test

A-11

Avalon-ST Video Verification IP Suite

Altera Corporation

Send Feedback

Advertising