User guide
Table Of Contents
- Contents
- 1. About This MegaCore Function Suite
- Release Information
- Device Family Support
- Features
- Design Example
- Performance and Resource Utilization
- 2D FIR Filter
- 2D Median Filter
- Alpha Blending Mixer
- Avalon-ST Video Monitor
- Chroma Resampler
- Clipper
- Clocked Video Input
- Clocked Video Output
- Color Plane Sequencer
- Color Space Converter
- Control Synchronizer
- Deinterlacer
- Deinterlacer II
- Frame Buffer
- Gamma Corrector
- Interlacer
- Scaler
- Scaler II
- Switch
- Test Pattern Generator
- Trace System
- 2. Getting Started with Altera IP Cores
- 3. Interfaces
- Interface Types
- Avalon-ST Video Protocol
- Avalon-MM Slave Interfaces
- Avalon-MM Master Interfaces
- Buffering of Non-Image Data Packets in Memory
- 4. 2D FIR Filter MegaCore Function
- 5. 2D Median Filter MegaCore Function
- 6. Alpha Blending MegaCore Function
- 7. Avalon-ST Video Monitor MegaCore Function
- 8. Chroma Resampler MegaCore Function
- 9. Clipper MegaCore Function
- 10. Clocked Video Input MegaCore Function
- 11. Clocked Video Output MegaCore Function
- 12. Color Plane Sequencer MegaCore Function
- 13. Color Space Converter MegaCore Function
- 14. Control Synchronizer MegaCore Function
- 15. Deinterlacer MegaCore Function
- Core Overview
- Functional Description
- Parameter Settings
- Signals
- Control Register Maps
- 16. Deinterlacer II MegaCore Function
- 17. Frame Reader MegaCore Function
- 18. Frame Buffer MegaCore Function
- 19. Gamma Corrector MegaCore Function
- 20. Interlacer MegaCore Function
- 21. Scaler MegaCore Function
- 22. Scaler II MegaCore Function
- 23. Switch MegaCore Function
- 24. Test Pattern Generator MegaCore Function
- 25. Trace System MegaCore Function
- A. Avalon-ST Video Verification IP Suite
- B. Choosing the Correct Deinterlacer
- Additional Information

A–22 Appendix A: Avalon-ST Video Verification IP Suite
Constrained Random Test
Video and Image Processing Suite January 2013 Altera Corporation
User Guide
If the reference video item is a
video_packet
type, the scoreboard code shown in
Example A–6 receives the reference video item from the scoreboard mailbox. The 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 greyscale video is generated the
code calls the to_grey function (refer to Example A–7) 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 us.
Example A–7 shows the code for the
to_grey
function.
to_grey
function reads each pixel in turn from the RGB
video_packet
object,
calculates the greyscale value, writes the value to each channel of the outgoing pixel,
and pushes that on to the returned
video_packet
object, grey.
Example A–7. Scoreboard Behavioral Model of the DUT
// 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;
grey = new ();
grey.packet_type = video_packet;
do
begin
grey_pixel = new();
rgb_pixel = rgb.pop_pixel();
// Turn RGB into greyscale :
grey_value = ( red_factor * rgb_pixel.get_data(2) +
green_factor * rgb_pixel.get_data(1) +
blue_factor * rgb_pixel.get_data(0));
grey_pixel.set_data(2, grey_value[15:8]);
grey_pixel.set_data(1, grey_value[15:8]);
grey_pixel.set_data(0, grey_value[15:8]);
grey.push_pixel(grey_pixel);
end
while (rgb.get_length()>0);
return grey;
endfunction