OpenCores
URL https://opencores.org/ocsvn/qaz_libs/qaz_libs/trunk

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [BFM/] [src/] [axis_video_frame/] [avf_agent_class_pkg.sv] - Blame information for rev 34

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 34 qaztronic
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
//// Copyright (C) 2015 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
 
29
package avf_agent_class_pkg;
30
 
31
  // --------------------------------------------------------------------
32
  //
33
  import video_frame_pkg::*;
34
  import axis_video_frame_bfm_pkg::*;
35
 
36
 
37
  // --------------------------------------------------------------------
38
  //
39
  class avf_agent_class #(BYTES_PER_PIXEL = 2, OUTPUTS_PER_TILE = 1, AVF_U = 3);
40
 
41
    localparam AVF_N = BYTES_PER_PIXEL * OUTPUTS_PER_TILE;  // data bus width in bytes
42
    localparam AVF_B = BYTES_PER_PIXEL * 8;                 // bits per pixel on TDATA
43
 
44
    virtual axis_if #(.N(AVF_N), .U(AVF_U)) avf_axis_in_if[];
45
    virtual axis_if #(.N(AVF_N), .U(AVF_U)) avf_axis_out_if[];
46
 
47
    avf_config_class c_h;
48
 
49
    avf_tx_class #(BYTES_PER_PIXEL, OUTPUTS_PER_TILE, AVF_U) tx_h;
50
    avf_rx_class #(BYTES_PER_PIXEL, OUTPUTS_PER_TILE, AVF_U) rx_h;
51
 
52
    video_frame_class clone_h;
53
    video_frame_class sent_f_h;
54
    video_frame_class rx_f_h;
55
 
56
    mailbox #(video_frame_class) q[];
57
 
58
 
59
    // --------------------------------------------------------------------
60
    //
61
    virtual task
62
      queue_frame
63
      (
64
        string pattern = "",
65
        int pixel = 0
66
      );
67
 
68
        if(pattern != "")
69
          tx_h.make_frame(pattern, pixel);
70
 
71
        foreach(tx_h.tx_bfm_h[i])
72
        begin
73
          clone_h = tx_h.tx_bfm_h[i].f_h.clone();
74
          tx_h.tx_bfm_h[i].put(clone_h);
75
          q[i].put(clone_h);
76
        end
77
 
78
        $display("^^^ %16.t | %m | using %s pattern", $time, pattern);
79
 
80
    endtask: queue_frame
81
 
82
 
83
    // --------------------------------------------------------------------
84
    //
85
    virtual task automatic
86
      compare_frame;
87
 
88
      int mismatch_count;
89
 
90
      $display("^^^ %16.t | %m", $time);
91
 
92
      foreach(rx_h.rx_bfm_h[i])
93
      begin
94
        q[i].get(sent_f_h);
95
        rx_h.rx_bfm_h[i].get(rx_f_h);
96
        mismatch_count = sent_f_h.compare(8, rx_f_h);
97
      end
98
 
99
    endtask: compare_frame
100
 
101
 
102
    // --------------------------------------------------------------------
103
    //
104
    virtual task set_tready(input tready);
105
      $display("^^^ %16.t | %m", $time);
106
      foreach(rx_h.rx_bfm_h[i])
107
        rx_h.rx_bfm_h[i].set_tready(tready);
108
    endtask: set_tready
109
 
110
 
111
    // --------------------------------------------------------------------
112
    //
113
    virtual task flush_sent_frame;
114
      $display("^^^ %16.t | %m", $time);
115
      foreach(rx_h.rx_bfm_h[i])
116
        q[i].get(sent_f_h);
117
    endtask: flush_sent_frame
118
 
119
 
120
    // --------------------------------------------------------------------
121
    //
122
    virtual task rx_flush_frame;
123
      $display("^^^ %16.t | %m", $time);
124
      foreach(rx_h.rx_bfm_h[i])
125
        rx_h.rx_bfm_h[i].get(rx_f_h);
126
    endtask: rx_flush_frame
127
 
128
 
129
    //--------------------------------------------------------------------
130
    //
131
    function void init(avf_config_class c_h);
132
 
133
      rx_h = new(c_h, avf_axis_in_if);
134
      tx_h = new(c_h, avf_axis_out_if);
135
 
136
      this.q = new[$size(avf_axis_out_if)];
137
      foreach(q[i])
138
        this.q[i] = new();
139
 
140
    endfunction: init
141
 
142
 
143
    //--------------------------------------------------------------------
144
    //
145
    function new
146
      (
147
        virtual axis_if #(.N(AVF_N), .U(AVF_U)) avf_axis_in_if[],
148
        virtual axis_if #(.N(AVF_N), .U(AVF_U)) avf_axis_out_if[]
149
      );
150
 
151
      this.avf_axis_in_if = avf_axis_in_if;
152
      this.avf_axis_out_if = avf_axis_out_if;
153
    endfunction: new
154
 
155
 
156
    // --------------------------------------------------------------------
157
    //
158
 
159
  endclass: avf_agent_class
160
 
161
endpackage: avf_agent_class_pkg
162
 
163
 
164
 
165
 
166
 

powered by: WebSVN 2.1.0

© copyright 1999-2019 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.