User guide

Table Of Contents
Appendix A: Avalon-ST Video Verification IP Suite A–13
Video File Reader Test
January 2013 Altera Corporation Video and Image Processing Suite
User Guide
tb_test.sv—Section 2
Example A–2 shows the second section of the code.
In this section, the video source and sink BFMs are declared as previously described
in Figure A–3 on page A–7. 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.
At the end of this section, the file I/O class is used to declare the file reader and file
writer objects.
Example A–2. tb_test_sv (Section 2)
// 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;