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

Subversion Repositories uart2bus_testbench

[/] [uart2bus_testbench/] [trunk/] [tb/] [uvm_src/] [macros/] [uvm_object_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-2011 Cadence Design Systems, Inc.
4
//   Copyright 2010-2011 Synopsys, Inc.
5
//   Copyright 2013-2014 NVIDIA Corporation
6
//   Copyright 2013      Cisco Systems, Inc.
7
//   All Rights Reserved Worldwide
8
//
9
//   Licensed under the Apache License, Version 2.0 (the
10
//   "License"); you may not use this file except in
11
//   compliance with the License.  You may obtain a copy of
12
//   the License at
13
//
14
//       http://www.apache.org/licenses/LICENSE-2.0
15
//
16
//   Unless required by applicable law or agreed to in
17
//   writing, software distributed under the License is
18
//   distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
19
//   CONDITIONS OF ANY KIND, either express or implied.  See
20
//   the License for the specific language governing
21
//   permissions and limitations under the License.
22
//------------------------------------------------------------------------------
23
 
24
`ifndef UVM_OBJECT_DEFINES_SVH
25
`define UVM_OBJECT_DEFINES_SVH
26
 
27
`ifdef UVM_EMPTY_MACROS
28
 
29
`define uvm_field_utils_begin(T)
30
`define uvm_field_utils_end
31
`define uvm_object_utils(T)
32
`define uvm_object_param_utils(T)
33
`define uvm_object_utils_begin(T)
34
`define uvm_object_param_utils_begin(T)
35
`define uvm_object_utils_end
36
`define uvm_component_utils(T)
37
`define uvm_component_param_utils(T)
38
`define uvm_component_utils_begin(T)
39
`define uvm_component_param_utils_begin(T)
40
`define uvm_component_utils_end
41
`define uvm_field_int(ARG,FLAG)
42
`define uvm_field_real(ARG,FLAG)
43
`define uvm_field_enum(T,ARG,FLAG)
44
`define uvm_field_object(ARG,FLAG)
45
`define uvm_field_event(ARG,FLAG)
46
`define uvm_field_string(ARG,FLAG)
47
`define uvm_field_array_enum(ARG,FLAG)
48
`define uvm_field_array_int(ARG,FLAG)
49
`define uvm_field_sarray_int(ARG,FLAG)
50
`define uvm_field_sarray_enum(ARG,FLAG)
51
`define uvm_field_array_object(ARG,FLAG)
52
`define uvm_field_sarray_object(ARG,FLAG)
53
`define uvm_field_array_string(ARG,FLAG)
54
`define uvm_field_sarray_string(ARG,FLAG)
55
`define uvm_field_queue_enum(ARG,FLAG)
56
`define uvm_field_queue_int(ARG,FLAG)
57
`define uvm_field_queue_object(ARG,FLAG)
58
`define uvm_field_queue_string(ARG,FLAG)
59
`define uvm_field_aa_int_string(ARG, FLAG)
60
`define uvm_field_aa_string_string(ARG, FLAG)
61
`define uvm_field_aa_object_string(ARG, FLAG)
62
`define uvm_field_aa_int_int(ARG, FLAG)
63
`define uvm_field_aa_int_int(ARG, FLAG)
64
`define uvm_field_aa_int_int_unsigned(ARG, FLAG)
65
`define uvm_field_aa_int_integer(ARG, FLAG)
66
`define uvm_field_aa_int_integer_unsigned(ARG, FLAG)
67
`define uvm_field_aa_int_byte(ARG, FLAG)
68
`define uvm_field_aa_int_byte_unsigned(ARG, FLAG)
69
`define uvm_field_aa_int_shortint(ARG, FLAG)
70
`define uvm_field_aa_int_shortint_unsigned(ARG, FLAG)
71
`define uvm_field_aa_int_longint(ARG, FLAG)
72
`define uvm_field_aa_int_longint_unsigned(ARG, FLAG)
73
`define uvm_field_aa_int_key(KEY, ARG, FLAG)
74
`define uvm_field_aa_string_int(ARG, FLAG)
75
`define uvm_field_aa_object_int(ARG, FLAG)
76
 
77
`else
78
 
79
//------------------------------------------------------------------------------
80
//
81
// Title: Utility and Field Macros for Components and Objects
82
//
83
// Group: Utility Macros
84
//
85
// The ~utils~ macros define the infrastructure needed to enable the
86
// object/component for correct factory operation. See <`uvm_object_utils> and
87
// <`uvm_component_utils> for details.
88
//
89
// A ~utils~ macro should be used inside ~every~ user-defined class that extends
90
//  directly or indirectly, including  and
91
// .
92
//
93
// Below is an example usage of the ~utils~ macro for a user-defined object.
94
//
95
//|  class mydata extends uvm_object;
96
//|
97
//|     `uvm_object_utils(mydata)
98
//|
99
//|     // declare data properties
100
//|
101
//|    function new(string name="mydata_inst");
102
//|      super.new(name);
103
//|    endfunction
104
//|
105
//|  endclass
106
//
107
// Below is an example usage of a ~utils~ macro for a user-defined component.
108
//
109
//|  class my_comp extends uvm_component;
110
//|
111
//|     `uvm_component_utils(my_comp)
112
//|
113
//|     // declare data properties
114
//|
115
//|    function new(string name, uvm_component parent=null);
116
//|      super.new(name,parent);
117
//|    endfunction
118
//|
119
//|  endclass
120
//
121
//------------------------------------------------------------------------------
122
 
123
// Define- UVM_NO_REGISTERED_CONVERTER
124
//
125
// if this symbol is defined all auto registration of the proxies to print resources
126
// are disabled and you only get the typename printed (printing the objects contents
127
// either requires fill %p support or an appropriate proxy registered)
128
//
129
`ifdef UVM_NO_DEPRECATED
130
  `define UVM_NO_REGISTERED_CONVERTER
131
`endif
132
 
133
 
134
// Definitions for the user to use inside their derived data class declarations.
135
 
136
// MACRO: `uvm_field_utils_begin
137
 
138
// MACRO: `uvm_field_utils_end
139
//
140
// These macros form a block in which `uvm_field_* macros can be placed.
141
// Used as
142
//
143
//|  `uvm_field_utils_begin(TYPE)
144
//|    `uvm_field_* macros here
145
//|  `uvm_field_utils_end
146
//
147
//
148
// These macros do ~not~ perform factory registration nor implement the
149
// ~get_type_name~ and ~create~ methods. Use this form when you need custom
150
// implementations of these two methods, or when you are setting up field macros
151
// for an abstract class (i.e. virtual class).
152
 
153
`define uvm_field_utils_begin(T) \
154
   function void __m_uvm_field_automation (uvm_object tmp_data__, \
155
                                     int what__, \
156
                                     string str__); \
157
   begin \
158
     T local_data__; /* Used for copy and compare */ \
159
     typedef T ___local_type____; \
160
     string string_aa_key; /* Used for associative array lookups */ \
161
     uvm_object __current_scopes[$]; \
162
     if(what__ inside {UVM_SETINT,UVM_SETSTR,UVM_SETOBJ}) begin \
163
        if(__m_uvm_status_container.m_do_cycle_check(this)) begin \
164
            return; \
165
        end \
166
        else \
167
            __current_scopes=__m_uvm_status_container.m_uvm_cycle_scopes; \
168
     end \
169
     super.__m_uvm_field_automation(tmp_data__, what__, str__); \
170
     /* Type is verified by uvm_object::compare() */ \
171
     if(tmp_data__ != null) \
172
       /* Allow objects in same hierarchy to be copied/compared */ \
173
       if(!$cast(local_data__, tmp_data__)) return;
174
 
175
`define uvm_field_utils_end \
176
     if(what__ inside {UVM_SETINT,UVM_SETSTR,UVM_SETOBJ}) begin \
177
        // remove all scopes recorded (through super and other objects visited before) \
178
        void'(__current_scopes.pop_back()); \
179
        __m_uvm_status_container.m_uvm_cycle_scopes = __current_scopes; \
180
     end \
181
     end \
182
endfunction \
183
 
184
// MACRO: `uvm_object_utils
185
 
186
// MACRO: `uvm_object_param_utils
187
 
188
// MACRO: `uvm_object_utils_begin
189
 
190
// MACRO: `uvm_object_param_utils_begin
191
 
192
// MACRO: `uvm_object_utils_end
193
//
194
// -based class declarations may contain one of the above forms of
195
// utility macros.
196
//
197
// For simple objects with no field macros, use
198
//
199
//|  `uvm_object_utils(TYPE)
200
//
201
// For simple objects with field macros, use
202
//
203
//|  `uvm_object_utils_begin(TYPE)
204
//|    `uvm_field_* macro invocations here
205
//|  `uvm_object_utils_end
206
//
207
// For parameterized objects with no field macros, use
208
//
209
//|  `uvm_object_param_utils(TYPE)
210
//
211
// For parameterized objects, with field macros, use
212
//
213
//|  `uvm_object_param_utils_begin(TYPE)
214
//|    `uvm_field_* macro invocations here
215
//|  `uvm_object_utils_end
216
//
217
// Simple (non-parameterized) objects use the uvm_object_utils* versions, which
218
// do the following:
219
//
220
// o Implements get_type_name, which returns TYPE as a string
221
//
222
// o Implements create, which allocates an object of type TYPE by calling its
223
//   constructor with no arguments. TYPE's constructor, if defined, must have
224
//   default values on all it arguments.
225
//
226
// o Registers the TYPE with the factory, using the string TYPE as the factory
227
//   lookup string for the type.
228
//
229
// o Implements the static get_type() method which returns a factory
230
//   proxy object for the type.
231
//
232
// o Implements the virtual get_object_type() method which works just like the
233
//   static get_type() method, but operates on an already allocated object.
234
//
235
// Parameterized classes must use the uvm_object_param_utils* versions. They
236
// differ from <`uvm_object_utils> only in that they do not supply a type name
237
// when registering the object with the factory. As such, name-based lookup with
238
// the factory for parameterized classes is not possible.
239
//
240
// The macros with _begin suffixes are the same as the non-suffixed versions
241
// except that they also start a block in which `uvm_field_* macros can be
242
// placed. The block must be terminated by `uvm_object_utils_end.
243
//
244
 
245
`define uvm_object_utils(T) \
246
  `uvm_object_utils_begin(T) \
247
  `uvm_object_utils_end
248
 
249
`define uvm_object_param_utils(T) \
250
  `uvm_object_param_utils_begin(T) \
251
  `uvm_object_utils_end
252
 
253
`define uvm_object_utils_begin(T) \
254
   `m_uvm_object_registry_internal(T,T)  \
255
   `m_uvm_object_create_func(T) \
256
   `m_uvm_get_type_name_func(T) \
257
   `uvm_field_utils_begin(T)
258
 
259
`define uvm_object_param_utils_begin(T) \
260
   `m_uvm_object_registry_param(T)  \
261
   `m_uvm_object_create_func(T) \
262
   `uvm_field_utils_begin(T)
263
 
264
`define uvm_object_utils_end \
265
     end \
266
   endfunction \
267
 
268
 
269
// MACRO: `uvm_component_utils
270
 
271
// MACRO: `uvm_component_param_utils
272
 
273
// MACRO: `uvm_component_utils_begin
274
 
275
// MACRO: `uvm_component_param_utils_begin
276
 
277
// MACRO: `uvm_component_end
278
//
279
// uvm_component-based class declarations may contain one of the above forms of
280
// utility macros.
281
//
282
// For simple components with no field macros, use
283
//
284
//|  `uvm_component_utils(TYPE)
285
//
286
// For simple components with field macros, use
287
//
288
//|  `uvm_component_utils_begin(TYPE)
289
//|    `uvm_field_* macro invocations here
290
//|  `uvm_component_utils_end
291
//
292
// For parameterized components with no field macros, use
293
//
294
//|  `uvm_component_param_utils(TYPE)
295
//
296
// For parameterized components with field macros, use
297
//
298
//|  `uvm_component_param_utils_begin(TYPE)
299
//|    `uvm_field_* macro invocations here
300
//|  `uvm_component_utils_end
301
//
302
// Simple (non-parameterized) components must use the uvm_components_utils*
303
// versions, which do the following:
304
//
305
// o Implements get_type_name, which returns TYPE as a string.
306
//
307
// o Implements create, which allocates a component of type TYPE using a two
308
//   argument constructor. TYPE's constructor must have a name and a parent
309
//   argument.
310
//
311
// o Registers the TYPE with the factory, using the string TYPE as the factory
312
//   lookup string for the type.
313
//
314
// o Implements the static get_type() method which returns a factory
315
//   proxy object for the type.
316
//
317
// o Implements the virtual get_object_type() method which works just like the
318
//   static get_type() method, but operates on an already allocated object.
319
//
320
// Parameterized classes must use the uvm_object_param_utils* versions. They
321
// differ from `uvm_object_utils only in that they do not supply a type name
322
// when registering the object with the factory. As such, name-based lookup with
323
// the factory for parameterized classes is not possible.
324
//
325
// The macros with _begin suffixes are the same as the non-suffixed versions
326
// except that they also start a block in which `uvm_field_* macros can be
327
// placed. The block must be terminated by `uvm_component_utils_end.
328
//
329
 
330
`define uvm_component_utils(T) \
331
   `m_uvm_component_registry_internal(T,T) \
332
   `m_uvm_get_type_name_func(T) \
333
 
334
`define uvm_component_param_utils(T) \
335
   `m_uvm_component_registry_param(T) \
336
 
337
 
338
`define uvm_component_utils_begin(T) \
339
   `uvm_component_utils(T) \
340
   `uvm_field_utils_begin(T)
341
 
342
`define uvm_component_param_utils_begin(T) \
343
   `uvm_component_param_utils(T) \
344
   `uvm_field_utils_begin(T)
345
 
346
`define uvm_component_utils_end \
347
     end \
348
   endfunction
349
 
350
 
351
// MACRO: `uvm_object_registry
352
//
353
// Register a uvm_object-based class with the factory
354
//
355
//| `uvm_object_registry(T,S)
356
//
357
// Registers a uvm_object-based class ~T~ and lookup
358
// string ~S~ with the factory. ~S~ typically is the
359
// name of the class in quotes. The <`uvm_object_utils>
360
// family of macros uses this macro.
361
 
362
`define uvm_object_registry(T,S) \
363
   typedef uvm_object_registry#(T,S) type_id; \
364
   static function type_id get_type(); \
365
     return type_id::get(); \
366
   endfunction \
367
   virtual function uvm_object_wrapper get_object_type(); \
368
     return type_id::get(); \
369
   endfunction
370
 
371
 
372
// MACRO: `uvm_component_registry
373
//
374
// Registers a uvm_component-based class with the factory
375
//
376
//| `uvm_component_registry(T,S)
377
//
378
// Registers a uvm_component-based class ~T~ and lookup
379
// string ~S~ with the factory. ~S~ typically is the
380
// name of the class in quotes. The <`uvm_object_utils>
381
// family of macros uses this macro.
382
 
383
`define uvm_component_registry(T,S) \
384
   typedef uvm_component_registry #(T,S) type_id; \
385
   static function type_id get_type(); \
386
     return type_id::get(); \
387
   endfunction \
388
   virtual function uvm_object_wrapper get_object_type(); \
389
     return type_id::get(); \
390
   endfunction
391
 
392
 
393
// uvm_new_func
394
// ------------
395
 
396
`define uvm_new_func \
397
  function new (string name, uvm_component parent); \
398
    super.new(name, parent); \
399
  endfunction
400
 
401
 
402
//-----------------------------------------------------------------------------
403
// INTERNAL MACROS - in support of *_utils macros -- do not use directly
404
//-----------------------------------------------------------------------------
405
 
406
// m_uvm_object_create_func
407
// ------------------------
408
 
409
`define m_uvm_object_create_func(T) \
410
   function uvm_object create (string name=""); \
411
     T tmp; \
412
`ifdef UVM_OBJECT_DO_NOT_NEED_CONSTRUCTOR \
413
     tmp = new(); \
414
     if (name!="") \
415
       tmp.set_name(name); \
416
`else \
417
     if (name=="") tmp = new(); \
418
     else tmp = new(name); \
419
`endif \
420
     return tmp; \
421
   endfunction
422
 
423
 
424
// m_uvm_get_type_name_func
425
// ----------------------
426
 
427
`define m_uvm_get_type_name_func(T) \
428
   const static string type_name = `"T`"; \
429
   virtual function string get_type_name (); \
430
     return type_name; \
431
   endfunction
432
 
433
 
434
// m_uvm_object_registry_internal
435
// ------------------------------
436
 
437
//This is needed due to an issue in of passing down strings
438
//created by args to lower level macros.
439
`define m_uvm_object_registry_internal(T,S) \
440
   typedef uvm_object_registry#(T,`"S`") type_id; \
441
   static function type_id get_type(); \
442
     return type_id::get(); \
443
   endfunction \
444
   virtual function uvm_object_wrapper get_object_type(); \
445
     return type_id::get(); \
446
   endfunction
447
 
448
 
449
// m_uvm_object_registry_param
450
// ---------------------------
451
 
452
`define m_uvm_object_registry_param(T) \
453
   typedef uvm_object_registry #(T) type_id; \
454
   static function type_id get_type(); \
455
     return type_id::get(); \
456
   endfunction \
457
   virtual function uvm_object_wrapper get_object_type(); \
458
     return type_id::get(); \
459
   endfunction
460
 
461
 
462
// m_uvm_component_registry_internal
463
// ---------------------------------
464
 
465
//This is needed due to an issue in of passing down strings
466
//created by args to lower level macros.
467
`define m_uvm_component_registry_internal(T,S) \
468
   typedef uvm_component_registry #(T,`"S`") type_id; \
469
   static function type_id get_type(); \
470
     return type_id::get(); \
471
   endfunction \
472
   virtual function uvm_object_wrapper get_object_type(); \
473
     return type_id::get(); \
474
   endfunction
475
 
476
// versions of the uvm_component_registry macros to be used with
477
// parameterized classes
478
 
479
// m_uvm_component_registry_param
480
// ------------------------------
481
 
482
`define m_uvm_component_registry_param(T) \
483
   typedef uvm_component_registry #(T) type_id; \
484
   static function type_id get_type(); \
485
     return type_id::get(); \
486
   endfunction \
487
   virtual function uvm_object_wrapper get_object_type(); \
488
     return type_id::get(); \
489
   endfunction
490
 
491
 
492
 
493
//------------------------------------------------------------------------------
494
//
495
// Group: Field Macros
496
//
497
// The `uvm_field_*  macros are invoked inside of the `uvm_*_utils_begin and
498
// `uvm_*_utils_end macro blocks to form "automatic" implementations of the
499
// core data methods: copy, compare, pack, unpack, record, print, and sprint.
500
//
501
// By using the macros, you do not have to implement any of the do_* methods
502
// inherited from . However, be aware that the field macros expand
503
// into general inline code that is not as run-time efficient nor as flexible
504
// as direct implementations of the do_* methods.
505
//
506
// Below is an example usage of the field macros for a sequence item.
507
//
508
//|  class my_trans extends uvm_sequence_item;
509
//|
510
//|    cmd_t  cmd;
511
//|    int    addr;
512
//|    int    data[$];
513
//|    my_ext ext;
514
//|    string str;
515
//|
516
//|    `uvm_object_utils_begin(my_trans)
517
//|      `uvm_field_enum     (cmd_t, cmd, UVM_ALL_ON)
518
//|      `uvm_field_int      (addr, UVM_ALL_ON)
519
//|      `uvm_field_queue_int(data, UVM_ALL_ON)
520
//|      `uvm_field_object   (ext,  UVM_ALL_ON)
521
//|      `uvm_field_string   (str,  UVM_ALL_ON)
522
//|    `uvm_object_utils_end
523
//|
524
//|    function new(string name="mydata_inst");
525
//|      super.new(name);
526
//|    endfunction
527
//|
528
//|  endclass
529
//
530
// Below is an example usage of the field macros for a component.
531
//
532
//|  class my_comp extends uvm_component;
533
//|
534
//|    my_comp_cfg  cfg;
535
//|
536
//|    `uvm_component_utils_begin(my_comp)
537
//|      `uvm_field_object   (cfg,  UVM_ALL_ON)
538
//|    `uvm_object_utils_end
539
//|
540
//|    function new(string name="my_comp_inst", uvm_component parent=null);
541
//|      super.new(name);
542
//|    endfunction
543
//|
544
//|  endclass
545
//
546
// Each `uvm_field_* macro is named according to the particular data type it
547
// handles: integrals, strings, objects, queues, etc., and each has at least two
548
// arguments: ~ARG~ and ~FLAG~.
549
//
550
// ARG -  is the instance name of the variable, whose type must be compatible with
551
// the macro being invoked. In the example, class variable ~addr~ is an integral type,
552
// so we use the ~`uvm_field_int~ macro.
553
//
554
// FLAG - if set to ~UVM_ALL_ON~, as in the example, the ARG variable will be
555
// included in all data methods. If FLAG is set to something other than
556
// ~UVM_ALL_ON~ or ~UVM_DEFAULT~, it specifies which data method implementations will
557
// ~not~ include the given variable. Thus, if ~FLAG~ is specified as ~NO_COMPARE~,
558
// the ARG variable will not affect comparison operations, but it will be
559
// included in everything else.
560
//
561
// All possible values for ~FLAG~ are listed and described below. Multiple flag
562
// values can be bitwise OR'ed together (in most cases they may be added together
563
// as well, but care must be taken when using the + operator to ensure that the
564
// same bit is not added more than once).
565
//
566
//   UVM_ALL_ON     - Set all operations on.
567
//   UVM_DEFAULT    - This is the recommended set of flags to pass
568
//                      to the field macros.  Currently, it enables
569
//                      all of the operations, making it functionally
570
//                      identical to ~UVM_ALL_ON~.  In the future
571
//                      however, additional flags could be added with
572
//                      a recommended default value of ~off~.
573
//
574
//   UVM_NOCOPY     - Do not copy this field.
575
//   UVM_NOCOMPARE  - Do not compare this field.
576
//   UVM_NOPRINT    - Do not print this field.
577
//   UVM_NOPACK     - Do not pack or unpack this field.
578
//
579
//   UVM_REFERENCE  - For object types, operate only on the handle (e.g. no deep copy)
580
//
581
//   UVM_PHYSICAL   - Treat as a physical field. Use physical setting in
582
//                      policy class for this field.
583
//   UVM_ABSTRACT   - Treat as an abstract field. Use the abstract setting
584
//                      in the policy class for this field.
585
//   UVM_READONLY   - Do not allow setting of this field from the set_*_local
586
//                      methods or during  operation.
587
//
588
//
589
// A radix for printing and recording can be specified by OR'ing one of the
590
// following constants in the ~FLAG~ argument
591
//
592
//   UVM_BIN      - Print / record the field in binary (base-2).
593
//   UVM_DEC      - Print / record the field in decimal (base-10).
594
//   UVM_UNSIGNED - Print / record the field in unsigned decimal (base-10).
595
//   UVM_OCT      - Print / record the field in octal (base-8).
596
//   UVM_HEX      - Print / record the field in hexadecimal (base-16).
597
//   UVM_STRING   - Print / record the field in string format.
598
//   UVM_TIME     - Print / record the field in time format.
599
//
600
//   Radix settings for integral types. Hex is the default radix if none is
601
//   specified.
602
//
603
// A UVM component should ~not~ be specified using the `uvm_field_object macro
604
// unless its flag includes UVM_REFERENCE.  Otherwise, the field macro will
605
// implement deep copy, which is an illegal operation for uvm_components.
606
// You will get a FATAL error if you tried to copy or clone an object containing
607
// a component handle that was registered with a field macro without the
608
// UVM_REFERENCE flag. You will also get duplicate entries when printing
609
// component topology, as this functionality is already provided by UVM.
610
//------------------------------------------------------------------------------
611
 
