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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [camera_link/] [sim/] [src/] [camera_link_agent_pkg.sv] - Rev 41

Go to most recent revision | 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 camera_link_agent_pkg;

  // --------------------------------------------------------------------
  //
  import fifo_bfm_pkg::*;

  class fifo_agent_class #(W = 8);

    fifo_bfm_class source_fifo;
    fifo_bfm_class sink_fifo;
    fifo_transaction_class tr_h;
    fifo_transaction_class clone_h;

    //--------------------------------------------------------------------
    function
      new
      (
        virtual fifo_write_if #(.W(W)) source,
        virtual fifo_read_if  #(.W(W)) sink
      );

      this.source_fifo = new(.source(source));
      this.sink_fifo = new(.sink(sink));
      this.tr_h = new();

    endfunction: new


    // --------------------------------------------------------------------
    //
    function void init;

      source_fifo.init("source", SOURCE);
      sink_fifo.init("sink", SINK);

    endfunction: init


    // --------------------------------------------------------------------
    //
    task automatic
      start_q;

      source_fifo.fifo_write_q();
      sink_fifo.fifo_read_q();

    endtask: start_q


    // --------------------------------------------------------------------
    //
    task automatic
      queue_random;

        if (!tr_h.randomize())
        begin
          $display("^^^ %16.t | %m | ERROR! randomize error", $time);
          $stop;
        end

        clone_h = tr_h.clone();
        source_fifo.fifo_tr_q.put(clone_h);
        sink_fifo.fifo_tr_q.put(clone_h);

    endtask: queue_random


    // --------------------------------------------------------------------
    //

  endclass: fifo_agent_class

endpackage: camera_link_agent_pkg

Go to most recent revision | 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.