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

Subversion Repositories qaz_libs

[/] [qaz_libs/] [trunk/] [PCIe/] [sim/] [src/] [pcie_monitor_pkg.sv] - Blame information for rev 32

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

Line No. Rev Author Line
1 31 qaztronic
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
//// Copyright (C) 2015 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
// --------------------------------------------------------------------
30
//
31
package pcie_monitor_pkg;
32
 
33 32 qaztronic
  // --------------------------------------------------------------------
34
  //
35
  import pcie_common_pkg::*;
36 31 qaztronic
 
37
 
38
  // --------------------------------------------------------------------
39
  //
40 32 qaztronic
  class tlp_monitor_class;
41 31 qaztronic
 
42 32 qaztronic
    // tlp_type_t        header_type       = Reserved;
43
    // tlp_routing_t     routing_type      = ROUTING_UNKNOWN;
44
    // tlp_transaction_t transaction_type  = TRANSACTION_UNKNOWN;
45
    // logic [7:0] fmt_type;
46
    // logic [2:0] tc;
47
    // logic       th;
48
    // logic [2:0] attr;
49
    // logic       td;
50
    // logic       ep;
51
    // logic [9:0] length;
52
    // logic [7:0] header [16];
53
    // logic       header_is_4_dw;
54 31 qaztronic
 
55
 
56 32 qaztronic
    // // --------------------------------------------------------------------
57
    // //
58
    // function tlp_type_t get_tlp_type(logic [7:0] fmt_type);
59 31 qaztronic
 
60 32 qaztronic
      // casez(fmt_type)
61
        // 8'b000_00000: get_tlp_type = MRd;
62
        // 8'b001_00000: get_tlp_type = MRd;
63
        // 8'b000_00001: get_tlp_type = MRdLk;
64
        // 8'b001_00001: get_tlp_type = MRdLk;
65
        // 8'b010_00000: get_tlp_type = MWr;
66
        // 8'b011_00000: get_tlp_type = MWr;
67
        // 8'b000_00010: get_tlp_type = IORd;
68
        // 8'b010_00010: get_tlp_type = IOWr;
69
        // 8'b000_00100: get_tlp_type = CfgRd0;
70
        // 8'b010_00100: get_tlp_type = CfgWr0;
71
        // 8'b000_00101: get_tlp_type = CfgRd1;
72
        // 8'b010_00101: get_tlp_type = CfgWr1;
73
        // 8'b000_11011: get_tlp_type = TCfgRd;
74
        // 8'b010_11011: get_tlp_type = TCfgWr;
75
        // 8'b001_10???: get_tlp_type = Msg;
76
        // 8'b011_10???: get_tlp_type = MsgD;
77
        // 8'b000_01010: get_tlp_type = Cpl;
78
        // 8'b010_01010: get_tlp_type = CplD;
79
        // 8'b000_01011: get_tlp_type = CplLk;
80
        // 8'b010_01011: get_tlp_type = CplDLk;
81
        // 8'b010_01100: get_tlp_type = FetchAdd;
82
        // 8'b011_01100: get_tlp_type = FetchAdd;
83
        // 8'b010_01101: get_tlp_type = Swap;
84
        // 8'b011_01101: get_tlp_type = Swap;
85
        // 8'b010_01110: get_tlp_type = CAS;
86
        // 8'b011_01110: get_tlp_type = CAS;
87
        // 8'b100_0????: get_tlp_type = LPrfx;
88
        // 8'b100_1????: get_tlp_type = EPrfx;
89
        // default:      get_tlp_type = Reserved;
90
      // endcase
91 31 qaztronic
 
92 32 qaztronic
    // endfunction: get_tlp_type
93 31 qaztronic
 
94
 
95 32 qaztronic
    // // --------------------------------------------------------------------
96
    // //
97
    // function tlp_routing_t get_tlp_routing(tlp_type_t tlp_type);
98 31 qaztronic
 
99 32 qaztronic
      // case(tlp_type)
100
        // MRd:      get_tlp_routing = ADDRESS;
101
        // MRdLk:    get_tlp_routing = ADDRESS;
102
        // MWr:      get_tlp_routing = ADDRESS;
103
        // IORd:     get_tlp_routing = ADDRESS;
104
        // IOWr:     get_tlp_routing = ADDRESS;
105
        // CfgRd0:   get_tlp_routing = ID;
106
        // CfgWr0:   get_tlp_routing = ID;
107
        // CfgRd1:   get_tlp_routing = ID;
108
        // CfgWr1:   get_tlp_routing = ID;
109
        // TCfgRd:   get_tlp_routing = ID;
110
        // TCfgWr:   get_tlp_routing = ID;
111
        // Msg:      get_tlp_routing = ROUTING_UNKNOWN;
112
        // MsgD:     get_tlp_routing = ROUTING_UNKNOWN;
113
        // Cpl:      get_tlp_routing = ID;
114
        // CplD:     get_tlp_routing = ID;
115
        // CplLk:    get_tlp_routing = ID;
116
        // CplDLk:   get_tlp_routing = ID;