612
//-----------------------------------------------------------------------------
613
// Group: `uvm_field_* macros
614
//
615
// Macros that implement data operations for scalar properties.
616
//
617
//-----------------------------------------------------------------------------
618
 
619
// MACRO: `uvm_field_int
620
//
621
// Implements the data operations for any packed integral property.
622
//
623
//|  `uvm_field_int(ARG,FLAG)
624
//
625
// ~ARG~ is an integral property of the class, and ~FLAG~ is a bitwise OR of
626
// one or more flag settings as described in  above.
627
 
628
`define uvm_field_int(ARG,FLAG) \
629
  begin \
630
    case (what__) \
631
      UVM_CHECK_FIELDS: \
632
        begin \
633
          __m_uvm_status_container.do_field_check(`"ARG`", this); \
634
        end \
635
      UVM_COPY: \
636
        begin \
637
          if(local_data__ == null) return; \
638
          if(!((FLAG)&UVM_NOCOPY)) ARG = local_data__.ARG; \
639
        end \
640
      UVM_COMPARE: \
641
        begin \
642
          if(local_data__ == null) return; \
643
          if(!((FLAG)&UVM_NOCOMPARE)) begin \
644
            if(ARG !== local_data__.ARG) begin \
645
               void'(__m_uvm_status_container.comparer.compare_field(`"ARG`", ARG, local_data__.ARG, $bits(ARG))); \
646
               if(__m_uvm_status_container.comparer.result && (__m_uvm_status_container.comparer.show_max <= __m_uvm_status_container.comparer.result)) return; \
647
            end \
648
          end \
649
        end \
650
      UVM_PACK: \
651
        if(!((FLAG)&UVM_NOPACK)) begin \
652
          if($bits(ARG) <= 64) __m_uvm_status_container.packer.pack_field_int(ARG, $bits(ARG)); \
653
          else __m_uvm_status_container.packer.pack_field(ARG, $bits(ARG)); \
654
        end \
655
      UVM_UNPACK: \
656
        if(!((FLAG)&UVM_NOPACK)) begin \
657
          if($bits(ARG) <= 64) ARG =  __m_uvm_status_container.packer.unpack_field_int($bits(ARG)); \
658
          else ARG = __m_uvm_status_container.packer.unpack_field($bits(ARG)); \
659
        end \
660
      UVM_RECORD: \
661
        `m_uvm_record_int(ARG, FLAG) \
662
      UVM_PRINT: \
663
        `m_uvm_print_int(ARG, FLAG) \
664
      UVM_SETINT: \
665
        begin \
666
          bit matched; \
