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

Subversion Repositories uart2bus_testbench

[/] [uart2bus_testbench/] [trunk/] [tb/] [uvm_src/] [macros/] [uvm_tlm_defines.svh] - Blame information for rev 16

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 16 HanySalah
//----------------------------------------------------------------------
2
//   Copyright 2007-2011 Mentor Graphics Corporation
3
//   Copyright 2007-2010 Cadence Design Systems, Inc.
4
//   Copyright 2010 Synopsys, Inc.
5
//   All Rights Reserved Worldwide
6
//
7
//   Licensed under the Apache License, Version 2.0 (the
8
//   "License"); you may not use this file except in
9
//   compliance with the License.  You may obtain a copy of
10
//   the License at
11
//
12
//       http://www.apache.org/licenses/LICENSE-2.0
13
//
14
//   Unless required by applicable law or agreed to in
15
//   writing, software distributed under the License is
16
//   distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
17
//   CONDITIONS OF ANY KIND, either express or implied.  See
18
//   the License for the specific language governing
19
//   permissions and limitations under the License.
20
//----------------------------------------------------------------------
21
 
22
//-----------------------------------------------------------------------------
23
//
24
// Title: TLM Implementation Port Declaration Macros
25
//
26
// The TLM implementation declaration macros provide a way for components
27
// to provide multiple implementation ports of the same implementation
28
// interface. When an implementation port is defined using the built-in
29
// set of imps, there must be exactly one implementation of the interface.
30
//
31
// For example, if a component needs to provide a put implementation then
32
// it would have an implementation port defined like:
33
//
34
//| class mycomp extends uvm_component;
35
//|   uvm_put_imp#(data_type, mycomp) put_imp;
36
//|   ...
37
//|   virtual task put (data_type t);
38
//|     ...
39
//|   endtask
40
//| endclass
41
//
42
// There are times, however, when you need more than one implementation
43
// for an interface. This set of declarations allow you to easily create
44
// a new implementation class to allow for multiple implementations. Although
45
// the new implementation class is a different class, it can be bound to
46
// the same types of exports and ports as the original class. Extending
47
// the put example above, let's say that mycomp needs to provide two put
48
// implementation ports. In that case, you would do something like:
49
//
50
//| //Define two new put interfaces which are compatible with uvm_put_ports
51
//| //and uvm_put_exports.
52
//|
53
//| `uvm_put_imp_decl(_1)
54
//| `uvm_put_imp_decl(_2)
55
//|
56
//| class my_put_imp#(type T=int) extends uvm_component;
57
//|    uvm_put_imp_1#(T,my_put_imp#(T)) put_imp1;
58
//|    uvm_put_imp_2#(T,my_put_imp#(T)) put_imp2;
59
//|    ...
60
//|    function void put_1 (input T t);
61
//|      //puts coming into put_imp1
62
//|      ...
63
//|    endfunction
64
//|    function void put_2(input T t);
65
//|      //puts coming into put_imp2
66
//|      ...
67
//|    endfunction
68
//| endclass
69
//
70
// The important thing to note is that each `uvm__imp_decl creates a
71
// new class of type uvm__imp, where suffix is the input
72
// argument to the macro. For this reason, you will typically want to put
73
// these macros in a separate package to avoid collisions and to allow
74
// sharing of the definitions.
75
//-----------------------------------------------------------------------------
76
 
77
// MACRO: `uvm_blocking_put_imp_decl
78
//
79
//| `uvm_blocking_put_imp_decl(SFX)
80
//
81
// Define the class uvm_blocking_put_impSFX for providing blocking put
82
// implementations.  ~SFX~ is the suffix for the new class type.
83
 
84
`define uvm_blocking_put_imp_decl(SFX) \
85
class uvm_blocking_put_imp``SFX #(type T=int, type IMP=int) \
86
  extends uvm_port_base #(uvm_tlm_if_base #(T,T)); \
87
  `UVM_IMP_COMMON(`UVM_TLM_BLOCKING_PUT_MASK,`"uvm_blocking_put_imp``SFX`",IMP) \
88
  `UVM_BLOCKING_PUT_IMP_SFX(SFX, m_imp, T, t) \
89
endclass
90
 
91
// MACRO: `uvm_nonblocking_put_imp_decl
92
//
93
//| `uvm_nonblocking_put_imp_decl(SFX)
94
//
95
// Define the class uvm_nonblocking_put_impSFX for providing non-blocking
96
// put implementations.  ~SFX~ is the suffix for the new class type.
97
 
98
`define uvm_nonblocking_put_imp_decl(SFX) \
99
class uvm_nonblocking_put_imp``SFX #(type T=int, type IMP=int) \
100
  extends uvm_port_base #(uvm_tlm_if_base #(T,T)); \
101
  `UVM_IMP_COMMON(`UVM_TLM_NONBLOCKING_PUT_MASK,`"uvm_nonblocking_put_imp``SFX`",IMP) \