117
        // FetchAdd: get_tlp_routing = ROUTING_UNKNOWN;
118
        // Swap:     get_tlp_routing = ROUTING_UNKNOWN;
119
        // CAS:      get_tlp_routing = ROUTING_UNKNOWN;
120
        // LPrfx:    get_tlp_routing = ROUTING_UNKNOWN;
121
        // EPrfx:    get_tlp_routing = ROUTING_UNKNOWN;
122
        // default:  get_tlp_routing = ROUTING_UNKNOWN;
123
      // endcase
124 31 qaztronic
 
125 32 qaztronic
    // endfunction: get_tlp_routing
126 31 qaztronic
 
127
 
128 32 qaztronic
    // // --------------------------------------------------------------------
129
    // //
130
    // function tlp_transaction_t get_tlp_transaction(tlp_type_t tlp_type);
131 31 qaztronic
 
132 32 qaztronic
      // case(tlp_type)
133 31 qaztronic
        // MRd:      get_tlp_transaction = REQUESTER;
134
        // MRdLk:    get_tlp_transaction = REQUESTER;
135
        // MWr:      get_tlp_transaction = REQUESTER;
136
        // IORd:     get_tlp_transaction = REQUESTER;
137
        // IOWr:     get_tlp_transaction = REQUESTER;
138 32 qaztronic
        // CfgRd0:   get_tlp_transaction = REQUESTER;
139
        // CfgWr0:   get_tlp_transaction = REQUESTER;
140
        // CfgRd1:   get_tlp_transaction = REQUESTER;
141
        // CfgWr1:   get_tlp_transaction = REQUESTER;
142
        // TCfgRd:   get_tlp_transaction = REQUESTER;
143
        // TCfgWr:   get_tlp_transaction = REQUESTER;
144 31 qaztronic
        // Msg:      get_tlp_transaction = REQUESTER;
145
        // MsgD:     get_tlp_transaction = REQUESTER;
146
        // Cpl:      get_tlp_transaction = COMPLETER;
147
        // CplD:     get_tlp_transaction = COMPLETER;
148
        // CplLk:    get_tlp_transaction = COMPLETER;
149
        // CplDLk:   get_tlp_transaction = COMPLETER;
150
        // FetchAdd: get_tlp_transaction = TRANSACTION_UNKNOWN;
151
        // Swap:     get_tlp_transaction = TRANSACTION_UNKNOWN;
152
        // CAS:      get_tlp_transaction = TRANSACTION_UNKNOWN;
153
        // LPrfx:    get_tlp_transaction = TRANSACTION_UNKNOWN;
154
        // EPrfx:    get_tlp_transaction = TRANSACTION_UNKNOWN;
155 32 qaztronic
        // default:  get_tlp_transaction = TRANSACTION_UNKNOWN;
156
      // endcase
157 31 qaztronic
 
158 32 qaztronic
    // endfunction: get_tlp_transaction
159 31 qaztronic
 
160
 
161 32 qaztronic
    // // --------------------------------------------------------------------
162
    // //
163
    // function void display_tlp_cfg(tlp_header_class hd_h);
164
 
165
      // logic [5:0] Register_Number = hd_h.header[11][7:2];
166
      // logic [3:0] Extended_Register_Number = hd_h.header[10][3:0];
167
 
168
      // // $display("??? %16.t | Register_Number           = %b", $time, Register_Number);
169
      // // $display("??? %16.t | Extended_Register_Number  = %b", $time, Extended_Register_Number);
170
      // $display("??? %16.t | config offset             = 0x%5.x",
171
                // $time, {Extended_Register_Number, Register_Number, 2'b00});
172
 
173
    // endfunction: display_tlp_cfg
174
 
175
 
176
    // // --------------------------------------------------------------------
177
    // //
178
    // function void display_tlp_type(tlp_type_t tlp_type);
179
 
180
      // case(tlp_type)
181
        // // MRd:      get_tlp_transaction = REQUESTER;
182
        // // MRdLk:    get_tlp_transaction = REQUESTER;
183
        // // MWr:      get_tlp_transaction = REQUESTER;
184
        // // IORd:     get_tlp_transaction = REQUESTER;
185
        // // IOWr:     get_tlp_transaction = REQUESTER;
186
        // CfgRd0:   display_tlp_cfg(tlp_type);
187
        // CfgWr0:   display_tlp_cfg(tlp_type);
188
        // CfgRd1:   display_tlp_cfg(tlp_type);
189
        // CfgWr1:   display_tlp_cfg(tlp_type);
190
        // TCfgRd:   display_tlp_cfg(tlp_type);
191
        // TCfgWr:   display_tlp_cfg(tlp_type);
192
        // // Msg:      get_tlp_transaction = REQUESTER;
193
        // // MsgD:     get_tlp_transaction = REQUESTER;
194
        // // Cpl:      get_tlp_transaction = COMPLETER;
195
        // // CplD:     get_tlp_transaction = COMPLETER;
196
        // // CplLk:    get_tlp_transaction = COMPLETER;
197
        // // CplDLk:   get_tlp_transaction = COMPLETER;
