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] - Rev 50

Compare with Previous | Blame | View Log

//////////////////////////////////////////////////////////////////////
////                                                              ////
//// Copyright (C) 2017 Authors and OPENCORES.ORG                 ////
////                                                              ////
//// This source file may be used and distributed without         ////
//// restriction provided that this copyright statement is not    ////
//// removed from the file and that any derivative work contains  ////
//// the original copyright notice and the associated disclaimer. ////
////                                                              ////
//// This source file is free software; you can redistribute it   ////
//// and/or modify it under the terms of the GNU Lesser General   ////
//// Public License as published by the Free Software Foundation; ////
//// either version 2.1 of the License, or (at your option) any   ////
//// later version.                                               ////
////                                                              ////
//// This source is distributed in the hope that it will be       ////
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
//// PURPOSE.  See the GNU Lesser General Public License for more ////
//// details.                                                     ////
////                                                              ////
//// You should have received a copy of the GNU Lesser General    ////
//// Public License along with this source; if not, download it   ////
//// from http://www.opencores.org/lgpl.shtml                     ////
////                                                              ////
//////////////////////////////////////////////////////////////////////


package tb_axis_switch_allocator_pkg;

  // --------------------------------------------------------------------
  //
  import video_frame_pkg::*;
  import axis_video_frame_bfm_pkg::*;
  import avf_agent_class_pkg::*;


  // --------------------------------------------------------------------
  //
  localparam AW = 32; // active width
  localparam AH = 16; // active height
  localparam B = 2; // bytes per pixel
  localparam T = 1; // pixels per clock
  localparam VERTICAL_BLANKING = AW * 4;
  localparam N =  B * T; // data bus width in bytes
  localparam I = 1; // TID width
  localparam D = 1; // TDEST width
  localparam U = 3; // TUSER width
  localparam U_IS_EOP = 2;
  localparam SA = 3;
  localparam SD = 2 ** SA;


  // --------------------------------------------------------------------
  //
  class tb_axis_switch_allocator_class;

    avf_config_class c_h;
    avf_tile_config_t   tile_config[];

    virtual axis_if #(.N(N), .I(I), .D(D), .U(U)) axis_out[];
    virtual axis_if #(.N(N), .I(I), .D(D), .U(U)) axis_in;

    avf_tx_class #(B, T, U) tx_h;
    avf_rx_class #(B, T, U) rx_h;

    // video_frame_class clone_h;
    // video_frame_class sent_f_h;
    // video_frame_class rx_f_h;

    // mailbox #(video_frame_class) q[];


    // --------------------------------------------------------------------
    //
    task automatic
      queue_frame
      (
        string pattern = "",
        int pixel = 0
      );
        video_frame_class clone_h;

        if(pattern != "")
          tx_h.make_frame(pattern, pixel);

        foreach(tx_h.tx_bfm_h[i])
        begin
          clone_h = tx_h.tx_bfm_h[i].f_h.clone();
          tx_h.tx_bfm_h[i].put(clone_h);
          // q[i].put(clone_h);
        end

        $display("^^^ %16.t | %m | using %s pattern", $time, pattern);

    endtask: queue_frame


    //--------------------------------------------------------------------
    //
    function new
      (
        virtual axis_if #(.N(N), .U(U)) axis_in,
        virtual axis_if #(.N(N), .U(U)) axis_out[]
      );

      this.axis_out = axis_out;
      this.axis_in = axis_in;

      this.tile_config              = new[T];
      this.tile_config[0].direction = RIGHT_DOWN;

      this.c_h = new
      (
        .width(AW),
        .height(AH),
        .bytes_per_pixel(B),
        .bits_per_pixel(B * 8),
        .pixels_per_clk(T),
        .name("AVR_"),
        .vertical_blanking(VERTICAL_BLANKING),
        .tile(tile_config)
      );

      rx_h = new(c_h, axis_out);
      tx_h = new(c_h, '{axis_in});

    endfunction: new


  // --------------------------------------------------------------------
  //
  endclass: tb_axis_switch_allocator_class


// --------------------------------------------------------------------
//
endpackage: tb_axis_switch_allocator_pkg





Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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