102
  `UVM_NONBLOCKING_PUT_IMP_SFX( SFX, m_imp, T, t) \
103
endclass
104
 
105
// MACRO: `uvm_put_imp_decl
106
//
107
//| `uvm_put_imp_decl(SFX)
108
//
109
// Define the class uvm_put_impSFX for providing both blocking and
110
// non-blocking put implementations.  ~SFX~ is the suffix for the new class
111
// type.
112
 
113
`define uvm_put_imp_decl(SFX) \
114
class uvm_put_imp``SFX #(type T=int, type IMP=int) \
115
  extends uvm_port_base #(uvm_tlm_if_base #(T,T)); \
116
  `UVM_IMP_COMMON(`UVM_TLM_PUT_MASK,`"uvm_put_imp``SFX`",IMP) \
117
  `UVM_BLOCKING_PUT_IMP_SFX(SFX, m_imp, T, t) \
118
  `UVM_NONBLOCKING_PUT_IMP_SFX(SFX, m_imp, T, t) \
119
endclass
120
 
121
// MACRO: `uvm_blocking_get_imp_decl
122
//
123
//| `uvm_blocking_get_imp_decl(SFX)
124
//
125
// Define the class uvm_blocking_get_impSFX for providing blocking get
126
// implementations.  ~SFX~ is the suffix for the new class type.
127
 
128
`define uvm_blocking_get_imp_decl(SFX) \
129
class uvm_blocking_get_imp``SFX #(type T=int, type IMP=int) \
130
  extends uvm_port_base #(uvm_tlm_if_base #(T,T)); \
131
  `UVM_IMP_COMMON(`UVM_TLM_BLOCKING_GET_MASK,`"uvm_blocking_get_imp``SFX`",IMP) \
132
  `UVM_BLOCKING_GET_IMP_SFX(SFX, m_imp, T, t) \
133
endclass
134
 
135
// MACRO: `uvm_nonblocking_get_imp_decl
136
//
137
//| `uvm_nonblocking_get_imp_decl(SFX)
138
//
139
// Define the class uvm_nonblocking_get_impSFX for providing non-blocking
140
// get implementations.  ~SFX~ is the suffix for the new class type.
141
 
142
`define uvm_nonblocking_get_imp_decl(SFX) \
143
class uvm_nonblocking_get_imp``SFX #(type T=int, type IMP=int) \
144
  extends uvm_port_base #(uvm_tlm_if_base #(T,T)); \
145
  `UVM_IMP_COMMON(`UVM_TLM_NONBLOCKING_GET_MASK,`"uvm_nonblocking_get_imp``SFX`",IMP) \
146
  `UVM_NONBLOCKING_GET_IMP_SFX(SFX, m_imp, T, t) \
147
endclass
148
 
149
// MACRO: `uvm_get_imp_decl
150
//
151
//| `uvm_get_imp_decl(SFX)
152
//
153
// Define the class uvm_get_impSFX for providing both blocking and
154
// non-blocking get implementations.  ~SFX~ is the suffix for the new class
155
// type.
156
 
157
`define uvm_get_imp_decl(SFX) \
158
class uvm_get_imp``SFX #(type T=int, type IMP=int) \
159
  extends uvm_port_base #(uvm_tlm_if_base #(T,T)); \
160
  `UVM_IMP_COMMON(`UVM_TLM_GET_MASK,`"uvm_get_imp``SFX`",IMP) \
161
  `UVM_BLOCKING_GET_IMP_SFX(SFX, m_imp, T, t) \
162
  `UVM_NONBLOCKING_GET_IMP_SFX(SFX, m_imp, T, t) \
163
endclass
164
 
165
// MACRO: `uvm_blocking_peek_imp_decl
166
//
167
//| `uvm_blocking_peek_imp_decl(SFX)
168
//
169
// Define the class uvm_blocking_peek_impSFX for providing blocking peek
170
// implementations.  ~SFX~ is the suffix for the new class type.
171
 
172
`define uvm_blocking_peek_imp_decl(SFX) \
173
class uvm_blocking_peek_imp``SFX #(type T=int, type IMP=int) \
174
  extends uvm_port_base #(uvm_tlm_if_base #(T,T)); \
175
  `UVM_IMP_COMMON(`UVM_TLM_BLOCKING_PEEK_MASK,`"uvm_blocking_peek_imp``SFX`",IMP) \
176
  `UVM_BLOCKING_PEEK_IMP_SFX(SFX, m_imp, T, t) \
177
endclass
178
 
179
// MACRO: `uvm_nonblocking_peek_imp_decl
180
//
181
//| `uvm_nonblocking_peek_imp_decl(SFX)
182
//
183
// Define the class uvm_nonblocking_peek_impSFX for providing non-blocking
184
// peek implementations.  ~SFX~ is the suffix for the new class type.
185
 
