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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [BFM/] [src/] [axis_video_frame/] [legacy/] [avf_rx.sv] - Blame information for rev 45

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 45 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
import axis_video_frame_bfm_pkg::*;
29
 
30
module
31
  avf_rx
32
  #(
33
    BYTES_PER_PIXEL  = 2,
34
    AVF_OUTPUTS      = 4,
35
    AVF_TILES        = 1
36
  )
37
  (
38
    ref axis_video_frame_bfm_class f_tx_h[AVF_TILES],
39
    ref axis_video_frame_bfm_class f_rx_h[AVF_TILES]
40
  );
41
 
42
  // --------------------------------------------------------------------
43
  //
44
  localparam AVF_VERTICAL_BLANKING = 20;
45
 
46
  task automatic
47
    init_avf_rx;
48
 
49
      f_rx_h[0].run_rx_q(RIGHT_DOWN);
50
      f_rx_h[1].run_rx_q(RIGHT_UP);
51
      f_rx_h[2].run_rx_q(LEFT_DOWN);
52
      f_rx_h[3].run_rx_q(LEFT_UP);
53
 
54
  endtask: init_avf_rx
55
 
56
 
57
  // --------------------------------------------------------------------
58
  //
59
  task
60
    wait_for_rx_frames
61
    (
62
      input int unsigned count
63
    );
64
 
65
    repeat(count)
66
      @(f_rx_h[0].rx_frame_done);
67
 
68
  endtask: wait_for_rx_frames
69
 
70
 
71
  // --------------------------------------------------------------------
72
  //
73
  semaphore get_frame_semaphore = new(1);
74
  logic get_frame_active = 0;
75
 
76
  task automatic
77
    get_frame;
78
 
79
      if(get_frame_semaphore.try_get() == 0)
80
      begin
81
        $display("^^^ %16.t | %m | ERROR! Already getting a frame.", $time);
82
        return;
83
      end
84
 
85
      $display("^^^ %16.t | %m | getting a frame.", $time);
86
      get_frame_active = 1;
87
 
88
      fork
89
      begin
90
 
91
        f_rx_h[0].avf_fork_rx(RIGHT_DOWN);
92
        f_rx_h[1].avf_fork_rx(RIGHT_UP);
93
        f_rx_h[2].avf_fork_rx(LEFT_DOWN);
94
        f_rx_h[3].avf_fork_rx(LEFT_UP);
95
 
96
        wait fork;
97
        get_frame_active = 0;
98
        $display("^^^ %16.t | %m | Got a frame.", $time);
99
        get_frame_semaphore.put();
100
 
101
      end
102
      join_none
103
 
104
 
105
  endtask: get_frame
106
 
107
 
108
  // --------------------------------------------------------------------
109
  //
110
  import video_frame_pkg::*;
111
 
112
  function automatic
113
    int compare_frame;
114
 
115
    int mismatch_count[AVF_TILES];
116
 
117
    $display("^^^ %16.t | %m", $time);
118
 
119
    foreach(f_rx_h[i])
120
      mismatch_count[i] = f_rx_h[i].f_h.compare(8, f_tx_h[i].f_h);
121
 
122
 
123
  endfunction: compare_frame
124
 
125
 
126
  // --------------------------------------------------------------------
127
  //
128
 
129
 
130
endmodule
131
 
132
 
133
 
134
 

powered by: WebSVN 2.1.0

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