Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Video and Image Processing Suite User Guide Avalon st video.pdf
Скачиваний:
81
Добавлен:
11.06.2015
Размер:
2.64 Mб
Скачать

A-16

Complete Class Reference

UG-VIPSUITE

2015.01.23

 

 

The Avalon-ST BFM monitors (available in Qsys) include a comprehensive set of functional coverage points (in the altera_avalon_st_monitor_coverage.sv file) that can add an Avalon-ST protocol coverage to any user DUT coverage, greatly facilitating powerful constrained random test.

Complete Class Reference

c_av_st_video_control

The declaration for the c_av_st_video_control class:

class c_av_st_video_control #(parameter BITS_PER_CHANNEL = 8, CHANNELS_PER_PIXEL = 3) extends c_av_st_video_item;

Table A-4: Method Calls for c_av_st_video_control Class

 

 

Method Call

 

Description

 

 

 

 

 

 

 

 

function new();

 

The PHY RX and TX latency numbers for

 

 

 

 

different PCS options.

 

 

 

 

 

 

 

function bit compare (c_av_st_video_control r)

 

Compares this instance to object r. Returns 1 if

;

 

 

identical, 0 if otherwise.

 

 

 

 

 

 

 

function bit [15:0] get_width ();

 

 

 

 

 

 

 

 

function bit [15:0] get_height ();

 

 

 

 

 

 

 

 

function bit [3:0] get_interlacing ();

 

 

 

 

 

 

 

 

function t_packet_control get_append_garbage

 

();

 

 

 

 

 

 

 

 

 

 

 

function int get_garbage_probability ();

 

 

 

 

 

 

 

 

function void set_width (bit [15:0] w);

 

 

 

 

 

 

 

 

function void set_height (bit [15:0] h);

 

 

 

 

 

 

 

 

function void set_interlacing (bit [3:0] i);

 

 

 

 

 

 

 

 

function void set_append_garbage (t_packet_

 

Refer to append_garbage member.

 

control i);

 

 

 

 

 

 

 

 

 

 

function void set_garbage_probability (int i);

 

 

 

 

 

 

 

 

function string info();

 

Returns a formatted string containing the

 

 

 

 

width, height and interlacing members.

 

Table A-5: Members of c_av_st_video_control Class

 

 

 

 

 

 

 

 

 

 

Member

 

Description

 

 

 

 

 

 

 

 

rand bit[15:0] width;

 

 

 

 

 

 

 

 

rand bit[15:0] height;

 

 

 

 

 

 

 

 

 

 

Altera Corporation

 

 

Avalon-ST Video Verification IP Suite

 

 

 

 

Send Feedback

UG-VIPSUITE

c_av_st_video_data

A-17

2015.01.23

 

 

Member

 

Description

 

 

 

rand bit[3:0] interlace;

 

 

 

 

rand t_packet_control append_garbage = off;

 

The append_garbage control is of type t_

 

 

packet_control, defined as: typedef

 

 

enum{on,off,random} t_packet_control;

 

 

 

rand int garbage_probability = 50;

 

The source BFM uses garbage_probability

 

 

and append_garbage to determine whether or

 

 

not to append garbage beats to the end of the

 

 

control packets.

 

 

Garbage beats are generated with a probability

 

 

of Garbage_probability%.

 

 

• When a stream of garbage is being

 

 

generated, the probability that the stream

 

 

terminates is fixed in the source BFM at

 

 

10%.

 

 

• When garbage is produced, this typically

 

 

produces around 1 to 30 beats of garbage

 

 

per control packet.

 

 

 

c_av_st_video_data

The declaration for the c_av_st_video_data class:

class c_av_st_video_data#(parameter BITS_PER_CHANNEL = 8, CHANNELS_PER_PIXEL = 3) extends c_av_st_video_item;

Table A-6: Method Calls for c_av_st_video_data Class

 

Method Call

 

Description

 

 

 

 

 

 

 

 

function new();

 

Constructor

 

 

 

 

 

 

 

function void copy (c_av_st_video_data c);

 

Copies object c into this object.

 

 

 

 

 

 

 

function bit compare (c_av_st_video_data r);

 

Compares this instance to object r. Returns 1 if

 

 

 

identical, 0 if otherwise.

 

 

 

 

 

 

 