186
`define uvm_nonblocking_peek_imp_decl(SFX) \
187
class uvm_nonblocking_peek_imp``SFX #(type T=int, type IMP=int) \
188
  extends uvm_port_base #(uvm_tlm_if_base #(T,T)); \
189
  `UVM_IMP_COMMON(`UVM_TLM_NONBLOCKING_PEEK_MASK,`"uvm_nonblocking_peek_imp``SFX`",IMP) \
190
  `UVM_NONBLOCKING_PEEK_IMP_SFX(SFX, m_imp, T, t) \
191
endclass
192
 
193
// MACRO: `uvm_peek_imp_decl
194
//
195
//| `uvm_peek_imp_decl(SFX)
196
//
197
// Define the class uvm_peek_impSFX for providing both blocking and
198
// non-blocking peek implementations.  ~SFX~ is the suffix for the new class
199
// type.
200
 
201
`define uvm_peek_imp_decl(SFX) \
202
class uvm_peek_imp``SFX #(type T=int, type IMP=int) \
203
  extends uvm_port_base #(uvm_tlm_if_base #(T,T)); \
204
  `UVM_IMP_COMMON(`UVM_TLM_PEEK_MASK,`"uvm_peek_imp``SFX`",IMP) \
205
  `UVM_BLOCKING_PEEK_IMP_SFX(SFX, m_imp, T, t) \
206
  `UVM_NONBLOCKING_PEEK_IMP_SFX(SFX, m_imp, T, t) \
207
endclass
208
 
209
 
210
// MACRO: `uvm_blocking_get_peek_imp_decl
211
//
212
//| `uvm_blocking_get_peek_imp_decl(SFX)
213
//
214
// Define the class uvm_blocking_get_peek_impSFX for providing the
215
// blocking get_peek implementation.
216
 
217
`define uvm_blocking_get_peek_imp_decl(SFX) \
218
class uvm_blocking_get_peek_imp``SFX #(type T=int, type IMP=int) \
219
  extends uvm_port_base #(uvm_tlm_if_base #(T,T)); \
220
  `UVM_IMP_COMMON(`UVM_TLM_BLOCKING_GET_PEEK_MASK,`"uvm_blocking_get_peek_imp``SFX`",IMP) \
221
  `UVM_BLOCKING_GET_IMP_SFX(SFX, m_imp, T, t) \
222
  `UVM_BLOCKING_PEEK_IMP_SFX(SFX, m_imp, T, t) \
223
endclass
224
 
225
// MACRO: `uvm_nonblocking_get_peek_imp_decl
226
//
227
//| `uvm_nonblocking_get_peek_imp_decl(SFX)
228
//
229
// Define the class uvm_nonblocking_get_peek_impSFX for providing non-blocking
230
// get_peek implementation.
231
 
232
`define uvm_nonblocking_get_peek_imp_decl(SFX) \
233
class uvm_nonblocking_get_peek_imp``SFX #(type T=int, type IMP=int) \
234
  extends uvm_port_base #(uvm_tlm_if_base #(T,T)); \
235
  `UVM_IMP_COMMON(`UVM_TLM_NONBLOCKING_GET_PEEK_MASK,`"uvm_nonblocking_get_peek_imp``SFX`",IMP) \
236
  `UVM_NONBLOCKING_GET_IMP_SFX(SFX, m_imp, T, t) \
237
  `UVM_NONBLOCKING_PEEK_IMP_SFX(SFX, m_imp, T, t) \
238
endclass
239
 
240
 
241
// MACRO: `uvm_get_peek_imp_decl
242
//
243
//| `uvm_get_peek_imp_decl(SFX)
244
//
245
// Define the class uvm_get_peek_impSFX for providing both blocking and
246
// non-blocking get_peek implementations.  ~SFX~ is the suffix for the new class
247
// type.
248
 
249
`define uvm_get_peek_imp_decl(SFX) \
250
class uvm_get_peek_imp``SFX #(type T=int, type IMP=int) \
251
  extends uvm_port_base #(uvm_tlm_if_base #(T,T)); \
252
  `UVM_IMP_COMMON(`UVM_TLM_GET_PEEK_MASK,`"uvm_get_peek_imp``SFX`",IMP) \
253
  `UVM_BLOCKING_GET_IMP_SFX(SFX, m_imp, T, t) \
254
  `UVM_NONBLOCKING_GET_IMP_SFX(SFX, m_imp, T, t) \
255
  `UVM_BLOCKING_PEEK_IMP_SFX(SFX, m_imp, T, t) \
256
  `UVM_NONBLOCKING_PEEK_IMP_SFX(SFX, m_imp, T, t) \
257
endclass
258
 
259
// MACRO: `uvm_blocking_master_imp_decl
260
//
261
//| `uvm_blocking_master_imp_decl(SFX)
262
//
263
// Define the class uvm_blocking_master_impSFX for providing the
264
// blocking master implementation.
265
 
