beautypg.com

Altera Video and Image Processing Suite User Manual

Page 280

background image

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.

tb_test.sv

—third section of the code.

initial
begin

wait (resetn == 1'b1)
repeat (4) @ (posedge (clk));

// Constructors associate the mailboxes with the source and sink classes
`SOURCE = new(m_video_items_for_src_bfm);
`SINK = new(m_video_items_for_sink_bfm);

`SOURCE.set_pixel_transport(`TRANSPORT);
`SINK.set_pixel_transport(`TRANSPORT);

`SOURCE.set_name(`SOURCE_STR);
`SINK.set_name( `SINK_STR);

`SOURCE.set_readiness_probability(90);
`SINK.set_readiness_probability(90);

`SOURCE.set_long_delay_probability(0.01);
`SINK.set_long_delay_probability(0.01);

In this code, after reset has gone high, the video source and sink BFM objects are constructed with the

previously declared mailboxes. Then, some method calls are made to configure the transport mechanism,

name the objects (for reporting purposes), and set some attributes regarding readiness and probability of

long delays.

tb_test.sv

—final section of the code

fork

`SOURCE.start();
`SINK.start();

begin

// File reader :

// Associate the source BFM's video in mailbox with the video
// file reader object via the file reader's constructor :
video_file_reader = new(m_video_items_for_src_bfm);
video_file_reader.set_object_name("file_reader_0");

video_file_reader.open_file("flag_i_crop.raw",read, 60, 100, 4'b1100);
video_file_reader.read_file();
video_file_reader.close_file();

fields_read = video_file_reader.get_video_packets_handled();

// File writer :

video_file_writer = new(m_video_items_for_sink_bfm);
video_file_writer.set_object_name("file_writer_0");
video_file_writer.open_file("data_out.raw", write, 60, 100, 4'b1100);

// Write the video output packets to a file :

A-12

Video File Reader Test

UG-VIPSUITE

2015.05.04

Altera Corporation

Avalon-ST Video Verification IP Suite

Send Feedback