function void set_max_length(int length);

 

 

 

 

 

 

 

 

function int get_length();

 

 

 

 

 

 

 

 

function c_pixel #(BITS_PER_CHANNEL,CHANNELS_

 

Returns a pixel object from the packet in first

 

PER_PIXEL) pop_pixel();

 

in first out (FIFO) order.

 

 

 

 

 

 

 

function c_pixel #(BITS_PER_CHANNEL,CHANNELS_

 

Returns a pixel object from the packet at index

 

PER_PIXEL) query_pixel(int i);

 

i, without removing the pixel.

 

 

 

 

 

 

 

function void unpopulate(bit display);

 

Pops all pixels from the packet, displaying

 

 

 

them if display = 1.

 

 

 

 

 

 

 

 

 

 

Avalon-ST Video Verification IP Suite

 

 

Altera Corporation

 

Send Feedback

 

 

 

 

A-18

c_av_st_video_file_io

 

UG-VIPSUITE

2015.01.23

 

 

 

 

 

 

 

 

 

 

 

Method Call

 

Description

 

 

 

 

 

 

 

function void push_pixel(c_pixel #(BITS_PER_ CHANNEL, CHANNELS_PER_PEXEL)pixel);

Pushes a pixel into the packet.

Table A-7: Members of c_av_st_video_data Class

Member

 

Description

 

 

 

c_pixel #(BITS_PER_CHANNEL,CHANNELS_PER_PIXEL)

 

The video data is held in a queue of pixel

pixels [$];

 

objects.

 

 

 

c_pixel #(BITS_PER_CHANNEL,CHANNELS_PER_PIXEL)

 

Pixel objects used for storing intermediate

pixel, new_pixel, r_pixel;

 

data.

 

 

 

rand int video_length;

 

The length of the video packet (used for

 

 

constrained random generation only).

 

 

 

int video_max_length = 10;

 

Maximum length of video packet (used for

 

 

constrained random generation only).

 

 

 

c_av_st_video_file_io

The declaration for the c_av_st_video_file_io class:

class c_av_st_video_file_io#(parameter BITS_PER_CHANNEL = 8, CHANNELS_PER_PIXEL = 3);

Table A-8: Method Calls for c_av_st_video_file_io Class

Method Call

 

Description

 

 

 

function void set_send_control_packets(t_

 

If this method is used to set the send_

packet_controls);

 

control_packet control to off, then one

 

 

control packet is sent at the beginning of video

 

 

data, but no further control packets are sent.

 

 

 

function t_packet_control get_send_control_

 

packets();

 

 

 

 

 

 

function void set_send_user_packets(t_packet_

 

If the send_user_packets control is off, no

control s);

 

user packets at all are sent. Otherwise, user

 

 

packets are sent before and after any control

 

 

packets.

 

 

 

function t_packet_control get_send_user_

 

packets();

 

 

 

 

 

 

function void set_send_early_eop_packets(t_

 

If the send_eop_packets control is off, all

packet_control s);

 

packets are of the correct length (or longer).

 

 

Otherwise, early EOP are sent of a length

 

 

determined by the constraints on early_eop_

 

 

packet_length.

 

 

 

Altera Corporation

Avalon-ST Video Verification IP Suite

 

 

Send Feedback

UG-VIPSUITE

 

c_av_st_video_file_io

A-19

2015.01.23

 

 

 

 

 

 

 

 

 

 

Method Call

 

Description

 

 

 

 

 

 

 

function t_packet_control get_send_early_eop_

 

 

 

packets();

 

 

 

 

 

 

 

 

 

 

 

function void set_early_eop_probability(int s)

 

If the send_early_eop_packets control is set

;

 

to random, the early_eop_probability

 

 

 

 

control determines what proportion of video

 

 

 

 

packets are terminated early.

 

 

 

 

 

 

 

function int get_early_eop_probability();

 

 

 

 

 

 

 

function void set_send_late_eop_packets(t_

 

If the send_late_eop_packets control is off,

 

packet_controls);

 

all packets are of the correct length (or longer).

 

 

 

Otherwise, late EOP are sent of a length

 

 

 

 

determined by the constraints on late_eop_

 

 

 

 

packet_length.

 

 

 

 

 

 

 

function t_packet_control get_send_late_eop_

 

 

 

packets();

 

 

 

 

 

 

 

 

 

 

 

function void set_late_eop_probability (int s)

 

If the send_late_eop_packets control is set

;

 

to random, the late_eop_probability

 

 

 

 

control determines what proportion of video

 

 

 

 

packets are terminated late.

 

 

 

 

 

 

 

function int get_late_eop_probability ();

 

 

 

 

 

 

 

 

function void set_user_packet_probability (int

 

If the send_user_packets is set to random,

 

 

s);

 

the user_packet_probability control

 

 

 

 

determines the probability that a user packet

 

 

 

 

being sent before a control packet. It also

 

 

 

 

determines the probability that a user packet

 

 

 

 

will be sent after a control packet.

 

 

 

 

 

 

 

function int get_user_packet_probability ();

 

 

 

 

 

 

 

function void set_control_packet_

 

If the send_control_packets control is set to

 

probability(int s);

 

random, the control_packet_probability

 

 

 

 

control determines the probability of a control

 

 

 

packet being sent before a video packet.

 

 

 

 

 

 

 

function int get_control_packet_probability();

 

 

 

 

 

 

 

 

function void set_send_garbage_after_control_

 

When the send_control_packet() method

 

 

packets (t_packet_control s);

 

puts a control packet into the m_video_item_

 

 

 

out mailbox, the append_garbage member of

 

 

 

the control packet object is set to the value of

 

 

 

send_garbage_after_control_packets.

 

 

 

 

 

 

 

function t_packet_control get_send_garbage_

 

 

 

after_control_packets();

 

 

 

 

 

 

 

 

 

 

 

Avalon-ST Video Verification IP Suite

Altera Corporation

 

 

Send Feedback

A-20

c_av_st_video_file_io

UG-VIPSUITE

2015.01.23

 

 

Method Call

 

 

Description

 

 

 

function void set_object_name(string s);

 

You can use object_name to name a given

 

 

object instance of a class to ensure any

 

 

reporting that the class generates is labeled

 

 

with the originating object’s name.

 

 

 

 

function string get_object_name();

 

 

 

 

 

function string get_filename();

 

This returns the filename associated with the

 

 

object, by the open_file call.

 

 

 

 

function void set_image_

 

 

height(bit[15:0]height);

 

 

 

 

 

 

 

 

 

function bit[15:0]get_image_height();

 

 

 

 

 

 

function void set_image_width(bit[15:0] width)

 

 

;

 

 

 

 

 

 

 

 

 

function bit[15:] get_image_width();

 

 

 

 

 

function void set_video_data_type(string s);

 

Sets the fourcc[3] code associated with the

 

 

raw video data. The following are the

 

 

supported four character code (FOURCC)

 

 

codes:

 

 

RGB32

 

 

IYU2

 

 

YUY2

 

 

Y410

 

 

A2R10GB10

 

 

Y210

 

 

 

function string get_video_data_type();

 

Returns the FOURCC code (for example,

 

 

RGB32) being used for the raw video data.

 

 

 

 

function int get_video_packets_handled();

 

 

 

 

 

 

function int get_control_packets_handled();

 

 

 

 

 

 

function int get_user_packets_handled();

 

 

 

 

 

function new(mailbox #(c_av_st_video_item)m_

 

Constructor. The mailbox is used to pass all

vid_out);

 

packets in and out of the file I/O object.

 

 

 

 

Altera Corporation

Avalon-ST Video Verification IP Suite

 

 

Send Feedback

UG-VIPSUITE

c_av_st_video_file_io

A-21

2015.01.23

 

 

Method Call

 

Description

 

 

 

function void open_file(string fname, t_rwrw);

 

Files are opened using this method. For

 

 

example:

 

 

video_file_reader.open_file(‘’vip_car_

 

 

0.bin”, read);

 

 

t_rw is an enumerated type with values read or

 

 

write.

 

 

NB. The read fails if there is no associated .spc

 

 

file, for example, vip_car_o.spc).

 

 

 