266
`define uvm_blocking_master_imp_decl(SFX) \
267
class uvm_blocking_master_imp``SFX #(type REQ=int, type RSP=int, type IMP=int, \
268
                                     type REQ_IMP=IMP, type RSP_IMP=IMP) \
269
  extends uvm_port_base #(uvm_tlm_if_base #(REQ, RSP)); \
270
  typedef IMP     this_imp_type; \
271
  typedef REQ_IMP this_req_type; \
272
  typedef RSP_IMP this_rsp_type; \
273
  `UVM_MS_IMP_COMMON(`UVM_TLM_BLOCKING_MASTER_MASK,`"uvm_blocking_master_imp``SFX`") \
274
  \
275
  `UVM_BLOCKING_PUT_IMP_SFX(SFX, m_req_imp, REQ, t) // req \
276
  \
277
  `UVM_BLOCKING_GET_IMP_SFX(SFX, m_rsp_imp, RSP, t) // rsp \
278
  `UVM_BLOCKING_PEEK_IMP_SFX(SFX, m_rsp_imp, RSP, t) // rsp \
279
  \
280
endclass
281
 
282
// MACRO: `uvm_nonblocking_master_imp_decl
283
//
284
//| `uvm_nonblocking_master_imp_decl(SFX)
285
//
286
// Define the class uvm_nonblocking_master_impSFX for providing the
287
// non-blocking master implementation.
288
 
289
`define uvm_nonblocking_master_imp_decl(SFX) \
290
class uvm_nonblocking_master_imp``SFX #(type REQ=int, type RSP=int, type IMP=int, \
291
                                   type REQ_IMP=IMP, type RSP_IMP=IMP) \
292
  extends uvm_port_base #(uvm_tlm_if_base #(REQ, RSP)); \
293
  typedef IMP     this_imp_type; \
294
  typedef REQ_IMP this_req_type; \
295
  typedef RSP_IMP this_rsp_type; \
296
  `UVM_MS_IMP_COMMON(`UVM_TLM_NONBLOCKING_MASTER_MASK,`"uvm_nonblocking_master_imp``SFX`") \
297
  \
298
  `UVM_NONBLOCKING_PUT_IMP_SFX(SFX, m_req_imp, REQ, t) // req \
299
  \
300
  `UVM_NONBLOCKING_GET_IMP_SFX(SFX, m_rsp_imp, RSP, t) // rsp \
301
  `UVM_NONBLOCKING_PEEK_IMP_SFX(SFX, m_rsp_imp, RSP, t) // rsp \
302
  \
303
endclass
304
 
305
// MACRO: `uvm_master_imp_decl
306
//
307
//| `uvm_master_imp_decl(SFX)
308
//
309
// Define the class uvm_master_impSFX for providing both blocking and
310
// non-blocking master implementations.  ~SFX~ is the suffix for the new class
311
// type.
312
 
313
`define uvm_master_imp_decl(SFX) \
314
class uvm_master_imp``SFX #(type REQ=int, type RSP=int, type IMP=int, \
315
                            type REQ_IMP=IMP, type RSP_IMP=IMP) \
316
  extends uvm_port_base #(uvm_tlm_if_base #(REQ, RSP)); \
317
  typedef IMP     this_imp_type; \
318
  typedef REQ_IMP this_req_type; \
319
  typedef RSP_IMP this_rsp_type; \
320
  `UVM_MS_IMP_COMMON(`UVM_TLM_MASTER_MASK,`"uvm_master_imp``SFX`") \
321
  \
322
  `UVM_BLOCKING_PUT_IMP_SFX(SFX, m_req_imp, REQ, t) // req \
323
  `UVM_NONBLOCKING_PUT_IMP_SFX(SFX, m_req_imp, REQ, t) // req \
324
  \
325
  `UVM_BLOCKING_GET_IMP_SFX(SFX, m_rsp_imp, RSP, t) // rsp \
326
  `UVM_BLOCKING_PEEK_IMP_SFX(SFX, m_rsp_imp, RSP, t) // rsp \
327
  `UVM_NONBLOCKING_GET_IMP_SFX(SFX, m_rsp_imp, RSP, t) // rsp \
328
  `UVM_NONBLOCKING_PEEK_IMP_SFX(SFX, m_rsp_imp, RSP, t) // rsp \
329
  \
330
endclass
331
 
332
// MACRO: `uvm_blocking_slave_imp_decl
333
//
334
//| `uvm_blocking_slave_imp_decl(SFX)
335
//
336
// Define the class uvm_blocking_slave_impSFX for providing the
337
// blocking slave implementation.
338
 
