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] - Blame information for rev 32

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 32 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 riffa_agent_class_pkg;
30
 
31
  // --------------------------------------------------------------------
32
  //
33
  import riffa_bfm_class_pkg::*;
34
 
35
 
36
  // --------------------------------------------------------------------
37
  //
38
  class riffa_agent_class #(N);
39
 
40
    riffa_transaction_class #(N) tr_h;
41
    rp_tx_bfm_class #(N) tx_h;
42
    rp_rx_bfm_class #(N) rx_h;
43
    mailbox #(riffa_transaction_class #(N)) q;
44
 
45
 
46
    // --------------------------------------------------------------------
47
    //
48
    task queue_tx(riffa_transaction_class #(N) tr_h);
49
      tx_h.put(tr_h);
50
      q.put(tr_h);
51
    endtask: queue_tx
52
 
53
 
54
    // --------------------------------------------------------------------
55
    //
56
    task queue_tx_random(int len, int off, bit last);
57
      tr_h = new(len, off, last);
58
      tr_h.random(len, off, last);
59
      tx_h.put(tr_h);
60
      q.put(tr_h);
61
    endtask: queue_tx_random
62
 
63
 
64
    // --------------------------------------------------------------------
65
    //
66
    task queue_rx(int len, int off, bit last);
67
      tr_h = new(len, off, last);
68
      rx_h.put(tr_h);
69
    endtask: queue_rx
70
 
71
 
72
    // --------------------------------------------------------------------
73
    //
74
    task wait_for_tx;
75
      @(tx_h.tx_done);
76
    endtask: wait_for_tx
77
 
78
 
79
    // --------------------------------------------------------------------
80
    //
81
    task wait_for_rx;
82
      @(rx_h.rx_done);
83
    endtask: wait_for_rx
84
 
85
 
86
    //--------------------------------------------------------------------
87
    //
88
    function new(virtual riffa_chnl_if #(.N(N)) chnl_bus);
89
      tx_h = new(chnl_bus);
90
      rx_h = new(chnl_bus);
91
      this.q = new;
92
    endfunction: new
93
 
94
 
95
  // --------------------------------------------------------------------
96
  //
97
  endclass: riffa_agent_class
98
 
99
 
100
// --------------------------------------------------------------------
101
//
102
endpackage: riffa_agent_class_pkg
103
 
104
 
105
 
106
 
107
 

powered by: WebSVN 2.1.0

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