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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [BFM/] [src/] [8b10b/] [video_frame/] [vf_8b10b_monitor.svh] - Blame information for rev 49

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

Line No. Rev Author Line
1 46 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 vf_8b10b_monitor extends uvm_component;
29
  `uvm_component_utils(vf_8b10b_monitor);
30
 
31
  virtual deserializer_8b10b_bfm_if vif;
32
  vf_8b10b_config cfg_h;
33
  uvm_analysis_port #(vf_8b10b_sequence_item) ap;
34
 
35
  // --------------------------------------------------------------------
36
  function new (string name, uvm_component parent);
37
    super.new(name,parent);
38
  endfunction
39
 
40
  // --------------------------------------------------------------------
41
  function void build_phase(uvm_phase phase);
42
    ap = new("ap", this);
43
  endfunction : build_phase
44
 
45
  // --------------------------------------------------------------------
46
  task run_phase(uvm_phase phase);
47
    bit got_new_frame = 0;
48
    int l = 0;
49
    int p = 0;
50
    vf_8b10b_sequence_item item;
51
    video_frame_class f_h;
52
    f_h = new();
53
    f_h.init( cfg_h.pixels_per_line
54
                    , cfg_h.lines_per_frame
55
                    , cfg_h.bits_per_pixel
56
                    );
57
 
58
    forever @(vif.cb iff vif.cb.dataout_valid)
59
    begin
60
      if(vif.dataout == cfg_h.sof_8b)
61
      begin
62
        item = vf_8b10b_sequence_item::type_id::create("item");
63
        item.f_h = f_h.clone;
64
        item.sof_timestamp = $time;
65
        got_new_frame = 1;
66
      end
67
 
68
      if(~vif.dataout[8] & got_new_frame)
69
      begin
70
        item.f_h.lines[l].pixel[p] = vif.dataout[7:0];
71
        p++;
72
      end
73
 
74
      if(vif.dataout == cfg_h.eol_8b)
75
      begin
76
        l++;
77
        p = 0;
78
      end
79
 
80
      if(vif.dataout == cfg_h.eof_8b)
81
      begin
82
        got_new_frame = 0;
83
        l = 0;
84
        p = 0;
85
        ap.write(item);
86
      end
87
    end
88
  endtask : run_phase
89
 
90
// --------------------------------------------------------------------
91
endclass : vf_8b10b_monitor

powered by: WebSVN 2.1.0

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