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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [BFM/] [src/] [axis_video_frame/] [avf_monitor.svh] - Blame information for rev 47

Details | Compare with Previous | View Log

Line No. Rev Author Line
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 avf_monitor #(N, U) extends uvm_component;
29
  `uvm_component_param_utils(avf_monitor #(N, U));
30
 
31
  virtual axis_if #(.N(N), .U(U)) vif;
32 47 qaztronic
  video_frame_config c_h;
33 45 qaztronic
  uvm_analysis_port #(avf_sequence_item) ap;
34
  uvm_analysis_port #(avf_sequence_item) req;
35
 
36
  // --------------------------------------------------------------------
37
  function new (string name, uvm_component parent);
38
    super.new(name,parent);
39
  endfunction
40
 
41
  // --------------------------------------------------------------------
42
  function void build_phase(uvm_phase phase);
43
    ap = new("ap", this);
44
    req = new("req", this);
45
  endfunction : build_phase
46
 
47
  // --------------------------------------------------------------------
48
  task run_phase(uvm_phase phase);
49
    avf_sequence_item req_item;
50
    avf_sequence_item ap_item;
51
    bit sof_received = 0;
52
    int l, p;
53
    int offset;
54
 
55
    forever @(vif.cb_m iff vif.cb_m.aresetn === 1)
56
    begin
57
      if(vif.cb_s.tvalid & ~vif.cb_m.tready)
58
      begin
59
        req_item = avf_sequence_item::type_id::create("req_item");
60
        req_item.kind = AVF_REQUEST;
61
        req.write(req_item);
62
      end
63
 
64
      if(vif.cb_s.tvalid & vif.cb_m.tready)
65
      begin
66
        if(vif.cb_s.tuser[0]) // SOF
67
        begin
68
          ap_item = avf_sequence_item::type_id::create("ap_item");
69
          ap_item.kind = AVF_TRANSACTION;
70
          ap_item.f_h = new();
71 47 qaztronic
          ap_item.f_h.init( c_h.pixels_per_line
72
                          , c_h.lines_per_frame
73
                          , c_h.bits_per_pixel
74
                          , c_h.pixels_per_clk
75
                          , c_h.name
76 45 qaztronic
                          );
77
          sof_received = 1;
78
          p = 0;
79
          l = 0;
80
        end
81
 
82
        if(sof_received)
83
        begin
84
 
85
          for(int i = 0; i < ap_item.f_h.pixels_per_clk; i++, p++)
86
          begin
87
            offset = i * ap_item.f_h.bytes_per_pixel * 8;
88
            for(int k = 0; k < ap_item.f_h.bytes_per_pixel; k++)
89
              ap_item.f_h.lines[l].pixel[p][k * 8 +: 8] = vif.cb_s.tdata[offset + (k * 8) +: 8];
90
          end
91
 
92
          if(p >= ap_item.f_h.pixels_per_line)
93
          begin
94
            p = 0;
95
            l++;
96
          end
97
 
98
          if(vif.cb_s.tuser[2])  // EOF
99
          begin
100
            ap.write(ap_item);
101
            sof_received = 0;
102
          end
103
        end
104
      end
105
    end
106
  endtask : run_phase
107
 
108
// --------------------------------------------------------------------
109
endclass : avf_monitor

powered by: WebSVN 2.1.0

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