function void close_file();

 

For example, video_file_reader.close_

 

 

file();

 

 

 

task read_file();

 

Read_file() optionally calls send_user_

 

 

packet() and send_control_packet(), then

 

 

calls read_video_packet().

 

 

 

task send_control_packet();

 

The control packet sent is derived from the

 

 

image height, width, and interlace fields as

 

 

provided by open_file().

 

 

 

task send_user_packet();

 

The user packet sent is always comprised of

 

 

random data and had a maximum length

 

 

hard-coded to 33 data items.

 

 

 

task_generate_spc_file();

 

When writing a file, this call creates the

 

 

necessary associated .spc file.

 

 

 

task read_video_packet();

 

The main file reading method call. Binary data

 

 

is read from the file and packed into pixel

 

 

objects according to the settings of ycbr_

 

 

pixel_order and endianism. Pixel objects are

 

 

packed into a video data object, with some

 

 

pixels optionally added or discarded if late/

 

 

early EOP is being applied. When one

 

 

complete field of video has been read (as

 

 

determined by the height and width controls),

 

 

the video_data object is put in the mailbox.

 

 

 

task wait_for_and_write_video_packet_to_file()

 

When called, this method waits for an object

;

 

to be put in the mailbox (usually from a sink

 

 

BFM). When a control or a user packet object

 

 

