Code for to_grey function – Altera Video and Image Processing Suite User Manual
Page 286

begin
// Get the reference item from the scoreboard mailbox :
m_video_items_for_scoreboard.get(ref_pkt);
// If the reference item is a video packet, then check
// for the control & video packet response :
if (ref_pkt.get_packet_type() == video_packet)
begin
m_video_items_for_sink_bfm.get(dut_pkt);
if (dut_pkt.get_packet_type() != control_packet)
$fatal(1,"SCOREBOARD ERROR”);
m_video_items_for_sink_bfm.get(dut_pkt);
if (dut_pkt.get_packet_type() != video_packet)
$fatal(1, "SCOREBOARD ERROR”);
// A video packet has been received, as expected.
// Now compare the video data itself :
dut_video_pkt = c_av_st_video_data'(dut_pkt);
if (dut_video_pkt.compare (to_grey(c_av_st_video_data'(ref_pkt))))
$display("%t Scoreboard match”);
else
$fatal(1, "SCOREBOARD ERROR : Incorrect video packet.\n");
end
-> event_dut_output_analyzed;
end
end
end
initial
#1000000 $finish;
If the reference video item is a
video_packet
type, this scoreboard code receives the reference video item
from the scoreboard mailbox. This code then receives two consecutive items from the DUT and checks
whether or not these items are a control and video packet. To check that grayscale video is generated the
code calls the
to_grey
function on the reference video item and calls the
compare()
method. If the items
matched, the code returns a 1. If the items does not matched, the code returns an 0. Then, the result is
output to the display. You can run the test for as long as you have to. In this example, it is 1 µs.
Code for
to_grey
Function
// The scoreboard calls a function which models the behaviour of the video
algorithm
function c_av_st_video_data to_grey (c_av_st_video_data rgb) ;
const bit [7:0] red_factor = 76; // 255 * 0.299
const bit [7:0] green_factor = 150; // 255 * 0.587;
const bit [7:0] blue_factor = 29; // 255 * 0.114;
c_av_st_video_data grey;
c_pixel rgb_pixel;
c_pixel grey_pixel;
int grey_value;
A-18
Code for to_grey Function
UG-VIPSUITE
2015.05.04
Altera Corporation
Avalon-ST Video Verification IP Suite