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_tx.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
 
29
import axis_video_frame_bfm_pkg::*;
30
 
31
module
32
  avf_tx
33
  #(
34
    BYTES_PER_PIXEL  = 2,
35
    AVF_OUTPUTS      = 4,
36
    AVF_TILES        = 1
37
  )
38
  (
39
    ref axis_video_frame_bfm_class f_tx_h[AVF_TILES],
40
    ref axis_video_frame_bfm_class f_rx_h[AVF_TILES]
41
  );
42
 
43
  // --------------------------------------------------------------------
44
  //
45
  localparam AVF_VERTICAL_BLANKING = 20;
46
 
47
  task automatic
48
    init_avf_tx;
49
 
50
      foreach(f_tx_h[i])
51
        f_tx_h[i].avf_vertical_blanking = AVF_VERTICAL_BLANKING;
52
 
53
      f_tx_h[0].run_tx_q(RIGHT_DOWN, 0);
54
      f_tx_h[1].run_tx_q(RIGHT_UP, 0);
55
      f_tx_h[2].run_tx_q(LEFT_DOWN, 0);
56
      f_tx_h[3].run_tx_q(LEFT_UP, 0);
57
 
58
  endtask: init_avf_tx
59
 
60
 
61
  // --------------------------------------------------------------------
62
  //
63
  import video_frame_pkg::*;
64
 
65
  video_frame_class clone_h;
66
 
67
 
68
  // --------------------------------------------------------------------
69
  //
70
  task automatic
71
    make_frame
72
    (
73
      string pattern,
74
      int pixel = 0
75
    );
76
 
77
      case(pattern.tolower)
78
        "constant":   foreach(f_tx_h[i]) f_tx_h[i].f_h.make_constant(pixel);
79
        "counting":   foreach(f_tx_h[i]) f_tx_h[i].f_h.make_counting();
80
        "horizontal": foreach(f_tx_h[i]) f_tx_h[i].f_h.make_horizontal();
81
        "vertical":   foreach(f_tx_h[i]) f_tx_h[i].f_h.make_vertical();
82
        "random":     foreach(f_tx_h[i]) f_tx_h[i].f_h.make_random();
83
        default:      $display("^^^ %16.t | %m | ERROR! %s pattern not supported", $time, pattern);
84
      endcase
85
 
86
  endtask: make_frame
87
 
88
 
89
  // --------------------------------------------------------------------
90
  //
91
 
92
  task automatic
93
    queue_frame
94
    (
95
      string pattern = ""
96
    );
97
 
98
      if(pattern != "")
99
        make_frame(pattern);
100
 
101
      foreach(f_tx_h[i])
102
      begin
103
        clone_h = f_tx_h[i].f_h.clone();
104
        f_tx_h[i].avf_q.put(clone_h);
105
        f_rx_h[i].avf_q.put(clone_h);
106
      end
107
 
108
      $display("^^^ %16.t | %m | using %s pattern", $time, pattern);
109
 
110
  endtask: queue_frame
111
 
112
 
113
  // --------------------------------------------------------------------
114
  //
115
  task
116
    wait_for_tx_frames
117
    (
118
      input int unsigned count
119
    );
120
 
121
    repeat(count)
122
      @(f_tx_h[0].tx_frame_done);
123
 
124
  endtask: wait_for_tx_frames
125
 
126
 
127
  // --------------------------------------------------------------------
128
  //
129
  logic put_frame_active = 0;
130
  semaphore put_frame_semaphore = new(1);
131
 
132
  task automatic
133
    put_frame;
134
 
135
      if(put_frame_semaphore.try_get() == 0)
136
      begin
137
        $display("^^^ %16.t | %m | ERROR! Already put a frame.", $time);
138
        return;
139
      end
140
 
141
      $display("^^^ %16.t | %m | Putting a frame.", $time);
142
      put_frame_active = 1;
143
 
144
      fork
145
      begin
146
 
147
        f_tx_h[0].avf_fork_tx(RIGHT_DOWN, 0);
148
        f_tx_h[1].avf_fork_tx(RIGHT_UP, 0);
149
        f_tx_h[2].avf_fork_tx(LEFT_DOWN, 0);
150
        f_tx_h[3].avf_fork_tx(LEFT_UP, 0);
151
 
152
        wait fork;
153
        put_frame_active = 0;
154
        $display("^^^ %16.t | %m | Put a frame.", $time);
155
        put_frame_semaphore.put();
156
 
157
      end
158
      join_none
159
 
160
  endtask: put_frame
161
 
162
 
163
  // --------------------------------------------------------------------
164
  //
165
 
166
 
167
endmodule
168
 
169
 
170
 
171
 

powered by: WebSVN 2.1.0

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