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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [axi4_stream_lib/] [sim/] [tests/] [legacy/] [tb_axis_switch_allocator/] [tb_axis_switch_allocator_pkg.sv] - Blame information for rev 50

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 50 qaztronic
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
//// Copyright (C) 2017 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 tb_axis_switch_allocator_pkg;
30
 
31
  // --------------------------------------------------------------------
32
  //
33
  import video_frame_pkg::*;
34
  import axis_video_frame_bfm_pkg::*;
35
  import avf_agent_class_pkg::*;
36
 
37
 
38
  // --------------------------------------------------------------------
39
  //
40
  localparam AW = 32; // active width
41
  localparam AH = 16; // active height
42
  localparam B = 2; // bytes per pixel
43
  localparam T = 1; // pixels per clock
44
  localparam VERTICAL_BLANKING = AW * 4;
45
  localparam N =  B * T; // data bus width in bytes
46
  localparam I = 1; // TID width
47
  localparam D = 1; // TDEST width
48
  localparam U = 3; // TUSER width
49
  localparam U_IS_EOP = 2;
50
  localparam SA = 3;
51
  localparam SD = 2 ** SA;
52
 
53
 
54
  // --------------------------------------------------------------------
55
  //
56
  class tb_axis_switch_allocator_class;
57
 
58
    avf_config_class c_h;
59
    avf_tile_config_t   tile_config[];
60
 
61
    virtual axis_if #(.N(N), .I(I), .D(D), .U(U)) axis_out[];
62
    virtual axis_if #(.N(N), .I(I), .D(D), .U(U)) axis_in;
63
 
64
    avf_tx_class #(B, T, U) tx_h;
65
    avf_rx_class #(B, T, U) rx_h;
66
 
67
    // video_frame_class clone_h;
68
    // video_frame_class sent_f_h;
69
    // video_frame_class rx_f_h;
70
 
71
    // mailbox #(video_frame_class) q[];
72
 
73
 
74
    // --------------------------------------------------------------------
75
    //
76
    task automatic
77
      queue_frame
78
      (
79
        string pattern = "",
80
        int pixel = 0
81
      );
82
        video_frame_class clone_h;
83
 
84
        if(pattern != "")
85
          tx_h.make_frame(pattern, pixel);
86
 
87
        foreach(tx_h.tx_bfm_h[i])
88
        begin
89
          clone_h = tx_h.tx_bfm_h[i].f_h.clone();
90
          tx_h.tx_bfm_h[i].put(clone_h);
91
          // q[i].put(clone_h);
92
        end
93
 
94
        $display("^^^ %16.t | %m | using %s pattern", $time, pattern);
95
 
96
    endtask: queue_frame
97
 
98
 
99
    //--------------------------------------------------------------------
100
    //
101
    function new
102
      (
103
        virtual axis_if #(.N(N), .U(U)) axis_in,
104
        virtual axis_if #(.N(N), .U(U)) axis_out[]
105
      );
106
 
107
      this.axis_out = axis_out;
108
      this.axis_in = axis_in;
109
 
110
      this.tile_config              = new[T];
111
      this.tile_config[0].direction = RIGHT_DOWN;
112
 
113
      this.c_h = new
114
      (
115
        .width(AW),
116
        .height(AH),
117
        .bytes_per_pixel(B),
118
        .bits_per_pixel(B * 8),
119
        .pixels_per_clk(T),
120
        .name("AVR_"),
121
        .vertical_blanking(VERTICAL_BLANKING),
122
        .tile(tile_config)
123
      );
124
 
125
      rx_h = new(c_h, axis_out);
126
      tx_h = new(c_h, '{axis_in});
127
 
128
    endfunction: new
129
 
130
 
131
  // --------------------------------------------------------------------
132
  //
133
  endclass: tb_axis_switch_allocator_class
134
 
135
 
136
// --------------------------------------------------------------------
137
//
138
endpackage: tb_axis_switch_allocator_pkg
139
 
140
 
141
 
142
 
143
 

powered by: WebSVN 2.1.0

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