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 35

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
      tx_h.put(tr_h);
61
      tx_q.put(tr_h);
62
    endtask: queue_tx_constant
63
 
64
 
65
    // --------------------------------------------------------------------
66
    //
67
    task queue_tx_counting(int len, int off, bit last);
68
      tr_h = new(len, off, last);
69
      tr_h.counting(len, off, last);
70
      tx_h.put(tr_h);
71
      tx_q.put(tr_h);
72
    endtask: queue_tx_counting
73
 
74
 
75
    // --------------------------------------------------------------------
76
    //
77 32 qaztronic
    task queue_tx_random(int len, int off, bit last);
78
      tr_h = new(len, off, last);
79
      tr_h.random(len, off, last);
80
      tx_h.put(tr_h);
81 35 qaztronic
      tx_q.put(tr_h);
82 32 qaztronic
    endtask: queue_tx_random
83
 
84
 
85
    // --------------------------------------------------------------------
86
    //
87
    task queue_rx(int len, int off, bit last);
88
      tr_h = new(len, off, last);
89
      rx_h.put(tr_h);
90 35 qaztronic
      // rx_q.put(tr_h);
91 32 qaztronic
    endtask: queue_rx
92
 
93
 
94
    // --------------------------------------------------------------------
95
    //
96
    task wait_for_tx;
97
      @(tx_h.tx_done);
98
    endtask: wait_for_tx
99
 
100
 
101
    // --------------------------------------------------------------------
102
    //
103
    task wait_for_rx;
104
      @(rx_h.rx_done);
105
    endtask: wait_for_rx
106
 
107
 
108
    //--------------------------------------------------------------------
109
    //
110
    function new(virtual riffa_chnl_if #(.N(N)) chnl_bus);
111
      tx_h = new(chnl_bus);
112
      rx_h = new(chnl_bus);
113 35 qaztronic
      this.tx_q = new;
114
      // this.rx_q = new;
115 32 qaztronic
    endfunction: new
116
 
117
 
118
  // --------------------------------------------------------------------
119
  //
120
  endclass: riffa_agent_class
121
 
122
 
123
// --------------------------------------------------------------------
124
//
125
endpackage: riffa_agent_class_pkg
126
 
127
 
128
 
129
 
130
 

powered by: WebSVN 2.1.0

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