339
`define uvm_blocking_slave_imp_decl(SFX) \
340
class uvm_blocking_slave_imp``SFX #(type REQ=int, type RSP=int, type IMP=int, \
341
                                    type REQ_IMP=IMP, type RSP_IMP=IMP) \
342
  extends uvm_port_base #(uvm_tlm_if_base #(RSP, REQ)); \
343
  typedef IMP     this_imp_type; \
344
  typedef REQ_IMP this_req_type; \
345
  typedef RSP_IMP this_rsp_type; \
346
  `UVM_MS_IMP_COMMON(`UVM_TLM_BLOCKING_SLAVE_MASK,`"uvm_blocking_slave_imp``SFX`") \
347
  \
348
  `UVM_BLOCKING_PUT_IMP_SFX(SFX, m_rsp_imp, RSP, t) // rsp \
349
  \
350
  `UVM_BLOCKING_GET_IMP_SFX(SFX, m_req_imp, REQ, t) // req \
351
  `UVM_BLOCKING_PEEK_IMP_SFX(SFX, m_req_imp, REQ, t) // req \
352
  \
353
endclass
354
 
355
// MACRO: `uvm_nonblocking_slave_imp_decl
356
//
357
//| `uvm_nonblocking_slave_imp_decl(SFX)
358
//
359
// Define the class uvm_nonblocking_slave_impSFX for providing the
360
// non-blocking slave implementation.
361
 
362
`define uvm_nonblocking_slave_imp_decl(SFX) \
363
class uvm_nonblocking_slave_imp``SFX #(type REQ=int, type RSP=int, type IMP=int, \
364
                                       type REQ_IMP=IMP, type RSP_IMP=IMP) \
365
  extends uvm_port_base #(uvm_tlm_if_base #(RSP, REQ)); \
366
  typedef IMP     this_imp_type; \
367
  typedef REQ_IMP this_req_type; \
368
  typedef RSP_IMP this_rsp_type; \
369
  `UVM_MS_IMP_COMMON(`UVM_TLM_NONBLOCKING_SLAVE_MASK,`"uvm_nonblocking_slave_imp``SFX`") \
370
  \
371
  `UVM_NONBLOCKING_PUT_IMP_SFX(SFX, m_rsp_imp, RSP, t) // rsp \
372
  \
373
  `UVM_NONBLOCKING_GET_IMP_SFX(SFX, m_req_imp, REQ, t) // req \
374
  `UVM_NONBLOCKING_PEEK_IMP_SFX(SFX, m_req_imp, REQ, t) // req \
375
  \
376
endclass
377
 
378
// MACRO: `uvm_slave_imp_decl
379
//
380
//| `uvm_slave_imp_decl(SFX)
381
//
382
// Define the class uvm_slave_impSFX for providing both blocking and
383
// non-blocking slave implementations.  ~SFX~ is the suffix for the new class
384
// type.
385
 
386
`define uvm_slave_imp_decl(SFX) \
387
class uvm_slave_imp``SFX #(type REQ=int, type RSP=int, type IMP=int, \
388
                           type REQ_IMP=IMP, type RSP_IMP=IMP) \
389
  extends uvm_port_base #(uvm_tlm_if_base #(RSP, REQ)); \
390
  typedef IMP     this_imp_type; \
391
  typedef REQ_IMP this_req_type; \
392
  typedef RSP_IMP this_rsp_type; \
393
  `UVM_MS_IMP_COMMON(`UVM_TLM_SLAVE_MASK,`"uvm_slave_imp``SFX`") \
394
  \
395
  `UVM_BLOCKING_PUT_IMP_SFX(SFX, m_rsp_imp, RSP, t) // rsp \
396
  `UVM_NONBLOCKING_PUT_IMP_SFX(SFX, m_rsp_imp, RSP, t) // rsp \
397
  \
398
  `UVM_BLOCKING_GET_IMP_SFX(SFX, m_req_imp, REQ, t) // req \
399
  `UVM_BLOCKING_PEEK_IMP_SFX(SFX, m_req_imp, REQ, t) // req \
400
  `UVM_NONBLOCKING_GET_IMP_SFX(SFX, m_req_imp, REQ, t) // req \
401
  `UVM_NONBLOCKING_PEEK_IMP_SFX(SFX, m_req_imp, REQ, t) // req \
402
  \
403
endclass
404
 
405
// MACRO: `uvm_blocking_transport_imp_decl
406
//
407
//| `uvm_blocking_transport_imp_decl(SFX)
408
//
409
// Define the class uvm_blocking_transport_impSFX for providing the
410
// blocking transport implementation.
411
 
412
`define uvm_blocking_transport_imp_decl(SFX) \
413
class uvm_blocking_transport_imp``SFX #(type REQ=int, type RSP=int, type IMP=int) \
414
  extends uvm_port_base #(uvm_tlm_if_base #(REQ, RSP)); \
415
  `UVM_IMP_COMMON(`UVM_TLM_BLOCKING_TRANSPORT_MASK,`"uvm_blocking_transport_imp``SFX`",IMP) \
