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 |
47 |
qaztronic |
mailbox #(video_frame_class) frame_buffer;
|
34 |
45 |
qaztronic |
|
35 |
|
|
// --------------------------------------------------------------------
|
36 |
47 |
qaztronic |
video_frame_config c_h;
|
37 |
45 |
qaztronic |
|
38 |
47 |
qaztronic |
function void init(video_frame_config c_h);
|
39 |
|
|
this.c_h = c_h;
|
40 |
45 |
qaztronic |
endfunction : init
|
41 |
|
|
|
42 |
|
|
// --------------------------------------------------------------------
|
43 |
|
|
task automatic put_frame(string pattern, int pixel = 0);
|
44 |
|
|
video_frame_class f_h = new;
|
45 |
47 |
qaztronic |
f_h.init( c_h.pixels_per_line
|
46 |
|
|
, c_h.lines_per_frame
|
47 |
|
|
, c_h.bits_per_pixel
|
48 |
|
|
, c_h.pixels_per_clk
|
49 |
45 |
qaztronic |
);
|
50 |
|
|
case(pattern.tolower)
|
51 |
|
|
"constant": f_h.make_constant(pixel);
|
52 |
|
|
"counting": f_h.make_counting();
|
53 |
|
|
"horizontal": f_h.make_horizontal();
|
54 |
|
|
"vertical": f_h.make_vertical();
|
55 |
|
|
"random": f_h.make_random();
|
56 |
|
|
default: `uvm_fatal(get_name(), "Pattern not supported!")
|
57 |
|
|
endcase
|
58 |
|
|
|
59 |
|
|
frame_buffer.put(f_h);
|
60 |
|
|
uvm_report_info(get_name(), $sformatf("| put_frame(%s)", pattern.tolower));
|
61 |
|
|
endtask: put_frame
|
62 |
|
|
|
63 |
|
|
// --------------------------------------------------------------------
|
64 |
|
|
task send_frame_buffer( uvm_sequencer_base seqr
|
65 |
|
|
, uvm_sequence_base parent = null
|
66 |
|
|
);
|
67 |
|
|
this.start(seqr, parent);
|
68 |
|
|
endtask
|
69 |
|
|
|
70 |
|
|
// --------------------------------------------------------------------
|
71 |
|
|
task body();
|
72 |
|
|
item = avf_sequence_item::type_id::create("avf_sequence_item");
|
73 |
|
|
start_item(item);
|
74 |
|
|
if(frame_buffer.num() != 0)
|
75 |
|
|
item.frame_buffer = this.frame_buffer;
|
76 |
|
|
finish_item(item);
|
77 |
|
|
endtask
|
78 |
|
|
|
79 |
|
|
// --------------------------------------------------------------------
|
80 |
|
|
function new(string name = "s_avf_api");
|
81 |
|
|
super.new(name);
|
82 |
|
|
frame_buffer = new;
|
83 |
|
|
endfunction
|
84 |
|
|
|
85 |
|
|
// --------------------------------------------------------------------
|
86 |
|
|
endclass : s_avf_api
|