198
        // // FetchAdd: get_tlp_transaction = TRANSACTION_UNKNOWN;
199
        // // Swap:     get_tlp_transaction = TRANSACTION_UNKNOWN;
200
        // // CAS:      get_tlp_transaction = TRANSACTION_UNKNOWN;
201
        // // LPrfx:    get_tlp_transaction = TRANSACTION_UNKNOWN;
202
        // // EPrfx:    get_tlp_transaction = TRANSACTION_UNKNOWN;
203
        // default:  return;
204
      // endcase
205 31 qaztronic
 
206 32 qaztronic
    // endfunction: display_tlp_type
207
 
208
 
209
    // // --------------------------------------------------------------------
210
    // //
211
    // function void set_little_endian_header( logic [127:0] data);
212
 
213
      // logic [2:0] fmt = data[7:5];
214 31 qaztronic
 
215 32 qaztronic
      // if(fmt > 3'b011)
216
      // begin
217
        // $display("!!! %16.t | fmt 3'b%b not supported", $time, fmt);
218
        // $stop;
219
      // end
220 31 qaztronic
 
221 32 qaztronic
      // header_is_4_dw = data[5];
222 31 qaztronic
 
223 32 qaztronic
      // for(int i = 0; i < (header_is_4_dw ? 16 : 12); i += 4)
224
        // {header[i + 0], header[i + 1], header[i + 2], header[i + 3]} = data[i*8 +: 32];
225 31 qaztronic
 
226 32 qaztronic
      // header_type      = get_tlp_type(header[0]);
227
      // routing_type     = get_tlp_routing(header_type);
228
      // transaction_type = get_tlp_transaction(header_type);
229 31 qaztronic
 
230 32 qaztronic
      // fmt_type = header[0];
231
      // tc       = header[1][6:4];
232
      // th       = header[1][0];
233
      // attr     = {header[1][2], header[2][5:4]};
234
      // td       = header[2][7];
235
      // ep       = header[2][6];
236
      // length   = {header[2][1:0], header[3]};
237 31 qaztronic
 
238 32 qaztronic
    // endfunction: set_little_endian_header
239 31 qaztronic
 
240
 
241 32 qaztronic
    // // --------------------------------------------------------------------
242
    // //
243
    // function void display_header(string str);
244 31 qaztronic
 
245 32 qaztronic
      // $display("??? %16.t | .....................", $time);
246
      // $display("??? %16.t | %s | TLP type | %s", $time, str, header_type.name);
247
      // // $display("??? %16.t | fmt           = %b | type = %b", $time, fmt_type[7:5], fmt_type[4:0]);
248
      // $display("??? %16.t | length = %d", $time, length);
249
      // $display("??? %16.t | tc = %b | th = %b | attr = %b | td = %b | ep = %b",
250
                // $time, tc, th, attr, td, ep);
251 31 qaztronic
 
252 32 qaztronic
      // if(routing_type == ADDRESS)
253
        // if(header_is_4_dw)
254
          // $display("??? %16.t | address[63:0] = 0x%16.x", $time,
255
                    // { header[8],  header[9],  header[10], header[11],
256
                      // header[12], header[13], header[14], header[15][7:2], 2'b00});
257
        // else
258
          // $display("??? %16.t | address[31:0] = 0x%8.x", $time,
259
                    // { header[8],  header[9],  header[10], header[11][7:2], 2'b00});
260
      // else if(routing_type == ID)
261
          // $display("??? %16.t | bus = 0x%2.x | device = 0x%x | function = 0x%x", $time,
262
                    // header[8],  header[9][7:3],  header[9][2:0]);
263 31 qaztronic
 
264 32 qaztronic
      // if(transaction_type == COMPLETER)
265
      // begin
266
        // $display("??? %16.t | Completer ID  = %b", $time, {header[4], header[5]});
267
        // $display("??? %16.t | requester ID  = %b", $time, {header[8], header[9]});
268
        // $display("??? %16.t | tag           = %b", $time, header[10]);
269
      // end
270
      // else
271
      // begin
272
        // $display("??? %16.t | requester ID  = %b", $time, {header[4], header[5]});
273
        // $display("??? %16.t | tag           = %b", $time, header[6]);
274
        // $display("??? %16.t | last DW BE = %b | first DW BE = %b",
275
                  // $time, header[7][7:4], header[7][3:0]);
276
      // end
277 31 qaztronic
 
278 32 qaztronic
      // display_tlp_type(header_type);
279 31 qaztronic
 
280 32 qaztronic
      // $display("??? %16.t | ---------------------", $time);
281 31 qaztronic
 
282 32 qaztronic
    // endfunction: display_header
283 31 qaztronic
 
284
 
285
    // //--------------------------------------------------------------------
286
    // //
287
    // function new;
288
 
289
    // endfunction: new
290
 
291
 
292
  // --------------------------------------------------------------------
293
  //
294 32 qaztronic
  endclass: tlp_monitor_class
295 31 qaztronic
 
296
 
297
// --------------------------------------------------------------------
298
//
299
endpackage: pcie_monitor_pkg
300
 
301
 

powered by: WebSVN 2.1.0

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