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 47

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

powered by: WebSVN 2.1.0

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