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 37

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 35 qaztronic
    // mailbox #(riffa_transaction_class #(N)) tx_q, rx_q;
44
    mailbox #(riffa_transaction_class #(N)) tx_q;
45 32 qaztronic
 
46
 
47
    // --------------------------------------------------------------------
48
    //
49
    task queue_tx(riffa_transaction_class #(N) tr_h);
50
      tx_h.put(tr_h);
51 35 qaztronic
      tx_q.put(tr_h);
52 32 qaztronic
    endtask: queue_tx
53
 
54
 
55
    // --------------------------------------------------------------------
56
    //
57 35 qaztronic
    task queue_tx_constant(int len, int off, bit last, logic [(8*N)-1:0] value);
58
      tr_h = new(len, off, last);
59
      tr_h.constant(len, off, last, value);
60 37 qaztronic
      queue_tx(tr_h);
61 35 qaztronic
    endtask: queue_tx_constant
62
 
63
 
64
    // --------------------------------------------------------------------
65
    //
66
    task queue_tx_counting(int len, int off, bit last);
67
      tr_h = new(len, off, last);
68
      tr_h.counting(len, off, last);
69 37 qaztronic
      queue_tx(tr_h);
70 35 qaztronic
    endtask: queue_tx_counting
71
 
72
 
73
    // --------------------------------------------------------------------
74
    //
75 32 qaztronic
    task queue_tx_random(int len, int off, bit last);
76
      tr_h = new(len, off, last);
77
      tr_h.random(len, off, last);
78 37 qaztronic
      queue_tx(tr_h);
79 32 qaztronic
    endtask: queue_tx_random
80
 
81
 
82
    // --------------------------------------------------------------------
83
    //
84
    task queue_rx(int len, int off, bit last);
85
      tr_h = new(len, off, last);
86
      rx_h.put(tr_h);
87 35 qaztronic
      // rx_q.put(tr_h);
88 32 qaztronic
    endtask: queue_rx
89
 
90
 
91
    // --------------------------------------------------------------------
92
    //
93
    task wait_for_tx;
94
      @(tx_h.tx_done);
95
    endtask: wait_for_tx
96
 
97
 
98
    // --------------------------------------------------------------------
99
    //
100
    task wait_for_rx;
101
      @(rx_h.rx_done);
102
    endtask: wait_for_rx
103
 
104
 
105
    //--------------------------------------------------------------------
106
    //
107
    function new(virtual riffa_chnl_if #(.N(N)) chnl_bus);
108
      tx_h = new(chnl_bus);
109
      rx_h = new(chnl_bus);
110 35 qaztronic
      this.tx_q = new;
111
      // this.rx_q = new;
112 32 qaztronic
    endfunction: new
113
 
114
 
115
  // --------------------------------------------------------------------
116
  //
117
  endclass: riffa_agent_class
118
 
119
 
120
// --------------------------------------------------------------------
121
//
122
endpackage: riffa_agent_class_pkg
123
 
124
 
125
 
126
 
127
 

powered by: WebSVN 2.1.0

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