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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [PCIe/] [sim/] [src/] [riffa_agent_class_pkg.sv] - Rev 40

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

  // --------------------------------------------------------------------
  //
  import riffa_bfm_class_pkg::*;


  // --------------------------------------------------------------------
  //
  class riffa_agent_class #(N);

    riffa_transaction_class #(N) tr_h;
    rp_tx_bfm_class #(N) tx_h;
    rp_rx_bfm_class #(N) rx_h;
    mailbox #(riffa_transaction_class #(N)) tx_q;


    // --------------------------------------------------------------------
    //
    task queue_tx(riffa_transaction_class #(N) tr_h);
      tx_h.put(tr_h);
      tx_q.put(tr_h);
    endtask: queue_tx


    // --------------------------------------------------------------------
    //
    task queue_tx_constant(int len, int off, bit last, logic [(8*N)-1:0] value);
      tr_h = new(len, off, last);
      tr_h.constant(len, off, last, value);
      queue_tx(tr_h);
    endtask: queue_tx_constant


    // --------------------------------------------------------------------
    //
    task queue_tx_counting(int len, int off, bit last);
      tr_h = new(len, off, last);
      tr_h.counting(len, off, last);
      queue_tx(tr_h);
    endtask: queue_tx_counting


    // --------------------------------------------------------------------
    //
    task queue_tx_hex(string str, int off, bit last);
      tr_h = new(1, off, last);
      tr_h.hex(str, off, last);
      queue_tx(tr_h);
    endtask: queue_tx_hex


    // --------------------------------------------------------------------
    //
    task queue_tx_random(int len, int off, bit last);
      tr_h = new(len, off, last);
      tr_h.random(len, off, last);
      queue_tx(tr_h);
    endtask: queue_tx_random


    // --------------------------------------------------------------------
    //
    task queue_rx(int len, int off, bit last);
      tr_h = new(len, off, last);
      rx_h.put(tr_h);
    endtask: queue_rx


    // --------------------------------------------------------------------
    //
    task wait_for_tx;
      @(tx_h.tx_done);
    endtask: wait_for_tx


    // --------------------------------------------------------------------
    //
    task wait_for_rx;
      @(rx_h.rx_done);
    endtask: wait_for_rx


    //--------------------------------------------------------------------
    //
    function new(virtual riffa_chnl_if #(.N(N)) chnl_bus);
      tx_h = new(chnl_bus);
      rx_h = new(chnl_bus);
      this.tx_q = new;
    endfunction: new


  // --------------------------------------------------------------------
  //
  endclass: riffa_agent_class


// --------------------------------------------------------------------
//
endpackage: riffa_agent_class_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.