1 |
45 |
qaztronic |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// Copyright (C) 2018 Authors and OPENCORES.ORG ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// This source file may be used and distributed without ////
|
6 |
|
|
//// restriction provided that this copyright statement is not ////
|
7 |
|
|
//// removed from the file and that any derivative work contains ////
|
8 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
9 |
|
|
//// ////
|
10 |
|
|
//// This source file is free software; you can redistribute it ////
|
11 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
12 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
13 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
14 |
|
|
//// later version. ////
|
15 |
|
|
//// ////
|
16 |
|
|
//// This source is distributed in the hope that it will be ////
|
17 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
18 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
19 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
20 |
|
|
//// details. ////
|
21 |
|
|
//// ////
|
22 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
23 |
|
|
//// Public License along with this source; if not, download it ////
|
24 |
|
|
//// from http://www.opencores.org/lgpl.shtml ////
|
25 |
|
|
//// ////
|
26 |
|
|
//////////////////////////////////////////////////////////////////////
|
27 |
|
|
|
28 |
|
|
class s_avf_api
|
29 |
|
|
extends uvm_sequence #(avf_sequence_item);
|
30 |
|
|
`uvm_object_utils(s_avf_api)
|
31 |
|
|
|
32 |
|
|
avf_sequence_item item;
|
33 |
|
|
|
34 |
|
|
// --------------------------------------------------------------------
|
35 |
|
|
mailbox #(video_frame_class) frame_buffer;
|
36 |
|
|
int pixels_per_line;
|
37 |
|
|
int lines_per_frame;
|
38 |
|
|
int bits_per_pixel;
|
39 |
|
|
int bytes_per_pixel;
|
40 |
|
|
int pixels_per_clk;
|
41 |
|
|
|
42 |
|
|
// --------------------------------------------------------------------
|
43 |
|
|
function void init( int pixels_per_line
|
44 |
|
|
, int lines_per_frame
|
45 |
|
|
, int bits_per_pixel
|
46 |
|
|
, int pixels_per_clk
|
47 |
|
|
);
|
48 |
|
|
this.pixels_per_line = pixels_per_line;
|
49 |
|
|
this.lines_per_frame = lines_per_frame;
|
50 |
|
|
this.bits_per_pixel = bits_per_pixel;
|
51 |
|
|
this.bytes_per_pixel = (bits_per_pixel % 8 == 0)
|
52 |
|
|
? (bits_per_pixel / 8)
|
53 |
|
|
: (bits_per_pixel / 8) + 1;
|
54 |
|
|
this.pixels_per_clk = pixels_per_clk;
|
55 |
|
|
endfunction : init
|
56 |
|
|
|
57 |
|
|
// --------------------------------------------------------------------
|
58 |
|
|
task automatic put_frame(string pattern, int pixel = 0);
|
59 |
|
|
video_frame_class f_h = new;
|
60 |
|
|
f_h.init( pixels_per_line
|
61 |
|
|
, lines_per_frame
|
62 |
|
|
, bits_per_pixel
|
63 |
|
|
, pixels_per_clk
|
64 |
|
|
);
|
65 |
|
|
case(pattern.tolower)
|
66 |
|
|
"constant": f_h.make_constant(pixel);
|
67 |
|
|
"counting": f_h.make_counting();
|
68 |
|
|
"horizontal": f_h.make_horizontal();
|
69 |
|
|
"vertical": f_h.make_vertical();
|
70 |
|
|
"random": f_h.make_random();
|
71 |
|
|
default: `uvm_fatal(get_name(), "Pattern not supported!")
|
72 |
|
|
endcase
|
73 |
|
|
|
74 |
|
|
frame_buffer.put(f_h);
|
75 |
|
|
uvm_report_info(get_name(), $sformatf("| put_frame(%s)", pattern.tolower));
|
76 |
|
|
endtask: put_frame
|
77 |
|
|
|
78 |
|
|
// --------------------------------------------------------------------
|
79 |
|
|
task send_frame_buffer( uvm_sequencer_base seqr
|
80 |
|
|
, uvm_sequence_base parent = null
|
81 |
|
|
);
|
82 |
|
|
this.start(seqr, parent);
|
83 |
|
|
endtask
|
84 |
|
|
|
85 |
|
|
// --------------------------------------------------------------------
|
86 |
|
|
task body();
|
87 |
|
|
item = avf_sequence_item::type_id::create("avf_sequence_item");
|
88 |
|
|
start_item(item);
|
89 |
|
|
if(frame_buffer.num() != 0)
|
90 |
|
|
item.frame_buffer = this.frame_buffer;
|
91 |
|
|
finish_item(item);
|
92 |
|
|
endtask
|
93 |
|
|
|
94 |
|
|
// --------------------------------------------------------------------
|
95 |
|
|
function new(string name = "s_avf_api");
|
96 |
|
|
super.new(name);
|
97 |
|
|
frame_buffer = new;
|
98 |
|
|
endfunction
|
99 |
|
|
|
100 |
|
|
// --------------------------------------------------------------------
|
101 |
|
|
endclass : s_avf_api
|