667
          __m_uvm_status_container.scope.set_arg(`"ARG`"); \
668
          matched = uvm_is_match(str__, __m_uvm_status_container.scope.get()); \
669
          if(matched) begin \
670
            if((FLAG)&UVM_READONLY) begin \
671
              uvm_report_warning("RDONLY", $sformatf("Readonly argument match %s is ignored",  \
672
                 __m_uvm_status_container.get_full_scope_arg()), UVM_NONE); \
673
            end \
674
            else begin \
675
              if (__m_uvm_status_container.print_matches) \
676
                  uvm_report_info("STRMTC", {"set_int()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg()}, UVM_LOW); \
677
              ARG = uvm_object::__m_uvm_status_container.bitstream; \
678
              uvm_object::__m_uvm_status_container.status = 1; \
679
            end \
680
          end \
681
          __m_uvm_status_container.scope.unset_arg(`"ARG`"); \
682
        end \
683
    endcase \
684
  end
685
 
686
 
687
// MACRO: `uvm_field_object
688
//
689
// Implements the data operations for a -based property.
690
//
691
//|  `uvm_field_object(ARG,FLAG)
692
//
693
// ~ARG~ is an object property of the class, and ~FLAG~ is a bitwise OR of
694
// one or more flag settings as described in  above.
695
 
696
`define uvm_field_object(ARG,FLAG) \
697
  begin \
698
    case (what__) \
699
      UVM_CHECK_FIELDS: \
700
        __m_uvm_status_container.do_field_check(`"ARG`", this); \
701
      UVM_COPY: \
702
        begin \
703
          if(local_data__ == null) return; \
704
          if(!((FLAG)&UVM_NOCOPY)) begin \
705
            if((FLAG)&UVM_REFERENCE || local_data__.ARG == null) ARG = local_data__.ARG; \
706
            else begin \
707
              uvm_object l_obj; \
708
              if(local_data__.ARG.get_name() == "") local_data__.ARG.set_name(`"ARG`"); \
709
              l_obj = local_data__.ARG.clone(); \
710
              if(l_obj == null) begin \
711
                `uvm_fatal("FAILCLN", $sformatf("Failure to clone %s.ARG, thus the variable will remain null.", local_data__.get_name())); \
712
              end \
713
              else begin \
714
                $cast(ARG, l_obj); \
715
                ARG.set_name(local_data__.ARG.get_name()); \
716
              end \
717
            end \
718
          end \
719
        end \
720
      UVM_COMPARE: \
721
        begin \
722
          if(local_data__ == null) return; \
723
          if(!((FLAG)&UVM_NOCOMPARE)) begin \
724
            void'(__m_uvm_status_container.comparer.compare_object(`"ARG`", ARG, local_data__.ARG)); \
725
            if(__m_uvm_status_container.comparer.result && (__m_uvm_status_container.comparer.show_max <= __m_uvm_status_container.comparer.result)) return; \
726
          end \
727
        end \
728
      UVM_PACK: \
729
        if(!((FLAG)&UVM_NOPACK)) begin \
730
          if(((FLAG)&UVM_NOPACK) == 0 && ((FLAG)&UVM_REFERENCE) == 0) \
731
            __m_uvm_status_container.packer.pack_object(ARG); \
732
        end \
733
      UVM_UNPACK: \
734
        if(!((FLAG)&UVM_NOPACK)) begin \
735
          if(((FLAG)&UVM_NOPACK) == 0 && ((FLAG)&UVM_REFERENCE) == 0) \
736
            __m_uvm_status_container.packer.unpack_object(ARG); \
737
        end \
738
      UVM_RECORD: \
739
        `m_uvm_record_object(ARG,FLAG) \
740
      UVM_PRINT: \
741
        begin \
742
          if(!((FLAG)&UVM_NOPRINT)) begin \
743
            if(((FLAG)&UVM_REFERENCE) != 0) \
744
              __m_uvm_status_container.printer.print_object_header(`"ARG`", ARG); \
745
            else \
746
              __m_uvm_status_container.printer.print_object(`"ARG`", ARG); \
747
          end \
748
        end \
749
      UVM_SETINT: \
750
        begin \
751
          if((ARG != null) && (((FLAG)&UVM_READONLY)==0) && (((FLAG)&UVM_REFERENCE)==0)) begin \
752
            __m_uvm_status_container.scope.down(`"ARG`"); \
753
            ARG.__m_uvm_field_automation(null, UVM_SETINT, str__); \
754
            __m_uvm_status_container.scope.up(); \
755
          end \
756
        end \
757
      UVM_SETSTR: \
758
        begin \
759
          if((ARG != null) && (((FLAG)&UVM_READONLY)==0) && (((FLAG)&UVM_REFERENCE)==0)) begin \
760
            __m_uvm_status_container.scope.down(`"ARG`"); \
761
            ARG.__m_uvm_field_automation(null, UVM_SETSTR, str__); \
762
            __m_uvm_status_container.scope.up(); \
763
          end \
764
        end \
765
      UVM_SETOBJ: \
766
        begin \
767
          __m_uvm_status_container.scope.set_arg(`"ARG`"); \
768
          if(uvm_is_match(str__, __m_uvm_status_container.scope.get())) begin \
769
            if((FLAG)&UVM_READONLY) begin \
770
              uvm_report_warning("RDONLY", $sformatf("Readonly argument match %s is ignored",  \
771
                 __m_uvm_status_container.get_full_scope_arg()), UVM_NONE); \
772
            end \
773
            else begin \
774
              if (__m_uvm_status_container.print_matches) \
775
                  uvm_report_info("STRMTC", {"set_object()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg()}, UVM_LOW); \
776
              if($cast(ARG,uvm_object::__m_uvm_status_container.object)) \
777
                uvm_object::__m_uvm_status_container.status = 1; \
778
            end \
779
          end \
780
          else if(ARG!=null && ((FLAG)&UVM_READONLY) == 0) begin \
781
            int cnt; \
782
            //Only traverse if there is a possible match. \
783
            for(cnt=0; cnt
784
              if(str__[cnt] == "." || str__[cnt] == "*") break; \
785
            end \
786
            if(cnt!=str__.len()) begin \
787
              __m_uvm_status_container.scope.down(`"ARG`"); \
788
              ARG.__m_uvm_field_automation(null, UVM_SETOBJ, str__); \
789
              __m_uvm_status_container.scope.up(); \
790
            end \
791
          end \
792
        end \
793
    endcase \
794
  end
795
 
796
 
797
// MACRO: `uvm_field_string
798
//
799
// Implements the data operations for a string property.
800
//
801
//|  `uvm_field_string(ARG,FLAG)
802
//
803
// ~ARG~ is a string property of the class, and ~FLAG~ is a bitwise OR of
804
// one or more flag settings as described in  above.
805
 
806
`define uvm_field_string(ARG,FLAG) \
807
  begin \
808
    case (what__) \
809
      UVM_CHECK_FIELDS: \
810
        __m_uvm_status_container.do_field_check(`"ARG`", this); \
811
      UVM_COPY: \
812
        begin \
813
          if(local_data__ == null) return; \
814
          if(!((FLAG)&UVM_NOCOPY)) ARG = local_data__.ARG; \
815
        end \
816
      UVM_COMPARE: \
817
        begin \
818
          if(local_data__ == null) return; \
819
          if(!((FLAG)&UVM_NOCOMPARE)) begin \
820
            if(ARG != local_data__.ARG) begin \
821
               void'(__m_uvm_status_container.comparer.compare_string(`"ARG`", ARG, local_data__.ARG)); \
822
               if(__m_uvm_status_container.comparer.result && (__m_uvm_status_container.comparer.show_max <= __m_uvm_status_container.comparer.result)) return; \
823
            end \
824
          end \
825
        end \
826
      UVM_PACK: \
827
        if(!((FLAG)&UVM_NOPACK)) begin \
828
          __m_uvm_status_container.packer.pack_string(ARG); \
829
        end \
830
      UVM_UNPACK: \
831
        if(!((FLAG)&UVM_NOPACK)) begin \
832
          ARG = __m_uvm_status_container.packer.unpack_string(); \
833
        end \
834
      UVM_RECORD: \
835
        `m_uvm_record_string(ARG, ARG, FLAG) \
836
      UVM_PRINT: \
837
        if(!((FLAG)&UVM_NOPRINT)) begin \
838
          __m_uvm_status_container.printer.print_string(`"ARG`", ARG); \
839
        end \
840
      UVM_SETSTR: \
841
        begin \
842
          __m_uvm_status_container.scope.set_arg(`"ARG`"); \
843
          if(uvm_is_match(str__, __m_uvm_status_container.scope.get())) begin \
844
            if((FLAG)&UVM_READONLY) begin \
845
              uvm_report_warning("RDONLY", $sformatf("Readonly argument match %s is ignored",  \
846
                 __m_uvm_status_container.get_full_scope_arg()), UVM_NONE); \
847
            end \
848
            else begin \
849
              if (__m_uvm_status_container.print_matches) \
850
                  uvm_report_info("STRMTC", {"set_str()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg()}, UVM_LOW); \
851
              ARG = uvm_object::__m_uvm_status_container.stringv; \
852
              __m_uvm_status_container.status = 1; \
853
            end \
854
          end \
855
      end \
856
    endcase \
857
  end
858
 
859
 
860
// MACRO: `uvm_field_enum
861
//
862
// Implements the data operations for an enumerated property.
863
//
864
//|  `uvm_field_enum(T,ARG,FLAG)
865
//
866
// ~T~ is an enumerated _type_, ~ARG~ is an instance of that type, and
867
// ~FLAG~ is a bitwise OR of one or more flag settings as described in
868
//  above.
869
 
870
`define uvm_field_enum(T,ARG,FLAG) \
871
  begin \
872
    case (what__) \
873
      UVM_CHECK_FIELDS: \
874
        __m_uvm_status_container.do_field_check(`"ARG`", this); \
875
      UVM_COPY: \
876
        begin \
877
          if(local_data__ == null) return; \
878
          if(!((FLAG)&UVM_NOCOPY)) ARG = local_data__.ARG; \
879
        end \
880
      UVM_COMPARE: \
881
        begin \
882
          if(local_data__ == null) return; \
883
          if(!((FLAG)&UVM_NOCOMPARE)) begin \
884
            if(ARG !== local_data__.ARG) begin \
885
               __m_uvm_status_container.scope.set_arg(`"ARG`"); \
886
               $swrite(__m_uvm_status_container.stringv, "lhs = %0s : rhs = %0s", \
887
                 ARG.name(), local_data__.ARG.name()); \
888
               __m_uvm_status_container.comparer.print_msg(__m_uvm_status_container.stringv); \
889
               if(__m_uvm_status_container.comparer.result && (__m_uvm_status_container.comparer.show_max <= __m_uvm_status_container.comparer.result)) return; \
890
            end \
891
          end \
892
        end \
893
      UVM_PACK: \
894
        if(!((FLAG)&UVM_NOPACK)) begin \
895
          __m_uvm_status_container.packer.pack_field(ARG, $bits(ARG)); \
896
        end \
897
      UVM_UNPACK: \
898
        if(!((FLAG)&UVM_NOPACK)) begin \
899
          ARG =  T'(__m_uvm_status_container.packer.unpack_field_int($bits(ARG))); \
900
        end \
901
      UVM_RECORD: \
902
        `m_uvm_record_string(ARG, ARG.name(), FLAG) \
903
      UVM_PRINT: \
904
        if(!((FLAG)&UVM_NOPRINT)) begin \
905
          __m_uvm_status_container.printer.print_generic(`"ARG`", `"T`", $bits(ARG), ARG.name()); \
906
        end \
907
      UVM_SETINT: \
908
        begin \
909
          __m_uvm_status_container.scope.set_arg(`"ARG`"); \
910
          if(uvm_is_match(str__, __m_uvm_status_container.scope.get())) begin \
911
            if((FLAG)&UVM_READONLY) begin \
912
              uvm_report_warning("RDONLY", $sformatf("Readonly argument match %s is ignored",  \
913
                 __m_uvm_status_container.get_full_scope_arg()), UVM_NONE); \
914
            end \
915
            else begin \
916
              if (__m_uvm_status_container.print_matches) \
917
                  uvm_report_info("STRMTC", {"set_int()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg()}, UVM_LOW); \
918
              ARG = T'(uvm_object::__m_uvm_status_container.bitstream); \
919
              __m_uvm_status_container.status = 1; \
920
            end \
921
          end \
922
        end \
923
      UVM_SETSTR: \
924
        begin \
925
          __m_uvm_status_container.scope.set_arg(`"ARG`"); \
926
          if(uvm_is_match(str__, __m_uvm_status_container.scope.get())) begin \
927
            if((FLAG)&UVM_READONLY) begin \
928
              uvm_report_warning("RDONLY", $sformatf("Readonly argument match %s is ignored",  \
929
                 __m_uvm_status_container.get_full_scope_arg()), UVM_NONE); \
930
            end \
931
            else begin \
932
              if (__m_uvm_status_container.print_matches) \
933
                  uvm_report_info("STRMTC", {"set_str()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg()}, UVM_LOW); \
934
              void'(uvm_enum_wrapper#(T)::from_name(uvm_object::__m_uvm_status_container.stringv, ARG)); \
935
              __m_uvm_status_container.status = 1; \
936
            end \
937
          end \
938
      end \
939
    endcase \
940
  end
941
 
942
 
943
// MACRO: `uvm_field_real
944
//
945
// Implements the data operations for any real property.
946
//
947
//|  `uvm_field_real(ARG,FLAG)
948
//
949
// ~ARG~ is an real property of the class, and ~FLAG~ is a bitwise OR of
950
// one or more flag settings as described in  above.
951
 
952
`define uvm_field_real(ARG,FLAG) \
953
  begin \
954
    case (what__) \
955
      UVM_CHECK_FIELDS: \
956
        __m_uvm_status_container.do_field_check(`"ARG`", this); \
957
      UVM_COPY: \
958
        begin \
959
          if(local_data__ == null) return; \
960
          if(!((FLAG)&UVM_NOCOPY)) ARG = local_data__.ARG; \
961
        end \
962
      UVM_COMPARE: \
963
        begin \
964
          if(local_data__ == null) return; \
965
          if(!((FLAG)&UVM_NOCOMPARE)) begin \
966
            if(ARG != local_data__.ARG) begin \
967
               void'(__m_uvm_status_container.comparer.compare_field_real(`"ARG`", ARG, local_data__.ARG)); \
968
               if(__m_uvm_status_container.comparer.result && (__m_uvm_status_container.comparer.show_max <= __m_uvm_status_container.comparer.result)) return; \
969
            end \
970
          end \
971
        end \
972
      UVM_PACK: \
973
        if(!((FLAG)&UVM_NOPACK)) begin \
974
          __m_uvm_status_container.packer.pack_field_int($realtobits(ARG), 64); \
975
        end \
976
      UVM_UNPACK: \
977
        if(!((FLAG)&UVM_NOPACK)) begin \
978
          ARG = $bitstoreal(__m_uvm_status_container.packer.unpack_field_int(64)); \
979
        end \
980
      UVM_RECORD: \
981
        if(!((FLAG)&UVM_NORECORD)) begin \
982
          __m_uvm_status_container.recorder.record_field_real(`"ARG`", ARG); \
983
        end \
984
      UVM_PRINT: \
985
        if(!((FLAG)&UVM_NOPRINT)) begin \
986
          __m_uvm_status_container.printer.print_real(`"ARG`", ARG); \
987
        end \
988
      UVM_SETINT: \
989
        begin \
990
          __m_uvm_status_container.scope.set_arg(`"ARG`"); \
991
          if(uvm_is_match(str__, __m_uvm_status_container.scope.get())) begin \
992
            if((FLAG)&UVM_READONLY) begin \
993
              uvm_report_warning("RDONLY", $sformatf("Readonly argument match %s is ignored",  \
994
                 __m_uvm_status_container.get_full_scope_arg()), UVM_NONE); \
995
            end \
996
            else begin \
997
              if (__m_uvm_status_container.print_matches) \
998
                  uvm_report_info("STRMTC", {"set_int()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg()}, UVM_LOW); \
999
              ARG = $bitstoreal(uvm_object::__m_uvm_status_container.bitstream); \
1000
              __m_uvm_status_container.status = 1; \
1001
            end \
1002
          end \
1003
      end \
1004
    endcase \
1005
  end
1006
 
1007
 
1008
// MACRO: `uvm_field_event
1009
//
1010
// Implements the data operations for an event property.
1011
//
1012
//|  `uvm_field_event(ARG,FLAG)
1013
//
1014
// ~ARG~ is an event property of the class, and ~FLAG~ is a bitwise OR of
1015
// one or more flag settings as described in  above.
1016
 
1017
`define uvm_field_event(ARG,FLAG) \
1018
  begin \
1019
    case (what__) \
1020
      UVM_COPY: \
1021
        begin \
1022
          if(local_data__ == null) return; \
1023
          if(!((FLAG)&UVM_NOCOPY)) ARG = local_data__.ARG; \
1024
        end \
1025
      UVM_COMPARE: \
1026
        begin \
1027
          if(local_data__ == null) return; \
1028
          if(!((FLAG)&UVM_NOCOMPARE)) begin \
1029
            if(ARG != local_data__.ARG) begin \
1030
               __m_uvm_status_container.scope.down(`"ARG`"); \
1031
               __m_uvm_status_container.comparer.print_msg(""); \
1032
               if(__m_uvm_status_container.comparer.result && (__m_uvm_status_container.comparer.show_max <= __m_uvm_status_container.comparer.result)) return; \
1033
            end \
1034
          end \
1035
        end \
1036
      UVM_PACK: \
1037
        if(!((FLAG)&UVM_NOPACK)) begin \
1038
          // Events aren't packed or unpacked  \
1039
        end \
1040
      UVM_UNPACK: \
1041
        if(!((FLAG)&UVM_NOPACK)) begin \
1042
        end \
1043
      UVM_RECORD: \
1044
        begin \
1045
          // Events are not recorded  \
1046
        end \
1047
      UVM_PRINT: \
1048
        if(!((FLAG)&UVM_NOPRINT)) begin \
1049
          __m_uvm_status_container.printer.print_generic(`"ARG`", "event", -1, ""); \
1050
        end \
1051
      UVM_SETINT: \
1052
        begin \
1053
          // Events are not configurable via set_config \
1054
        end \
1055
    endcase \
1056
  end
1057
 
1058
 
1059
//-----------------------------------------------------------------------------
1060
// Group: `uvm_field_sarray_* macros
1061
//
1062
// Macros that implement data operations for one-dimensional static array
1063
// properties.
1064
//-----------------------------------------------------------------------------
1065
 
1066
// MACRO: `uvm_field_sarray_int
1067
//
1068
// Implements the data operations for a one-dimensional static array of
1069
// integrals.
1070
//
1071
//|  `uvm_field_sarray_int(ARG,FLAG)
1072
//
1073
// ~ARG~ is a one-dimensional static array of integrals, and ~FLAG~
1074
// is a bitwise OR of one or more flag settings as described in
1075
//  above.
1076
 
1077
`define uvm_field_sarray_int(ARG,FLAG) \
1078
  begin \
1079
    case (what__) \
1080
      UVM_CHECK_FIELDS: \
1081
        __m_uvm_status_container.do_field_check(`"ARG`", this); \
1082
      UVM_COPY: \
1083
        begin \
1084
          if(local_data__ == null) return; \
1085
          if(!((FLAG)&UVM_NOCOPY)) ARG = local_data__.ARG; \
1086
        end \
1087
      UVM_COMPARE: \
1088
        begin \
1089
          if(local_data__ == null) return; \
1090
          if(!((FLAG)&UVM_NOCOMPARE)) begin \
1091
            if(ARG !== local_data__.ARG) begin \
1092
               if(__m_uvm_status_container.comparer.show_max == 1) begin \
1093
                 __m_uvm_status_container.scope.set_arg(`"ARG`"); \
1094
                 __m_uvm_status_container.comparer.print_msg(""); \
1095
               end \
1096
               else if(__m_uvm_status_container.comparer.show_max) begin \
1097
                 foreach(ARG[i]) begin \
1098
                   if(ARG[i] !== local_data__.ARG[i]) begin \
1099
                     __m_uvm_status_container.scope.set_arg_element(`"ARG`",i); \
1100
                     void'(__m_uvm_status_container.comparer.compare_field("", ARG[i], local_data__.ARG[i], $bits(ARG[i]))); \
1101
                   end \
1102
                 end \
1103
               end \
1104
               else if ((__m_uvm_status_container.comparer.physical&&((FLAG)&UVM_PHYSICAL)) || \
1105
                        (__m_uvm_status_container.comparer.abstract&&((FLAG)&UVM_ABSTRACT)) || \
1106
                        (!((FLAG)&UVM_PHYSICAL) && !((FLAG)&UVM_ABSTRACT)) ) \
1107
                 __m_uvm_status_container.comparer.result++; \
1108
               if(__m_uvm_status_container.comparer.result && (__m_uvm_status_container.comparer.show_max <= __m_uvm_status_container.comparer.result)) return; \
1109
            end \
1110
          end \
1111
        end \
1112
      UVM_PACK: \
1113
        if(!((FLAG)&UVM_NOPACK)) begin \
1114
          foreach(ARG[i])  \
1115
            if($bits(ARG[i]) <= 64) __m_uvm_status_container.packer.pack_field_int(ARG[i], $bits(ARG[i])); \
1116
            else __m_uvm_status_container.packer.pack_field(ARG[i], $bits(ARG[i])); \
1117
        end \
1118
      UVM_UNPACK: \
1119
        if(!((FLAG)&UVM_NOPACK)) begin \
1120
          foreach(ARG[i]) \
1121
            if($bits(ARG[i]) <= 64) ARG[i] = __m_uvm_status_container.packer.unpack_field_int($bits(ARG[i])); \
1122
            else ARG[i] = __m_uvm_status_container.packer.unpack_field($bits(ARG[i])); \
1123
        end \
1124
      UVM_RECORD: \
1125
        `m_uvm_record_qda_int(ARG, FLAG, $size(ARG))  \
1126
      UVM_PRINT: \
1127
        if(!((FLAG)&UVM_NOPRINT)) begin \
1128
          if(((FLAG)&UVM_NOPRINT) == 0) begin \
1129
             `uvm_print_sarray_int3(ARG, uvm_radix_enum'((FLAG)&(UVM_RADIX)), \
1130
                                   __m_uvm_status_container.printer) \
1131
          end \
1132
        end \
1133
      UVM_SETINT: \
1134
        begin \
1135
          __m_uvm_status_container.scope.set_arg(`"ARG`"); \
1136
          if(uvm_is_match(str__, __m_uvm_status_container.scope.get())) begin \
1137
            if((FLAG)&UVM_READONLY) begin \
1138
              uvm_report_warning("RDONLY", $sformatf("Readonly argument match %s is ignored",  \
1139
                 __m_uvm_status_container.get_full_scope_arg()), UVM_NONE); \
1140
            end \
1141
            else begin \
1142
              uvm_report_warning("RDONLY", $sformatf("%s: static arrays cannot be resized via configuraton.",  \
1143
                 __m_uvm_status_container.get_full_scope_arg()), UVM_NONE); \
1144
            end \
1145
          end \
1146
          else if(!((FLAG)&UVM_READONLY)) begin \
1147
            foreach(ARG[i]) begin \
1148
              __m_uvm_status_container.scope.set_arg_element(`"ARG`",i); \
1149
              if(uvm_is_match(str__, __m_uvm_status_container.scope.get())) begin \
1150
                if (__m_uvm_status_container.print_matches) \
1151
                  uvm_report_info("STRMTC", {"set_int()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg()}, UVM_LOW); \
1152
                ARG[i] =  uvm_object::__m_uvm_status_container.bitstream; \
1153
                __m_uvm_status_container.status = 1; \
1154
              end \
1155
            end \
1156
          end \
1157
        end \
1158
    endcase \
1159
  end
1160
 
1161
 
1162
// MACRO: `uvm_field_sarray_object
1163
//
1164
// Implements the data operations for a one-dimensional static array of
1165
// -based objects.
1166
//
1167
//|  `uvm_field_sarray_object(ARG,FLAG)
1168
//
1169
// ~ARG~ is a one-dimensional static array of -based objects,
1170
// and ~FLAG~ is a bitwise OR of one or more flag settings as described in
1171
//  above.
1172
 
1173
`define uvm_field_sarray_object(ARG,FLAG) \
1174
  begin \
1175
    case (what__) \
1176
      UVM_CHECK_FIELDS: \
1177
        __m_uvm_status_container.do_field_check(`"ARG`", this); \
1178
      UVM_COPY: \
1179
        begin \
1180
          if(local_data__ == null) return; \
1181
          if(!((FLAG)&UVM_NOCOPY)) begin \
1182
            if(((FLAG)&UVM_REFERENCE)) \
1183
              ARG = local_data__.ARG; \
1184
            else \
1185
              foreach(ARG[i]) begin \
1186
                if(ARG[i] != null && local_data__.ARG[i] != null) \
1187
                  ARG[i].copy(local_data__.ARG[i]); \
1188
                else if(ARG[i] == null && local_data__.ARG[i] != null) \
1189
                  $cast(ARG[i], local_data__.ARG[i].clone()); \
1190
                else \
1191
                  ARG[i] = null; \
1192
              end \
1193
          end \
1194
        end \
1195
      UVM_COMPARE: \
1196
        begin \
1197
          if(local_data__ == null) return; \
1198
          if(!((FLAG)&UVM_NOCOMPARE)) begin \
1199
            if(((FLAG)&UVM_REFERENCE) && (__m_uvm_status_container.comparer.show_max <= 1) && (ARG !== local_data__.ARG) ) begin \
1200
               if(__m_uvm_status_container.comparer.show_max == 1) begin \
1201
                 __m_uvm_status_container.scope.set_arg(`"ARG`"); \
1202
                 __m_uvm_status_container.comparer.print_msg(""); \
1203
               end \
1204
               else if ((__m_uvm_status_container.comparer.physical&&((FLAG)&UVM_PHYSICAL)) || \
1205
                        (__m_uvm_status_container.comparer.abstract&&((FLAG)&UVM_ABSTRACT)) || \
1206
                        (!((FLAG)&UVM_PHYSICAL) && !((FLAG)&UVM_ABSTRACT)) ) \
1207
                 __m_uvm_status_container.comparer.result++; \
1208
               if(__m_uvm_status_container.comparer.result && (__m_uvm_status_container.comparer.show_max <= __m_uvm_status_container.comparer.result)) return; \
1209
            end \
1210
            else begin \
1211
              string s; \
1212
              foreach(ARG[i]) begin \
1213
                if(ARG[i] != null && local_data__.ARG[i] != null) begin \
1214
                  $swrite(s,`"ARG[%0d]`",i); \
1215
                  void'(__m_uvm_status_container.comparer.compare_object(s, ARG[i], local_data__.ARG[i])); \
1216
                end \
1217
                if(__m_uvm_status_container.comparer.result && (__m_uvm_status_container.comparer.show_max <= __m_uvm_status_container.comparer.result)) return; \
1218
              end \
1219
            end \
1220
          end \
1221
        end \
1222
      UVM_PACK: \
1223
        if(!((FLAG)&UVM_NOPACK)) begin \
1224
          foreach(ARG[i])  \
1225
            __m_uvm_status_container.packer.pack_object(ARG[i]); \
1226
        end \
1227
      UVM_UNPACK: \
1228
        if(!((FLAG)&UVM_NOPACK)) begin \
1229
          foreach(ARG[i]) \
1230
            __m_uvm_status_container.packer.unpack_object(ARG[i]); \
1231
        end \
1232
      UVM_RECORD: \
1233
        `m_uvm_record_qda_object(ARG,FLAG,$size(ARG)) \
1234
      UVM_PRINT: \
1235
        begin \
1236
          if(((FLAG)&UVM_NOPRINT) == 0) begin \
1237
             `uvm_print_sarray_object3(ARG, __m_uvm_status_container.printer, FLAG) \
1238
          end \
1239
        end \
1240
      UVM_SETINT: \
1241
        begin \
1242
          string s; \
1243
          if(!((FLAG)&UVM_READONLY)) begin \
1244
            foreach(ARG[i]) begin \
1245
              $swrite(s,`"ARG[%0d]`",i); \
1246
              __m_uvm_status_container.scope.set_arg(s); \
1247
              if(uvm_is_match(str__, __m_uvm_status_container.scope.get())) begin \
1248
                if (__m_uvm_status_container.print_matches) \
1249
                  uvm_report_info("STRMTC", {"set_object()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg()}, UVM_LOW); \
1250
                if($cast(ARG[i],uvm_object::__m_uvm_status_container.object)) \
1251
                  uvm_object::__m_uvm_status_container.status = 1; \
1252
              end \
1253
              else if(ARG[i]!=null && !((FLAG)&UVM_REFERENCE)) begin \
1254
                int cnt; \
1255
                //Only traverse if there is a possible match. \
1256
                for(cnt=0; cnt
1257
                  if(str__[cnt] == "." || str__[cnt] == "*") break; \
1258
                end \
1259
                if(cnt!=str__.len()) begin \
1260
                  __m_uvm_status_container.scope.down(s); \
1261
                  ARG[i].__m_uvm_field_automation(null, UVM_SETINT, str__); \
1262
                  __m_uvm_status_container.scope.up(); \
1263
                end \
1264
              end \
1265
            end \
1266
          end \
1267
        end \
1268
      UVM_SETSTR: \
1269
        begin \
1270
          string s; \
1271
          if(!((FLAG)&UVM_READONLY)) begin \
1272
            foreach(ARG[i]) begin \
1273
              $swrite(s,`"ARG[%0d]`",i); \
1274
              __m_uvm_status_container.scope.set_arg(s); \
1275
              if(uvm_is_match(str__, __m_uvm_status_container.scope.get())) begin \
1276
                if (__m_uvm_status_container.print_matches) \
1277
                  uvm_report_info("STRMTC", {"set_object()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg()}, UVM_LOW); \
1278
                if($cast(ARG[i],uvm_object::__m_uvm_status_container.object)) \
1279
                  uvm_object::__m_uvm_status_container.status = 1; \
1280
              end \
1281
              else if(ARG[i]!=null && !((FLAG)&UVM_REFERENCE)) begin \
1282
                int cnt; \
1283
                //Only traverse if there is a possible match. \
1284
                for(cnt=0; cnt
1285
                  if(str__[cnt] == "." || str__[cnt] == "*") break; \
1286
                end \
1287
                if(cnt!=str__.len()) begin \
1288
                  __m_uvm_status_container.scope.down(s); \
1289
                  ARG[i].__m_uvm_field_automation(null, UVM_SETSTR, str__); \
1290
                  __m_uvm_status_container.scope.up(); \
1291
                end \
1292
              end \
1293
            end \
1294
          end \
1295
        end \
1296
      UVM_SETOBJ: \
1297
        begin \
1298
          string s; \
1299
          if(!((FLAG)&UVM_READONLY)) begin \
1300
            foreach(ARG[i]) begin \
1301
              $swrite(s,`"ARG[%0d]`",i); \
1302
              __m_uvm_status_container.scope.set_arg(s); \
1303
              if(uvm_is_match(str__, __m_uvm_status_container.scope.get())) begin \
1304
                if (__m_uvm_status_container.print_matches) \
1305
                  uvm_report_info("STRMTC", {"set_object()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg()}, UVM_LOW); \
1306
                if($cast(ARG[i],uvm_object::__m_uvm_status_container.object)) \
1307
                  uvm_object::__m_uvm_status_container.status = 1; \
1308
              end \
1309
              else if(ARG[i]!=null && !((FLAG)&UVM_REFERENCE)) begin \
1310
                int cnt; \
1311
                //Only traverse if there is a possible match. \
1312
                for(cnt=0; cnt
1313
                  if(str__[cnt] == "." || str__[cnt] == "*") break; \
1314
                end \
1315
                if(cnt!=str__.len()) begin \
1316
                  __m_uvm_status_container.scope.down(s); \
1317
                  ARG[i].__m_uvm_field_automation(null, UVM_SETOBJ, str__); \
1318
                  __m_uvm_status_container.scope.up(); \
1319
                end \
1320
              end \
1321
            end \
1322
          end \
1323
        end \
1324
    endcase \
1325
  end
1326
 
1327
 
1328
// MACRO: `uvm_field_sarray_string
1329
//
1330
// Implements the data operations for a one-dimensional static array of
1331
// strings.
1332
//
1333
//|  `uvm_field_sarray_string(ARG,FLAG)
1334
//
1335
// ~ARG~ is a one-dimensional static array of strings, and ~FLAG~ is a bitwise
1336
// OR of one or more flag settings as described in  above.
1337
 
1338
`define uvm_field_sarray_string(ARG,FLAG) \
1339
  begin \
1340
    case (what__) \
1341
      UVM_CHECK_FIELDS: \
1342
        __m_uvm_status_container.do_field_check(`"ARG`", this); \
1343
      UVM_COPY: \
1344
        begin \
1345
          if(local_data__ == null) return; \
1346
          if(!((FLAG)&UVM_NOCOPY)) ARG = local_data__.ARG; \
1347
        end \
1348
      UVM_COMPARE: \
1349
        begin \
1350
          if(local_data__ == null) return; \
1351
          if(!((FLAG)&UVM_NOCOMPARE)) begin \
1352
            if(ARG != local_data__.ARG) begin \
1353
               if(__m_uvm_status_container.comparer.show_max == 1) begin \
1354
                 __m_uvm_status_container.scope.set_arg(`"ARG`"); \
1355
                 __m_uvm_status_container.comparer.print_msg(""); \
1356
               end \
1357
               else if(__m_uvm_status_container.comparer.show_max) begin \
1358
                 foreach(ARG[i]) begin \
1359
                   if(ARG[i] != local_data__.ARG[i]) begin \
1360
                     __m_uvm_status_container.scope.set_arg_element(`"ARG`",i); \
1361
                     void'(__m_uvm_status_container.comparer.compare_string("", ARG[i], local_data__.ARG[i])); \
1362
                   end \
1363
                 end \
1364
               end \
1365
               else if ((__m_uvm_status_container.comparer.physical&&((FLAG)&UVM_PHYSICAL)) || \
1366
                        (__m_uvm_status_container.comparer.abstract&&((FLAG)&UVM_ABSTRACT)) || \
1367
                        (!((FLAG)&UVM_PHYSICAL) && !((FLAG)&UVM_ABSTRACT)) ) \
1368
                 __m_uvm_status_container.comparer.result++; \
1369
               if(__m_uvm_status_container.comparer.result && (__m_uvm_status_container.comparer.show_max <= __m_uvm_status_container.comparer.result)) return; \
1370
            end \
1371
          end \
1372
        end \
1373
      UVM_PACK: \
1374
        if(!((FLAG)&UVM_NOPACK)) begin \
1375
          foreach(ARG[i])  \
1376
            __m_uvm_status_container.packer.pack_string(ARG[i]); \
1377
        end \
1378
      UVM_UNPACK: \
1379
        if(!((FLAG)&UVM_NOPACK)) begin \
1380
          foreach(ARG[i]) \
1381
            ARG[i] = __m_uvm_status_container.packer.unpack_string(); \
1382
        end \
1383
      UVM_RECORD: \
1384
        begin \
1385
          /* Issue with $size for sarray with strings */ \
1386
          int sz; foreach(ARG[i]) sz=i; \
1387
          `m_uvm_record_qda_string(ARG, FLAG, sz) \
1388
        end \
1389
      UVM_PRINT: \
1390
        begin \
1391
          if(((FLAG)&UVM_NOPRINT) == 0) begin \
1392
             `uvm_print_sarray_string2(ARG, __m_uvm_status_container.printer) \
1393
          end \
1394
        end \
1395
      UVM_SETSTR: \
1396
        begin \
1397
          __m_uvm_status_container.scope.set_arg(`"ARG`"); \
1398
          if(uvm_is_match(str__, __m_uvm_status_container.scope.get())) begin \
1399
            if((FLAG)&UVM_READONLY) begin \
1400
              uvm_report_warning("RDONLY", $sformatf("Readonly argument match %s is ignored",  \
1401
                 __m_uvm_status_container.get_full_scope_arg()), UVM_NONE); \
1402
            end \
1403
            else begin \
1404
              uvm_report_warning("RDONLY", {__m_uvm_status_container.get_full_scope_arg(), \
1405
              ": static arrays cannot be resized via configuraton."}, UVM_NONE); \
1406
            end \
1407
          end \
1408
          else if(!((FLAG)&UVM_READONLY)) begin \
1409
            foreach(ARG[i]) begin \
1410
              __m_uvm_status_container.scope.set_arg_element(`"ARG`",i); \
1411
              if(uvm_is_match(str__, __m_uvm_status_container.scope.get())) begin \
1412
                if (__m_uvm_status_container.print_matches) \
1413
                  uvm_report_info("STRMTC", {"set_int()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg()}, UVM_LOW); \
1414
                ARG[i] =  uvm_object::__m_uvm_status_container.stringv; \
1415
                __m_uvm_status_container.status = 1; \
1416
              end \
1417
            end \
1418
          end \
1419
        end \
1420
    endcase \
1421
  end
1422
 
1423
 
1424
// MACRO: `uvm_field_sarray_enum
1425
//
1426
// Implements the data operations for a one-dimensional static array of
1427
// enums.
1428
//
1429
//|  `uvm_field_sarray_enum(T,ARG,FLAG)
1430
//
1431
// ~T~ is a one-dimensional dynamic array of enums _type_, ~ARG~ is an
1432
// instance of that type, and ~FLAG~ is a bitwise OR of one or more flag
1433
// settings as described in  above.
1434
 
1435
`define uvm_field_sarray_enum(T,ARG,FLAG) \
1436
  begin \
1437
    case (what__) \
1438
      UVM_CHECK_FIELDS: \
1439
        __m_uvm_status_container.do_field_check(`"ARG`", this); \
1440
      UVM_COPY: \
1441
        begin \
1442
          if(local_data__ == null) return; \
1443
          if(!((FLAG)&UVM_NOCOPY)) ARG = local_data__.ARG; \
1444
        end \
1445
      UVM_COMPARE: \
1446
        begin \
1447
          if(local_data__ == null) return; \
1448
          if(!((FLAG)&UVM_NOCOMPARE)) begin \
1449
            if(ARG !== local_data__.ARG) begin \
1450
               if(__m_uvm_status_container.comparer.show_max == 1) begin \
1451
                 __m_uvm_status_container.scope.set_arg(`"ARG`"); \
1452
                 __m_uvm_status_container.comparer.print_msg(""); \
1453
               end \
1454
               else if(__m_uvm_status_container.comparer.show_max) begin \
1455
                 foreach(ARG[i]) begin \
1456
                   if(ARG[i] !== local_data__.ARG[i]) begin \
1457
                     __m_uvm_status_container.scope.set_arg_element(`"ARG`",i); \
1458
                     $swrite(__m_uvm_status_container.stringv, "lhs = %0s : rhs = %0s", \
1459
                       ARG[i].name(), local_data__.ARG[i].name()); \
1460
                     __m_uvm_status_container.comparer.print_msg(__m_uvm_status_container.stringv); \
1461
                     if(__m_uvm_status_container.comparer.result && (__m_uvm_status_container.comparer.show_max <= __m_uvm_status_container.comparer.result)) return; \
1462
                   end \
1463
                 end \
1464
               end \
1465
               else if ((__m_uvm_status_container.comparer.physical&&((FLAG)&UVM_PHYSICAL)) || \
1466
                        (__m_uvm_status_container.comparer.abstract&&((FLAG)&UVM_ABSTRACT)) || \
1467
                        (!((FLAG)&UVM_PHYSICAL) && !((FLAG)&UVM_ABSTRACT)) ) \
1468
                 __m_uvm_status_container.comparer.result++; \
1469
               if(__m_uvm_status_container.comparer.result && (__m_uvm_status_container.comparer.show_max <= __m_uvm_status_container.comparer.result)) return; \
1470
            end \
1471
          end \
1472
        end \
1473
      UVM_PACK: \
1474
        if(!((FLAG)&UVM_NOPACK)) begin \
1475
          foreach(ARG[i])  \
1476
            __m_uvm_status_container.packer.pack_field_int(int'(ARG[i]), $bits(ARG[i])); \
1477
        end \
1478
      UVM_UNPACK: \
1479
        if(!((FLAG)&UVM_NOPACK)) begin \
1480
          foreach(ARG[i]) \
1481
            ARG[i] = T'(__m_uvm_status_container.packer.unpack_field_int($bits(ARG[i]))); \
1482
        end \
1483
      UVM_RECORD: \
1484
        `m_uvm_record_qda_enum(ARG, FLAG, $size(ARG)) \
1485
      UVM_PRINT: \
1486
        begin \
1487
          if(((FLAG)&UVM_NOPRINT) == 0) begin \
1488
             `uvm_print_qda_enum(ARG, __m_uvm_status_container.printer, array, T) \
1489
          end \
1490
        end \
1491
      UVM_SETINT: \
1492
        begin \
1493
          __m_uvm_status_container.scope.set_arg(`"ARG`"); \
1494
          if(uvm_is_match(str__, __m_uvm_status_container.scope.get())) begin \
1495
            if((FLAG)&UVM_READONLY) begin \
1496
              uvm_report_warning("RDONLY", $sformatf("Readonly argument match %s is ignored",  \
1497
                 __m_uvm_status_container.get_full_scope_arg()), UVM_NONE); \
1498
            end \
1499
            else begin \
1500
              uvm_report_warning("RDONLY", $sformatf("%s: static arrays cannot be resized via configuraton.",  \
1501
                 __m_uvm_status_container.get_full_scope_arg()), UVM_NONE); \
1502
            end \
1503
          end \
1504
          else if(!((FLAG)&UVM_READONLY)) begin \
1505
            foreach(ARG[i]) begin \
1506
              __m_uvm_status_container.scope.set_arg_element(`"ARG`",i); \
1507
              if(uvm_is_match(str__, __m_uvm_status_container.scope.get())) begin \
1508
                if (__m_uvm_status_container.print_matches) \
1509
                  uvm_report_info("STRMTC", {"set_int()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg()}, UVM_LOW); \
1510
                ARG[i] =  T'(uvm_object::__m_uvm_status_container.bitstream); \
1511
                __m_uvm_status_container.status = 1; \
1512
              end \
1513
            end \
1514
          end \
1515
        end \
1516
      UVM_SETSTR: \
1517
        begin \
1518
          __m_uvm_status_container.scope.set_arg(`"ARG`"); \
1519
          if(uvm_is_match(str__, __m_uvm_status_container.scope.get())) begin \
1520
            if((FLAG)&UVM_READONLY) begin \
1521
              uvm_report_warning("RDONLY", $sformatf("Readonly argument match %s is ignored",  \
1522
                 __m_uvm_status_container.get_full_scope_arg()), UVM_NONE); \
1523
            end \
1524
            else begin \
1525
              uvm_report_warning("RDONLY", {__m_uvm_status_container.get_full_scope_arg(), \
1526
              ": static arrays cannot be resized via configuraton."}, UVM_NONE); \
1527
            end \
1528
          end \
1529
          else if(!((FLAG)&UVM_READONLY)) begin \
1530
            foreach(ARG[i]) begin \
1531
              __m_uvm_status_container.scope.set_arg_element(`"ARG`",i); \
1532
              if(uvm_is_match(str__, __m_uvm_status_container.scope.get())) begin \
1533
                      T t__;  \
1534
                if (__m_uvm_status_container.print_matches) \
1535
                  uvm_report_info("STRMTC", {"set_int()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg()}, UVM_LOW); \
1536
                void'(uvm_enum_wrapper#(T)::from_name(uvm_object::__m_uvm_status_container.stringv, t__)); ARG[i]=t__;\
1537
                __m_uvm_status_container.status = 1; \
1538
              end \
1539
            end \
1540
          end \
1541
        end \
1542
    endcase \
1543
  end
1544
 
1545
 
1546
 
1547
//-----------------------------------------------------------------------------
1548
// Group: `uvm_field_array_* macros
1549
//
1550
// Macros that implement data operations for one-dimensional dynamic array
1551
// properties.
1552
//
1553
// Implementation note:
1554
// lines flagged with empty multi-line comments, /**/, are not needed or need
1555
// to be different for fixed arrays, which cannot be resized. Fixed arrays
1556
// do not need to pack/unpack their size either, because their size is known;
1557
// wouldn't hurt though if it allowed code consolidation. Unpacking would
1558
// necessarily be different. */
1559
//
1560
//-----------------------------------------------------------------------------
1561
 
1562
// M_UVM_QUEUE_RESIZE
1563
// ------------------
1564
 
1565
`define M_UVM_QUEUE_RESIZE(ARG,VAL) \
1566
  while(ARG.size()
1567
  while(ARG.size()>sz) void'(ARG.pop_front()); \
1568
 
1569
 
1570
// M_UVM_ARRAY_RESIZE
1571
// ------------------
1572
 
1573
`define M_UVM_ARRAY_RESIZE(ARG,VAL) \
1574
  ARG = new[sz](ARG); \
1575
 
1576
 
1577
// M_UVM_SARRAY_RESIZE
1578
// -------------------
1579
 
1580
`define M_UVM_SARRAY_RESIZE(ARG,VAL) \
1581
  /* fixed arrays cannot be resized; do nothing */
1582
 
1583
 
1584
// M_UVM_FIELD_QDA_INT
1585
// -------------------
1586
 
1587
`define M_UVM_FIELD_QDA_INT(TYPE,ARG,FLAG) \
1588
  begin \
1589
    case (what__) \
1590
      UVM_CHECK_FIELDS: \
1591
        __m_uvm_status_container.do_field_check(`"ARG`", this); \
1592
      UVM_COPY: \
1593
        begin \
1594
          if (local_data__ == null) return; \
1595
          if(!((FLAG)&UVM_NOCOPY)) ARG = local_data__.ARG; \
1596
        end \
1597
      UVM_COMPARE: \
1598
        begin \
1599
          if (local_data__ == null) return; \
1600
          if(!((FLAG)&UVM_NOCOMPARE)) begin \
1601
            if(ARG !== local_data__.ARG) begin \
1602
               if(__m_uvm_status_container.comparer.show_max == 1) begin \
1603
                 __m_uvm_status_container.scope.set_arg(`"ARG`"); \
1604
                 __m_uvm_status_container.comparer.print_msg(""); \
1605
               end \
1606
               else if(__m_uvm_status_container.comparer.show_max) begin \
1607
                 /**/ if(ARG.size() != local_data__.ARG.size()) begin \
1608
                 /**/   void'(__m_uvm_status_container.comparer.compare_field(`"ARG``.size`", ARG.size(), local_data__.ARG.size(), 32)); \
1609
                 /**/ end \
1610
                 else begin \
1611
                   foreach(ARG[i]) begin \
1612
                     if(ARG[i] !== local_data__.ARG[i]) begin \
1613
                       __m_uvm_status_container.scope.set_arg_element(`"ARG`",i); \
1614
                       void'(__m_uvm_status_container.comparer.compare_field("", ARG[i], local_data__.ARG[i], $bits(ARG[i]))); \
1615
                     end \
1616
                   end \
1617
                 end \
1618
               end \
1619
               else if ((__m_uvm_status_container.comparer.physical&&((FLAG)&UVM_PHYSICAL)) || \
1620
                        (__m_uvm_status_container.comparer.abstract&&((FLAG)&UVM_ABSTRACT)) || \
1621
                        (!((FLAG)&UVM_PHYSICAL) && !((FLAG)&UVM_ABSTRACT)) ) \
1622
                 __m_uvm_status_container.comparer.result++; \
1623
               if(__m_uvm_status_container.comparer.result && (__m_uvm_status_container.comparer.show_max <= __m_uvm_status_container.comparer.result)) return; \
1624
            end \
1625
          end \
1626
        end \
1627
      UVM_PACK: \
1628
        if(!((FLAG)&UVM_NOPACK)) begin \
1629
          /**/ if(__m_uvm_status_container.packer.use_metadata) __m_uvm_status_container.packer.pack_field_int(ARG.size(), 32); \
1630
          foreach(ARG[i])  \
1631
            if($bits(ARG[i]) <= 64) __m_uvm_status_container.packer.pack_field_int(ARG[i], $bits(ARG[i])); \
1632
            else __m_uvm_status_container.packer.pack_field(ARG[i], $bits(ARG[i])); \
1633
        end \
1634
      UVM_UNPACK: \
1635
        if(!((FLAG)&UVM_NOPACK)) begin \
1636
          /**/ int sz = ARG.size(); \
1637
          /**/ if(__m_uvm_status_container.packer.use_metadata) sz = __m_uvm_status_container.packer.unpack_field_int(32); \
1638
          if(sz != ARG.size()) begin \
1639
          `M_UVM_``TYPE``_RESIZE (ARG,0) \
1640
          end \
1641
          foreach(ARG[i]) \
1642
            if($bits(ARG[i]) <= 64) ARG[i] = __m_uvm_status_container.packer.unpack_field_int($bits(ARG[i])); \
1643
            else ARG[i] = __m_uvm_status_container.packer.unpack_field($bits(ARG[i])); \
1644
        end \
1645
      UVM_RECORD: \
1646
        `m_uvm_record_qda_int(ARG, FLAG, ARG.size()) \
1647
      UVM_PRINT: \
1648
        begin \
1649
          if(((FLAG)&UVM_NOPRINT) == 0) begin \
1650
             `uvm_print_array_int3(ARG, uvm_radix_enum'((FLAG)&(UVM_RADIX)), \
1651
                                   __m_uvm_status_container.printer) \
1652
          end \
1653
        end \
1654
      UVM_SETINT: \
1655
        begin \
1656
          __m_uvm_status_container.scope.set_arg(`"ARG`"); \
1657
          if(uvm_is_match(str__, __m_uvm_status_container.scope.get())) begin \
1658
            if((FLAG)&UVM_READONLY) begin \
1659
              uvm_report_warning("RDONLY", $sformatf("Readonly argument match %s is ignored",  \
1660
                 __m_uvm_status_container.get_full_scope_arg()), UVM_NONE); \
1661
            end \
1662
            /**/ else begin \
1663
            /**/   int sz =  uvm_object::__m_uvm_status_container.bitstream; \
1664
            /**/   if (__m_uvm_status_container.print_matches) \
1665
                  uvm_report_info("STRMTC", {"set_int()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg()}, UVM_LOW); \
1666
            /**/   if(ARG.size() !=  sz) begin \
1667
            /**/     `M_UVM_``TYPE``_RESIZE(ARG,0) \
1668
            /**/   end \
1669
            /**/   __m_uvm_status_container.status = 1; \
1670
            /**/ end \
1671
          end \
1672
          else if(!((FLAG)&UVM_READONLY)) begin \
1673
            bit wildcard_index__; \
1674
            int index__; \
1675
            index__ = uvm_get_array_index_int(str__, wildcard_index__); \
1676
            if(uvm_is_array(str__)  && (index__ != -1)) begin\
1677
              if(wildcard_index__) begin \
1678
                for(index__=0; index__
1679
                  if(uvm_is_match(str__, {__m_uvm_status_container.scope.get_arg(),$sformatf("[%0d]", index__)})) begin \
1680
                    if (__m_uvm_status_container.print_matches) \
1681
                      uvm_report_info("STRMTC", {"set_int()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg(), $sformatf("[%0d]",index__)}, UVM_LOW); \
1682
                    ARG[index__] = uvm_object::__m_uvm_status_container.bitstream; \
1683
                    __m_uvm_status_container.status = 1; \
1684
                  end \
1685
                end \
1686
              end \
1687
              else if(uvm_is_match(str__, {__m_uvm_status_container.scope.get_arg(),$sformatf("[%0d]", index__)})) begin \
1688
                if(index__+1 > ARG.size()) begin \
1689
                  int sz = index__; \
1690
                  int tmp__; \
1691
                  `M_UVM_``TYPE``_RESIZE(ARG,tmp__) \
1692
                end \
1693
                if (__m_uvm_status_container.print_matches) \
1694
                  uvm_report_info("STRMTC", {"set_int()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg()}, UVM_LOW); \
1695
                ARG[index__] =  uvm_object::__m_uvm_status_container.bitstream; \
1696
                __m_uvm_status_container.status = 1; \
1697
              end \
1698
            end \
1699
          end \
1700
        end \
1701
    endcase \
1702
  end
1703
 
1704
 
1705
// MACRO: `uvm_field_array_int
1706
//
1707
// Implements the data operations for a one-dimensional dynamic array of
1708
// integrals.
1709
//
1710
//|  `uvm_field_array_int(ARG,FLAG)
1711
//
1712
// ~ARG~ is a one-dimensional dynamic array of integrals,
1713
// and ~FLAG~ is a bitwise OR of one or more flag settings as described in
1714
//  above.
1715
 
1716
`define uvm_field_array_int(ARG,FLAG) \
1717
   `M_UVM_FIELD_QDA_INT(ARRAY,ARG,FLAG)
1718
 
1719
 
1720
// MACRO: `uvm_field_array_object
1721
//
1722
// Implements the data operations for a one-dimensional dynamic array
1723
// of -based objects.
1724
//
1725
//|  `uvm_field_array_object(ARG,FLAG)
1726
//
1727
// ~ARG~ is a one-dimensional dynamic array of -based objects,
1728
// and ~FLAG~ is a bitwise OR of one or more flag settings as described in
1729
//  above.
1730
 
1731
`define uvm_field_array_object(ARG,FLAG) \
1732
  `M_UVM_FIELD_QDA_OBJECT(ARRAY,ARG,FLAG)
1733
 
1734
`define M_UVM_FIELD_QDA_OBJECT(TYPE,ARG,FLAG) \
1735
  begin \
1736
    case (what__) \
1737
      UVM_CHECK_FIELDS: \
1738
        __m_uvm_status_container.do_field_check(`"ARG`", this); \
1739
      UVM_COPY: \
1740
        begin \
1741
          if(local_data__ == null) return; \
1742
          if(!((FLAG)&UVM_NOCOPY)) begin \
1743
            if(((FLAG)&UVM_REFERENCE)) \
1744
              ARG = local_data__.ARG; \
1745
            else begin \
1746
              int sz = local_data__.ARG.size(); \
1747
              `M_UVM_``TYPE``_RESIZE(ARG,null) \
1748
              foreach(ARG[i]) begin \
1749
                if(ARG[i] != null && local_data__.ARG[i] != null) \
1750
                  ARG[i].copy(local_data__.ARG[i]); \
1751
                else if(ARG[i] == null && local_data__.ARG[i] != null) \
1752
                  $cast(ARG[i], local_data__.ARG[i].clone()); \
1753
                else \
1754
                  ARG[i] = null; \
1755
              end \
1756
            end \
1757
          end \
1758
        end \
1759
      UVM_COMPARE: \
1760
        begin \
1761
          if(local_data__ == null) return; \
1762
          if(!((FLAG)&UVM_NOCOMPARE)) begin \
1763
            if(((FLAG)&UVM_REFERENCE) && (__m_uvm_status_container.comparer.show_max <= 1) && (ARG !== local_data__.ARG) ) begin \
1764
               if(__m_uvm_status_container.comparer.show_max == 1) begin \
1765
                 __m_uvm_status_container.scope.set_arg(`"ARG`"); \
1766
                 __m_uvm_status_container.comparer.print_msg(""); \
1767
               end \
1768
               else if ((__m_uvm_status_container.comparer.physical&&((FLAG)&UVM_PHYSICAL)) || \
1769
                        (__m_uvm_status_container.comparer.abstract&&((FLAG)&UVM_ABSTRACT)) || \
1770
                        (!((FLAG)&UVM_PHYSICAL) && !((FLAG)&UVM_ABSTRACT)) ) \
1771
                 __m_uvm_status_container.comparer.result++; \
1772
               if(__m_uvm_status_container.comparer.result && (__m_uvm_status_container.comparer.show_max <= __m_uvm_status_container.comparer.result)) return; \
1773
            end \
1774
            else begin \
1775
              string s; \
1776
              if(ARG.size() != local_data__.ARG.size()) begin \
1777
                __m_uvm_status_container.scope.set_arg(`"ARG`"); \
1778
                __m_uvm_status_container.comparer.print_msg($sformatf("size mismatch: lhs: %0d  rhs: %0d", ARG.size(), local_data__.ARG.size())); \
1779
                if(__m_uvm_status_container.comparer.show_max == 1) return; \
1780
              end \
1781
              for(int i=0; i
1782
                if(ARG[i] != null && local_data__.ARG[i] != null) begin \
1783
                  $swrite(s,`"ARG[%0d]`",i); \
1784
                  void'(__m_uvm_status_container.comparer.compare_object(s, ARG[i], local_data__.ARG[i])); \
1785
                end \
1786
                if(__m_uvm_status_container.comparer.result && (__m_uvm_status_container.comparer.show_max <= __m_uvm_status_container.comparer.result)) return; \
1787
              end \
1788
            end \
1789
          end \
1790
        end \
1791
      UVM_PACK: \
1792
        if(!((FLAG)&UVM_NOPACK)) begin \
1793
          if(__m_uvm_status_container.packer.use_metadata) __m_uvm_status_container.packer.pack_field_int(ARG.size(), 32); \
1794
          foreach(ARG[i])  \
1795
            __m_uvm_status_container.packer.pack_object(ARG[i]); \
1796
        end \
1797
      UVM_UNPACK: \
1798
        if(!((FLAG)&UVM_NOPACK)) begin \
1799
          int sz = ARG.size(); \
1800
          if(__m_uvm_status_container.packer.use_metadata) sz = __m_uvm_status_container.packer.unpack_field_int(32); \
1801
          if(sz != ARG.size()) begin \
1802
            `M_UVM_``TYPE``_RESIZE(ARG,null) \
1803
          end \
1804
          foreach(ARG[i]) \
1805
            __m_uvm_status_container.packer.unpack_object(ARG[i]); \
1806
        end \
1807
      UVM_RECORD: \
1808
        `m_uvm_record_qda_object(ARG,FLAG,ARG.size()) \
1809
      UVM_PRINT: \
1810
        begin \
1811
          if(((FLAG)&UVM_NOPRINT) == 0) begin \
1812
             `uvm_print_array_object3(ARG, __m_uvm_status_container.printer,FLAG) \
1813
          end \
1814
        end \
1815
      UVM_SETINT: \
1816
        begin \
1817
          __m_uvm_status_container.scope.set_arg(`"ARG`"); \
1818
          if(uvm_is_match(str__, __m_uvm_status_container.scope.get())) begin \
1819
            if((FLAG)&UVM_READONLY) begin \
1820
              uvm_report_warning("RDONLY", $sformatf("Readonly argument match %s is ignored",  \
1821
                 __m_uvm_status_container.get_full_scope_arg()), UVM_NONE); \
1822
            end \
1823
            else begin \
1824
              int sz =  uvm_object::__m_uvm_status_container.bitstream; \
1825
              if (__m_uvm_status_container.print_matches) \
1826
                  uvm_report_info("STRMTC", {"set_int()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg()}, UVM_LOW); \
1827
              if(ARG.size() !=  sz) begin \
1828
                `M_UVM_``TYPE``_RESIZE(ARG,null) \
1829
              end \
1830
              __m_uvm_status_container.status = 1; \
1831
            end \
1832
          end \
1833
          else if(!((FLAG)&UVM_READONLY)) begin \
1834
            foreach(ARG[i]) begin \
1835
              string s; \
1836
              $swrite(s,`"ARG[%0d]`",i); \
1837
              __m_uvm_status_container.scope.set_arg(s); \
1838
              if(uvm_is_match(str__, __m_uvm_status_container.scope.get())) begin \
1839
                 uvm_report_warning("STRMTC", {"set_int()", ": Match ignored for string ", str__, ". Cannot set object to int value."}); \
1840
              end \
1841
              else if(ARG[i]!=null && !((FLAG)&UVM_REFERENCE)) begin \
1842
                int cnt; \
1843
                //Only traverse if there is a possible match. \
1844
                for(cnt=0; cnt
1845
                  if(str__[cnt] == "." || str__[cnt] == "*") break; \
1846
                end \
1847
                if(cnt!=str__.len()) begin \
1848
                  __m_uvm_status_container.scope.down(s); \
1849
                  ARG[i].__m_uvm_field_automation(null, UVM_SETINT, str__); \
1850
                  __m_uvm_status_container.scope.up(); \
1851
                end \
1852
              end \
1853
            end \
1854
          end \
1855
        end \
1856
      UVM_SETSTR: \
1857
        begin \
1858
          __m_uvm_status_container.scope.set_arg(`"ARG`"); \
1859
          if(uvm_is_match(str__, __m_uvm_status_container.scope.get())) begin \
1860
            if((FLAG)&UVM_READONLY) begin \
1861
              uvm_report_warning("RDONLY", $sformatf("Readonly argument match %s is ignored",  \
1862
                 __m_uvm_status_container.get_full_scope_arg()), UVM_NONE); \
1863
            end \
1864
            else begin \
1865
                  uvm_report_warning("STRMTC", {"set_str()", ": Match ignored for string ", str__, ". Cannot set array of objects to string value."}); \
1866
            end \
1867
          end \
1868
          else if(!((FLAG)&UVM_READONLY)) begin \
1869
            foreach(ARG[i]) begin \
1870
              string s; \
1871
              $swrite(s,`"ARG[%0d]`",i); \
1872
              __m_uvm_status_container.scope.set_arg(s); \
1873
              if(uvm_is_match(str__, __m_uvm_status_container.scope.get())) begin \
1874
                  uvm_report_warning("STRMTC", {"set_str()", ": Match ignored for string ", str__, ". Cannot set object to string value."}); \
1875
              end \
1876
              else if(ARG[i]!=null && !((FLAG)&UVM_REFERENCE)) begin \
1877
                int cnt; \
1878
                //Only traverse if there is a possible match. \
1879
                for(cnt=0; cnt
1880
                  if(str__[cnt] == "." || str__[cnt] == "*") break; \
1881
                end \
1882
                if(cnt!=str__.len()) begin \
1883
                  __m_uvm_status_container.scope.down(s); \
1884
                  ARG[i].__m_uvm_field_automation(null, UVM_SETSTR, str__); \
1885
                  __m_uvm_status_container.scope.up(); \
1886
                end \
1887
              end \
1888
            end \
1889
          end \
1890
        end \
1891
      UVM_SETOBJ: \
1892
        begin \
1893
          string s; \
1894
          if(!((FLAG)&UVM_READONLY)) begin \
1895
            bit wildcard_index__; \
1896
            int index__; \
1897
            __m_uvm_status_container.scope.set_arg(`"ARG`"); \
1898
            index__ = uvm_get_array_index_int(str__, wildcard_index__); \
1899
            if(uvm_is_array(str__)  && (index__ != -1)) begin\
1900
              if(wildcard_index__) begin \
1901
                for(index__=0; index__
1902
                  if(uvm_is_match(str__, {__m_uvm_status_container.scope.get_arg(),$sformatf("[%0d]", index__)})) begin \
1903
                    if (__m_uvm_status_container.print_matches) \
1904
                      uvm_report_info("STRMTC", {"set_int()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg(), $sformatf("[%0d]",index__)}, UVM_LOW); \
1905
                    $cast(ARG[index__], uvm_object::__m_uvm_status_container.object); \
1906
                    __m_uvm_status_container.status = 1; \
1907
                  end \
1908
                end \
1909
              end \
1910
              else if(uvm_is_match(str__, {__m_uvm_status_container.get_full_scope_arg(),$sformatf("[%0d]", index__)})) begin \
1911
                if(index__+1 > ARG.size()) begin \
1912
                  int sz = index__+1; \
1913
                  `M_UVM_``TYPE``_RESIZE(ARG,null) \
1914
                end \
1915
                if (__m_uvm_status_container.print_matches) \
1916
                  uvm_report_info("STRMTC", {"set_int()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg()}, UVM_LOW); \
1917
                $cast(ARG[index__],  uvm_object::__m_uvm_status_container.object); \
1918
                __m_uvm_status_container.status = 1; \
1919
              end \
1920
            end \
1921
            else if(!((FLAG)&UVM_REFERENCE)) begin \
1922
              int cnt; \
1923
              foreach(ARG[i]) begin \
1924
                if (ARG[i]!=null) begin \
1925
                  string s; \
1926
                  $swrite(s,`"ARG[%0d]`",i); \
1927
                //Only traverse if there is a possible match. \
1928
                for(cnt=0; cnt
1929
                  if(str__[cnt] == "." || str__[cnt] == "*") break; \
1930
                end \
1931
                if(cnt!=str__.len()) begin \
1932
                  __m_uvm_status_container.scope.down(s); \
1933
                  ARG[i].__m_uvm_field_automation(null, UVM_SETOBJ, str__); \
1934
                  __m_uvm_status_container.scope.up(); \
1935
                end \
1936
              end \
1937
            end \
1938
          end \
1939
        end \
1940
        end \
1941
    endcase \
1942
  end
1943
 
1944
 
1945
// MACRO: `uvm_field_array_string
1946
//
1947
// Implements the data operations for a one-dimensional dynamic array
1948
// of strings.
1949
//
1950
//|  `uvm_field_array_string(ARG,FLAG)
1951
//
1952
// ~ARG~ is a one-dimensional dynamic array of strings, and ~FLAG~ is a bitwise
1953
// OR of one or more flag settings as described in  above.
1954
 
1955
`define uvm_field_array_string(ARG,FLAG) \
1956
  `M_UVM_FIELD_QDA_STRING(ARRAY,ARG,FLAG)
1957
 
1958
`define M_UVM_FIELD_QDA_STRING(TYPE,ARG,FLAG) \
1959
  begin \
1960
    case (what__) \
1961
      UVM_CHECK_FIELDS: \
1962
        __m_uvm_status_container.do_field_check(`"ARG`", this); \
1963
      UVM_COPY: \
1964
        begin \
1965
          if(local_data__ == null) return; \
1966
          if(!((FLAG)&UVM_NOCOPY)) ARG = local_data__.ARG; \
1967
        end \
1968
      UVM_COMPARE: \
1969
        begin \
1970
          if(local_data__ == null) return; \
1971
          if(!((FLAG)&UVM_NOCOMPARE)) begin \
1972
            if(ARG != local_data__.ARG) begin \
1973
               if(__m_uvm_status_container.comparer.show_max == 1) begin \
1974
                 __m_uvm_status_container.scope.set_arg(`"ARG`"); \
1975
                 __m_uvm_status_container.comparer.print_msg(""); \
1976
               end \
1977
               else if(__m_uvm_status_container.comparer.show_max) begin \
1978
                 if(ARG.size() != local_data__.ARG.size()) begin \
1979
                   void'(__m_uvm_status_container.comparer.compare_field(`"ARG``.size`", ARG.size(), local_data__.ARG.size(), 32)); \
1980
                 end \
1981
                 else begin \
1982
                   foreach(ARG[i]) begin \
1983
                     if(ARG[i] != local_data__.ARG[i]) begin \
1984
                       __m_uvm_status_container.scope.set_arg_element(`"ARG`",i); \
1985
                       void'(__m_uvm_status_container.comparer.compare_string("", ARG[i], local_data__.ARG[i])); \
1986
                     end \
1987
                   end \
1988
                 end \
1989
               end \
1990
               else if ((__m_uvm_status_container.comparer.physical&&((FLAG)&UVM_PHYSICAL)) || \
1991
                        (__m_uvm_status_container.comparer.abstract&&((FLAG)&UVM_ABSTRACT)) || \
1992
                        (!((FLAG)&UVM_PHYSICAL) && !((FLAG)&UVM_ABSTRACT)) ) \
1993
                 __m_uvm_status_container.comparer.result++; \
1994
               if(__m_uvm_status_container.comparer.result && (__m_uvm_status_container.comparer.show_max <= __m_uvm_status_container.comparer.result)) return; \
1995
            end \
1996
          end \
1997
        end \
1998
      UVM_PACK: \
1999
        if(!((FLAG)&UVM_NOPACK)) begin \
2000
          if(__m_uvm_status_container.packer.use_metadata) __m_uvm_status_container.packer.pack_field_int(ARG.size(), 32); \
2001
          foreach(ARG[i])  \
2002
            __m_uvm_status_container.packer.pack_string(ARG[i]); \
2003
        end \
2004
      UVM_UNPACK: \
2005
        if(!((FLAG)&UVM_NOPACK)) begin \
2006
          int sz = ARG.size(); \
2007
          if(__m_uvm_status_container.packer.use_metadata) sz = __m_uvm_status_container.packer.unpack_field_int(32); \
2008
          if(sz != ARG.size()) begin \
2009
            `M_UVM_``TYPE``_RESIZE(ARG,"") \
2010
          end \
2011
          foreach(ARG[i]) \
2012
            ARG[i] = __m_uvm_status_container.packer.unpack_string(); \
2013
        end \
2014
      UVM_RECORD: \
2015
        `m_uvm_record_qda_string(ARG,FLAG,ARG.size()) \
2016
      UVM_PRINT: \
2017
        begin \
2018
          if(((FLAG)&UVM_NOPRINT) == 0) begin \
2019
             `uvm_print_array_string2(ARG, __m_uvm_status_container.printer) \
2020
          end \
2021
        end \
2022
      UVM_SETINT: \
2023
        begin \
2024
          __m_uvm_status_container.scope.set_arg(`"ARG`"); \
2025
          if(uvm_is_match(str__, __m_uvm_status_container.scope.get())) begin \
2026
            if((FLAG)&UVM_READONLY) begin \
2027
              uvm_report_warning("RDONLY", $sformatf("Readonly argument match %s is ignored",  \
2028
                 __m_uvm_status_container.get_full_scope_arg()), UVM_NONE); \
2029
            end \
2030
            else begin \
2031
              int sz =  uvm_object::__m_uvm_status_container.bitstream; \
2032
              if (__m_uvm_status_container.print_matches) \
2033
                  uvm_report_info("STRMTC", {"set_int()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg()}, UVM_LOW); \
2034
              if(ARG.size() !=  sz) begin \
2035
                `M_UVM_``TYPE``_RESIZE(ARG,"") \
2036
              end \
2037
              __m_uvm_status_container.status = 1; \
2038
            end \
2039
          end \
2040
        end \
2041
      UVM_SETSTR: \
2042
        begin \
2043
          if(!((FLAG)&UVM_READONLY)) begin \
2044
            bit wildcard_index__; \
2045
            int index__; \
2046
            __m_uvm_status_container.scope.set_arg(`"ARG`"); \
2047
            index__ = uvm_get_array_index_int(str__, wildcard_index__); \
2048
            if(uvm_is_array(str__)  && (index__ != -1)) begin\
2049
              if(wildcard_index__) begin \
2050
                for(index__=0; index__
2051
                  if(uvm_is_match(str__, {__m_uvm_status_container.scope.get_arg(),$sformatf("[%0d]", index__)})) begin \
2052
                    if (__m_uvm_status_container.print_matches) \
2053
                      uvm_report_info("STRMTC", {"set_int()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg(), $sformatf("[%0d]",index__)}, UVM_LOW); \
2054
                    ARG[index__] = uvm_object::__m_uvm_status_container.stringv; \
2055
                    __m_uvm_status_container.status = 1; \
2056
                  end \
2057
                end \
2058
              end \
2059
              else if(uvm_is_match(str__, {__m_uvm_status_container.scope.get_arg(),$sformatf("[%0d]", index__)})) begin \
2060
                if(index__+1 > ARG.size()) begin \
2061
                  int sz = index__; \
2062
                  string tmp__; \
2063
                  `M_UVM_``TYPE``_RESIZE(ARG,tmp__) \
2064
                end \
2065
                if (__m_uvm_status_container.print_matches) \
2066
                  uvm_report_info("STRMTC", {"set_int()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg()}, UVM_LOW); \
2067
                ARG[index__] =  uvm_object::__m_uvm_status_container.stringv; \
2068
                __m_uvm_status_container.status = 1; \
2069
              end \
2070
            end \
2071
          end \
2072
        end \
2073
    endcase \
2074
  end
2075
 
2076
 
2077
 
2078
// MACRO: `uvm_field_array_enum
2079
//
2080
// Implements the data operations for a one-dimensional dynamic array of
2081
// enums.
2082
//
2083
//|  `uvm_field_array_enum(T,ARG,FLAG)
2084
//
2085
// ~T~ is a one-dimensional dynamic array of enums _type_,
2086
// ~ARG~ is an instance of that type, and ~FLAG~ is a bitwise OR of
2087
// one or more flag settings as described in  above.
2088
 
2089
`define uvm_field_array_enum(T,ARG,FLAG) \
2090
  `M_FIELD_QDA_ENUM(ARRAY,T,ARG,FLAG)
2091
 
2092
`define M_FIELD_QDA_ENUM(TYPE,T,ARG,FLAG) \
2093
  begin \
2094
    case (what__) \
2095
      UVM_CHECK_FIELDS: \
2096
        __m_uvm_status_container.do_field_check(`"ARG`", this); \
2097
      UVM_COPY: \
2098
        begin \
2099
          if(!((FLAG)&UVM_NOCOPY)) ARG = local_data__.ARG; \
2100
        end \
2101
      UVM_COMPARE: \
2102
        begin \
2103
          if(!((FLAG)&UVM_NOCOMPARE)) begin \
2104
            if(ARG !== local_data__.ARG) begin \
2105
               if(__m_uvm_status_container.comparer.show_max == 1) begin \
2106
                 __m_uvm_status_container.scope.set_arg(`"ARG`"); \
2107
                 __m_uvm_status_container.comparer.print_msg(""); \
2108
               end \
2109
               else if(__m_uvm_status_container.comparer.show_max) begin \
2110
                 /**/if(ARG.size() != local_data__.ARG.size()) begin \
2111
                 /**/  void'(__m_uvm_status_container.comparer.compare_field(`"ARG``.size`", ARG.size(), local_data__.ARG.size(), 32)); \
2112
                 /**/end \
2113
                 /**/else begin \
2114
                   foreach(ARG[i]) begin \
2115
                     if(ARG[i] !== local_data__.ARG[i]) begin \
2116
                       __m_uvm_status_container.scope.set_arg_element(`"ARG`",i); \
2117
                       $swrite(__m_uvm_status_container.stringv, "lhs = %0s : rhs = %0s", \
2118
                         ARG[i].name(), local_data__.ARG[i].name()); \
2119
                       __m_uvm_status_container.comparer.print_msg(__m_uvm_status_container.stringv); \
2120
                       if(__m_uvm_status_container.comparer.result && (__m_uvm_status_container.comparer.show_max <= __m_uvm_status_container.comparer.result)) return; \
2121
                     end \
2122
                   end \
2123
                 /**/end \
2124
               end \
2125
               else if ((__m_uvm_status_container.comparer.physical&&((FLAG)&UVM_PHYSICAL)) || \
2126
                        (__m_uvm_status_container.comparer.abstract&&((FLAG)&UVM_ABSTRACT)) || \
2127
                        (!((FLAG)&UVM_PHYSICAL) && !((FLAG)&UVM_ABSTRACT)) ) \
2128
                 __m_uvm_status_container.comparer.result++; \
2129
               if(__m_uvm_status_container.comparer.result && (__m_uvm_status_container.comparer.show_max <= __m_uvm_status_container.comparer.result)) return; \
2130
            end \
2131
          end \
2132
        end \
2133
      UVM_PACK: \
2134
        if(!((FLAG)&UVM_NOPACK)) begin \
2135
          /**/if(__m_uvm_status_container.packer.use_metadata) __m_uvm_status_container.packer.pack_field_int(ARG.size(), 32); \
2136
          foreach(ARG[i])  \
2137
            __m_uvm_status_container.packer.pack_field_int(int'(ARG[i]), $bits(ARG[i])); \
2138
        end \
2139
      UVM_UNPACK: \
2140
        if(!((FLAG)&UVM_NOPACK)) begin \
2141
          /**/int sz = ARG.size(); \
2142
          /**/if(__m_uvm_status_container.packer.use_metadata) sz = __m_uvm_status_container.packer.unpack_field_int(32); \
2143
          /**/if(sz != ARG.size()) begin \
2144
          /**/  T tmp__; \
2145
          /**/  `M_UVM_``TYPE``_RESIZE(ARG,tmp__) \
2146
          /**/end \
2147
          foreach(ARG[i]) \
2148
            ARG[i] = T'(__m_uvm_status_container.packer.unpack_field_int($bits(ARG[i]))); \
2149
        end \
2150
      UVM_RECORD: \
2151
        /**/`m_uvm_record_qda_enum(ARG,FLAG,ARG.size()) \
2152
      UVM_PRINT: \
2153
        begin \
2154
          if(((FLAG)&UVM_NOPRINT) == 0) begin \
2155
             `uvm_print_qda_enum(ARG, __m_uvm_status_container.printer, array, T) \
2156
          end \
2157
        end \
2158
      UVM_SETINT: \
2159
        begin \
2160
          __m_uvm_status_container.scope.set_arg(`"ARG`"); \
2161
          if(uvm_is_match(str__, __m_uvm_status_container.scope.get())) begin \
2162
            if((FLAG)&UVM_READONLY) begin \
2163
              uvm_report_warning("RDONLY", $sformatf("Readonly argument match %s is ignored",  \
2164
                 __m_uvm_status_container.get_full_scope_arg()), UVM_NONE); \
2165
            end \
2166
            /**/else begin \
2167
            /**/  int sz =  uvm_object::__m_uvm_status_container.bitstream; \
2168
            /**/  if (__m_uvm_status_container.print_matches) \
2169
                  uvm_report_info("STRMTC", {"set_int()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg()}, UVM_LOW); \
2170
            /**/  if(ARG.size() !=  sz) begin \
2171
            /**/    T tmp__; \
2172
            /**/    `M_UVM_``TYPE``_RESIZE(ARG,tmp__) \
2173
            /**/  end \
2174
            /**/  __m_uvm_status_container.status = 1; \
2175
            /**/end \
2176
          end \
2177
          else if(!((FLAG)&UVM_READONLY)) begin \
2178
            bit wildcard_index__; \
2179
            int index__; \
2180
            index__ = uvm_get_array_index_int(str__, wildcard_index__); \
2181
            if(uvm_is_array(str__)  && (index__ != -1)) begin\
2182
              if(wildcard_index__) begin \
2183
                for(index__=0; index__
2184
                  if(uvm_is_match(str__, {__m_uvm_status_container.scope.get_arg(),$sformatf("[%0d]", index__)})) begin \
2185
                    if (__m_uvm_status_container.print_matches) \
2186
                      uvm_report_info("STRMTC", {"set_int()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg(), $sformatf("[%0d]",index__)}, UVM_LOW); \
2187
                    ARG[index__] = T'(uvm_object::__m_uvm_status_container.bitstream); \
2188
                    __m_uvm_status_container.status = 1; \
2189
                  end \
2190
                end \
2191
              end \
2192
              else if(uvm_is_match(str__, {__m_uvm_status_container.scope.get_arg(),$sformatf("[%0d]", index__)})) begin \
2193
                if(index__+1 > ARG.size()) begin \
2194
                  int sz = index__; \
2195
                  T tmp__; \
2196
                  `M_UVM_``TYPE``_RESIZE(ARG,tmp__) \
2197
                end \
2198
                if (__m_uvm_status_container.print_matches) \
2199
                  uvm_report_info("STRMTC", {"set_int()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg()}, UVM_LOW); \
2200
                ARG[index__] =  T'(uvm_object::__m_uvm_status_container.bitstream); \
2201
                __m_uvm_status_container.status = 1; \
2202
              end \
2203
            end \
2204
          end \
2205
        end \
2206
      UVM_SETSTR: \
2207
        begin \
2208
          if(!((FLAG)&UVM_READONLY)) begin \
2209
            bit wildcard_index__; \
2210
            int index__; \
2211
            __m_uvm_status_container.scope.set_arg(`"ARG`"); \
2212
            index__ = uvm_get_array_index_int(str__, wildcard_index__); \
2213
            if(uvm_is_array(str__)  && (index__ != -1)) begin\
2214
              if(wildcard_index__) begin \
2215
                for(index__=0; index__
2216
                  if(uvm_is_match(str__, {__m_uvm_status_container.scope.get_arg(),$sformatf("[%0d]", index__)})) begin \
2217
                          T t__; \
2218
                    if (__m_uvm_status_container.print_matches) \
2219
                      uvm_report_info("STRMTC", {"set_int()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg(), $sformatf("[%0d]",index__)}, UVM_LOW); \
2220
                    void'(uvm_enum_wrapper#(T)::from_name(uvm_object::__m_uvm_status_container.stringv, t__)); ARG[index__]=t__; \
2221
                    __m_uvm_status_container.status = 1; \
2222
                  end \
2223
                end \
2224
              end \
2225
              else if(uvm_is_match(str__, {__m_uvm_status_container.scope.get_arg(),$sformatf("[%0d]", index__)})) begin \
2226
                    T t__; \
2227
                if(index__+1 > ARG.size()) begin \
2228
                  int sz = index__; \
2229
                  T tmp__; \
2230
                  `M_UVM_``TYPE``_RESIZE(ARG,tmp__) \
2231
                end \
2232
                if (__m_uvm_status_container.print_matches) \
2233
                  uvm_report_info("STRMTC", {"set_int()", ": Matched string ", str__, " to field ", __m_uvm_status_container.get_full_scope_arg()}, UVM_LOW); \
2234
                void'(uvm_enum_wrapper#(T)::from_name(uvm_object::__m_uvm_status_container.stringv, t__)); ARG[index__]=t__; \
2235
                __m_uvm_status_container.status = 1; \
2236
              end \
2237
            end \
2238
          end \
2239
        end \
2240
    endcase \
2241
  end
2242
 
2243
 
2244
//-----------------------------------------------------------------------------
2245
// Group: `uvm_field_queue_* macros
2246
//
2247
// Macros that implement data operations for dynamic queues.
2248
//
2249
//-----------------------------------------------------------------------------
2250
 
2251
// MACRO: `uvm_field_queue_int
2252
//
2253
// Implements the data operations for a queue of integrals.
2254
//
2255
//|  `uvm_field_queue_int(ARG,FLAG)
2256
//
2257
// ~ARG~ is a one-dimensional queue of integrals,
2258
// and ~FLAG~ is a bitwise OR of one or more flag settings as described in
2259
//  above.
2260
 
2261
`define uvm_field_queue_int(ARG,FLAG) \
2262
  `M_UVM_FIELD_QDA_INT(QUEUE,ARG,FLAG)
2263
 
2264
// MACRO: `uvm_field_queue_object
2265
//
2266
// Implements the data operations for a queue of -based objects.
2267
//
2268
//|  `uvm_field_queue_object(ARG,FLAG)
2269
//
2270
// ~ARG~ is a one-dimensional queue of -based objects,
2271
// and ~FLAG~ is a bitwise OR of one or more flag settings as described in
2272
//  above.
2273
 
2274
`define uvm_field_queue_object(ARG,FLAG) \
2275
  `M_UVM_FIELD_QDA_OBJECT(QUEUE,ARG,FLAG)
2276
 
2277
 
2278
// MACRO: `uvm_field_queue_string
2279
//
2280
// Implements the data operations for a queue of strings.
2281
//
2282
//|  `uvm_field_queue_string(ARG,FLAG)
2283
//
2284
// ~ARG~ is a one-dimensional queue of strings, and ~FLAG~ is a bitwise
2285
// OR of one or more flag settings as described in  above.
2286
 
2287
`define uvm_field_queue_string(ARG,FLAG) \
2288
  `M_UVM_FIELD_QDA_STRING(QUEUE,ARG,FLAG)
2289
 
2290
 
2291
// MACRO: `uvm_field_queue_enum
2292
//
2293
// Implements the data operations for a one-dimensional queue of enums.
2294
//
2295
//|  `uvm_field_queue_enum(T,ARG,FLAG)
2296
//
2297
// ~T~ is a queue of enums _type_, ~ARG~ is an instance of that type,
2298
// and ~FLAG~ is a bitwise OR of one or more flag settings as described
2299
// in  above.
2300
 
2301
`define uvm_field_queue_enum(T,ARG,FLAG) \
2302
  `M_FIELD_QDA_ENUM(QUEUE,T,ARG,FLAG)
2303
 
2304
 
2305
//-----------------------------------------------------------------------------
2306
// Group: `uvm_field_aa_*_string macros
2307
//
2308
// Macros that implement data operations for associative arrays indexed
2309
// by ~string~.
2310
//
2311
//-----------------------------------------------------------------------------
2312
 
2313
// MACRO: `uvm_field_aa_int_string
2314
//
2315
// Implements the data operations for an associative array of integrals indexed
2316
// by ~string~.
2317
//
2318
//|  `uvm_field_aa_int_string(ARG,FLAG)
2319
//
2320
// ~ARG~ is the name of a property that is an associative array of integrals
2321
// with string key, and ~FLAG~ is a bitwise OR of one or more flag settings as
2322
// described in  above.
2323
 
2324
`define uvm_field_aa_int_string(ARG, FLAG) \
2325
  begin \
2326
  if(what__==UVM_CHECK_FIELDS) __m_uvm_status_container.do_field_check(`"ARG`", this); \
2327
  `M_UVM_FIELD_DATA_AA_int_string(ARG,FLAG) \
2328
  `M_UVM_FIELD_SET_AA_TYPE(string, INT, ARG, __m_uvm_status_container.bitstream, FLAG)  \
2329
  end
2330
 
2331
 
2332
// MACRO: `uvm_field_aa_object_string
2333
//
2334
// Implements the data operations for an associative array of -based
2335
// objects indexed by ~string~.
2336
//
2337
//|  `uvm_field_aa_object_string(ARG,FLAG)
2338
//
2339
// ~ARG~ is the name of a property that is an associative array of objects
2340
// with string key, and ~FLAG~ is a bitwise OR of one or more flag settings as
2341
// described in  above.
2342
 
2343
`define uvm_field_aa_object_string(ARG, FLAG) \
2344
  begin \
2345
  if(what__==UVM_CHECK_FIELDS) __m_uvm_status_container.do_field_check(`"ARG`", this); \
2346
  `M_UVM_FIELD_DATA_AA_object_string(ARG,FLAG) \
2347
  `M_UVM_FIELD_SET_AA_OBJECT_TYPE(string, ARG, FLAG)  \
2348
  end
2349
 
2350
 
2351
// MACRO: `uvm_field_aa_string_string
2352
//
2353
// Implements the data operations for an associative array of strings indexed
2354
// by ~string~.
2355
//
2356
//|  `uvm_field_aa_string_string(ARG,FLAG)
2357
//
2358
// ~ARG~ is the name of a property that is an associative array of strings
2359
// with string key, and ~FLAG~ is a bitwise OR of one or more flag settings as
2360
// described in  above.
2361
 
2362
`define uvm_field_aa_string_string(ARG, FLAG) \
2363
  begin \
2364
  if(what__==UVM_CHECK_FIELDS) __m_uvm_status_container.do_field_check(`"ARG`", this); \
2365
  `M_UVM_FIELD_DATA_AA_string_string(ARG,FLAG) \
2366
  `M_UVM_FIELD_SET_AA_TYPE(string, STR, ARG, __m_uvm_status_container.stringv, FLAG)  \
2367
  end
2368
 
2369
 
2370
//-----------------------------------------------------------------------------
2371
// Group: `uvm_field_aa_*_int macros
2372
//
2373
// Macros that implement data operations for associative arrays indexed by an
2374
// integral type.
2375
//
2376
//-----------------------------------------------------------------------------
2377
 
2378
// MACRO: `uvm_field_aa_object_int
2379
//
2380
// Implements the data operations for an associative array of -based
2381
// objects indexed by the ~int~ data type.
2382
//
2383
//|  `uvm_field_aa_object_int(ARG,FLAG)
2384
//
2385
// ~ARG~ is the name of a property that is an associative array of objects
2386
// with ~int~ key, and ~FLAG~ is a bitwise OR of one or more flag settings as
2387
// described in  above.
2388
 
2389
`define uvm_field_aa_object_int(ARG, FLAG) \
2390
  begin \
2391
  if(what__==UVM_CHECK_FIELDS) __m_uvm_status_container.do_field_check(`"ARG`", this); \
2392
  `M_UVM_FIELD_DATA_AA_object_int(ARG,FLAG) \
2393
  `M_UVM_FIELD_SET_AA_OBJECT_TYPE(int, ARG, FLAG)  \
2394
  end
2395
 
2396
 
2397
// MACRO: `uvm_field_aa_int_int
2398
//
2399
// Implements the data operations for an associative array of integral
2400
// types indexed by the ~int~ data type.
2401
//
2402
//|  `uvm_field_aa_int_int(ARG,FLAG)
2403
//
2404
// ~ARG~ is the name of a property that is an associative array of integrals
2405
// with ~int~ key, and ~FLAG~ is a bitwise OR of one or more flag settings as
2406
// described in  above.
2407
 
2408
`define uvm_field_aa_int_int(ARG, FLAG) \
2409
  `uvm_field_aa_int_key(int, ARG, FLAG) \
2410
 
2411
 
2412
// MACRO: `uvm_field_aa_int_int_unsigned
2413
//
2414
// Implements the data operations for an associative array of integral
2415
// types indexed by the ~int unsigned~ data type.
2416
//
2417
//|  `uvm_field_aa_int_int_unsigned(ARG,FLAG)
2418
//
2419
// ~ARG~ is the name of a property that is an associative array of integrals
2420
// with ~int unsigned~ key, and ~FLAG~ is a bitwise OR of one or more flag
2421
// settings as described in  above.
2422
 
2423
`define uvm_field_aa_int_int_unsigned(ARG, FLAG) \
2424
  `uvm_field_aa_int_key(int unsigned, ARG, FLAG)
2425
 
2426
 
2427
// MACRO: `uvm_field_aa_int_integer
2428
//
2429
// Implements the data operations for an associative array of integral
2430
// types indexed by the ~integer~ data type.
2431
//
2432
//|  `uvm_field_aa_int_integer(ARG,FLAG)
2433
//
2434
// ~ARG~ is the name of a property that is an associative array of integrals
2435
// with ~integer~ key, and ~FLAG~ is a bitwise OR of one or more flag settings
2436
// as described in  above.
2437
 
2438
`define uvm_field_aa_int_integer(ARG, FLAG) \
2439
  `uvm_field_aa_int_key(integer, ARG, FLAG)
2440
 
2441
 
2442
// MACRO: `uvm_field_aa_int_integer_unsigned
2443
//
2444
// Implements the data operations for an associative array of integral
2445
// types indexed by the ~integer unsigned~ data type.
2446
//
2447
//|  `uvm_field_aa_int_integer_unsigned(ARG,FLAG)
2448
//
2449
// ~ARG~ is the name of a property that is an associative array of integrals
2450
// with ~integer unsigned~ key, and ~FLAG~ is a bitwise OR of one or more
2451
// flag settings as described in  above.
2452
 
2453
`define uvm_field_aa_int_integer_unsigned(ARG, FLAG) \
2454
  `uvm_field_aa_int_key(integer unsigned, ARG, FLAG)
2455
 
2456
 
2457
// MACRO: `uvm_field_aa_int_byte
2458
//
2459
// Implements the data operations for an associative array of integral
2460
// types indexed by the ~byte~ data type.
2461
//
2462
//|  `uvm_field_aa_int_byte(ARG,FLAG)
2463
//
2464
// ~ARG~ is the name of a property that is an associative array of integrals
2465
// with ~byte~ key, and ~FLAG~ is a bitwise OR of one or more flag settings as
2466
// described in  above.
2467
 
2468
`define uvm_field_aa_int_byte(ARG, FLAG) \
2469
  `uvm_field_aa_int_key(byte, ARG, FLAG)
2470
 
2471
 
2472
// MACRO: `uvm_field_aa_int_byte_unsigned
2473
//
2474
// Implements the data operations for an associative array of integral
2475
// types indexed by the ~byte unsigned~ data type.
2476
//
2477
//|  `uvm_field_aa_int_byte_unsigned(ARG,FLAG)
2478
//
2479
// ~ARG~ is the name of a property that is an associative array of integrals
2480
// with ~byte unsigned~ key, and ~FLAG~ is a bitwise OR of one or more flag
2481
// settings as described in  above.
2482
 
2483
`define uvm_field_aa_int_byte_unsigned(ARG, FLAG) \
2484
  `uvm_field_aa_int_key(byte unsigned, ARG, FLAG)
2485
 
2486
 
2487
// MACRO: `uvm_field_aa_int_shortint
2488
//
2489
// Implements the data operations for an associative array of integral
2490
// types indexed by the ~shortint~ data type.
2491
//
2492
//|  `uvm_field_aa_int_shortint(ARG,FLAG)
2493
//
2494
// ~ARG~ is the name of a property that is an associative array of integrals
2495
// with ~shortint~ key, and ~FLAG~ is a bitwise OR of one or more flag
2496
// settings as described in  above.
2497
 
2498
`define uvm_field_aa_int_shortint(ARG, FLAG) \
2499
  `uvm_field_aa_int_key(shortint, ARG, FLAG)
2500
 
2501
 
2502
// MACRO: `uvm_field_aa_int_shortint_unsigned
2503
//
2504
// Implements the data operations for an associative array of integral
2505
// types indexed by the ~shortint unsigned~ data type.
2506
//
2507
//|  `uvm_field_aa_int_shortint_unsigned(ARG,FLAG)
2508
//
2509
// ~ARG~ is the name of a property that is an associative array of integrals
2510
// with ~shortint unsigned~ key, and ~FLAG~ is a bitwise OR of one or more
2511
// flag settings as described in  above.
2512
 
2513
`define uvm_field_aa_int_shortint_unsigned(ARG, FLAG) \
2514
  `uvm_field_aa_int_key(shortint unsigned, ARG, FLAG)
2515
 
2516
 
2517
// MACRO: `uvm_field_aa_int_longint
2518
//
2519
// Implements the data operations for an associative array of integral
2520
// types indexed by the ~longint~ data type.
2521
//
2522
//|  `uvm_field_aa_int_longint(ARG,FLAG)
2523
//
2524
// ~ARG~ is the name of a property that is an associative array of integrals
2525
// with ~longint~ key, and ~FLAG~ is a bitwise OR of one or more flag settings
2526
// as described in  above.
2527
 
2528
`define uvm_field_aa_int_longint(ARG, FLAG) \
2529
  `uvm_field_aa_int_key(longint, ARG, FLAG)
2530
 
2531
 
2532
// MACRO: `uvm_field_aa_int_longint_unsigned
2533
//
2534
// Implements the data operations for an associative array of integral
2535
// types indexed by the ~longint unsigned~ data type.
2536
//
2537
//|  `uvm_field_aa_int_longint_unsigned(ARG,FLAG)
2538
//
2539
// ~ARG~ is the name of a property that is an associative array of integrals
2540
// with ~longint unsigned~ key, and ~FLAG~ is a bitwise OR of one or more
2541
// flag settings as described in  above.
2542
 
2543
`define uvm_field_aa_int_longint_unsigned(ARG, FLAG) \
2544
  `uvm_field_aa_int_key(longint unsigned, ARG, FLAG)
2545
 
2546
 
2547
// MACRO: `uvm_field_aa_int_key
2548
//
2549
// Implements the data operations for an associative array of integral
2550
// types indexed by any integral key data type.
2551
//
2552
//|  `uvm_field_aa_int_key(KEY,ARG,FLAG)
2553
//
2554
// ~KEY~ is the data type of the integral key, ~ARG~ is the name of a property
2555
// that is an associative array of integrals, and ~FLAG~ is a bitwise OR of one
2556
// or more flag settings as described in  above.
2557
 
2558
`define uvm_field_aa_int_key(KEY, ARG, FLAG) \
2559
  begin \
2560
  if(what__==UVM_CHECK_FIELDS) __m_uvm_status_container.do_field_check(`"ARG`", this); \
2561
  `M_UVM_FIELD_DATA_AA_int_key(KEY,ARG,FLAG) \
2562
  `M_UVM_FIELD_SET_AA_INT_TYPE(KEY, INT, ARG, __m_uvm_status_container.bitstream, FLAG)  \
2563
  end
2564
 
2565
 
2566
// MACRO: `uvm_field_aa_int_enumkey
2567
//
2568
// Implements the data operations for an associative array of integral
2569
// types indexed by any enumeration key data type.
2570
//
2571
//|  `uvm_field_aa_int_enumkey(KEY, ARG,FLAG)
2572
//
2573
// ~KEY~ is the enumeration type of the key, ~ARG~ is the name of a property
2574
// that is an associative array of integrals, and ~FLAG~ is a bitwise OR of one
2575
// or more flag settings as described in  above.
2576
 
2577
`define uvm_field_aa_int_enumkey(KEY, ARG, FLAG) \
2578
  begin \
2579
  if(what__==UVM_CHECK_FIELDS) __m_uvm_status_container.do_field_check(`"ARG`", this); \
2580
  `M_UVM_FIELD_DATA_AA_enum_key(KEY,ARG,FLAG) \
2581
  `M_UVM_FIELD_SET_AA_INT_ENUMTYPE(KEY, INT, ARG, __m_uvm_status_container.bitstream, FLAG)  \
2582
  end
2583
 
2584
// m_uvm_print_int
2585
 
2586
// Purpose: provide print functionality for a specific integral field. This
2587
// macro is available for user access. If used externally, a record_options
2588
// object must be avaialble and must have the name opt.
2589
//
2590
// Postcondition: ~ARG~ is printed using the format set by the FLAGS.
2591
 
2592
`define m_uvm_print_int(ARG,FLAG) \
2593
  if(!((FLAG)&UVM_NOPRINT)) begin \
2594
     if ($bits(ARG) > 64) \
2595
      __m_uvm_status_container.printer.print_field(`"ARG`", ARG,  $bits(ARG), uvm_radix_enum'((FLAG)&(UVM_RADIX))); \
2596
     else \
2597
      __m_uvm_status_container.printer.print_field_int(`"ARG`", ARG,  $bits(ARG), uvm_radix_enum'((FLAG)&(UVM_RADIX))); \
2598
  end
2599
 
2600
//-----------------------------------------------------------------------------
2601
//
2602
// MACROS- recording
2603
//
2604
//-----------------------------------------------------------------------------
2605
 
2606
// m_uvm_record_int
2607
// ----------------
2608
 
2609
// Purpose: provide record functionality for a specific integral field. This
2610
// macro is available for user access. If used externally, a record_options
2611
// object must be avaialble and must have the name opt.
2612
//
2613
// Postcondition: ~ARG~ is printed using the format set by the FLAGS.
2614
 
2615
`define m_uvm_record_int(ARG,FLAG) \
2616
  if(!((FLAG)&UVM_NORECORD)) begin \
2617
    if ($bits(ARG) > 64) \
2618
      __m_uvm_status_container.recorder.record_field(`"ARG`", ARG,  $bits(ARG), uvm_radix_enum'((FLAG)&(UVM_RADIX))); \
2619
    else \
2620
      __m_uvm_status_container.recorder.record_field_int(`"ARG`", ARG,  $bits(ARG), uvm_radix_enum'((FLAG)&(UVM_RADIX))); \
2621
  end
2622
 
2623
 
2624
// m_uvm_record_string
2625
// -------------------
2626
 
2627
// Purpose: provide record functionality for a specific string field. This
2628
// macro is available for user access. If used externally, a record_options
2629
// object must be avaialble and must have the name recorder.
2630
//
2631
// Postcondition: ~ARG~ is recorded in string format.
2632
 
2633
 
2634
`define m_uvm_record_string(ARG,STR,FLAG) \
2635
  if(!((FLAG)&UVM_NORECORD)) begin \
2636
    __m_uvm_status_container.recorder.record_string(`"ARG`", STR); \
2637
  end
2638
 
2639
 
2640
// m_uvm_record_object
2641
// -------------------
2642
 
2643
// Purpose: provide record functionality for a specific  field. This
2644
// macro is available for user access. If used externally, a record_options
2645
// object must be avaialble and must have the name recorder.
2646
//
2647
// Postcondition: ~ARG~ is recorded. The record is done recursively where the
2648
// depth to record is set in the recorder object.
2649
 
2650
 
2651
`define m_uvm_record_object(ARG,FLAG) \
2652
  if(!((FLAG)&UVM_NORECORD)) begin \
2653
    __m_uvm_status_container.recorder.record_object(`"ARG`", ARG); \
2654
  end
2655
 
2656
 
2657
// m_uvm_record_qda_int
2658
// --------------------
2659
 
2660
`define m_uvm_record_qda_int(ARG, FLAG, SZ) \
2661
  begin \
2662
    if(!((FLAG)&UVM_NORECORD)) begin \
2663
      int sz__ = SZ; \
2664
      if(sz__ == 0) begin \
2665
        __m_uvm_status_container.recorder.record_field_int(`"ARG`", 0, 32, UVM_DEC); \
2666
      end \
2667
      else if(sz__ < 10) begin \
2668
        foreach(ARG[i]) begin \
2669
           __m_uvm_status_container.scope.set_arg_element(`"ARG`",i); \
2670
           if ($bits(ARG[i]) > 64) \
2671
             __m_uvm_status_container.recorder.record_field(__m_uvm_status_container.scope.get(), ARG[i], $bits(ARG[i]), uvm_radix_enum'((FLAG)&UVM_RADIX)); \
2672
           else \
2673
             __m_uvm_status_container.recorder.record_field_int(__m_uvm_status_container.scope.get(), ARG[i], $bits(ARG[i]), uvm_radix_enum'((FLAG)&UVM_RADIX)); \
2674
        end \
2675
      end \
2676
      else begin \
2677
        for(int i=0; i<5; ++i) begin \
2678
           __m_uvm_status_container.scope.set_arg_element(`"ARG`", i); \
2679
           if ($bits(ARG[i]) > 64) \
2680
             __m_uvm_status_container.recorder.record_field(__m_uvm_status_container.scope.get(), ARG[i], $bits(ARG[i]), uvm_radix_enum'((FLAG)&UVM_RADIX)); \
2681
           else \
2682
             __m_uvm_status_container.recorder.record_field_int(__m_uvm_status_container.scope.get(), ARG[i], $bits(ARG[i]), uvm_radix_enum'((FLAG)&UVM_RADIX)); \
2683
        end \
2684
        for(int i=sz__-5; i
2685
           __m_uvm_status_container.scope.set_arg_element(`"ARG`", i); \
2686
           if ($bits(ARG[i]) > 64) \
2687
             __m_uvm_status_container.recorder.record_field(__m_uvm_status_container.scope.get(), ARG[i], $bits(ARG[i]), uvm_radix_enum'((FLAG)&UVM_RADIX)); \
2688
           else \
2689
             __m_uvm_status_container.recorder.record_field_int(__m_uvm_status_container.scope.get(), ARG[i], $bits(ARG[i]), uvm_radix_enum'((FLAG)&UVM_RADIX)); \
2690
        end \
2691
      end \
2692
    end \
2693
  end
2694
 
2695
 
2696
// m_uvm_record_qda_enum
2697
// ---------------------
2698
 
2699
`define m_uvm_record_qda_enum(ARG, FLAG, SZ) \
2700
  begin \
2701
    if(!((FLAG)&UVM_NORECORD) && (__m_uvm_status_container.recorder != null)) begin \
2702
      int sz__ = SZ; \
2703
      if(sz__ == 0) begin \
2704
        __m_uvm_status_container.recorder.record_field_int(`"ARG``.size`", 0, 32, UVM_DEC); \
2705
      end \
2706
      else if(sz__ < 10) begin \
2707
        foreach(ARG[i]) begin \
2708
           __m_uvm_status_container.scope.set_arg_element(`"ARG`",i); \
2709
           __m_uvm_status_container.recorder.record_string(__m_uvm_status_container.scope.get(), ARG[i].name()); \
2710
        end \
2711
      end \
2712
      else begin \
2713
        for(int i=0; i<5; ++i) begin \
2714
           __m_uvm_status_container.scope.set_arg_element(`"ARG`", i); \
2715
           __m_uvm_status_container.recorder.record_string(__m_uvm_status_container.scope.get(), ARG[i].name()); \
2716
        end \
2717
        for(int i=sz__-5; i
2718
           __m_uvm_status_container.scope.set_arg_element(`"ARG`", i); \
2719
           __m_uvm_status_container.recorder.record_string(__m_uvm_status_container.scope.get(), ARG[i].name()); \
2720
        end \
2721
      end \
2722
    end \
2723
  end
2724
 
2725
 
2726
// m_uvm_record_qda_object
2727
// -----------------------
2728
 
2729
`define m_uvm_record_qda_object(ARG, FLAG, SZ) \
2730
  begin \
2731
    if(!((FLAG)&UVM_NORECORD)) begin \
2732
      int sz__ = SZ; \
2733
      string s; \
2734
      if(sz__ == 0 ) begin \
2735
        __m_uvm_status_container.recorder.record_field_int(`"ARG``.size`", 0, 32, UVM_DEC); \
2736
      end \
2737
      if(sz__ < 10) begin \
2738
        foreach(ARG[i]) begin \
2739
           $swrite(s,`"ARG[%0d]`", i); \
2740
           __m_uvm_status_container.recorder.record_object(s, ARG[i]); \
2741
        end \
2742
      end \
2743
      else begin \
2744
        for(int i=0; i<5; ++i) begin \
2745
           $swrite(s,`"ARG[%0d]`", i); \
2746
           __m_uvm_status_container.recorder.record_object(s, ARG[i]); \
2747
        end \
2748
        for(int i=sz__-5; i
2749
           $swrite(s,`"ARG[%0d]`", i); \
2750
           __m_uvm_status_container.recorder.record_object(s, ARG[i]); \
2751
        end \
2752
      end \
2753
    end \
2754
  end
2755
 
2756
 
2757
// m_uvm_record_qda_string
2758
// -----------------------
2759
 
2760
`define m_uvm_record_qda_string(ARG, FLAG, SZ) \
2761
  begin \
2762
    int sz__ = SZ; \
2763
    if(!((FLAG)&UVM_NORECORD)) begin \
2764
      if(sz__ == 0) begin \
2765
        __m_uvm_status_container.recorder.record_field_int(`"ARG``.size`", 0, 32, UVM_DEC); \
2766
      end \
2767
      else if(sz__ < 10) begin \
2768
        foreach(ARG[i]) begin \
2769
           __m_uvm_status_container.scope.set_arg_element(`"ARG`",i); \
2770
           __m_uvm_status_container.recorder.record_string(__m_uvm_status_container.scope.get(), ARG[i]); \
2771
        end \
2772
      end \
2773
      else begin \
2774
        for(int i=0; i<5; ++i) begin \
2775
           __m_uvm_status_container.scope.set_arg_element(`"ARG`", i); \
2776
           __m_uvm_status_container.recorder.record_string(__m_uvm_status_container.scope.get(), ARG[i]); \
2777
        end \
2778
        for(int i=sz__-5; i
2779
           __m_uvm_status_container.scope.set_arg_element(`"ARG`", i); \
2780
           __m_uvm_status_container.recorder.record_string(__m_uvm_status_container.scope.get(), ARG[i]); \
2781
        end \
2782
      end \
2783
    end \
2784
  end
2785
 
2786
 
2787
// M_UVM_FIELD_DATA_AA_generic
2788
// -------------------------
2789
 
2790
`define M_UVM_FIELD_DATA_AA_generic(TYPE, KEY, ARG, FLAG) \
2791
  begin \
2792
    begin \
2793
      case (what__) \
2794
        UVM_COMPARE: \
2795
           begin \
2796
            if(!((FLAG)&UVM_NOCOMPARE) && (tmp_data__ != null) ) \
2797
            begin \
2798
              $cast(local_data__, tmp_data__); \
2799
              if(ARG.num() != local_data__.ARG.num()) begin \
2800
                 int s1__, s2__; \
2801
                 __m_uvm_status_container.stringv = ""; \
2802
                 s1__ = ARG.num(); s2__ = local_data__.ARG.num(); \
2803
                 $swrite(__m_uvm_status_container.stringv, "lhs size = %0d : rhs size = %0d", \
2804
                    s1__, s2__);\
2805
                 __m_uvm_status_container.comparer.print_msg(__m_uvm_status_container.stringv); \
2806
              end \
2807
              string_aa_key = ""; \
2808
              while(ARG.next(string_aa_key)) begin \
2809
                string s; \
2810
                __m_uvm_status_container.scope.set_arg({"[",string_aa_key,"]"}); \
2811
                s = {`"ARG[`",string_aa_key,"]"}; \
2812
                if($bits(ARG[string_aa_key]) <= 64) \
2813
                  void'(__m_uvm_status_container.comparer.compare_field_int(s, ARG[string_aa_key], local_data__.ARG[string_aa_key], $bits(ARG[string_aa_key]), uvm_radix_enum'((FLAG)&UVM_RADIX))); \
2814
                else \
2815
                  void'(__m_uvm_status_container.comparer.compare_field(s, ARG[string_aa_key], local_data__.ARG[string_aa_key], $bits(ARG[string_aa_key]), uvm_radix_enum'((FLAG)&UVM_RADIX))); \
2816
                __m_uvm_status_container.scope.unset_arg(string_aa_key); \
2817
              end \
2818
            end \
2819
           end \
2820
        UVM_COPY: \
2821
          begin \
2822
            if(!((FLAG)&UVM_NOCOPY) && (tmp_data__ != null) ) \
2823
            begin \
2824
              $cast(local_data__, tmp_data__); \
2825
              ARG.delete(); \
2826
              string_aa_key = ""; \
2827
              while(local_data__.ARG.next(string_aa_key)) \
2828
                ARG[string_aa_key] = local_data__.ARG[string_aa_key]; \
2829
            end \
2830
          end \
2831
        UVM_PRINT: \
2832
          if(!((FLAG)&UVM_NOPRINT)) begin \
2833
            `uvm_print_aa_``KEY``_``TYPE``3(ARG, uvm_radix_enum'((FLAG)&(UVM_RADIX)), \
2834
                                            __m_uvm_status_container.printer) \
2835
          end \
2836
      endcase \
2837
    end \
2838
  end
2839
 
2840
 
2841
// M_UVM_FIELD_DATA_AA_int_string
2842
// ----------------------------
2843
 
2844
`define M_UVM_FIELD_DATA_AA_int_string(ARG, FLAG) \
2845
  `M_UVM_FIELD_DATA_AA_generic(int, string, ARG, FLAG)
2846
 
2847
 
2848
// M_UVM_FIELD_DATA_AA_int_int
2849
// ----------------------------
2850
 
2851
`define M_UVM_FIELD_DATA_AA_int_key(KEY, ARG, FLAG) \
2852
  begin \
2853
    begin \
2854
      KEY aa_key; \
2855
      case (what__) \
2856
        UVM_COMPARE: \
2857
           begin \
2858
            if(!((FLAG)&UVM_NOCOMPARE) && (tmp_data__ != null) ) \
2859
            begin \
2860
              $cast(local_data__, tmp_data__); \
2861
              if(ARG.num() != local_data__.ARG.num()) begin \
2862
                 int s1__, s2__; \
2863
                 __m_uvm_status_container.stringv = ""; \
2864
                 s1__ = ARG.num(); s2__ = local_data__.ARG.num(); \
2865
                 $swrite(__m_uvm_status_container.stringv, "lhs size = %0d : rhs size = %0d", \
2866
                    s1__, s2__);\
2867
                 __m_uvm_status_container.comparer.print_msg(__m_uvm_status_container.stringv); \
2868
              end \
2869
              foreach(ARG[_aa_key]) begin \
2870
                  string s; \
2871
                  $swrite(string_aa_key, "%0d", _aa_key); \
2872
                  __m_uvm_status_container.scope.set_arg({"[",string_aa_key,"]"}); \
2873
                  s = {`"ARG[`",string_aa_key,"]"}; \
2874
                  if($bits(ARG[_aa_key]) <= 64) \
2875
                    void'(__m_uvm_status_container.comparer.compare_field_int(s, ARG[_aa_key], local_data__.ARG[_aa_key], $bits(ARG[_aa_key]), uvm_radix_enum'((FLAG)&UVM_RADIX))); \
2876
                  else \
2877
                    void'(__m_uvm_status_container.comparer.compare_field(s, ARG[_aa_key], local_data__.ARG[_aa_key], $bits(ARG[_aa_key]), uvm_radix_enum'((FLAG)&UVM_RADIX))); \
2878
                  __m_uvm_status_container.scope.unset_arg(string_aa_key); \
2879
                end \
2880
            end \
2881
           end \
2882
        UVM_COPY: \
2883
          begin \
2884
            if(!((FLAG)&UVM_NOCOPY) && (tmp_data__ != null) ) \
2885
            begin \
2886
              $cast(local_data__, tmp_data__); \
2887
              ARG.delete(); \
2888
              if(local_data__.ARG.first(aa_key)) \
2889
                do begin \
2890
                  ARG[aa_key] = local_data__.ARG[aa_key]; \
2891
                end while(local_data__.ARG.next(aa_key)); \
2892
            end \
2893
          end \
2894
        UVM_PRINT: \
2895
          if(!((FLAG)&UVM_NOPRINT)) begin \
2896
             `uvm_print_aa_int_key4(KEY,ARG, uvm_radix_enum'((FLAG)&(UVM_RADIX)), \
2897
                                    __m_uvm_status_container.printer) \
2898
          end \
2899
      endcase \
2900
    end \
2901
  end
2902
 
2903
 
2904
// M_UVM_FIELD_DATA_AA_enum_key
2905
// ----------------------------
2906
 
2907
`define M_UVM_FIELD_DATA_AA_enum_key(KEY, ARG, FLAG) \
2908
  begin \
2909
    begin \
2910
      KEY aa_key; \
2911
      case (what__) \
2912
        UVM_COMPARE: \
2913
           begin \
2914
            if(!((FLAG)&UVM_NOCOMPARE) && (tmp_data__ != null) ) \
2915
            begin \
2916
              $cast(local_data__, tmp_data__); \
2917
              if(ARG.num() != local_data__.ARG.num()) begin \
2918
                 int s1__, s2__; \
2919
                 __m_uvm_status_container.stringv = ""; \
2920
                 s1__ = ARG.num(); s2__ = local_data__.ARG.num(); \
2921
                 $swrite(__m_uvm_status_container.stringv, "lhs size = %0d : rhs size = %0d", \
2922
                    s1__, s2__);\
2923
                 __m_uvm_status_container.comparer.print_msg(__m_uvm_status_container.stringv); \
2924
              end \
2925
              foreach(ARG[_aa_key]) begin \
2926
                  void'(__m_uvm_status_container.comparer.compare_field_int({`"ARG[`",_aa_key.name(),"]"}, \
2927
                    ARG[_aa_key], local_data__.ARG[_aa_key], $bits(ARG[_aa_key]), \
2928
                    uvm_radix_enum'((FLAG)&UVM_RADIX) )); \
2929
                end \
2930
            end \
2931
           end \
2932
        UVM_COPY: \
2933
          begin \
2934
            if(!((FLAG)&UVM_NOCOPY) && (tmp_data__ != null) ) \
2935
            begin \
2936
              $cast(local_data__, tmp_data__); \
2937
              ARG=local_data__.ARG; \
2938
            end \
2939
          end \
2940
        UVM_PRINT: \
2941
          if(!((FLAG)&UVM_NOPRINT)) begin \
2942
            uvm_printer p__ = __m_uvm_status_container.printer; \
2943
            p__.print_array_header (`"ARG`", ARG.num(),`"aa_``KEY`"); \
2944
            if((p__.knobs.depth == -1) || (__m_uvm_status_container.printer.m_scope.depth() < p__.knobs.depth+1)) \
2945
            begin \
2946
              foreach(ARG[_aa_key]) \
2947
               begin \
2948
                  if ($bits(ARG[_aa_key]) > 64) \
2949
                    __m_uvm_status_container.printer.print_field( \
2950
                      {"[",_aa_key.name(),"]"}, ARG[_aa_key], $bits(ARG[_aa_key]), \
2951
                      uvm_radix_enum'((FLAG)&UVM_RADIX), "[" ); \
2952
                  else \
2953
                    __m_uvm_status_container.printer.print_field_int( \
2954
                      {"[",_aa_key.name(),"]"}, ARG[_aa_key], $bits(ARG[_aa_key]), \
2955
                      uvm_radix_enum'((FLAG)&UVM_RADIX), "[" ); \
2956
                end \
2957
            end \
2958
            p__.print_array_footer(ARG.num()); \
2959
            //p__.print_footer(); \
2960
          end \
2961
      endcase \
2962
    end \
2963
  end
2964
 
2965
 
2966
// M_UVM_FIELD_DATA_AA_object_string
2967
// -------------------------------
2968
 
2969
`define M_UVM_FIELD_DATA_AA_object_string(ARG, FLAG) \
2970
  begin \
2971
    begin \
2972
      case (what__) \
2973
        UVM_COMPARE: \
2974
           begin \
2975
            if(!((FLAG)&UVM_NOCOMPARE) && (tmp_data__ != null) ) \
2976
            begin \
2977
              $cast(local_data__, tmp_data__); \
2978
              if(ARG.num() != local_data__.ARG.num()) begin \
2979
                 int s1__, s2__; \
2980
                 __m_uvm_status_container.stringv = ""; \
2981
                 s1__ = ARG.num(); s2__ = local_data__.ARG.num(); \
2982
                 $swrite(__m_uvm_status_container.stringv, "lhs size = %0d : rhs size = %0d", \
2983
                          s1__, s2__);\
2984
                 __m_uvm_status_container.comparer.print_msg(__m_uvm_status_container.stringv); \
2985
              end \
2986
              string_aa_key = ""; \
2987
              while(ARG.next(string_aa_key)) begin \
2988
                uvm_object lhs; \
2989
                uvm_object rhs; \
2990
                lhs = ARG[string_aa_key]; \
2991
                rhs = local_data__.ARG[string_aa_key]; \
2992
                __m_uvm_status_container.scope.down({"[",string_aa_key,"]"}); \
2993
                //if the object are the same then don't need to do a deep compare \
2994
                if(rhs != lhs) begin \
2995
                  bit refcmp; \
2996
                  refcmp = ((FLAG)& UVM_SHALLOW) && !(__m_uvm_status_container.comparer.policy == UVM_DEEP); \
2997
                  //do a deep compare here  \
2998
                  if(!refcmp && !(__m_uvm_status_container.comparer.policy == UVM_REFERENCE)) begin \
2999
                    if(((rhs == null) && (lhs != null)) || ((lhs==null) && (rhs!=null))) begin \
3000
                      __m_uvm_status_container.comparer.print_msg_object(lhs, rhs); \
3001
                    end \
3002
                    else begin \
3003
                      if (lhs != null)  \
3004
                        void'(lhs.compare(rhs, __m_uvm_status_container.comparer)); \
3005
                    end \
3006
                  end \
3007
                  else begin //reference compare \
3008
                    __m_uvm_status_container.comparer.print_msg_object(lhs, rhs); \
3009
                  end \
3010
                end \
3011
                __m_uvm_status_container.scope.up_element(); \
3012
              end \
3013
            end \
3014
          end \
3015
        UVM_COPY: \
3016
          begin \
3017
           if(!((FLAG)&UVM_NOCOPY) && (tmp_data__ != null) ) \
3018
           begin \
3019
            $cast(local_data__, tmp_data__); \
3020
            ARG.delete(); \
3021
            foreach(local_data__.ARG[_string_aa_key]) begin\
3022
               if((FLAG)&UVM_REFERENCE) \
3023
                ARG[_string_aa_key] = local_data__.ARG[_string_aa_key]; \
3024
             /*else if((FLAG)&UVM_SHALLOW)*/ \
3025
             /* ARG[string_aa_key] = new local_data__.ARG[string_aa_key];*/ \
3026
               else begin\
3027
                $cast(ARG[_string_aa_key],local_data__.ARG[_string_aa_key].clone());\
3028
                ARG[_string_aa_key].set_name({`"ARG`","[",_string_aa_key, "]"});\
3029
               end \
3030
             end \
3031
           end \
3032
          end \
3033
        UVM_PRINT: \
3034
          if(!((FLAG)&UVM_NOPRINT)) begin \
3035
            `uvm_print_aa_string_object3(ARG, __m_uvm_status_container.printer,FLAG) \
3036
          end \
3037
      endcase \
3038
    end \
3039
  end
3040
 
3041
 
3042
// M_UVM_FIELD_DATA_AA_object_int
3043
// -------------------------------
3044
 
3045
`define M_UVM_FIELD_DATA_AA_object_int(ARG, FLAG) \
3046
  begin \
3047
    int key__; \
3048
    begin \
3049
      case (what__) \
3050
        UVM_COMPARE: \
3051
           begin \
3052
            if(!((FLAG)&UVM_NOCOMPARE) && (tmp_data__ != null) ) \
3053
            begin \
3054
              $cast(local_data__, tmp_data__); \
3055
              if(ARG.num() != local_data__.ARG.num()) begin \
3056
                 int s1__, s2__; \
3057
                 __m_uvm_status_container.stringv = ""; \
3058
                 s1__ = ARG.num(); s2__ = local_data__.ARG.num(); \
3059
                 $swrite(__m_uvm_status_container.stringv, "lhs size = %0d : rhs size = %0d", \
3060
                          s1__, s2__);\
3061
                 __m_uvm_status_container.comparer.print_msg(__m_uvm_status_container.stringv); \
3062
              end \
3063
              foreach(ARG[_key__]) begin \
3064
                  uvm_object lhs; \
3065
                  uvm_object rhs; \
3066
                  lhs = ARG[key__]; \
3067
                  rhs = local_data__.ARG[_key__]; \
3068
                  __m_uvm_status_container.scope.down_element(_key__); \
3069
                  if(rhs != lhs) begin \
3070
                    bit refcmp; \
3071
                    refcmp = ((FLAG)& UVM_SHALLOW) && !(__m_uvm_status_container.comparer.policy == UVM_DEEP); \
3072
                    //do a deep compare here  \
3073
                    if(!refcmp && !(__m_uvm_status_container.comparer.policy == UVM_REFERENCE)) begin \
3074
                      if(((rhs == null) && (lhs != null)) || ((lhs==null) && (rhs!=null))) begin \
3075
                        __m_uvm_status_container.comparer.print_msg_object(lhs, rhs); \
3076
                      end \
3077
                      else begin \
3078
                        if (lhs != null)  \
3079
                          void'(lhs.compare(rhs, __m_uvm_status_container.comparer)); \
3080
                      end \
3081
                    end \
3082
                    else begin //reference compare \
3083
                      __m_uvm_status_container.comparer.print_msg_object(lhs, rhs); \
3084
                    end \
3085
                  end \
3086
                  __m_uvm_status_container.scope.up_element(); \
3087
              end \
3088
            end \
3089
          end \
3090
        UVM_COPY: \
3091
          begin \
3092
           if(!((FLAG)&UVM_NOCOPY) && (tmp_data__ != null) ) \
3093
           begin \
3094
            $cast(local_data__, tmp_data__); \
3095
            ARG.delete(); \
3096
            foreach(local_data__.ARG[_key__]) begin \
3097
               if((FLAG)&UVM_REFERENCE) \
3098
                ARG[_key__] = local_data__.ARG[_key__]; \
3099
             /*else if((FLAG)&UVM_SHALLOW)*/ \
3100
             /* ARG[key__] = new local_data__.ARG[key__];*/ \
3101
               else begin\
3102
                 uvm_object tmp_obj; \
3103
                 tmp_obj = local_data__.ARG[_key__].clone(); \
3104
                 if(tmp_obj != null) \
3105
                   $cast(ARG[_key__], tmp_obj); \
3106
                 else \
3107
                   ARG[_key__]=null; \
3108
               end \
3109
             end \
3110
           end \
3111
         end \
3112
        UVM_PRINT: \
3113
          if(!((FLAG)&UVM_NOPRINT)) begin \
3114
             `uvm_print_aa_int_object3(ARG, __m_uvm_status_container.printer,FLAG) \
3115
          end \
3116
      endcase \
3117
    end \
3118
  end
3119
 
3120
 
3121
// M_UVM_FIELD_DATA_AA_string_string
3122
// -------------------------------
3123
 
3124
`define M_UVM_FIELD_DATA_AA_string_string(ARG, FLAG) \
3125
  begin \
3126
    begin \
3127
      case (what__) \
3128
        UVM_COPY: \
3129
          begin \
3130
            if(!((FLAG)&UVM_NOCOPY) && (local_data__ !=null)) \
3131
              ARG = local_data__.ARG ; \
3132
          end \
3133
        UVM_PRINT: \
3134
          if(!((FLAG)&UVM_NOPRINT)) begin \
3135
            `uvm_print_aa_string_string2(ARG, __m_uvm_status_container.printer) \
3136
          end \
3137
        UVM_COMPARE: \
3138
           begin \
3139
            if(!((FLAG)&UVM_NOCOMPARE) && (tmp_data__ != null) ) \
3140
            begin \
3141
              $cast(local_data__, tmp_data__); \
3142
              if(ARG.num() != local_data__.ARG.num()) begin \
3143
                 int s1__, s2__; \
3144
                 __m_uvm_status_container.stringv = ""; \
3145
                 s1__ = ARG.num(); s2__ = local_data__.ARG.num(); \
3146
                 $swrite(__m_uvm_status_container.stringv, "lhs size = %0d : rhs size = %0d", \
3147
                    s1__, s2__);\
3148
                 __m_uvm_status_container.comparer.print_msg(__m_uvm_status_container.stringv); \
3149
              end \
3150
              string_aa_key = ""; \
3151
              while(ARG.next(string_aa_key)) begin \
3152
                string s__ = ARG[string_aa_key]; \
3153
                __m_uvm_status_container.scope.set_arg({"[",string_aa_key,"]"}); \
3154
                if(ARG[string_aa_key] != local_data__.ARG[string_aa_key]) begin \
3155
                   __m_uvm_status_container.stringv = { "lhs = \"", s__, "\" : rhs = \"", local_data__.ARG[string_aa_key], "\""}; \
3156
                   __m_uvm_status_container.comparer.print_msg(__m_uvm_status_container.stringv); \
3157
                end \
3158
                __m_uvm_status_container.scope.unset_arg(string_aa_key); \
3159
              end \
3160
            end \
3161
           end \
3162
      endcase \
3163
    end \
3164
  end
3165
 
3166
 
3167
// M_UVM_FIELD_SET_AA_TYPE
3168
// -----------------------
3169
 
3170
`define M_UVM_FIELD_SET_AA_TYPE(INDEX_TYPE, ARRAY_TYPE, ARRAY, RHS, FLAG) \
3171
  if((what__ >= UVM_START_FUNCS && what__ <= UVM_END_FUNCS) && (((FLAG)&UVM_READONLY) == 0)) begin \
3172
    bit wildcard_index__; \
3173
    INDEX_TYPE index__; \
3174
    index__ = uvm_get_array_index_``INDEX_TYPE(str__, wildcard_index__); \
3175
    if(what__==UVM_SET``ARRAY_TYPE) \
3176
    begin \
3177
      __m_uvm_status_container.scope.down(`"ARRAY`"); \
3178
      if(uvm_is_array(str__) ) begin\
3179
        if(wildcard_index__) begin \
3180
          if(ARRAY.first(index__)) \
3181
          do begin \
3182
            if(uvm_is_match(str__, {__m_uvm_status_container.scope.get(),$sformatf("[%0d]", index__)}) ||  \
3183
               uvm_is_match(str__, {__m_uvm_status_container.scope.get(),$sformatf("[%0s]", index__)})) begin \
3184
              ARRAY[index__] = RHS; \
3185
              __m_uvm_status_container.status = 1; \
3186
            end \
3187
          end while(ARRAY.next(index__));\
3188
        end \
3189
        else if(uvm_is_match(str__, {__m_uvm_status_container.scope.get(),$sformatf("[%0d]", index__)})) begin \
3190
          ARRAY[index__] = RHS; \
3191
          __m_uvm_status_container.status = 1; \
3192
        end \
3193
        else if(uvm_is_match(str__, {__m_uvm_status_container.scope.get(),$sformatf("[%0s]", index__)})) begin \
3194
          ARRAY[index__] = RHS; \
3195
          __m_uvm_status_container.status = 1; \
3196
        end \
3197
      end \
3198
      __m_uvm_status_container.scope.up(); \
3199
    end \
3200
 end
3201
 
3202
 
3203
// M_UVM_FIELD_SET_AA_OBJECT_TYPE
3204
// ------------------------------
3205
 
3206
`define M_UVM_FIELD_SET_AA_OBJECT_TYPE(INDEX_TYPE, ARRAY, FLAG) \
3207
  if((what__ >= UVM_START_FUNCS && what__ <= UVM_END_FUNCS) && (((FLAG)&UVM_READONLY) == 0)) begin \
3208
    bit wildcard_index__; \
3209
    INDEX_TYPE index__; \
3210
    index__ = uvm_get_array_index_``INDEX_TYPE(str__, wildcard_index__); \
3211
    if(what__==UVM_SETOBJ) \
3212
    begin \
3213
      __m_uvm_status_container.scope.down(`"ARRAY`"); \
3214
      if(uvm_is_array(str__) ) begin\
3215
        if(wildcard_index__) begin \
3216
          foreach(ARRAY[_index__]) begin \
3217
            if(uvm_is_match(str__, {__m_uvm_status_container.scope.get(),$sformatf("[%0d]", _index__)}) || \
3218
               uvm_is_match(str__, {__m_uvm_status_container.scope.get(),$sformatf("[%0s]", _index__)})) begin \
3219
              if (__m_uvm_status_container.object != null) \
3220
                $cast(ARRAY[_index__], __m_uvm_status_container.object); \
3221
              __m_uvm_status_container.status = 1; \
3222
            end \
3223
          end \
3224
        end \
3225
        else if(uvm_is_match(str__, {__m_uvm_status_container.scope.get(),$sformatf("[%0d]", index__)})) begin \
3226
          if (__m_uvm_status_container.object != null) \
3227
            $cast(ARRAY[index__], __m_uvm_status_container.object); \
3228
          __m_uvm_status_container.status = 1; \
3229
        end \
3230
        else if(uvm_is_match(str__, {__m_uvm_status_container.scope.get(),$sformatf("[%0s]", index__)})) begin \
3231
          if (__m_uvm_status_container.object != null) \
3232
            $cast(ARRAY[index__], __m_uvm_status_container.object); \
3233
          __m_uvm_status_container.status = 1; \
3234
        end \
3235
      end \
3236
      __m_uvm_status_container.scope.up(); \
3237
    end \
3238
 end
3239
 
3240
 
3241
// M_UVM_FIELD_SET_AA_INT_TYPE
3242
// ---------------------------
3243
 
3244
`define M_UVM_FIELD_SET_AA_INT_TYPE(INDEX_TYPE, ARRAY_TYPE, ARRAY, RHS, FLAG) \
3245
  if((what__ >= UVM_START_FUNCS && what__ <= UVM_END_FUNCS) && (((FLAG)&UVM_READONLY) == 0)) begin \
3246
    bit wildcard_index__; \
3247
    INDEX_TYPE index__; \
3248
    string idx__; \
3249
    index__ = uvm_get_array_index_int(str__, wildcard_index__); \
3250
    if(what__==UVM_SET``ARRAY_TYPE) \
3251
    begin \
3252
      __m_uvm_status_container.scope.down(`"ARRAY`"); \
3253
      if(uvm_is_array(str__) ) begin\
3254
        if(wildcard_index__) begin \
3255
          foreach(ARRAY[_index__]) begin \
3256
            $swrite(idx__, __m_uvm_status_container.scope.get(), "[", _index__, "]"); \
3257
            if(uvm_is_match(str__, idx__)) begin \
3258
              ARRAY[_index__] = RHS; \
3259
              __m_uvm_status_container.status = 1; \
3260
            end \
3261
          end \
3262
        end \
3263
        else if(uvm_is_match(str__, {__m_uvm_status_container.scope.get(),$sformatf("[%0d]", index__)})) begin \
3264
          ARRAY[index__] = RHS; \
3265
          __m_uvm_status_container.status = 1; \
3266
        end  \
3267
      end \
3268
      __m_uvm_status_container.scope.up(); \
3269
    end \
3270
 end
3271
 
3272
 
3273
// M_UVM_FIELD_SET_AA_INT_ENUMTYPE
3274
// -------------------------------
3275
 
3276
`define M_UVM_FIELD_SET_AA_INT_ENUMTYPE(INDEX_TYPE, ARRAY_TYPE, ARRAY, RHS, FLAG) \
3277
  if((what__ >= UVM_START_FUNCS && what__ <= UVM_END_FUNCS) && (((FLAG)&UVM_READONLY) == 0)) begin \
3278
    bit wildcard_index__; \
3279
    INDEX_TYPE index__; \
3280
    string idx__; \
3281
    index__ = INDEX_TYPE'(uvm_get_array_index_int(str__, wildcard_index__)); \
3282
    if(what__==UVM_SET``ARRAY_TYPE) \
3283
    begin \
3284
      __m_uvm_status_container.scope.down(`"ARRAY`"); \
3285
      if(uvm_is_array(str__) ) begin\
3286
        if(wildcard_index__) begin \
3287
          foreach(ARRAY[_index__]) begin \
3288
            $swrite(idx__, __m_uvm_status_container.scope.get(), "[", _index__, "]"); \
3289
            if(uvm_is_match(str__, idx__)) begin \
3290
              ARRAY[_index__] = RHS; \
3291
              __m_uvm_status_container.status = 1; \
3292
            end \
3293
          end \
3294
        end \
3295
        else if(uvm_is_match(str__, {__m_uvm_status_container.scope.get(),$sformatf("[%0d]", index__)})) begin \
3296
          ARRAY[index__] = RHS; \
3297
          __m_uvm_status_container.status = 1; \
3298
        end  \
3299
      end \
3300
      __m_uvm_status_container.scope.up(); \
3301
    end \
3302
 end
3303
 
3304
`endif //!UVM_EMPTY_MACROS
3305
 
3306
 
3307
 
3308
 
3309
//------------------------------------------------------------------------------
3310
// Group: Recording Macros
3311
//
3312
// The recording macros assist users who implement the 
3313
// method. They help ensure that the fields are recorded using a vendor-
3314
// independent API. Unlike the  policy, fields recorded using
3315
// the macros do not lose type information--they are passed
3316
// directly to the vendor-specific API. This results in more efficient recording
3317
// and no artificial limit on bit-widths. See your simulator vendor's
3318
// documentation for more information on its transaction recording capabilities.
3319
//------------------------------------------------------------------------------
3320
 
3321
// Macro: `uvm_record_attribute
3322
//
3323
// Vendor-independent macro to hide tool-specific interface for
3324
// recording attributes (fields) to a transaction database.
3325
//
3326
//| `uvm_record_attribute(TR_HANDLE, NAME, VALUE)
3327
//
3328
// The default implementation of the macro passes ~NAME~ and
3329
// ~VALUE~ through to the  method.
3330
//
3331
// This macro should not be called directly by the user, the
3332
// other recording macros will call it automatically if
3333
//  returns true.
3334
//
3335
 
3336
`ifndef uvm_record_attribute
3337
 `ifdef QUESTA
3338
    `define uvm_record_attribute(TR_HANDLE,NAME,VALUE) \
3339
      $add_attribute(TR_HANDLE,VALUE,NAME);
3340
  `else
3341
    `define uvm_record_attribute(TR_HANDLE,NAME,VALUE) \
3342
      recorder.record_generic(NAME, $sformatf("%p", VALUE));
3343
  `endif
3344
`endif
3345
 
3346
// Macro: `uvm_record_int
3347
//
3348
//| `uvm_record_int(NAME,VALUE,SIZE[,RADIX])
3349
//
3350
// The ~`uvm_record_int~ macro takes the same arguments as
3351
// the  method (including the optional ~RADIX~).
3352
//
3353
// The default implementation will pass the name/value pair to
3354
// <`uvm_record_attribute> if enabled, otherwise the information
3355
// will be passed to .
3356
//
3357
 
3358
`ifndef uvm_record_int
3359
  `define uvm_record_int(NAME,VALUE,SIZE,RADIX = UVM_NORADIX) \
3360
    if (recorder != null && recorder.is_open()) begin \
3361
      if (recorder.use_record_attribute()) \
3362
        `uvm_record_attribute(recorder.get_record_attribute_handle(),NAME,VALUE) \
3363
      else \
3364
        if (SIZE > 64) \
3365
          recorder.record_field(NAME, VALUE, SIZE, RADIX); \
3366
        else \
3367
          recorder.record_field_int(NAME, VALUE, SIZE, RADIX); \
3368
    end
3369
`endif
3370
 
3371
// Macro: `uvm_record_string
3372
//
3373
//| `uvm_record_string(NAME,VALUE)
3374
//
3375
// The ~`uvm_record_string~ macro takes the same arguments as
3376
// the  method.
3377
//
3378
// The default implementation will pass the name/value pair to
3379
// <`uvm_record_attribute> if enabled, otherwise the information
3380
// will be passed to .
3381
//
3382
 
3383
`ifndef uvm_record_string
3384
  `define uvm_record_string(NAME,VALUE) \
3385
    if (recorder != null && recorder.is_open()) begin \
3386
      if (recorder.use_record_attribute()) \
3387
        `uvm_record_attribute(recorder.get_record_attribute_handle(),NAME,VALUE) \
3388
      else \
3389
        recorder.record_string(NAME,VALUE); \
3390
    end
3391
`endif
3392
 
3393
// Macro: `uvm_record_time
3394
//
3395
//| `uvm_record_time(NAME,VALUE)
3396
//
3397
// The ~`uvm_record_time~ macro takes the same arguments as
3398
// the  method.
3399
//
3400
// The default implementation will pass the name/value pair to
3401
// <`uvm_record_attribute> if enabled, otherwise the information
3402
// will be passed to .
3403
//
3404
`ifndef uvm_record_time
3405
  `define uvm_record_time(NAME,VALUE) \
3406
    if (recorder != null && recorder.is_open()) begin \
3407
      if (recorder.use_record_attribute()) \
3408
        `uvm_record_attribute(recorder.get_record_attribute_handle(),NAME,VALUE) \
3409
      else \
3410
         recorder.record_time(NAME,VALUE); \
3411
    end
3412
`endif
3413
 
3414
 
3415
// Macro: `uvm_record_real
3416
//
3417
//| `uvm_record_real(NAME,VALUE)
3418
//
3419
// The ~`uvm_record_real~ macro takes the same arguments as
3420
// the  method.
3421
//
3422
// The default implementation will pass the name/value pair to
3423
// <`uvm_record_attribute> if enabled, otherwise the information
3424
// will be passed to .
3425
//
3426
`ifndef uvm_record_real
3427
  `define uvm_record_real(NAME,VALUE) \
3428
    if (recorder != null && recorder.is_open()) begin \
3429
      if (recorder.use_record_attribute()) \
3430
        `uvm_record_attribute(recorder.get_record_attribute_handle(),NAME,VALUE) \
3431
      else \
3432
        recorder.record_field_real(NAME,VALUE); \
3433
    end
3434
`endif
3435
 
3436
// Macro: `uvm_record_field
3437
//
3438
// Macro for recording arbitrary name-value pairs into a transaction recording database.
3439
// Requires a valid transaction handle, as provided by the
3440
//  and  methods.
3441
//
3442
//| `uvm_record_field(NAME, VALUE)
3443
//
3444
// The default implementation will pass the name/value pair to
3445
// <`uvm_record_attribute> if enabled, otherwise the information
3446
// will be passed to , with the
3447
// ~VALUE~ being converted to a string using "%p" notation.
3448
//
3449
// | recorder.record_generic(NAME,$sformatf("%p",VALUE));
3450
//
3451
`define uvm_record_field(NAME,VALUE) \
3452
   if (recorder != null && recorder.is_open()) begin \
3453
     if (recorder.use_record_attribute()) begin \
3454
       `uvm_record_attribute(recorder.get_record_attribute_handle(),NAME,VALUE) \
3455
     end \
3456
     else \
3457
       recorder.record_generic(NAME, $sformatf("%p", VALUE)); \
3458
   end
3459
 
3460
 
3461
//------------------------------------------------------------------------------
3462
// Group: Packing Macros
3463
//
3464
// The packing macros assist users who implement the 
3465
// method. They help ensure that the pack operation is the exact inverse of the
3466
// unpack operation. See also .
3467
//
3468
//| virtual function void do_pack(uvm_packer packer);
3469
//|   `uvm_pack_int(cmd)
3470
//|   `uvm_pack_int(addr)
3471
//|   `uvm_pack_array(data)
3472
//| endfunction
3473
//
3474
// The 'N' versions of these macros take a explicit size argument, which must
3475
// be compile-time constant value greater than 0.
3476
//------------------------------------------------------------------------------
3477
 
3478
//--------------------------------
3479
// Group: Packing - With Size Info
3480
//--------------------------------
3481
 
3482
// Macro: `uvm_pack_intN
3483
//
3484
// Pack an integral variable.
3485
//
3486
//| `uvm_pack_intN(VAR,SIZE)
3487
//
3488
 
3489
`define uvm_pack_intN(VAR,SIZE) \
3490
  begin \
3491
   int __array[]; \
3492
   begin \
3493
     bit [SIZE-1:0] __vector = VAR; \
3494
     { << int { __array }} = {{($bits(int) - (SIZE % $bits(int))) {1'b0}}, __vector}; \
3495
   end \
3496
   packer.pack_ints(__array, SIZE); \
3497
  end
3498
 
3499
// Macro: `uvm_pack_enumN
3500
//
3501
// Pack an integral variable.
3502
//
3503
//| `uvm_pack_enumN(VAR,SIZE)
3504
//
3505
`define uvm_pack_enumN(VAR,SIZE) \
3506
   `uvm_pack_intN(VAR,SIZE)
3507
 
3508
 
3509
// Macro: `uvm_pack_sarrayN
3510
//
3511
// Pack a static array of integrals.
3512
//
3513
//| `uvm_pack_sarray(VAR,SIZE)
3514
//
3515
`define uvm_pack_sarrayN(VAR,SIZE) \
3516
    begin \
3517
    foreach (VAR `` [index]) \
3518
      `uvm_pack_intN(VAR[index],SIZE) \
3519
    end
3520
 
3521
 
3522
// Macro: `uvm_pack_arrayN
3523
//
3524
// Pack a dynamic array of integrals.
3525
//
3526
//| `uvm_pack_arrayN(VAR,SIZE)
3527
//
3528
`define uvm_pack_arrayN(VAR,SIZE) \
3529
    begin \
3530
    if (packer.use_metadata) \
3531
      `uvm_pack_intN(VAR.size(),32) \
3532
    `uvm_pack_sarrayN(VAR,SIZE) \
3533
    end
3534
 
3535
 
3536
// Macro: `uvm_pack_queueN
3537
//
3538
// Pack a queue of integrals.
3539
//
3540
//| `uvm_pack_queueN(VAR,SIZE)
3541
//
3542
`define uvm_pack_queueN(VAR,SIZE) \
3543
   `uvm_pack_arrayN(VAR,SIZE)
3544
 
3545
 
3546
//------------------------------
3547
// Group: Packing - No Size Info
3548
//------------------------------
3549
 
3550
// Macro: `uvm_pack_int
3551
//
3552
// Pack an integral variable without having to also specify the bit size.
3553
//
3554
//| `uvm_pack_int(VAR)
3555
//
3556
`define uvm_pack_int(VAR) \
3557
   `uvm_pack_intN(VAR,$bits(VAR))
3558
 
3559
 
3560
// Macro: `uvm_pack_enum
3561
//
3562
// Pack an enumeration value. Packing does not require its type be specified.
3563
//
3564
//| `uvm_pack_enum(VAR)
3565
//
3566
`define uvm_pack_enum(VAR) \
3567
   `uvm_pack_enumN(VAR,$bits(VAR))
3568
 
3569
 
3570
// Macro: `uvm_pack_string
3571
//
3572
// Pack a string variable.
3573
//
3574
//| `uvm_pack_string(VAR)
3575
//
3576
`define uvm_pack_string(VAR) \
3577
    begin \
3578
    `uvm_pack_sarrayN(VAR,8) \
3579
    if (packer.use_metadata) \
3580
      `uvm_pack_intN(8'b0,8) \
3581
    end
3582
 
3583
 
3584
// Macro: `uvm_pack_real
3585
//
3586
// Pack a variable of type real.
3587
//
3588
//| `uvm_pack_real(VAR)
3589
//
3590
`define uvm_pack_real(VAR) \
3591
   `uvm_pack_intN($realtobits(VAR),64)
3592
 
3593
 
3594
// Macro: `uvm_pack_sarray
3595
//
3596
// Pack a static array without having to also specify the bit size
3597
// of its elements.
3598
//
3599
//| `uvm_pack_sarray(VAR)
3600
//
3601
`define uvm_pack_sarray(VAR)  \
3602
   `uvm_pack_sarrayN(VAR,$bits(VAR[0]))
3603
 
3604
 
3605
// Macro: `uvm_pack_array
3606
//
3607
// Pack a dynamic array without having to also specify the bit size
3608
// of its elements. Array size must be non-zero.
3609
//
3610
//| `uvm_pack_array(VAR)
3611
//
3612
`define uvm_pack_array(VAR) \
3613
   `uvm_pack_arrayN(VAR,$bits(VAR[0]))
3614
 
3615
 
3616
// Macro: `uvm_pack_queue
3617
//
3618
// Pack a queue without having to also specify the bit size
3619
// of its elements. Queue must not be empty.
3620
//
3621
//| `uvm_pack_queue(VAR)
3622
//
3623
`define uvm_pack_queue(VAR) \
3624
   `uvm_pack_queueN(VAR,$bits(VAR[0]))
3625
 
3626
 
3627
 
3628
//------------------------------------------------------------------------------
3629
// Group: Unpacking Macros
3630
//
3631
// The unpacking macros assist users who implement the 
3632
// method. They help ensure that the unpack operation is the exact inverse of
3633
// the pack operation. See also .
3634
//
3635
//| virtual function void do_unpack(uvm_packer packer);
3636
//|   `uvm_unpack_enum(cmd,cmd_t)
3637
//|   `uvm_unpack_int(addr)
3638
//|   `uvm_unpack_array(data)
3639
//| endfunction
3640
//
3641
// The 'N' versions of these macros take a explicit size argument, which must
3642
// be a compile-time constant value greater than 0.
3643
//------------------------------------------------------------------------------
3644
 
3645
//----------------------------------
3646
// Group: Unpacking - With Size Info
3647
//----------------------------------
3648
 
3649
// Macro: `uvm_unpack_intN
3650
//
3651
// Unpack into an integral variable.
3652
//
3653
//| `uvm_unpack_intN(VAR,SIZE)
3654
//
3655
`define uvm_unpack_intN(VAR,SIZE) \
3656
   begin \
3657
      int __array[] = new[(SIZE+31)/32]; \
3658
      bit [(((SIZE + 31) / 32) * 32) - 1:0] __var; \
3659
      packer.unpack_ints(__array, SIZE); \
3660
      __var = { << int { __array }}; \
3661
      VAR = __var; \
3662
   end
3663
 
3664
 
3665
// Macro: `uvm_unpack_enumN
3666
//
3667
// Unpack enum of type ~TYPE~ into ~VAR~.
3668
//
3669
// `uvm_unpack_enumN(VAR,SIZE,TYPE)
3670
//
3671
`define uvm_unpack_enumN(VAR,SIZE,TYPE) \
3672
   begin \
3673
   if (packer.big_endian) \
3674
     { << { VAR }} = packer.m_bits[packer.count +: SIZE];  \
3675
   else \
3676
     VAR = TYPE'(packer.m_bits[packer.count +: SIZE]); \
3677
   \
3678
   packer.count += SIZE; \
3679
   end
3680
 
3681
 
3682
// Macro: `uvm_unpack_sarrayN
3683
//
3684
// Unpack a static (fixed) array of integrals.
3685
//
3686
//| `uvm_unpack_sarrayN(VAR,SIZE)
3687
//
3688
`define uvm_unpack_sarrayN(VAR,SIZE) \
3689
    begin \
3690
    foreach (VAR `` [i]) \
3691
      `uvm_unpack_intN(VAR``[i], SIZE) \
3692
    end
3693
 
3694
 
3695
// Macro: `uvm_unpack_arrayN
3696
//
3697
// Unpack into a dynamic array of integrals.
3698
//
3699
//| `uvm_unpack_arrayN(VAR,SIZE)
3700
//
3701
`define uvm_unpack_arrayN(VAR,SIZE) \
3702
    begin \
3703
    int sz__; \
3704
    if (packer.use_metadata) begin \
3705
      `uvm_unpack_intN(sz__,32) \
3706
      VAR = new[sz__]; \
3707
    end \
3708
    `uvm_unpack_sarrayN(VAR,SIZE) \
3709
    end
3710
 
3711
 
3712
// Macro: `uvm_unpack_queueN
3713
//
3714
// Unpack into a queue of integrals.
3715
//
3716
//| `uvm_unpack_queue(VAR,SIZE)
3717
//
3718
`define uvm_unpack_queueN(VAR,SIZE) \
3719
    begin \
3720
    int sz__; \
3721
    if (packer.use_metadata) \
3722
      `uvm_unpack_intN(sz__,32) \
3723
    while (VAR.size() > sz__) \
3724
      void'(VAR.pop_back()); \
3725
    for (int i=0; i
3726
      `uvm_unpack_intN(VAR[i],SIZE) \
3727
    end
3728
 
3729
 
3730
//--------------------------------
3731
// Group: Unpacking - No Size Info
3732
//--------------------------------
3733
 
3734
 
3735
// Macro: `uvm_unpack_int
3736
//
3737
// Unpack an integral variable without having to also specify the bit size.
3738
//
3739
//| `uvm_unpack_int(VAR)
3740
//
3741
`define uvm_unpack_int(VAR) \
3742
   `uvm_unpack_intN(VAR,$bits(VAR))
3743
 
3744
 
3745
// Macro: `uvm_unpack_enum
3746
//
3747
// Unpack an enumeration value, which requires its type be specified.
3748
//
3749
//| `uvm_unpack_enum(VAR,TYPE)
3750
//
3751
`define uvm_unpack_enum(VAR,TYPE) \
3752
   `uvm_unpack_enumN(VAR,$bits(VAR),TYPE)
3753
 
3754
 
3755
// Macro: `uvm_unpack_string
3756
//
3757
// Unpack a string variable.
3758
//
3759
//| `uvm_unpack_string(VAR)
3760
//
3761
`define uvm_unpack_string(VAR) \
3762
  VAR = packer.unpack_string();
3763
 
3764
// Macro: `uvm_unpack_real
3765
//
3766
// Unpack a variable of type real.
3767
//
3768
//| `uvm_unpack_real(VAR)
3769
//
3770
`define uvm_unpack_real(VAR) \
3771
   begin \
3772
   longint unsigned real_bits64__; \
3773
   `uvm_unpack_intN(real_bits64__,64) \
3774
   VAR = $bitstoreal(real_bits64__); \
3775
   end
3776
 
3777
 
3778
// Macro: `uvm_unpack_sarray
3779
//
3780
// Unpack a static array without having to also specify the bit size
3781
// of its elements.
3782
//
3783
// | `uvm_unpack_sarray(VAR)
3784
//
3785
`define uvm_unpack_sarray(VAR)  \
3786
   `uvm_unpack_sarrayN(VAR,$bits(VAR[0]))
3787
 
3788
 
3789
// Macro: `uvm_unpack_array
3790
//
3791
// Unpack a dynamic array without having to also specify the bit size
3792
// of its elements. Array size must be non-zero.
3793
//
3794
//| `uvm_unpack_array(VAR)
3795
//
3796
`define uvm_unpack_array(VAR) \
3797
   `uvm_unpack_arrayN(VAR,$bits(VAR[0]))
3798
 
3799
 
3800
// Macro: `uvm_unpack_queue
3801
//
3802
// Unpack a queue without having to also specify the bit size
3803
// of its elements. Queue must not be empty.
3804
//
3805
//| `uvm_unpack_queue(VAR)
3806
//
3807
`define uvm_unpack_queue(VAR) \
3808
   `uvm_unpack_queueN(VAR,$bits(VAR[0]))
3809
 
3810
 
3811
 
3812
`endif  // UVM_OBJECT_DEFINES_SVH
3813
 
3814
 

powered by: WebSVN 2.1.0

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