User guide

Table Of Contents
A–12 Appendix A: Avalon-ST Video Verification IP Suite
Video File Reader Test
Video and Image Processing Suite January 2013 Altera Corporation
User Guide
tb_test.sv—Section 1
Example A–1 shows the first section of the code.
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.
1 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.
Example A–1. tb_test.sv—Section 1
`timescale 1ns / 1ns
module tb_test;
`define CHANNELS_PER_PIXEL 3
`define BITS_PER_CHANNEL 8
import av_st_video_classes::*;
import av_st_video_file_io_class::*;
// Create clock and reset:
logic clk, reset;
initial
clk <= 1'b0;
always
#2.5 clk <= ~clk; //200 MHz
initial
begin
reset <= 1'b1;
#10 @(posedge clk) reset <= 1'b0;
end
// Instantiate "netlist" :
`define NETLIST netlist
tb `NETLIST (.reset(reset),.clk(clk));
// Create some useful objects from our defined classes :
c_av_st_video_data #(`BITS_PER_CHANNEL, `CHANNELS_PER_PIXEL) video_data_pkt1;
c_av_st_video_control #(`BITS_PER_CHANNEL, `CHANNELS_PER_PIXEL) video_control_pkt1;
c_av_st_video_user_packet #(`BITS_PER_CHANNEL, `CHANNELS_PER_PIXEL) user_pkt1;