416
  `UVM_BLOCKING_TRANSPORT_IMP_SFX(SFX, m_imp, REQ, RSP, req, rsp) \
417
endclass
418
 
419
// MACRO: `uvm_nonblocking_transport_imp_decl
420
//
421
//| `uvm_nonblocking_transport_imp_decl(SFX)
422
//
423
// Define the class uvm_nonblocking_transport_impSFX for providing the
424
// non-blocking transport implementation.
425
 
426
`define uvm_nonblocking_transport_imp_decl(SFX) \
427
class uvm_nonblocking_transport_imp``SFX #(type REQ=int, type RSP=int, type IMP=int) \
428
  extends uvm_port_base #(uvm_tlm_if_base #(REQ, RSP)); \
429
  `UVM_IMP_COMMON(`UVM_TLM_NONBLOCKING_TRANSPORT_MASK,`"uvm_nonblocking_transport_imp``SFX`",IMP) \
430
  `UVM_NONBLOCKING_TRANSPORT_IMP_SFX(SFX, m_imp, REQ, RSP, req, rsp) \
431
endclass
432
 
433
`define uvm_non_blocking_transport_imp_decl(SFX) \
434
  `uvm_nonblocking_transport_imp_decl(SFX)
435
 
436
// MACRO: `uvm_transport_imp_decl
437
//
438
//| `uvm_transport_imp_decl(SFX)
439
//
440
// Define the class uvm_transport_impSFX for providing both blocking and
441
// non-blocking transport implementations.  ~SFX~ is the suffix for the new class
442
// type.
443
 
444
`define uvm_transport_imp_decl(SFX) \
445
class uvm_transport_imp``SFX #(type REQ=int, type RSP=int, type IMP=int) \
446
  extends uvm_port_base #(uvm_tlm_if_base #(REQ, RSP)); \
447
  `UVM_IMP_COMMON(`UVM_TLM_TRANSPORT_MASK,`"uvm_transport_imp``SFX`",IMP) \
448
  `UVM_BLOCKING_TRANSPORT_IMP_SFX(SFX, m_imp, REQ, RSP, req, rsp) \
449
  `UVM_NONBLOCKING_TRANSPORT_IMP_SFX(SFX, m_imp, REQ, RSP, req, rsp) \
450
endclass
451
 
452
// MACRO: `uvm_analysis_imp_decl
453
//
454
//| `uvm_analysis_imp_decl(SFX)
455
//
456
// Define the class uvm_analysis_impSFX for providing an analysis
457
// implementation. ~SFX~ is the suffix for the new class type. The analysis
458
// implementation is the write function. The `uvm_analysis_imp_decl allows
459
// for a scoreboard (or other analysis component) to support input from many
460
// places. For example:
461
//
462
//| `uvm_analysis_imp_decl(_ingress)
463
//| `uvm_analysis_imp_decl(_egress)
464
//|
465
//| class myscoreboard extends uvm_component;
466
//|   uvm_analysis_imp_ingress#(mydata, myscoreboard) ingress;
467
//|   uvm_analysis_imp_egress#(mydata, myscoreboard) egress;
468
//|   mydata ingress_list[$];
469
//|   ...
470
//|
471
//|   function new(string name, uvm_component parent);
472
//|     super.new(name,parent);
473
//|     ingress = new("ingress", this);
474
//|     egress = new("egress", this);
475
//|   endfunction
476
//|
477
//|   function void write_ingress(mydata t);
478
//|     ingress_list.push_back(t);
479
//|   endfunction
480
//|
481
//|   function void write_egress(mydata t);
482
//|     find_match_in_ingress_list(t);
483
//|   endfunction
484
//|
485
//|   function void find_match_in_ingress_list(mydata t);
486
//|     //implement scoreboarding for this particular dut
487
//|     ...
488
//|   endfunction
489
//| endclass
490
 
491
`define uvm_analysis_imp_decl(SFX) \
492
class uvm_analysis_imp``SFX #(type T=int, type IMP=int) \
493
  extends uvm_port_base #(uvm_tlm_if_base #(T,T)); \
494
  `UVM_IMP_COMMON(`UVM_TLM_ANALYSIS_MASK,`"uvm_analysis_imp``SFX`",IMP) \
495
  function void write( input T t); \
496
    m_imp.write``SFX( t); \
497
  endfunction \
498
  \
499
endclass
500
 
501
 
502
// These imps are used in uvm_*_port, uvm_*_export and uvm_*_imp, using suffixes
503
//
504
 
505
`define UVM_BLOCKING_PUT_IMP_SFX(SFX, imp, TYPE, arg) \
506
  task put( input TYPE arg); imp.put``SFX( arg); endtask
507
 
508
`define UVM_BLOCKING_GET_IMP_SFX(SFX, imp, TYPE, arg) \
509
  task get( output TYPE arg); imp.get``SFX( arg); endtask
510
 
