00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 `ifndef OVM_OBJECT_DEFINES_SVH
00021 `define OVM_OBJECT_DEFINES_SVH
00022
00023 `ifdef OVM_EMPTY_MACROS
00024
00025 `define ovm_field_utils
00026 `define ovm_field_utils_begin(T)
00027 `define ovm_field_utils_end
00028 `define ovm_object_utils(T)
00029 `define ovm_object_utils_begin(T)
00030 `define ovm_object_utils_end
00031 `define ovm_component_utils(T)
00032 `define ovm_component_utils_begin(T)
00033 `define ovm_component_utils_end
00034 `define ovm_field_int(ARG,FLAG)
00035 `define ovm_field_object(ARG,FLAG)
00036 `define ovm_field_event(ARG,FLAG)
00037 `define ovm_field_string(ARG,FLAG)
00038 `define ovm_field_array_int(ARG,FLAG)
00039 `define ovm_field_array_object(ARG,FLAG)
00040 `define ovm_field_array_string(ARG,FLAG)
00041 `define ovm_field_queue_int(ARG,FLAG)
00042 `define ovm_field_queue_object(ARG,FLAG)
00043 `define ovm_field_queue_string(ARG,FLAG)
00044 `define ovm_field_aa_int_string(ARG, FLAG)
00045 `define ovm_field_aa_string_string(ARG, FLAG)
00046 `define ovm_field_aa_object_string(ARG, FLAG)
00047 `define ovm_field_aa_int_int(ARG, FLAG)
00048 `define ovm_field_aa_int_int(ARG, FLAG)
00049 `define ovm_field_aa_int_int_unsigned(ARG, FLAG)
00050 `define ovm_field_aa_int_integer(ARG, FLAG)
00051 `define ovm_field_aa_int_integer_unsigned(ARG, FLAG)
00052 `define ovm_field_aa_int_byte(ARG, FLAG)
00053 `define ovm_field_aa_int_byte_unsigned(ARG, FLAG)
00054 `define ovm_field_aa_int_shortint(ARG, FLAG)
00055 `define ovm_field_aa_int_shortint_unsigned(ARG, FLAG)
00056 `define ovm_field_aa_int_longint(ARG, FLAG)
00057 `define ovm_field_aa_int_longint_unsigned(ARG, FLAG)
00058 `define ovm_field_aa_int_key(KEY, ARG, FLAG)
00059 `define ovm_field_aa_string_int(ARG, FLAG)
00060 `define ovm_field_aa_object_int(ARG, FLAG)
00061
00062 `else
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076 `define ovm_field_utils
00077
00078
00079
00080
00081
00082 `define ovm_field_utils_begin(T) \
00083 static bit m_fields_checked = 0; \
00084 function void m_field_automation (ovm_object tmp_data__=null, \
00085 int what__=0, \
00086 string str__=""); \
00087 begin \
00088 T local_data__; \
00089 string string_aa_key; \
00090 \
00091 if(what__ == OVM_CHECK_FIELDS) begin \
00092 if(! T``::m_fields_checked) \
00093 T``::m_fields_checked=1; \
00094 else \
00095 return; \
00096 end \
00097 \
00098 if(tmp_data__ != null) $cast(local_data__, tmp_data__); \
00099 super.m_field_automation(tmp_data__, what__, str__); \
00100 if(what__ == OVM_CHECK_FIELDS) begin \
00101 m_field_array.delete(); \
00102 end
00103
00104
00105
00106
00107 `define ovm_field_utils_end \
00108 end \
00109 endfunction \
00110
00111
00112
00113
00114
00115
00116
00117 `define ovm_object_utils(T) \
00118 `ovm_object_utils_begin(T) \
00119 `ovm_object_utils_end
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131 `define ovm_object_utils_begin(T) \
00132 `ovm_object_registry(T,T) \
00133 `ovm_object_create_func(T) \
00134 `ovm_get_type_name_func(T) \
00135 `ovm_field_utils_begin(T)
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145 `define ovm_object_utils_end \
00146 end \
00147 endfunction \
00148
00149
00150
00151
00152
00153
00154
00155 `define ovm_component_utils(T) \
00156 `ovm_component_utils_begin(T) \
00157 `ovm_component_utils_end
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169 `define ovm_component_utils_begin(T) \
00170 `ovm_component_registry(T,T) \
00171 `ovm_get_type_name_func(T) \
00172 `ovm_field_utils_begin(T)
00173
00174
00175
00176
00177
00178
00179 `define ovm_component_utils_end \
00180 end \
00181 endfunction
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203 `define ovm_field_int(ARG,FLAG) \
00204 begin \
00205 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00206 m_sc.scope.set_arg(`"ARG`"); \
00207 `OVM_FIELD_DATA(ARG,FLAG) \
00208 `OVM_FIELD_SET(ARG,FLAG) \
00209 m_sc.scope.unset_arg(`"ARG`"); \
00210 end
00211
00212
00213 `define ovm_field_enum(T,ARG,FLAG) \
00214 begin \
00215 m_sc.scope.set_arg(`"ARG`"); \
00216 `OVM_FIELD_ENUM(T,ARG,FLAG) \
00217 m_sc.scope.unset_arg(`"ARG`"); \
00218 end
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230 `define ovm_field_object(ARG,FLAG) \
00231 if((ARG==null) || !m_sc.scope.in_hierarchy(ARG)) begin \
00232 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00233 m_sc.scope.down(`"ARG`", ARG); \
00234 `OVM_FIELD_DATA_OBJECT(ARG,FLAG) \
00235 `OVM_FIELD_SET_OBJECT(ARG,FLAG) \
00236 m_sc.scope.up(ARG); \
00237 end
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249 `define ovm_field_event(ARG,FLAG) \
00250 begin \
00251 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00252 m_sc.scope.down(`"ARG`", null); \
00253 `OVM_FIELD_DATA_EVENT(ARG,FLAG) \
00254 m_sc.scope.up(null); \
00255 end
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267 `define ovm_field_string(ARG,FLAG) \
00268 begin \
00269 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00270 m_sc.scope.down(`"ARG`",null); \
00271 `OVM_FIELD_DATA_STRING(ARG,FLAG) \
00272 `OVM_FIELD_SET_STRING(ARG,FLAG) \
00273 m_sc.scope.up(null); \
00274 end
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286 `define ovm_field_array_int(ARG,FLAG) \
00287 begin \
00288 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00289 m_sc.scope.down(`"ARG`",null); \
00290 if(what__==OVM_COPY && !((FLAG)&OVM_NOCOPY)) begin \
00291 if(local_data__!=null) begin \
00292 ARG = new [local_data__.ARG.size()](local_data__.ARG); \
00293 end \
00294 else begin \
00295 ARG.delete(); \
00296 end \
00297 end \
00298 `OVM_FIELD_DATA_ARRAY(ARG,FLAG) \
00299 `OVM_FIELD_ARRAY_INT_PACK(ARG,FLAG) \
00300 `OVM_FIELD_SET_ARRAY_TYPE(INT, ARG, m_sc.bitstream, FLAG) \
00301 m_sc.scope.up(null); \
00302 end
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313 `define ovm_field_sarray_int(ARG,FLAG) \
00314 begin \
00315 end
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334 `define ovm_field_array_object(ARG,FLAG) \
00335 begin \
00336 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00337 m_sc.scope.down(`"ARG`", null); \
00338 if(what__==OVM_COPY && !((FLAG)&OVM_NOCOPY)) begin \
00339 if(local_data__!=null) begin \
00340 ARG = new[local_data__.ARG.size()]; \
00341 end \
00342 else begin \
00343 ARG.delete(); \
00344 end \
00345 end \
00346 `OVM_FIELD_DATA_ARRAY_OBJECT(ARG,FLAG) \
00347 `OVM_FIELD_ARRAY_OBJ_PACK(ARG,FLAG) \
00348 `OVM_FIELD_SET_ARRAY_OBJECT(ARG,FLAG) \
00349 m_sc.scope.up(null); \
00350 end
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362 `define ovm_field_array_string(ARG,FLAG) \
00363 begin \
00364 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00365 m_sc.scope.down(`"ARG`", null); \
00366 if(what__==OVM_COPY && !((FLAG)&OVM_NOCOPY)) begin \
00367 if(local_data__!=null) begin \
00368 ARG = new[local_data__.ARG.size()]; \
00369 end \
00370 else begin \
00371 ARG.delete(); \
00372 end \
00373 end \
00374 `OVM_FIELD_DATA_ARRAY_STRING(ARG,FLAG) \
00375 `OVM_FIELD_ARRAY_STR_PACK(ARG,FLAG) \
00376 `OVM_FIELD_SET_ARRAY_TYPE(STR, ARG, m_sc.stringv, FLAG) \
00377 m_sc.scope.up(null); \
00378 end
00379
00380
00381
00382 `define ovm_field_queue_int(ARG,FLAG) \
00383 begin \
00384 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00385 m_sc.scope.down(`"ARG`", null); \
00386 if(what__==OVM_COPY && !((FLAG)&OVM_NOCOPY)) begin \
00387 if(local_data__!=null) begin \
00388 `RESIZE_QUEUE_NOCOPY(ovm_bitstream_t, ARG, local_data__.ARG.size()) \
00389 end \
00390 else begin \
00391 `RESIZE_QUEUE_NOCOPY(ovm_bitstream_t, ARG, 0) \
00392 end \
00393 end \
00394 `OVM_FIELD_DATA_ARRAY(ARG,FLAG) \
00395 `OVM_FIELD_QUEUE_INT_PACK(ARG,FLAG) \
00396 `OVM_FIELD_SET_QUEUE_TYPE(INT, ARG, m_sc.bitstream, FLAG) \
00397 m_sc.scope.up(null); \
00398 end
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410 `define ovm_field_queue_object(ARG,FLAG) \
00411 begin \
00412 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00413 m_sc.scope.down(`"ARG`", null); \
00414 if(what__==OVM_COPY && !((FLAG)&OVM_NOCOPY)) begin \
00415 if(local_data__!=null) begin \
00416 `RESIZE_QUEUE_OBJECT_NOCOPY(ARG, local_data__.ARG.size()) \
00417 end \
00418 else begin \
00419 `RESIZE_QUEUE_OBJECT_NOCOPY(ARG, 0) \
00420 end \
00421 end \
00422 `OVM_FIELD_DATA_ARRAY_OBJECT(ARG,FLAG) \
00423 `OVM_FIELD_QUEUE_OBJ_PACK(ARG,FLAG) \
00424 `OVM_FIELD_SET_QUEUE_OBJECT(ARG,FLAG) \
00425 m_sc.scope.up(null); \
00426 end
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438 `define ovm_field_queue_string(ARG,FLAG) \
00439 begin \
00440 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00441 m_sc.scope.down(`"ARG`", null); \
00442 if(what__==OVM_COPY && !((FLAG)&OVM_NOCOPY)) begin \
00443 if(local_data__!=null) begin \
00444 `RESIZE_QUEUE_NOCOPY(string, ARG, local_data__.ARG.size()) \
00445 end \
00446 else begin \
00447 `RESIZE_QUEUE_NOCOPY(string, ARG, 0) \
00448 end \
00449 end \
00450 `OVM_FIELD_DATA_ARRAY_STRING(ARG,FLAG) \
00451 `OVM_FIELD_QUEUE_STR_PACK(ARG,FLAG) \
00452 `OVM_FIELD_SET_QUEUE_TYPE(STR, ARG, m_sc.stringv, FLAG) \
00453 m_sc.scope.up(null); \
00454 end
00455
00456
00457
00458
00459
00460 `define ovm_field_aa_int_string(ARG, FLAG) \
00461 begin \
00462 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00463 m_sc.scope.down(`"ARG`", null); \
00464 `OVM_FIELD_DATA_AA_int_string(ARG,FLAG) \
00465 `OVM_FIELD_SET_AA_TYPE(string, INT, ARG, m_sc.bitstream, FLAG) \
00466 m_sc.scope.up(null); \
00467 end
00468
00469
00470
00471
00472
00473 `define ovm_field_aa_object_string(ARG, FLAG) \
00474 begin \
00475 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00476 m_sc.scope.down(`"ARG`", null); \
00477 `OVM_FIELD_DATA_AA_object_string(ARG,FLAG) \
00478 `OVM_FIELD_SET_AA_OBJECT_TYPE(string, ARG, FLAG) \
00479 m_sc.scope.up(null); \
00480 end
00481
00482
00483
00484
00485
00486 `define ovm_field_aa_string_string(ARG, FLAG) \
00487 begin \
00488 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00489 m_sc.scope.down(`"ARG`", null); \
00490 `OVM_FIELD_DATA_AA_string_string(ARG,FLAG) \
00491 `OVM_FIELD_SET_AA_TYPE(string, STR, ARG, m_sc.stringv, FLAG) \
00492 m_sc.scope.up(null); \
00493 end
00494
00495
00496
00497
00498 `define ovm_field_aa_object_int(ARG, FLAG) \
00499 begin \
00500 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00501 m_sc.scope.down(`"ARG`", null); \
00502 `OVM_FIELD_DATA_AA_object_int(ARG,FLAG) \
00503 `OVM_FIELD_SET_AA_OBJECT_TYPE(int, ARG, FLAG) \
00504 m_sc.scope.up(null); \
00505 end
00506
00507
00508
00509
00510 `define ovm_field_aa_int_int(ARG, FLAG) \
00511 `ovm_field_aa_int_key(int, ARG, FLAG) \
00512
00513 `define ovm_field_aa_int_int_unsigned(ARG, FLAG) \
00514 `ovm_field_aa_int_key(int unsigned, ARG, FLAG)
00515
00516 `define ovm_field_aa_int_integer(ARG, FLAG) \
00517 `ovm_field_aa_int_key(integer, ARG, FLAG)
00518
00519 `define ovm_field_aa_int_integer_unsigned(ARG, FLAG) \
00520 `ovm_field_aa_int_key(integer unsigned, ARG, FLAG)
00521
00522 `define ovm_field_aa_int_byte(ARG, FLAG) \
00523 `ovm_field_aa_int_key(byte, ARG, FLAG)
00524
00525 `define ovm_field_aa_int_byte_unsigned(ARG, FLAG) \
00526 `ovm_field_aa_int_key(byte unsigned, ARG, FLAG)
00527
00528 `define ovm_field_aa_int_shortint(ARG, FLAG) \
00529 `ovm_field_aa_int_key(shortint, ARG, FLAG)
00530
00531 `define ovm_field_aa_int_shortint_unsigned(ARG, FLAG) \
00532 `ovm_field_aa_int_key(shortint unsigned, ARG, FLAG)
00533
00534 `define ovm_field_aa_int_longint(ARG, FLAG) \
00535 `ovm_field_aa_int_key(longint, ARG, FLAG)
00536
00537 `define ovm_field_aa_int_longint_unsigned(ARG, FLAG) \
00538 `ovm_field_aa_int_key(longint unsigned, ARG, FLAG)
00539
00540 `define ovm_field_aa_int_key(KEY, ARG, FLAG) \
00541 begin \
00542 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00543 m_sc.scope.down(`"ARG`", null); \
00544 `OVM_FIELD_DATA_AA_int_key(KEY,ARG,FLAG) \
00545 `OVM_FIELD_SET_AA_INT_TYPE(KEY, INT, ARG, m_sc.bitstream, FLAG) \
00546 m_sc.scope.up(null); \
00547 end
00548
00549
00550
00551
00552
00553
00554 `define ovm_set_flags(ARG,FLAG) \
00555 begin \
00556 if(what__ == OVM_FLAGS) begin \
00557 end \
00558 end
00559
00560
00561
00562
00563
00564 `define ovm_print_msg_enum(LHS,RHS) \
00565 begin \
00566 ovm_comparer comparer; \
00567 comparer = ovm_auto_options_object.comparer; \
00568 if(comparer==null) comparer = ovm_default_comparer; \
00569 comparer.result++; \
00570 \
00571 \
00572 $swrite(comparer.miscompares,"%s%s: lhs = %0d : rhs = %0d\n", \
00573 comparer.miscompares, comparer.scope.get_arg(), LHS, RHS ); \
00574 end
00575
00576
00577
00578
00579
00580
00581
00582
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592
00593
00594 `define ovm_record_int(ARG,FLAG) \
00595 begin \
00596 integer h; \
00597 int radix; \
00598 ovm_bitstream_t value; \
00599 value = ARG; \
00600 radix = ovm_radix_enum'((FLAG)&(OVM_RADIX)); \
00601 if(recorder==null) \
00602 recorder=ovm_auto_options_object.recorder; \
00603 recorder.record_field(`"ARG`", ARG, radix, $bits(ARG); \
00604 end
00605
00606
00607 // ovm_record_string
00608 // -----------------
00609
00610 // Purpose: provide record functionality for a specific string field. This
00611 // macro is available for user access. If used externally, a record_options
00612 // object must be avaialble and must have the name recorder.
00613 //
00614 // Postcondition: ARG is recorded in string format.
00615
00616
00617 `define ovm_record_string(ARG) \
00618 recorder.record_string(`"ARG`", ARG); \
00619
00620
00621 // ovm_record_object
00622 // -----------------
00623
00624 // Purpose: provide record functionality for a specific ovm_object field. This
00625 // macro is available for user access. If used externally, a record_options
00626 // object must be avaialble and must have the name recorder.
00627 //
00628 // Postcondition: ARG is recorded. The record is done recursively where the
00629 // depth to record is set in the recorder object.
00630
00631
00632 `define ovm_record_object(ARG,FLAG) \
00633 begin \
00634 ovm_object v; \
00635 if(ARG != null) begin \
00636 if($cast(v,ARG)) begin \
00637 ovm_record_object__(`"ARG`", v, recorder); \
00638 end \
00639 end \
00640 else begin \
00641 `ovm_record_any_object(ARG); \
00642 end \
00643 end
00644
00645
00646 // ovm_record_any_object
00647 // ---------------------
00648
00649 // Purpose: provide record functionality for a user specific class object. This
00650 // macro is available for user access. If used externally, a record_options
00651 // object must be availble and must have the name recorder.
00652 //
00653 // Postcondition: The reference value of ARG is recorded.
00654
00655 `define ovm_record_any_object(ARG) \
00656 //recorder.record_object(`"ARG`", ARG);
00657
00658
00659 //-----------------------------------------------------------------------------
00660 //
00661 // INTERNAL MACROS - do not use directly
00662 //
00663 //-----------------------------------------------------------------------------
00664
00665 // MACROS: for composing the utils and field macro sets
00666
00667 // ovm_new_func
00668 // ------------
00669
00670 `define ovm_new_func \
00671 function new (string name, ovm_component parent); \
00672 super.new(name, parent); \
00673 endfunction
00674
00675 `define ovm_component_new_func \
00676 `ovm_new_func
00677
00678 `define ovm_new_func_data \
00679 function new (string name=""); \
00680 super.new(name); \
00681 endfunction
00682
00683 `define ovm_object_new_func \
00684 `ovm_new_func_data
00685
00686 `define ovm_named_object_new_func \
00687 function new (string name, ovm_component parent); \
00688 super.new(name, parent); \
00689 endfunction
00690
00691 // ovm_object_create_func
00692 // ----------------------
00693
00694 // Zero argument create function, requires default constructor
00695 `define ovm_object_create_func(T) \
00696 function ovm_object create (string name=""); \
00697 T tmp; \
00698 tmp = new(); \
00699 tmp.set_name(name); \
00700 return tmp; \
00701 endfunction
00702
00703 `define ovm_object_factory_create_func(T) \
00704 function ovm_object create_object (string name=""); \
00705 T tmp; \
00706 tmp = new(); \
00707 tmp.set_name(name); \
00708 return tmp; \
00709 endfunction
00710
00711 // ovm_named_object_create_func
00712 // ----------------------------
00713
00714 `define ovm_named_object_create_func(T) \
00715 function ovm_named_object create_named_object (string name, ovm_named_object parent); \
00716 T tmp; \
00717 tmp = new(.name(name), .parent(parent)); \
00718 return tmp; \
00719 endfunction
00720
00721 `define ovm_named_object_factory_create_func(T) \
00722 `ovm_named_object_create_func(T)
00723
00724 `define ovm_component_factory_create_func(T) \
00725 function ovm_component create_component (string name, ovm_component parent); \
00726 T tmp; \
00727 tmp = new(.name(name), .parent(parent)); \
00728 return tmp; \
00729 endfunction
00730
00731
00732 // ovm_get_type_name_func
00733 // ----------------------
00734
00735 `define ovm_get_type_name_func(T) \
00736 virtual function string get_type_name (); \
00737 return `"T`"; \
00738 endfunction
00739
00740
00741 // ovm_register_self_func
00742 // ----------------------
00743
00744 `ifndef INCA
00745 `define USE_PARAMETERIZED_WRAPPER
00746 `endif
00747
00748 `ifndef USE_PARAMETERIZED_WRAPPER
00749 `define ovm_register_self_func(T) \
00750 \
00751 static bit is_auto_registered = register_self(); \
00752 \
00753 static function bit register_self(); \
00754 T``wrapper obj_wrapper; \
00755 obj_wrapper = new(); \
00756 ovm_factory::auto_register(obj_wrapper); \
00757 return 1; \
00758 endfunction // bit
00759 `else
00760 `define ovm_register_self_func(T)
00761 `endif
00762
00763
00764 // ovm_object_derived_wrapper_class
00765 // --------------------------------
00766
00767 `ifndef USE_PARAMETERIZED_WRAPPER
00768 `define ovm_object_registry(T,S) \
00769 class T``wrapper extends ovm_object_wrapper; \
00770 virtual function string get_type_name (); \
00771 return `"S`"; \
00772 endfunction \
00773 `ovm_object_factory_create_func(T) \
00774 `ovm_register_self_func(T) \
00775 endclass
00776 `else
00777 `ifndef SVPP
00778 `define ovm_object_registry(T,S) \
00779 static ovm_object_registry#(T,`"S`") is_auto_registered;
00780 `endif //SVPP
00781 `endif //USE_PARAMETERIZED_WRAPPER
00782
00783
00784 // ovm_component_derived_wrapper_class
00785 // ---------------------------------
00786
00787 `ifndef USE_PARAMETERIZED_WRAPPER
00788 `define ovm_component_registry(T,S) \
00789 class T``wrapper extends ovm_object_wrapper; \
00790 virtual function string get_type_name (); \
00791 return `"S`"; \
00792 endfunction \
00793 `ovm_component_factory_create_func(T) \
00794 `ovm_register_self_func(T) \
00795 endclass
00796 `else
00797 `ifndef SVPP
00798 `define ovm_component_registry(T,S) \
00799 ovm_component_registry#(T,`"S`") is_auto_registered;
00800 `endif //SVPP
00801 `endif //USE_PARAMETERIZED_WRAPPER
00802
00803
00804 // OVM_FIELD_DATA
00805 // --------------
00806
00807 `define OVM_FIELD_DATA(ARG,FLAG) \
00808 begin \
00809 int r; \
00810 if((what__ == OVM_PRINT) && (((FLAG)&OVM_NOPRINT) == 0) && (((FLAG)&OVM_RADIX) == OVM_ENUM) && \
00811 (ovm_auto_options_object.printer.knobs.print_fields == 1)) begin \
00812 $swrite(m_sc.stringv, `"`OVM_ENUM`", ARG); \
00813 ovm_auto_options_object.printer.print_generic(`"ARG`", "enum", \
00814 $bits(ARG), m_sc.stringv); \
00815 end \
00816 else if((what__ == OVM_RECORD) && (((FLAG)&OVM_NORECORD) == 0) && (((FLAG)&OVM_RADIX) == OVM_ENUM)) \
00817 begin \
00818 $swrite(m_sc.stringv, `"`OVM_ENUM`", ARG); \
00819 ovm_auto_options_object.recorder.record_string(`"ARG`",m_sc.stringv); \
00820 end \
00821 else if(tmp_data__!=null) begin \
00822 if($cast(local_data__, tmp_data__)) begin \
00823 r = m_do_data(`"ARG`", ARG, local_data__.ARG, what__, $bits(ARG), FLAG); \
00824 end \
00825 end \
00826 else begin \
00827 if(what__ != OVM_COMPARE && what__ != OVM_COPY) begin \
00828 r = m_do_data(`"ARG`", ARG, 0, what__, $bits(ARG), FLAG); \
00829 end \
00830 end \
00831 if((what__ == OVM_COMPARE) && r) begin \
00832 if(((FLAG)&OVM_RADIX) == OVM_ENUM) begin \
00833 if(local_data__!=null) begin \
00834 `ovm_print_msg_enum(ARG, local_data__.ARG) \
00835 end \
00836 else begin \
00837 `ovm_print_msg_enum(ARG, 0) \
00838 end \
00839 end \
00840 end \
00841 end
00842
00843 `define OVM_FIELD_ENUM(T, ARG,FLAG) \
00844 begin \
00845 if((what__ == OVM_PRINT) && (((FLAG)&OVM_NOPRINT) == 0) && \
00846 (ovm_auto_options_object.printer.knobs.print_fields == 1)) begin \
00847 ovm_auto_options_object.printer.print_generic(`"ARG`", `"T`", \
00848 $bits(ARG), ARG.name()); \
00849 end \
00850 else if((what__ == OVM_RECORD) && (((FLAG)&OVM_NORECORD) == 0)) \
00851 begin \
00852 ovm_auto_options_object.recorder.record_string(`"ARG`",ARG.name()); \
00853 end \
00854 else if(tmp_data__!=null) begin \
00855 if($cast(local_data__, tmp_data__)) begin \
00856 case(what__) \
00857 OVM_COPY: \
00858 if(((FLAG)&OVM_NOCOPY) == 0) \
00859 ARG = local_data__.ARG; \
00860 OVM_COMPARE: \
00861 if((((FLAG)&OVM_NOCOMPARE) == 0) && (ARG != local_data__.ARG)) \
00862 ovm_auto_options_object.comparer.print_msg({"lhs = ", ARG.name(), " : rhs = ", local_data__.ARG.name()}); \
00863 endcase \
00864 end \
00865 end \
00866 else begin \
00867 case(what__) \
00868 OVM_PACK: \
00869 ovm_auto_options_object.packer.pack_field_int(int'(ARG), $bits(ARG)); \
00870 OVM_UNPACK: \
00871 begin \
00872 ARG = T'(ovm_auto_options_object.packer.unpack_field_int($bits(ARG))); \
00873 end \
00874 OVM_SETINT: \
00875 begin \
00876 if(ovm_is_match(str__ ,m_sc.scope.get_arg()) && (((FLAG)&OVM_READONLY) == 0)) begin \
00877 print_field_match("set_int()", str__); \
00878 ARG = T'(ovm_object::m_sc.bitstream); \
00879 ovm_object::m_sc.status = 1; \
00880 end \
00881 end \
00882 endcase \
00883 end \
00884 end
00885
00886
00887
00888
00889 `define OVM_FIELD_DATA_EVENT(ARG,FLAG) \
00890 begin \
00891 int r; \
00892 if(what__ == OVM_PRINT && ( (FLAG)&OVM_NOPRINT != 0) && \
00893 ovm_auto_options_object.printer.knobs.print_fields == 1) \
00894 ovm_auto_options_object.printer.print_generic(`"ARG`", "event", -1, "-"); \
00895 else if((what__ == OVM_COMPARE) && ( (FLAG)&OVM_NOCOMPARE != 0) && \
00896 local_data__ && ARG != local_data__.ARG) \
00897 begin \
00898 ovm_auto_options_object.comparer.print_msg(""); \
00899 end \
00900 else if((what__ == OVM_COPY) && local_data__ && ( (FLAG)&OVM_NOCOPY != 0 ) ) \
00901 begin \
00902 ARG = local_data__.ARG; \
00903 end \
00904 end
00905
00906
00907
00908
00909
00910 `define OVM_FIELD_DATA_OBJECT(ARG,FLAG) \
00911 begin \
00912 int r; \
00913 ovm_object lhs__, rhs__; \
00914 r = 0; \
00915 if(ARG == null) \
00916 lhs__ = null; \
00917 else if(!$cast(lhs__,ARG)) begin \
00918 ovm_object::m_sc.scratch1 = \
00919 `"Cast failed for ARG to ovm_object type (ovm_field_object not implemented)`"; \
00920 _global_reporter.ovm_report_warning("CSTFLD",ovm_object::m_sc.scratch1); \
00921 end \
00922 if(tmp_data__ != null) begin \
00923 if($cast(local_data__, tmp_data__)) begin \
00924 r = m_do_data_object(`"ARG`", lhs__, local_data__.ARG, what__, FLAG); \
00925 end \
00926 else if(tmp_data__!=null) begin \
00927 ovm_object::m_sc.scratch1 = `"Type check failed for ARG for copy/compare`"; \
00928 _global_reporter.ovm_report_error("TCKFLD", ovm_object::m_sc.scratch1); \
00929 end \
00930 end \
00931 else begin \
00932 r = m_do_data_object(`"ARG`", lhs__, null, what__, FLAG); \
00933 end \
00934 if((what__ == OVM_COPY) && (r == OVM_SHALLOW)) begin \
00935 ovm_object v; \
00936 v = ovm_global_copy_map.get(local_data__.ARG); \
00937 if(v != null) begin \
00938 $cast(ARG, v); \
00939 end \
00940 else begin \
00941 \
00942 \
00943 \
00944 if(local_data__.ARG==null) ARG = null; \
00945 else if(ARG!=null) ARG.copy(local_data__.ARG); \
00946 else begin \
00947 ovm_object cobj; \
00948 cobj = local_data__.ARG.clone(); \
00949 if(cobj == null) ARG = null; \
00950 else begin \
00951 $cast(ARG, local_data__.ARG.clone()); \
00952 ARG.set_name(`"ARG`"); \
00953 end \
00954 end \
00955 end \
00956 end \
00957 else if((what__ == OVM_COPY) && (r == OVM_REFERENCE)) begin \
00958 if((lhs__ == null)&&(local_data__.ARG != null)) begin \
00959 if(!$cast(ARG,local_data__.ARG)) begin \
00960 ovm_object::m_sc.scratch1 = `"Copy cast failed for ARG`"; \
00961 _global_reporter.ovm_report_error("CSTFLD",ovm_object::m_sc.scratch1); \
00962 end \
00963 end \
00964 else if(lhs__==null) \
00965 ARG = null; \
00966 else \
00967 $cast(ARG, lhs__); \
00968 end \
00969 end
00970
00971
00972
00973
00974
00975 `define OVM_FIELD_DATA_STRING(ARG,FLAG) \
00976 begin \
00977 int r; \
00978 if(local_data__ != null) begin \
00979 if($cast(local_data__, tmp_data__)) begin \
00980 r = m_do_data_string(`"ARG`", ARG, local_data__.ARG, what__, FLAG); \
00981 end \
00982 end \
00983 else \
00984 r = m_do_data_string(`"ARG`", ARG, "", what__, FLAG); \
00985 end
00986
00987
00988
00989
00990
00991 `define RESIZE_QUEUE_NOCOPY(T, ARG, SIZE) \
00992 begin \
00993 T tmp; \
00994 while(ARG.size()) void'(ARG.pop_front()); \
00995 while(ARG.size() != SIZE) ARG.push_back(tmp); \
00996 end
00997
00998
00999 // RESIZE_QUEUE_COPY
01000 // -----------------
01001
01002 `define RESIZE_QUEUE_COPY(T, ARG, SIZE) \
01003 begin \
01004 T tmp; \
01005 while(ARG.size()>SIZE) void'(ARG.pop_back()); \
01006 while(ARG.size() != SIZE) ARG.push_back(tmp); \
01007 end
01008
01009
01010
01011
01012
01013 `define RESIZE_QUEUE_OBJECT_NOCOPY(ARG, SIZE) \
01014 begin \
01015 while(ARG.size()) void'(ARG.pop_front()); \
01016 while(ARG.size() != SIZE) ARG.push_back(null); \
01017 end
01018
01019
01020 // RESIZE_QUEUE_OBJECT_COPY
01021 // ------------------------
01022
01023 `define RESIZE_QUEUE_OBJECT_COPY(ARG, SIZE) \
01024 begin \
01025 while(ARG.size()>SIZE) void'(ARG.pop_front()); \
01026 while(ARG.size() != SIZE) ARG.push_back(null); \
01027 end
01028
01029
01030
01031
01032 `define ovm_record_array_int(ARG, RADIX, RECORDER) \
01033 begin \
01034 if(RECORDER.tr_handle != 0) begin\
01035 if(RADIX == OVM_ENUM) begin \
01036 if(!m_sc.array_warning_done) begin \
01037 m_sc.array_warning_done = 1; \
01038 ovm_object::m_sc.scratch1 = \
01039 `"Recording not supported for array enumerations: ARG`"; \
01040 _global_reporter.ovm_report_warning("RCDNTS", ovm_object::m_sc.scratch1); \
01041 end \
01042 end \
01043 else begin \
01044 for(int i__=0; i__<ARG.size(); ++i__) \
01045 RECORDER.record_field($psprintf(`"ARG[%0d]`",i__), ARG[i__], $bits(ARG[i__]), ovm_radix_enum'(RADIX)); \
01046 end \
01047 end \
01048 end
01049
01050 // OVM_FIELD_DATA_ARRAY
01051 // --------------------
01052
01053 `define OVM_FIELD_DATA_ARRAY(ARG,FLAG) \
01054 begin \
01055 if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \
01056 case (what__) \
01057 OVM_COMPARE: \
01058 if ( !((FLAG)&OVM_NOCOMPARE) && (tmp_data__ != null) ) begin \
01059 int i__; \
01060 $cast(local_data__, tmp_data__); \
01061 if(ARG.size() != local_data__.ARG.size()) begin \
01062 int s1, s2; \
01063 m_sc.stringv = ""; \
01064 s1 = ARG.size(); s2 = local_data__.ARG.size(); \
01065 $swrite(m_sc.stringv, "lhs size = %0d : rhs size = %0d", s1, s2);\
01066 ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \
01067 end \
01068 for(i__=0; i__<ARG.size() && i__<local_data__.ARG.size(); ++i__) \
01069 if(ARG[i__] !== local_data__.``ARG[i__]) begin \
01070 ovm_auto_options_object.comparer.scope.down_element(i__, null);\
01071 $swrite(m_sc.stringv, "lhs = %0d : rhs = %0d", \
01072 ARG[i__], local_data__.ARG[i__]); \
01073 ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \
01074 ovm_auto_options_object.comparer.scope.up_element(null);\
01075 end \
01076 end \
01077 OVM_COPY: \
01078 if(!((FLAG)&OVM_NOCOPY) && (tmp_data__ != null)) \
01079 begin \
01080 int i__; \
01081 $cast(local_data__, tmp_data__); \
01082 /*Resizing of array is done in ovm_field*/ \
01083 for(i__=0; i__ < ARG``.size(); ++i__) begin \
01084 ARG[i__] = local_data__.``ARG[i__] ; \
01085 end \
01086 end \
01087 OVM_PRINT: \
01088 begin \
01089 if(((FLAG)&OVM_NOPRINT) == 0 && \
01090 ovm_auto_options_object.printer.knobs.print_fields == 1) begin \
01091 `ovm_print_array_int3(ARG, ovm_radix_enum'((FLAG)&(OVM_RADIX)), \
01092 ovm_auto_options_object.printer) \
01093 end \
01094 end \
01095 OVM_RECORD: \
01096 begin \
01097 if(((FLAG)&OVM_NORECORD) == 0) begin \
01098 `ovm_record_array_int(ARG, ovm_radix_enum'((FLAG)&(OVM_RADIX)), \
01099 ovm_auto_options_object.recorder) \
01100 end \
01101 end \
01102 endcase \
01103 end \
01104 end
01105
01106 `define OVM_FIELD_ARRAY_INT_PACK(ARG,FLAG) \
01107 case(what__) \
01108 OVM_PACK: \
01109 if(((FLAG)&OVM_NOPACK) == 0) \
01110 begin \