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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [axi4_stream_lib/] [sim/] [src/] [legacy/] [tb_axis_upsizer_agent_class_pkg.sv] - Rev 49

Compare with Previous | Blame | View Log

//////////////////////////////////////////////////////////////////////
////                                                              ////
//// Copyright (C) 2015 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_upsizer_agent_class_pkg;

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


  // --------------------------------------------------------------------
  //
  class tb_axis_upsizer_agent_class #(BYTES_PER_PIXEL, OUTPUTS_PER_TILE, AVF_N, AVF_U, S);

    virtual axis_if #(.N(AVF_N * S), .U(AVF_U)) avf_axis_in_if;
    virtual axis_if #(.N(AVF_N), .U(AVF_U)) avf_axis_out_if;

    avf_config_class c_h;

    avf_tx_class #(BYTES_PER_PIXEL, OUTPUTS_PER_TILE, AVF_U) tx_h;
    avf_rx_class #(BYTES_PER_PIXEL, OUTPUTS_PER_TILE * S, AVF_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;


    // --------------------------------------------------------------------
    //
    virtual task
      queue_frame
      (
        string pattern = "",
        int pixel = 0
      );

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

        clone_h = tx_h.tx_bfm_h[0].f_h.clone();
        tx_h.tx_bfm_h[0].put(clone_h);
        q.put(clone_h);

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

    endtask: queue_frame


    // --------------------------------------------------------------------
    //
    virtual task automatic
      compare_frame;

      int mismatch_count;

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

      q.get(sent_f_h);
      rx_h.rx_bfm_h[0].get(rx_f_h);
      mismatch_count = sent_f_h.compare(8, rx_f_h);

    endtask: compare_frame


    //--------------------------------------------------------------------
    //
    function void init(avf_config_class in_c_h, avf_config_class out_c_h);

      rx_h = new(in_c_h, '{avf_axis_in_if});
      tx_h = new(out_c_h, '{avf_axis_out_if});

      this.q = new();

    endfunction: init


    //--------------------------------------------------------------------
    //
    function new
      (
        virtual axis_if #(.N(AVF_N * S), .U(AVF_U)) avf_axis_in_if,
        virtual axis_if #(.N(AVF_N), .U(AVF_U)) avf_axis_out_if
      );

      this.avf_axis_in_if = avf_axis_in_if;
      this.avf_axis_out_if = avf_axis_out_if;
    endfunction: new


  // --------------------------------------------------------------------
  //
  endclass: tb_axis_upsizer_agent_class

// --------------------------------------------------------------------
//
endpackage: tb_axis_upsizer_agent_class_pkg





Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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