511
`define UVM_BLOCKING_PEEK_IMP_SFX(SFX, imp, TYPE, arg) \
512
  task peek( output TYPE arg);imp.peek``SFX( arg); endtask
513
 
514
`define UVM_NONBLOCKING_PUT_IMP_SFX(SFX, imp, TYPE, arg) \
515
  function bit try_put( input TYPE arg); \
516
    if( !imp.try_put``SFX( arg)) return 0; \
517
    return 1; \
518
  endfunction \
519
  function bit can_put(); return imp.can_put``SFX(); endfunction
520
 
521
`define UVM_NONBLOCKING_GET_IMP_SFX(SFX, imp, TYPE, arg) \
522
  function bit try_get( output TYPE arg); \
523
    if( !imp.try_get``SFX( arg)) return 0; \
524
    return 1; \
525
  endfunction \
526
  function bit can_get(); return imp.can_get``SFX(); endfunction
527
 
528
`define UVM_NONBLOCKING_PEEK_IMP_SFX(SFX, imp, TYPE, arg) \
529
  function bit try_peek( output TYPE arg); \
530
    if( !imp.try_peek``SFX( arg)) return 0; \
531
    return 1; \
532
  endfunction \
533
  function bit can_peek(); return imp.can_peek``SFX(); endfunction
534
 
535
`define UVM_BLOCKING_TRANSPORT_IMP_SFX(SFX, imp, REQ, RSP, req_arg, rsp_arg) \
536
  task transport( input REQ req_arg, output RSP rsp_arg); \
537
    imp.transport``SFX(req_arg, rsp_arg); \
538
  endtask
539
 
540
`define UVM_NONBLOCKING_TRANSPORT_IMP_SFX(SFX, imp, REQ, RSP, req_arg, rsp_arg) \
541
  function bit nb_transport( input REQ req_arg, output RSP rsp_arg); \
542
    if(imp) return imp.nb_transport``SFX(req_arg, rsp_arg); \
543
  endfunction
544
 
545
//----------------------------------------------------------------------
546
// imp definitions
547
//----------------------------------------------------------------------
548
`define UVM_SEQ_ITEM_PULL_IMP(imp, REQ, RSP, req_arg, rsp_arg) \
549
  function void disable_auto_item_recording(); imp.disable_auto_item_recording(); endfunction \
550
  function bit is_auto_item_recording_enabled(); return imp.is_auto_item_recording_enabled(); endfunction \
551
  task get_next_item(output REQ req_arg); imp.get_next_item(req_arg); endtask \
552
  task try_next_item(output REQ req_arg); imp.try_next_item(req_arg); endtask \
553
  function void item_done(input RSP rsp_arg = null); imp.item_done(rsp_arg); endfunction \
554
  task wait_for_sequences(); imp.wait_for_sequences(); endtask \
555
  function bit has_do_available(); return imp.has_do_available(); endfunction \
556
  function void put_response(input RSP rsp_arg); imp.put_response(rsp_arg); endfunction \
557
  task get(output REQ req_arg); imp.get(req_arg); endtask \
558
  task peek(output REQ req_arg); imp.peek(req_arg); endtask \
559
  task put(input RSP rsp_arg); imp.put(rsp_arg); endtask
560
 
561
// primitive interfaces
562
`define UVM_TLM_BLOCKING_PUT_MASK          (1<<0)
563
`define UVM_TLM_BLOCKING_GET_MASK          (1<<1)
564
`define UVM_TLM_BLOCKING_PEEK_MASK         (1<<2)
565
`define UVM_TLM_BLOCKING_TRANSPORT_MASK    (1<<3)
566
 
567
`define UVM_TLM_NONBLOCKING_PUT_MASK       (1<<4)
568
`define UVM_TLM_NONBLOCKING_GET_MASK       (1<<5)
569
`define UVM_TLM_NONBLOCKING_PEEK_MASK      (1<<6)
570
`define UVM_TLM_NONBLOCKING_TRANSPORT_MASK (1<<7)
571
 
572
`define UVM_TLM_ANALYSIS_MASK              (1<<8)
573
 
574
`define UVM_TLM_MASTER_BIT_MASK            (1<<9)
575
`define UVM_TLM_SLAVE_BIT_MASK             (1<<10)
576
// combination interfaces
577
`define UVM_TLM_PUT_MASK                  (`UVM_TLM_BLOCKING_PUT_MASK    | `UVM_TLM_NONBLOCKING_PUT_MASK)
578
`define UVM_TLM_GET_MASK                  (`UVM_TLM_BLOCKING_GET_MASK    | `UVM_TLM_NONBLOCKING_GET_MASK)
579
`define UVM_TLM_PEEK_MASK                 (`UVM_TLM_BLOCKING_PEEK_MASK   | `UVM_TLM_NONBLOCKING_PEEK_MASK)
580
 
581
`define UVM_TLM_BLOCKING_GET_PEEK_MASK    (`UVM_TLM_BLOCKING_GET_MASK    | `UVM_TLM_BLOCKING_PEEK_MASK)
582
`define UVM_TLM_BLOCKING_MASTER_MASK      (`UVM_TLM_BLOCKING_PUT_MASK       | `UVM_TLM_BLOCKING_GET_MASK | `UVM_TLM_BLOCKING_PEEK_MASK | `UVM_TLM_MASTER_BIT_MASK)
583
`define UVM_TLM_BLOCKING_SLAVE_MASK       (`UVM_TLM_BLOCKING_PUT_MASK       | `UVM_TLM_BLOCKING_GET_MASK | `UVM_TLM_BLOCKING_PEEK_MASK | `UVM_TLM_SLAVE_BIT_MASK)
584
 