arrives, this call is reported and ignored. When

 

 

a video packet arrives, the video data is written

 

 

to the open file in little endianism format.

 

 

 

Avalon-ST Video Verification IP Suite

Altera Corporation

 

 

Send Feedback

A-22

c_av_st_video_file_io

 

UG-VIPSUITE

2015.01.23

 

 

 

 

Table A-9: Members of c_av_st_video_file_io Class

 

 

 

 

 

 

 

 

 

 

 

Member

 

Description

 

 

 

 

 

 

 

 

 

local int video_packets_handled = 0;

 

video_packets_handled is added whenever a

 

 

 

 

packet is read or written to or from the file.

 

 

 

 

 

 

 

 

local int control_packets_handled = 0;

 

control_packets_handled is added

 

 

 

 

whenever a control packet is put in the object’s

 

 

 

 

mailbox.

 

 

 

 

 

 

 

 

local int user_packets_handled = 0;

 

user_packets_handled is added whenever a

 

 

 

 

user packet is put in the object's mailbox.

 

 

 

 

 

 

 

 

local reg[15:0] image_height;

 

 

 

 

 

 

 

 

 

local reg[15:0] image_width;

 

 

 

 

 

 

 

 

 

local reg[3:0] image_interlaced;

 

 

 

 

 

 

 

 

 

string image_fourcc;

 

 

 

 

 

 

 

 

 

local string object_name = "file_io";

 

 

 

 

 

 

 

 

 

local string filename;

 

 

 

 

 

 

 

 

 

local string spc_filename;

 

 

 

 

 

 

 

 

 

local int fourcc_channels_per_pixel;

 

Set when the associate .spc file is read.

 

 

 

 

 

 

 

 

local int fourcc_bits_per_channel;

 

Set when the associate .spc file is read.

 

 

 

 

 

 

 

 

local int fourcc_pixels_per_word;

 

Set when the associate .spc file is read.

 

 

 

 

 

 

 

 

local int fourcc_channel_lsb;

 

Set when the associate .spc file is read.

 

 

 

 

 

 

 

 

int early_eop_probability = 20;

 

 

 

 

 

 

 

 

 

Int late_eop_probability = 20;

 

 

 

 

 

 

 

 

 

int user_packet_probability = 20;

 

 

 

 

 

 

 

 

 

int control_packet_probability = 20;

 

 

 

 

 

 

 

 

 

mailbox #(c_av_st_video_item) m_video_item_out

 

The mailbox is used to pass all packets in/out

 

 

= new(0);

 

of the file i/o object.

 

 

 

 

 

 

 

 

rand t_packet_control send_control_packets =

 

 

 

on;

 

 

 

 

 

 

 

 

 

 

 

 

 

 

rand t_packet_control send_user_packets = off;

 

 

 

 

 

 

 

 

 

rand t_packet_control send_early_eop_packets =

 

 

 

off;

 

 

 

 

 

 

 

 

 

 

 

 

 

 

rand t_packet_control send_late_eop_packets =

 

If both send_late_eop_packets and send_

 

 

off;

 

early_eop_packets are set to random, a late

 

 

 

 

EOP will only be generated if an early EOP has

 

 

 

 

not been generated.

 

 

 

 

 

 

Altera Corporation

Avalon-ST Video Verification IP Suite

 

 

Send Feedback

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]