585
`define UVM_TLM_NONBLOCKING_GET_PEEK_MASK (`UVM_TLM_NONBLOCKING_GET_MASK | `UVM_TLM_NONBLOCKING_PEEK_MASK)
586
`define UVM_TLM_NONBLOCKING_MASTER_MASK   (`UVM_TLM_NONBLOCKING_PUT_MASK    | `UVM_TLM_NONBLOCKING_GET_MASK | `UVM_TLM_NONBLOCKING_PEEK_MASK | `UVM_TLM_MASTER_BIT_MASK)
587
`define UVM_TLM_NONBLOCKING_SLAVE_MASK    (`UVM_TLM_NONBLOCKING_PUT_MASK    | `UVM_TLM_NONBLOCKING_GET_MASK | `UVM_TLM_NONBLOCKING_PEEK_MASK | `UVM_TLM_SLAVE_BIT_MASK)
588
 
589
`define UVM_TLM_GET_PEEK_MASK             (`UVM_TLM_GET_MASK | `UVM_TLM_PEEK_MASK)
590
`define UVM_TLM_MASTER_MASK               (`UVM_TLM_BLOCKING_MASTER_MASK    | `UVM_TLM_NONBLOCKING_MASTER_MASK)
591
`define UVM_TLM_SLAVE_MASK                (`UVM_TLM_BLOCKING_SLAVE_MASK    | `UVM_TLM_NONBLOCKING_SLAVE_MASK)
592
`define UVM_TLM_TRANSPORT_MASK            (`UVM_TLM_BLOCKING_TRANSPORT_MASK | `UVM_TLM_NONBLOCKING_TRANSPORT_MASK)
593
 
594
`define UVM_SEQ_ITEM_GET_NEXT_ITEM_MASK       (1<<0)
595
`define UVM_SEQ_ITEM_TRY_NEXT_ITEM_MASK       (1<<1)
596
`define UVM_SEQ_ITEM_ITEM_DONE_MASK           (1<<2)
597
`define UVM_SEQ_ITEM_HAS_DO_AVAILABLE_MASK    (1<<3)
598
`define UVM_SEQ_ITEM_WAIT_FOR_SEQUENCES_MASK  (1<<4)
599
`define UVM_SEQ_ITEM_PUT_RESPONSE_MASK        (1<<5)
600
`define UVM_SEQ_ITEM_PUT_MASK                 (1<<6)
601
`define UVM_SEQ_ITEM_GET_MASK                 (1<<7)
602
`define UVM_SEQ_ITEM_PEEK_MASK                (1<<8)
603
 
604
`define UVM_SEQ_ITEM_PULL_MASK  (`UVM_SEQ_ITEM_GET_NEXT_ITEM_MASK | `UVM_SEQ_ITEM_TRY_NEXT_ITEM_MASK | \
605
                        `UVM_SEQ_ITEM_ITEM_DONE_MASK | `UVM_SEQ_ITEM_HAS_DO_AVAILABLE_MASK |  \
606
                        `UVM_SEQ_ITEM_WAIT_FOR_SEQUENCES_MASK | `UVM_SEQ_ITEM_PUT_RESPONSE_MASK | \
607
                        `UVM_SEQ_ITEM_PUT_MASK | `UVM_SEQ_ITEM_GET_MASK | `UVM_SEQ_ITEM_PEEK_MASK)
608
 
609
`define UVM_SEQ_ITEM_UNI_PULL_MASK (`UVM_SEQ_ITEM_GET_NEXT_ITEM_MASK | `UVM_SEQ_ITEM_TRY_NEXT_ITEM_MASK | \
610
                           `UVM_SEQ_ITEM_ITEM_DONE_MASK | `UVM_SEQ_ITEM_HAS_DO_AVAILABLE_MASK | \
611
                           `UVM_SEQ_ITEM_WAIT_FOR_SEQUENCES_MASK | `UVM_SEQ_ITEM_GET_MASK | \
612
                           `UVM_SEQ_ITEM_PEEK_MASK)
613
 
614
`define UVM_SEQ_ITEM_PUSH_MASK  (`UVM_SEQ_ITEM_PUT_MASK)
615
 
616
`include "tlm1/uvm_tlm_imps.svh"

powered by: WebSVN 2.1.0

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