00001 //---------------------------------------------------------------------- 00002 // Copyright 2007-2008 Mentor Graphics Corporation 00003 // Copyright 2007-2008 Cadence Design Systems, Inc. 00004 // All Rights Reserved Worldwide 00005 // 00006 // Licensed under the Apache License, Version 2.0 (the 00007 // "License"); you may not use this file except in 00008 // compliance with the License. You may obtain a copy of 00009 // the License at 00010 // 00011 // http://www.apache.org/licenses/LICENSE-2.0 00012 // 00013 // Unless required by applicable law or agreed to in 00014 // writing, software distributed under the License is 00015 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 00016 // CONDITIONS OF ANY KIND, either express or implied. See 00017 // the License for the specific language governing 00018 // permissions and limitations under the License. 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 // MACROS: utils 00067 // 00068 //------------------------------------------------------------------------------ 00069 00070 // Definitions for the user to use inside their derived data class declarations. 00071 00072 // ovm_field_utils 00073 // --------------- 00074 00075 // This macro is for consistency 00076 `define ovm_field_utils 00077 00078 00079 // ovm_field_utils_begin 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__; /* Used for copy and compare */ \ 00089 string string_aa_key; /* Used for associative array lookups */ \ 00090 /* Check the fields if not already checked */ \ 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 /* Type is verified by ovm_object::compare() */ \ 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 // ovm_field_utils_end 00105 // ------------------- 00106 00107 `define ovm_field_utils_end \ 00108 end \ 00109 endfunction \ 00110 00111 00112 // ovm_object_utils 00113 // ---------------- 00114 // Purpose: provide a single macro when no fields will be defined, mainly used 00115 // by components, but can be used by raw data. 00116 00117 `define ovm_object_utils(T) \ 00118 `ovm_object_utils_begin(T) \ 00119 `ovm_object_utils_end 00120 00121 00122 // ovm_object_utils_begin 00123 // ---------------------- 00124 // Purpose: Implements factory methods and get_type_name and 00125 // starts the implementation of the superfunction m_field_automation. 00126 // Requires a default ctor (e.g. all args MUST have a default value). 00127 // 00128 // Precondition: T is the type name of the current user class 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 // ovm_object_utils_end 00139 // -------------------- 00140 // Purpose: finishes the superfunction implementation. This is the same as 00141 // the ovm_utils_end, but is expected to be used in conjunction with 00142 // ovm_object_utils_begin(). 00143 // 00144 00145 `define ovm_object_utils_end \ 00146 end \ 00147 endfunction \ 00148 00149 00150 // ovm_component_utils 00151 // -------------- 00152 // Purpose: provide a single macro when no fields will be defined, mainly used 00153 // by components, but can be used by raw data. Requires two arg ctor. 00154 00155 `define ovm_component_utils(T) \ 00156 `ovm_component_utils_begin(T) \ 00157 `ovm_component_utils_end 00158 00159 00160 // ovm_component_utils_begin 00161 // -------------------- 00162 // Purpose: implements factory methods and get_type_name and 00163 // starts the implementation of the superfunction m_field_automation. 00164 // Requires a 2 arg ctor (name and parent are required args). 00165 // 00166 // Precondition: T is the type name of the current user class 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 // ovm_component_utils_end 00176 // ------------------ 00177 // Purpose: finishes the superfunction implementation. 00178 00179 `define ovm_component_utils_end \ 00180 end \ 00181 endfunction 00182 00183 00184 //------------------------------------------------------------------------------ 00185 // 00186 // MACROS: fields 00187 // 00188 // Use between begin/end utils macros, above 00189 //------------------------------------------------------------------------------ 00190 00191 // ovm_field_int 00192 // ------------- 00193 00194 // Purpose: provide implementation of all of the ovm functions for the given 00195 // integral field. This implementation is inside of the m_field_automation 00196 // function which allows a single macro declaration per field. 00197 // 00198 // Precondition: ARG is one of the fields of the class. FLAG is a unary anded 00199 // set of flags turning off fields. The ALL_ON flag turns all fields on. ARG 00200 // must not be a class object type or unpacked struct type, use 00201 // `ovm_field_object for a class object. 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 // Need a special macro for enums so that the enumerated value can be used 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 // ovm_field_object 00222 // ---------------- 00223 00224 // Purpose: provide implementation of all of the ovm functions for the given 00225 // ovm_object derived argument. 00226 // 00227 // Precondition: ARG is one of the fields of the class. ARG must be a class 00228 // object. 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 // ovm_field_event 00241 // --------------- 00242 00243 // Purpose: provide implementation of all of the ovm functions for the given 00244 // event argument. 00245 // 00246 // Precondition: ARG is one of the fields of the class. ARG must be an 00247 // event type. 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 // ovm_field_string 00259 // ---------------- 00260 00261 // Purpose: provide implementation of all of the ovm functions for the given 00262 // string field. 00263 // 00264 // Precondition: ARG is one of the fields of the class. ARG must be a string 00265 // object. 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 // ovm_field_array_int 00278 // ------------------- 00279 00280 // Purpose: provide implementation of all of the ovm functions for the given 00281 // array of integral objects field. 00282 // 00283 // Precondition: ARG is one of the fields of the class. ARG must be a array 00284 // of integral objects. The flags apply to fields within the array. 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 // ovm_field_sarray_int 00305 // ------------------- 00306 00307 // Purpose: provide implementation of all of the ovm functions for the given 00308 // a static array of integral objects field. 00309 // 00310 // Precondition: ARG is one of the fields of the class. ARG must be a array 00311 // of integral objects. The flags apply to fields within the array. 00312 00313 `define ovm_field_sarray_int(ARG,FLAG) \ 00314 begin \ 00315 end 00316 /**** Not yet supportted due to limitations with static array methods ***** 00317 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \ 00318 m_sc.scope.down(`"ARG`",null); \ 00319 `OVM_FIELD_DATA_SARRAY(ARG,FLAG) \ 00320 // `OVM_FIELD_SET_SARRAY(ARG,FLAG) \ 00321 m_sc.scope.up(null); \ 00322 end 00323 *************************************************************************/ 00324 00325 // ovm_field_array_object 00326 // ---------------------- 00327 00328 // Purpose: provide implementation of all of the ovm functions for the given 00329 // array of ovm_object objects field. 00330 // 00331 // Precondition: ARG is one of the fields of the class. ARG must be a array 00332 // of ovm_object objects. The flags apply to fields within the array. 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 // ovm_field_array_string 00354 // ---------------------- 00355 00356 // Purpose: provide implementation of all of the ovm functions for the given 00357 // array of string objects field. 00358 // 00359 // Precondition: ARG is one of the fields of the class. ARG must be a array 00360 // of string objects. The flags apply to fields within the array. 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 // ovm_field_queue_int 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 // ovm_field_queue_object 00402 // ---------------------- 00403 00404 // Purpose: provide implementation of all of the ovm functions for the given 00405 // queue of ovm_object objects field. 00406 // 00407 // Precondition: ARG is one of the fields of the class. ARG must be a queue 00408 // of ovm_object objects. The flags apply to fields within the queue. 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 // ovm_field_queue_string 00430 // ---------------------- 00431 00432 // Purpose: provide implementation of all of the ovm functions for the given 00433 // queue of string objects field. 00434 // 00435 // Precondition: ARG is one of the fields of the class. ARG must be a queue 00436 // of string objects. The flags apply to fields within the queue. 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 // ovm_field_aa_int_string 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 // ovm_field_aa_object_string 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 // ovm_field_aa_string_string 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 // ovm_field_aa_object_int 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 // ovm_field_aa_int_int 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 // Purpose: Provide a way for a derived class to override the flag settings in 00551 // the base class. 00552 // 00553 00554 `define ovm_set_flags(ARG,FLAG) \ 00555 begin \ 00556 if(what__ == OVM_FLAGS) begin \ 00557 end \ 00558 end 00559 00560 00561 // ovm_print_msg_enum 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 /* $swrite(comparer.miscompares,"%s%s: lhs = %s : rhs = %s\n",*/ \ 00571 /* comparer.miscompares, comparer.scope.get_arg(), LHS, RHS );*/ \ 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 // MACROS: recording 00580 // 00581 //----------------------------------------------------------------------------- 00582 00583 // TBD 00584 00585 // ovm_record_int 00586 // -------------- 00587 00588 // Purpose: provide print functionality for a specific integral field. This 00589 // macro is available for user access. If used externally, a record_options 00590 // object must be avaialble and must have the name opt. 00591 // 00592 // Postcondition: ARG is printed using the format set by the FLAGS. 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 // OVM_FIELD_DATA_EVENT 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 // OVM_FIELD_DATA_OBJECT 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 /* Can't do shallow copy right now due to */ \ 00942 /* an issue with abstract classes */ \ 00943 /* like ovm_object, so do a deep copy instead. */ \ 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 // OVM_FIELD_DATA_STRING 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 // RESIZE_QUEUE_NOCOPY 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 // RESIZE_QUEUE_OBJECT_NOCOPY 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 // ovm_record_array_int 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 \ 01111 if(ovm_auto_options_object.packer.use_metadata == 1) \ 01112 ovm_auto_options_object.packer.pack_field_int(ARG.size(), 32); \ 01113 foreach(ARG[i]) \ 01114 ovm_auto_options_object.packer.pack_field(ARG[i], $bits(ARG[i])); \ 01115 end \ 01116 OVM_UNPACK: \ 01117 if(((FLAG)&OVM_NOPACK) == 0) \ 01118 begin \ 01119 int s_; \ 01120 s_ = ovm_auto_options_object.packer.unpack_field_int(32); \ 01121 ARG = new[s_]; \ 01122 foreach(ARG[i]) \ 01123 ARG[i] = ovm_auto_options_object.packer.unpack_field($bits(ARG[i])); \ 01124 end \ 01125 endcase 01126 01127 `define OVM_FIELD_QUEUE_INT_PACK(ARG,FLAG) \ 01128 case(what__) \ 01129 OVM_PACK: \ 01130 if(((FLAG)&OVM_NOPACK) == 0) \ 01131 begin \ 01132 if(ovm_auto_options_object.packer.use_metadata == 1) \ 01133 ovm_auto_options_object.packer.pack_field_int(ARG.size(), 32); \ 01134 foreach(ARG[i]) \ 01135 ovm_auto_options_object.packer.pack_field(ARG[i], $bits(ARG[i])); \ 01136 end \ 01137 OVM_UNPACK: \ 01138 if(((FLAG)&OVM_NOPACK) == 0) \ 01139 begin \ 01140 int s_; \ 01141 s_ = ovm_auto_options_object.packer.unpack_field_int(32); \ 01142 while(ARG.size() < s_) ARG.push_back(0); \ 01143 while(ARG.size() > s_) void'(ARG.pop_front()); \ 01144 foreach(ARG[i]) \ 01145 ARG[i] = ovm_auto_options_object.packer.unpack_field($bits(ARG[i])); \ 01146 end \ 01147 endcase 01148 01149 `define OVM_FIELD_DATA_SARRAY(ARG,FLAG) \ 01150 begin \ 01151 if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \ 01152 int i__, min__, max__; \ 01153 // min__ = $low(ARG); \ 01154 // max__ = $high(ARG); \ 01155 case (what__) \ 01156 OVM_COMPARE: \ 01157 if ( !((FLAG)&OVM_NOCOMPARE) && (tmp_data__ != null) ) begin \ 01158 $cast(local_data__, tmp_data__); \ 01159 for(i__=min__; i__<max__; ++i__) \ 01160 if(ARG[i__] !== local_data__.ARG[i__]) begin \ 01161 ovm_auto_options_object.comparer.scope.down_element(i__, null);\ 01162 $swrite(m_sc.stringv, "lhs = %0d : rhs = %0d", \ 01163 ARG[i__], local_data__.ARG[i__]); \ 01164 ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \ 01165 ovm_auto_options_object.comparer.scope.up_element(null);\ 01166 end \ 01167 end \ 01168 OVM_COPY: \ 01169 if(!((FLAG)&OVM_NOCOPY) && (tmp_data__ != null) ) \ 01170 begin \ 01171 int i__; \ 01172 $cast(local_data__, tmp_data__); \ 01173 /*Resizing of array is done in ovm_field*/ \ 01174 for(i__=min__; i__ < max__; ++i__) begin \ 01175 ARG[i__] = local_data__.ARG[i__] ; \ 01176 end \ 01177 end \ 01178 OVM_PRINT: \ 01179 begin \ 01180 if(((FLAG)&OVM_NOPRINT) == 0 && \ 01181 ovm_auto_options_object.printer.knobs.print_fields == 1) begin \ 01182 `ovm_print_sarray_int3(ARG, ovm_radix_enum'((FLAG)&(OVM_RADIX)), \ 01183 ovm_auto_options_object.printer) \ 01184 end \ 01185 end \ 01186 OVM_RECORD: \ 01187 begin \ 01188 if(((FLAG)&OVM_NORECORD) == 0) begin \ 01189 `ovm_record_sarray_int3(ARG, ovm_radix_enum'((FLAG)&(OVM_RADIX)), \ 01190 ovm_auto_options_object.recorder) \ 01191 end \ 01192 end \ 01193 endcase \ 01194 end \ 01195 end 01196 01197 01198 // OVM_FIELD_DATA_ARRAY_OBJECT 01199 // --------------------------- 01200 01201 // ovm_record_array_object 01202 // -------------------- 01203 01204 `define ovm_record_array_object(ARG, RECORDER) \ 01205 begin \ 01206 if(RECORDER.tr_handle != 0) begin\ 01207 ovm_object obj__; \ 01208 for(int i__=0; i__<ARG.size(); ++i__) begin \ 01209 if((obj__ != null)) begin \ 01210 $cast(obj__, ARG[i__]); \ 01211 m_sc.scope.down_element(i__, null);\ 01212 obj__.m_field_automation(null, what__, str__); \ 01213 m_sc.scope.up_element(null);\ 01214 end \ 01215 end \ 01216 end \ 01217 end 01218 01219 `define OVM_FIELD_DATA_ARRAY_OBJECT(ARG,FLAG) \ 01220 begin \ 01221 if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \ 01222 ovm_object this_d__, from_d__; \ 01223 case (what__) \ 01224 OVM_COMPARE: \ 01225 if ( !((FLAG)&OVM_NOCOMPARE) && (tmp_data__ != null)) begin \ 01226 int i__; \ 01227 ovm_recursion_policy_enum orig_policy; \ 01228 orig_policy = ovm_auto_options_object.comparer.policy; \ 01229 if(((FLAG)&OVM_REFERENCE) != 0) begin \ 01230 ovm_auto_options_object.comparer.policy = OVM_REFERENCE; \ 01231 end \ 01232 $cast(local_data__, tmp_data__); \ 01233 if(ARG.size() != local_data__.``ARG.size()) begin \ 01234 int s1, s2; \ 01235 m_sc.stringv = ""; \ 01236 s1 = ARG.size(); s2 = local_data__.ARG.size(); \ 01237 $swrite(m_sc.stringv, "lhs size = %0d : rhs size = %0d", s1, s2);\ 01238 ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \ 01239 end \ 01240 for(i__=0; i__<ARG.size() && i__<local_data__.ARG.size(); ++i__) \ 01241 void'(ovm_auto_options_object.comparer.compare_object($psprintf(`"ARG[%0d]`",i__), ARG[i__], local_data__.ARG[i__])); \ 01242 ovm_auto_options_object.comparer.policy = orig_policy; \ 01243 end \ 01244 OVM_COPY: \ 01245 if(!((FLAG)&OVM_NOCOPY) && (tmp_data__ != null) ) \ 01246 begin \ 01247 int i__; \ 01248 $cast(local_data__, tmp_data__); \ 01249 /*Resizing of array is done in ovm_field_array* macro*/ \ 01250 for(i__=0; i__ < ARG``.size(); ++i__) begin \ 01251 `DOSHALLOWCOPY(ARG[i__], local_data__.ARG[i__], FLAG) \ 01252 `DODEEPCOPY(ARG[i__], FLAG) \ 01253 end \ 01254 end \ 01255 OVM_PRINT: \ 01256 if((((FLAG)&OVM_NOPRINT) == 0) && \ 01257 ovm_auto_options_object.printer.knobs.print_fields == 1) \ 01258 begin \ 01259 `ovm_print_array_object3(ARG, ovm_auto_options_object.printer,FLAG) \ 01260 end \ 01261 OVM_RECORD: \ 01262 begin \ 01263 if((((FLAG)&OVM_NORECORD) == 0) && (((FLAG)&OVM_SHALLOW) == 0)) begin \ 01264 `ovm_record_array_object(ARG,ovm_auto_options_object.recorder) \ 01265 end \ 01266 end \ 01267 endcase \ 01268 end \ 01269 end 01270 01271 `define OVM_FIELD_ARRAY_OBJ_PACK(ARG,FLAG) \ 01272 case(what__) \ 01273 OVM_PACK: \ 01274 if(((FLAG)&OVM_NOPACK) == 0) \ 01275 begin \ 01276 if(ovm_auto_options_object.packer.use_metadata == 1) \ 01277 ovm_auto_options_object.packer.pack_field_int(ARG.size(), 32); \ 01278 foreach(ARG[i]) \ 01279 ovm_auto_options_object.packer.pack_object(ARG[i]); \ 01280 end \ 01281 OVM_UNPACK: \ 01282 if(((FLAG)&OVM_NOPACK) == 0) \ 01283 begin \ 01284 int s_; \ 01285 s_ = ovm_auto_options_object.packer.unpack_field_int(32); \ 01286 /* Since arg man not have default ctor, user must allocate a correctly sized array */ \ 01287 if(ARG.size() < s_) \ 01288 _global_reporter.ovm_report_error("OBJUPK", $psprintf(`"Array ARG cannot support the unpack operation, the unpack requires %0d elements, ARG has only %0d`", s_, ARG.size())); \ 01289 foreach(ARG[i]) begin \ 01290 ovm_auto_options_object.packer.unpack_object(ARG[i]); \ 01291 end \ 01292 // ARG = new[s_]; \ 01293 // foreach(ARG[i]) begin \ 01294 // if(!ovm_auto_options_object.packer.is_null()) ARG[i] = new; \ 01295 // ovm_auto_options_object.packer.unpack_object(ARG[i]); \ 01296 // end \ 01297 end \ 01298 endcase 01299 01300 `define OVM_FIELD_QUEUE_OBJ_PACK(ARG,FLAG) \ 01301 case(what__) \ 01302 OVM_PACK: \ 01303 if(((FLAG)&OVM_NOPACK) == 0) \ 01304 begin \ 01305 if(ovm_auto_options_object.packer.use_metadata == 1) \ 01306 ovm_auto_options_object.packer.pack_field_int(ARG.size(), 32); \ 01307 foreach(ARG[i]) \ 01308 ovm_auto_options_object.packer.pack_object(ARG[i]); \ 01309 end \ 01310 OVM_UNPACK: \ 01311 if(((FLAG)&OVM_NOPACK) == 0) \ 01312 begin \ 01313 int s_; \ 01314 s_ = ovm_auto_options_object.packer.unpack_field_int(32); \ 01315 /* Since arg man not have default ctor, user must allocate a correctly sized array */ \ 01316 if(ARG.size() < s_) \ 01317 _global_reporter.ovm_report_error("OBJUPK", $psprintf(`"Queue ARG cannot support the unpack operation, the unpack requires %0d elements, ARG has only %0d`", s_, ARG.size())); \ 01318 foreach(ARG[i]) begin \ 01319 ovm_auto_options_object.packer.unpack_object(ARG[i]); \ 01320 end \ 01321 // while(ARG.size() < s_) ARG.push_back(null); \ 01322 // while(ARG.size() > s_) void'(ARG.pop_front()); \ 01323 // foreach(ARG[i]) begin \ 01324 // if(!ovm_auto_options_object.packer.is_null()) ARG[i] = new; \ 01325 // ovm_auto_options_object.packer.unpack_object(ARG[i]); \ 01326 // end \ 01327 end \ 01328 endcase 01329 01330 // OVM_FIELD_DATA_ARRAY_STRING 01331 // --------------------------- 01332 01333 // ovm_record_array_string 01334 // ------------------------ 01335 01336 `define ovm_record_array_string(ARG, RECORDER) \ 01337 begin \ 01338 if(RECORDER.tr_handle != 0) begin\ 01339 for(int i__=0; i__<ARG.size(); ++i__) \ 01340 RECORDER.record_string($psprintf(`"ARG[%0d]`", i__), ARG[i__]); \ 01341 end \ 01342 end 01343 01344 `define OVM_FIELD_DATA_ARRAY_STRING(ARG,FLAG) \ 01345 begin \ 01346 if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \ 01347 case (what__) \ 01348 OVM_COMPARE: \ 01349 if ( !((FLAG)&OVM_NOCOMPARE) && (tmp_data__ != null) ) begin \ 01350 int i__; \ 01351 $cast(local_data__, tmp_data__); \ 01352 if(ARG.size() != local_data__.``ARG.size()) begin \ 01353 int s1, s2; \ 01354 m_sc.stringv = ""; \ 01355 s1 = ARG.size(); s2 = local_data__.ARG.size(); \ 01356 $swrite(m_sc.stringv, "lhs size = %0d : rhs size = %0d", s1, s2);\ 01357 ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \ 01358 end \ 01359 for(i__=0; i__<ARG.size() && i__<local_data__.ARG.size(); ++i__) \ 01360 if(ARG[i__] != local_data__.ARG[i__]) begin \ 01361 string ls, rs; \ 01362 ls = ARG[i__]; rs = local_data__.ARG[i__]; \ 01363 ovm_auto_options_object.comparer.scope.down_element(i__, null);\ 01364 $swrite(m_sc.stringv, "lhs = %0s : rhs = %0s", ls, rs); \ 01365 ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \ 01366 ovm_auto_options_object.comparer.scope.up_element(null);\ 01367 end \ 01368 end \ 01369 OVM_COPY: \ 01370 if(!((FLAG)&OVM_NOCOPY) && (tmp_data__ != null) ) \ 01371 begin \ 01372 int i__; \ 01373 $cast(local_data__, tmp_data__); \ 01374 /*Resizing of array is done in ovm_field_array* macro*/ \ 01375 for(i__=0; i__ < ARG.size(); ++i__) \ 01376 ARG[i__] = local_data__.ARG[i__] ; \ 01377 end \ 01378 OVM_PRINT: \ 01379 begin \ 01380 if((FLAG)&OVM_NOPRINT != 0 && \ 01381 ovm_auto_options_object.printer.knobs.print_fields == 1) \ 01382 `ovm_print_array_string2(ARG, ovm_auto_options_object.printer) \ 01383 end \ 01384 OVM_RECORD: \ 01385 begin \ 01386 if(((FLAG)&OVM_NORECORD) == 0 && !m_sc.array_warning_done) begin \ 01387 `ovm_record_array_string(ARG, ovm_auto_options_object.recorder) \ 01388 end \ 01389 end \ 01390 endcase \ 01391 end \ 01392 end 01393 01394 `define OVM_FIELD_ARRAY_STR_PACK(ARG,FLAG) \ 01395 case(what__) \ 01396 OVM_PACK: \ 01397 if(((FLAG)&OVM_NOPACK) == 0) \ 01398 begin \ 01399 if(ovm_auto_options_object.packer.use_metadata == 1) \ 01400 ovm_auto_options_object.packer.pack_field_int(ARG.size(), 32); \ 01401 foreach(ARG[i]) \ 01402 ovm_auto_options_object.packer.pack_string(ARG[i]); \ 01403 end \ 01404 OVM_UNPACK: \ 01405 if(((FLAG)&OVM_NOPACK) == 0) \ 01406 begin \ 01407 int s_; \ 01408 s_ = ovm_auto_options_object.packer.unpack_field_int(32); \ 01409 ARG = new[s_]; \ 01410 foreach(ARG[i]) begin \ 01411 ARG[i] = ovm_auto_options_object.packer.unpack_string(); \ 01412 end \ 01413 end \ 01414 endcase 01415 01416 `define OVM_FIELD_QUEUE_STR_PACK(ARG,FLAG) \ 01417 case(what__) \ 01418 OVM_PACK: \ 01419 if(((FLAG)&OVM_NOPACK) == 0) \ 01420 begin \ 01421 if(ovm_auto_options_object.packer.use_metadata == 1) \ 01422 ovm_auto_options_object.packer.pack_field_int(ARG.size(), 32); \ 01423 foreach(ARG[i]) \ 01424 ovm_auto_options_object.packer.pack_string(ARG[i]); \ 01425 end \ 01426 OVM_UNPACK: \ 01427 if(((FLAG)&OVM_NOPACK) == 0) \ 01428 begin \ 01429 int s_; \ 01430 s_ = ovm_auto_options_object.packer.unpack_field_int(32); \ 01431 while(ARG.size() < s_) ARG.push_back(""); \ 01432 while(ARG.size() > s_) void'(ARG.pop_front()); \ 01433 foreach(ARG[i]) begin \ 01434 ARG[i] = ovm_auto_options_object.packer.unpack_string(); \ 01435 end \ 01436 end \ 01437 endcase 01438 01439 // OVM_COMPARE_FIELD 01440 // ----------------- 01441 01442 `define OVM_COMPARE_FAILED(ARG) \ 01443 begin \ 01444 ovm_object::m_sc.scratch1 = `"Compare failed ARG`"; \ 01445 ovm_auto_options_object.comparer.result++; \ 01446 if(ovm_auto_options_object.comparer.result <= \ 01447 ovm_auto_options_object.comparer.show_max) \ 01448 begin \ 01449 ovm_object::m_sc.scratch1 = `"Miscompare for field ARG`"; \ 01450 _global_reporter.ovm_report_info("MISCMP", ovm_object::m_sc.scratch1, 500) \ 01451 end \ 01452 end 01453 01454 01455 // OVM_FIELD_DATA_AA_generic 01456 // ------------------------- 01457 01458 `define OVM_FIELD_DATA_AA_generic(TYPE, KEY, ARG, FLAG) \ 01459 begin \ 01460 if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \ 01461 case (what__) \ 01462 OVM_COMPARE: \ 01463 begin \ 01464 if(!((FLAG)&OVM_NOCOMPARE) && (tmp_data__ != null) ) \ 01465 begin \ 01466 $cast(local_data__, tmp_data__); \ 01467 if(ARG.num() != local_data__.ARG.num()) begin \ 01468 int s1, s2; \ 01469 m_sc.stringv = ""; \ 01470 s1 = ARG.num(); s2 = local_data__.ARG.num(); \ 01471 $swrite(m_sc.stringv, "lhs size = %0d : rhs size = %0d", \ 01472 s1, s2);\ 01473 ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \ 01474 end \ 01475 string_aa_key = ""; \ 01476 while(ARG.next(string_aa_key)) begin \ 01477 ovm_auto_options_object.comparer.scope.set_arg({"[",string_aa_key,"]"}); \ 01478 void'(m_do_data({`"ARG[`", string_aa_key, "]"}, \ 01479 ARG[string_aa_key], \ 01480 local_data__.ARG[string_aa_key], what__, \ 01481 $bits(ARG[string_aa_key]), FLAG)); \ 01482 ovm_auto_options_object.comparer.scope.unset_arg(string_aa_key); \ 01483 end \ 01484 end \ 01485 end \ 01486 OVM_COPY: \ 01487 begin \ 01488 if(!((FLAG)&OVM_NOCOPY) && (tmp_data__ != null) ) \ 01489 begin \ 01490 $cast(local_data__, tmp_data__); \ 01491 ARG.delete(); \ 01492 string_aa_key = ""; \ 01493 while(local_data__.ARG.next(string_aa_key)) \ 01494 ARG[string_aa_key] = local_data__.ARG[string_aa_key]; \ 01495 end \ 01496 end \ 01497 OVM_PRINT: \ 01498 `ovm_print_aa_``KEY``_``TYPE``3(ARG, ovm_radix_enum'((FLAG)&(OVM_RADIX)), \ 01499 ovm_auto_options_object.printer) \ 01500 endcase \ 01501 end \ 01502 end 01503 01504 01505 // OVM_FIELD_DATA_AA_int_string 01506 // ---------------------------- 01507 01508 `define OVM_FIELD_DATA_AA_int_string(ARG, FLAG) \ 01509 `OVM_FIELD_DATA_AA_generic(int, string, ARG, FLAG) 01510 01511 // OVM_FIELD_DATA_AA_int_int 01512 // ---------------------------- 01513 01514 `define OVM_FIELD_DATA_AA_int_key(KEY, ARG, FLAG) \ 01515 begin \ 01516 if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \ 01517 KEY aa_key; \ 01518 case (what__) \ 01519 OVM_COMPARE: \ 01520 begin \ 01521 if(!((FLAG)&OVM_NOCOMPARE) && (tmp_data__ != null) ) \ 01522 begin \ 01523 $cast(local_data__, tmp_data__); \ 01524 if(ARG.num() != local_data__.ARG.num()) begin \ 01525 int s1, s2; \ 01526 m_sc.stringv = ""; \ 01527 s1 = ARG.num(); s2 = local_data__.ARG.num(); \ 01528 $swrite(m_sc.stringv, "lhs size = %0d : rhs size = %0d", \ 01529 s1, s2);\ 01530 ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \ 01531 end \ 01532 ovm_auto_options_object.comparer.scope.up(null); \ 01533 if(ARG.first(aa_key)) \ 01534 do begin \ 01535 $swrite(string_aa_key, "%0d", aa_key); \ 01536 ovm_auto_options_object.comparer.scope.set_arg({"[",string_aa_key,"]"}); \ 01537 void'(m_do_data({`"ARG[`", string_aa_key, "]"}, \ 01538 ARG[aa_key], \ 01539 local_data__.ARG[aa_key], what__, \ 01540 $bits(ARG[aa_key]), FLAG)); \ 01541 ovm_auto_options_object.comparer.scope.unset_arg(string_aa_key); \ 01542 end while(ARG.next(aa_key)); \ 01543 ovm_auto_options_object.comparer.scope.down(`"ARG`",null); \ 01544 end \ 01545 end \ 01546 OVM_COPY: \ 01547 begin \ 01548 if(!((FLAG)&OVM_NOCOPY) && (tmp_data__ != null) ) \ 01549 begin \ 01550 $cast(local_data__, tmp_data__); \ 01551 ARG.delete(); \ 01552 if(local_data__.ARG.first(aa_key)) \ 01553 do begin \ 01554 ARG[aa_key] = local_data__.ARG[aa_key]; \ 01555 end while(local_data__.ARG.next(aa_key)); \ 01556 end \ 01557 end \ 01558 OVM_PRINT: \ 01559 `ovm_print_aa_int_key4(KEY,ARG, ovm_radix_enum'((FLAG)&(OVM_RADIX)), \ 01560 ovm_auto_options_object.printer) \ 01561 endcase \ 01562 end \ 01563 end 01564 01565 01566 01567 // OVM_FIELD_DATA_AA_object_string 01568 // ------------------------------- 01569 01570 `define OVM_FIELD_DATA_AA_object_string(ARG, FLAG) \ 01571 begin \ 01572 if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \ 01573 case (what__) \ 01574 OVM_COMPARE: \ 01575 begin \ 01576 if(!((FLAG)&OVM_NOCOMPARE) && (tmp_data__ != null) ) \ 01577 begin \ 01578 $cast(local_data__, tmp_data__); \ 01579 if(ARG.num() != local_data__.ARG.num()) begin \ 01580 int s1, s2; \ 01581 m_sc.stringv = ""; \ 01582 s1 = ARG.num(); s2 = local_data__.ARG.num(); \ 01583 $swrite(m_sc.stringv, "lhs size = %0d : rhs size = %0d", \ 01584 s1, s2);\ 01585 ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \ 01586 end \ 01587 string_aa_key = ""; \ 01588 while(ARG.next(string_aa_key)) begin \ 01589 ovm_object tmp; \ 01590 /* Since m_do_data_object is inout, need a ovm_object for */ \ 01591 /* assignment compatibility. We must cast back the return. */ \ 01592 tmp = ARG[string_aa_key]; \ 01593 ovm_auto_options_object.comparer.scope.down({"[",string_aa_key,"]"},tmp); \ 01594 void'(m_do_data_object({"[", string_aa_key, "]"}, tmp, \ 01595 local_data__.ARG[string_aa_key], what__, FLAG)); \ 01596 ovm_auto_options_object.comparer.scope.up(tmp,"["); \ 01597 end \ 01598 end \ 01599 end \ 01600 OVM_COPY: \ 01601 begin \ 01602 if(!((FLAG)&OVM_NOCOPY) && (tmp_data__ != null) ) \ 01603 begin \ 01604 $cast(local_data__, tmp_data__); \ 01605 ARG.delete(); \ 01606 if(local_data__.ARG.first(string_aa_key)) \ 01607 do \ 01608 if((FLAG)&OVM_REFERENCE) \ 01609 ARG[string_aa_key] = local_data__.ARG[string_aa_key]; \ 01610 /*else if((FLAG)&OVM_SHALLOW)*/ \ 01611 /* ARG[string_aa_key] = new local_data__.ARG[string_aa_key];*/ \ 01612 else begin\ 01613 $cast(ARG[string_aa_key],local_data__.ARG[string_aa_key].clone());\ 01614 ARG[string_aa_key].set_name({`"ARG`","[",string_aa_key, "]"});\ 01615 end \ 01616 while(local_data__.ARG.next(string_aa_key)); \ 01617 end \ 01618 end \ 01619 OVM_PRINT: \ 01620 `ovm_print_aa_string_object3(ARG, ovm_auto_options_object.printer,FLAG) \ 01621 endcase \ 01622 end \ 01623 end 01624 01625 // OVM_FIELD_DATA_AA_object_int 01626 // ------------------------------- 01627 01628 `define OVM_FIELD_DATA_AA_object_int(ARG, FLAG) \ 01629 begin \ 01630 int key; \ 01631 if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \ 01632 case (what__) \ 01633 OVM_COMPARE: \ 01634 begin \ 01635 if(!((FLAG)&OVM_NOCOMPARE) && (tmp_data__ != null) ) \ 01636 begin \ 01637 $cast(local_data__, tmp_data__); \ 01638 if(ARG.num() != local_data__.ARG.num()) begin \ 01639 int s1, s2; \ 01640 m_sc.stringv = ""; \ 01641 s1 = ARG.num(); s2 = local_data__.ARG.num(); \ 01642 $swrite(m_sc.stringv, "lhs size = %0d : rhs size = %0d", \ 01643 s1, s2);\ 01644 ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \ 01645 end \ 01646 if(ARG.first(key)) begin \ 01647 do begin \ 01648 ovm_object tmp; \ 01649 /* Since m_do_data_object is inout, need a ovm_object for */ \ 01650 /* assignment compatibility. We must cast back the return. */ \ 01651 tmp = ARG[key]; \ 01652 $swrite(m_sc.stringv, "[%0d]", key); \ 01653 ovm_auto_options_object.comparer.scope.down_element(key,tmp); \ 01654 void'(m_do_data_object(m_sc.stringv, tmp, \ 01655 local_data__.ARG[key], what__, FLAG)); \ 01656 ovm_auto_options_object.comparer.scope.up_element(tmp); \ 01657 end while(ARG.next(key)); \ 01658 end \ 01659 end \ 01660 end \ 01661 OVM_COPY: \ 01662 begin \ 01663 if(!((FLAG)&OVM_NOCOPY) && (tmp_data__ != null) ) \ 01664 begin \ 01665 $cast(local_data__, tmp_data__); \ 01666 ARG.delete(); \ 01667 if(local_data__.ARG.first(key)) \ 01668 do begin \ 01669 if((FLAG)&OVM_REFERENCE) \ 01670 ARG[key] = local_data__.ARG[key]; \ 01671 /*else if((FLAG)&OVM_SHALLOW)*/ \ 01672 /* ARG[key] = new local_data__.ARG[key];*/ \ 01673 else begin\ 01674 ovm_object tmp_obj; \ 01675 tmp_obj = local_data__.ARG[key].clone(); \ 01676 if(tmp_obj != null) \ 01677 $cast(ARG[key], tmp_obj); \ 01678 else \ 01679 ARG[key]=null; \ 01680 end \ 01681 end while(local_data__.ARG.next(key)); \ 01682 end \ 01683 end \ 01684 OVM_PRINT: \ 01685 `ovm_print_aa_int_object3(ARG, ovm_auto_options_object.printer,FLAG) \ 01686 endcase \ 01687 end \ 01688 end 01689 01690 // OVM_FIELD_DATA_AA_string_string 01691 // ------------------------------- 01692 01693 `define OVM_FIELD_DATA_AA_string_string(ARG, FLAG) \ 01694 begin \ 01695 if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \ 01696 case (what__) \ 01697 OVM_COMPARE: \ 01698 begin \ 01699 if(!((FLAG)&OVM_NOCOMPARE) && (tmp_data__ != null) ) \ 01700 begin \ 01701 $cast(local_data__, tmp_data__); \ 01702 if(ARG.num() != local_data__.ARG.num()) begin \ 01703 int s1, s2; \ 01704 m_sc.stringv = ""; \ 01705 s1 = ARG.num(); s2 = local_data__.ARG.num(); \ 01706 $swrite(m_sc.stringv, "lhs size = %0d : rhs size = %0d", \ 01707 s1, s2);\ 01708 ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \ 01709 end \ 01710 string_aa_key = ""; \ 01711 while(ARG.next(string_aa_key)) begin \ 01712 ovm_auto_options_object.comparer.scope.set_arg({"[",string_aa_key,"]"}); \ 01713 void'(m_do_data_string({`"ARG[`", string_aa_key, "]"}, \ 01714 ARG[string_aa_key], \ 01715 local_data__.ARG[string_aa_key], what__, FLAG) ); \ 01716 ovm_auto_options_object.comparer.scope.unset_arg(string_aa_key); \ 01717 end \ 01718 end \ 01719 end \ 01720 OVM_COPY: \ 01721 begin \ 01722 if(!((FLAG)&OVM_NOCOPY) && (local_data__ !=null)) \ 01723 begin \ 01724 ARG.delete(); \ 01725 string_aa_key = ""; \ 01726 while(local_data__.ARG.next(string_aa_key)) \ 01727 ARG[string_aa_key] = local_data__.ARG[string_aa_key]; \ 01728 end \ 01729 end \ 01730 OVM_PRINT: \ 01731 `ovm_print_aa_string_string2(ARG, ovm_auto_options_object.printer) \ 01732 endcase \ 01733 end \ 01734 end 01735 01736 01737 // DOREFERENCECOPY 01738 // --------------- 01739 01740 `define DOREFERENCECOPY(ARG,FLAG) \ 01741 if( (FLAG)&OVM_REFERENCE)) \ 01742 ARG = local_data__.``ARG; \ 01743 01744 // DODEEPCOPY 01745 // ---------- 01746 01747 `define DODEEPCOPY(ARG,FLAG) \ 01748 begin \ 01749 ovm_object this_d__, from_d__; \ 01750 if(tmp_data__ != null) \ 01751 if(!$cast(local_data__, tmp_data__)) begin \ 01752 ovm_object::m_sc.scratch1 = `"Cast failed for argument: ARG`"; \ 01753 end \ 01754 if(ARG != null) $cast(this_d__,ARG); \ 01755 if(local_data__.ARG != null) $cast(from_d__,local_data__.ARG); \ 01756 \ 01757 if((this_d__==null) && (from_d__!=null)) begin \ 01758 this_d__ = from_d__.clone(); \ 01759 this_d__.set_name(`"ARG`"); \ 01760 end \ 01761 else if(from_d__ == null) \ 01762 this_d__ = from_d__; \ 01763 else begin \ 01764 this_d__.copy(from_d__); \ 01765 end \ 01766 if((this_d__ == null) || !$cast(ARG, this_d__)) begin \ 01767 ovm_object::m_sc.scratch1 = `"Cast failed for ARG during copy`"; \ 01768 _global_reporter.ovm_report_error("CSTFLD", ovm_object::m_sc.scratch1); \ 01769 end \ 01770 end 01771 01772 01773 // DOSHALLOWCOPY 01774 // ------------- 01775 01776 `define DOSHALLOWCOPY(ARG1,ARG2,FLAG) \ 01777 if( (FLAG)&OVM_SHALLOW) \ 01778 begin \ 01779 ovm_object lhs__, rhs__; \ 01780 ovm_object::m_sc.scratch1 = `"Executing shallow copy of arg ARG`"; \ 01781 /* Can't do shallow copy right now due to an issue with abstract classes */ \ 01782 /* like ovm_object, so do a deep copy instead. */ \ 01783 if(ARG2==null) ARG1 = ARG2; \ 01784 else begin \ 01785 if(ARG1 != null) $cast(lhs__, ARG1); \ 01786 if(ARG2 != null) $cast(rhs__, ARG2); \ 01787 if(rhs__!=null && lhs__!=null) \ 01788 lhs__.copy(rhs__); \ 01789 else if(rhs__ != null) begin \ 01790 $cast(lhs__, rhs__.clone()); \ 01791 if (lhs__ != null) \ 01792 $cast(ARG1, lhs__); \ 01793 end \ 01794 else \ 01795 ARG1 = null; \ 01796 /* ARG = new local_data__.ARG; */ \ 01797 end \ 01798 end \ 01799 else \ 01800 begin \ 01801 ovm_object::m_sc.scratch1 = `"Shallow copy off for arg ARG`"; \ 01802 end 01803 01804 01805 // OVM_FIELD_SET 01806 // ---------------- 01807 01808 `define OVM_FIELD_SET(ARG,FLAG) \ 01809 if(ovm_object::m_do_set (str__, `"ARG`", ARG, what__, FLAG)) begin \ 01810 m_sc.scope.up(null); \ 01811 return; \ 01812 end 01813 01814 01815 // OVM_FIELD_SET_EVENT 01816 // ---------------------- 01817 01818 `define OVM_FIELD_SET_EVENT(ARG,FLAG) \ 01819 /*Not implemented*/ 01820 01821 01822 // OVM_FIELD_SET_OBJECT 01823 // ----------------------- 01824 01825 `define OVM_FIELD_SET_OBJECT(ARG,FLAG) \ 01826 begin \ 01827 ovm_object arg_obj; \ 01828 int r; /*return 1 if get succeeds*/ \ 01829 if(ARG != null) $cast(arg_obj, ARG); \ 01830 r = ovm_object::m_do_set_object(str__, `"ARG`", \ 01831 arg_obj, what__, FLAG); \ 01832 /*in case of a set, cast back */ \ 01833 if(r && (what__ == OVM_SETOBJ) && (arg_obj != null)) \ 01834 $cast(ARG, arg_obj); \ 01835 else if(arg_obj == null) \ 01836 ARG = null; \ 01837 end 01838 01839 01840 // OVM_FIELD_SET_STRING 01841 // ----------------------- 01842 01843 `define OVM_FIELD_SET_STRING(ARG,FLAG) \ 01844 if(ovm_object::m_do_set_string (str__, `"ARG`", ARG, what__, FLAG)) begin \ 01845 m_sc.scope.up(null); \ 01846 return; \ 01847 end 01848 01849 `define OVM_FIELD_SET_QUEUE_TYPE(ATYPE, ARRAY, RHS, FLAG) \ 01850 if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \ 01851 bit wildcard_index; \ 01852 int index; \ 01853 index = ovm_get_array_index_int(str__, wildcard_index); \ 01854 if(what__==OVM_SET``ATYPE) \ 01855 begin \ 01856 if(ovm_is_array(str__) && (index != -1)) begin\ 01857 if(wildcard_index) begin \ 01858 for(index=0; index<ARRAY.size(); ++index) begin \ 01859 if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 01860 ARRAY[index] = RHS; \ 01861 m_sc.status = 1; \ 01862 end \ 01863 end \ 01864 end \ 01865 else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 01866 ARRAY[index] = RHS; \ 01867 m_sc.status = 1; \ 01868 end \ 01869 end \ 01870 end \ 01871 end 01872 01873 `define OVM_FIELD_SET_QUEUE_OBJECT_TYPE(ARRAY, FLAG) \ 01874 if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \ 01875 bit wildcard_index; \ 01876 int index; \ 01877 index = ovm_get_array_index_int(str__, wildcard_index); \ 01878 if(what__==OVM_SETOBJ) \ 01879 begin \ 01880 if(ovm_is_array(str__) ) begin\ 01881 if(wildcard_index) begin \ 01882 for(index=0; index<ARRAY.size(); ++index) begin \ 01883 if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 01884 if (m_sc.object != null) \ 01885 $cast(ARRAY[index], m_sc.object); \ 01886 m_sc.status = 1; \ 01887 end \ 01888 end \ 01889 end \ 01890 else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 01891 if (m_sc.object != null) \ 01892 $cast(ARRAY[index], m_sc.object); \ 01893 m_sc.status = 1; \ 01894 end \ 01895 end \ 01896 end \ 01897 end 01898 01899 `define OVM_FIELD_SET_AA_TYPE(INDEX_TYPE, ARRAY_TYPE, ARRAY, RHS, FLAG) \ 01900 if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \ 01901 bit wildcard_index; \ 01902 INDEX_TYPE index; \ 01903 index = ovm_get_array_index_``INDEX_TYPE(str__, wildcard_index); \ 01904 if(what__==OVM_SET``ARRAY_TYPE) \ 01905 begin \ 01906 if(ovm_is_array(str__) ) begin\ 01907 if(wildcard_index) begin \ 01908 if(ARRAY.first(index)) \ 01909 do begin \ 01910 if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)}) || \ 01911 ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0s]", index)})) begin \ 01912 ARRAY[index] = RHS; \ 01913 m_sc.status = 1; \ 01914 end \ 01915 end while(ARRAY.next(index));\ 01916 end \ 01917 else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 01918 ARRAY[index] = RHS; \ 01919 m_sc.status = 1; \ 01920 end \ 01921 else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0s]", index)})) begin \ 01922 ARRAY[index] = RHS; \ 01923 m_sc.status = 1; \ 01924 end \ 01925 end \ 01926 end \ 01927 end 01928 01929 `define OVM_FIELD_SET_AA_OBJECT_TYPE(INDEX_TYPE, ARRAY, FLAG) \ 01930 if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \ 01931 bit wildcard_index; \ 01932 INDEX_TYPE index; \ 01933 index = ovm_get_array_index_``INDEX_TYPE(str__, wildcard_index); \ 01934 if(what__==OVM_SETOBJ) \ 01935 begin \ 01936 if(ovm_is_array(str__) ) begin\ 01937 if(wildcard_index) begin \ 01938 if(ARRAY.first(index)) \ 01939 do begin \ 01940 if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)}) || \ 01941 ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0s]", index)})) begin \ 01942 if (m_sc.object != null) \ 01943 $cast(ARRAY[index], m_sc.object); \ 01944 m_sc.status = 1; \ 01945 end \ 01946 end while(ARRAY.next(index));\ 01947 end \ 01948 else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 01949 if (m_sc.object != null) \ 01950 $cast(ARRAY[index], m_sc.object); \ 01951 m_sc.status = 1; \ 01952 end \ 01953 else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0s]", index)})) begin \ 01954 if (m_sc.object != null) \ 01955 $cast(ARRAY[index], m_sc.object); \ 01956 m_sc.status = 1; \ 01957 end \ 01958 end \ 01959 end \ 01960 end 01961 01962 `define OVM_FIELD_SET_AA_INT_TYPE(INDEX_TYPE, ARRAY_TYPE, ARRAY, RHS, FLAG) \ 01963 if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \ 01964 bit wildcard_index; \ 01965 INDEX_TYPE index; \ 01966 index = ovm_get_array_index_int(str__, wildcard_index); \ 01967 if(what__==OVM_SET``ARRAY_TYPE) \ 01968 begin \ 01969 if(ovm_is_array(str__) ) begin\ 01970 if(wildcard_index) begin \ 01971 if(ARRAY.first(index)) \ 01972 do begin \ 01973 if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 01974 ARRAY[index] = RHS; \ 01975 m_sc.status = 1; \ 01976 end \ 01977 end while(ARRAY.next(index));\ 01978 end \ 01979 else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 01980 ARRAY[index] = RHS; \ 01981 m_sc.status = 1; \ 01982 end \ 01983 end \ 01984 end \ 01985 end 01986 01987 `define OVM_FIELD_SET_ARRAY_TYPE(ARRAY_TYPE, ARRAY, RHS, FLAG) \ 01988 if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \ 01989 int index; \ 01990 bit wildcard_index; \ 01991 index = ovm_get_array_index_int(str__, wildcard_index); \ 01992 if(what__==OVM_SET``ARRAY_TYPE) \ 01993 begin \ 01994 if(ovm_is_array(str__) ) begin\ 01995 if(wildcard_index) begin \ 01996 for(int index=0; index<ARRAY.size(); ++index) begin \ 01997 if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 01998 ARRAY[index] = RHS; \ 01999 m_sc.status = 1; \ 02000 end \ 02001 end \ 02002 end \ 02003 else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 02004 ARRAY[index] = RHS; \ 02005 m_sc.status = 1; \ 02006 end \ 02007 else if(what__==OVM_SET && ovm_is_match(str__, m_sc.scope.get_arg())) begin \ 02008 int size; \ 02009 size = m_sc.bitstream; \ 02010 ARRAY = new[size](ARRAY); \ 02011 m_sc.status = 1; \ 02012 end \ 02013 end \ 02014 else if(what__==OVM_SET && ovm_is_match(str__, m_sc.scope.get_arg())) begin \ 02015 int size; \ 02016 size = m_sc.bitstream; \ 02017 ARRAY = new[size](ARRAY); \ 02018 m_sc.status = 1; \ 02019 end \ 02020 end \ 02021 else if(what__==OVM_SET && ovm_is_match(str__, m_sc.scope.get_arg())) begin \ 02022 int size; \ 02023 size = m_sc.bitstream; \ 02024 ARRAY = new[size](ARRAY); \ 02025 m_sc.status = 1; \ 02026 end \ 02027 end 02028 02029 02030 `define OVM_FIELD_SET_ARRAY_OBJECT_TYPE(ARRAY, FLAG) \ 02031 if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \ 02032 int index; \ 02033 bit wildcard_index; \ 02034 index = ovm_get_array_index_int(str__, wildcard_index); \ 02035 if(what__==OVM_SETOBJ) \ 02036 begin \ 02037 if(ovm_is_array(str__) ) begin\ 02038 if(wildcard_index) begin \ 02039 for(int index=0; index<ARRAY.size(); ++index) begin \ 02040 if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 02041 if (m_sc.object != null) \ 02042 $cast(ARRAY[index], m_sc.object); \ 02043 m_sc.status = 1; \ 02044 end \ 02045 end \ 02046 end \ 02047 else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 02048 if (m_sc.object != null) \ 02049 $cast(ARRAY[index], m_sc.object); \ 02050 m_sc.status = 1; \ 02051 end \ 02052 end \ 02053 end \ 02054 else if(what__==OVM_SET && !ovm_is_array(str__) && ovm_is_match(str__, m_sc.scope.get_arg())) begin \ 02055 int size; \ 02056 size = m_sc.bitstream; \ 02057 ARRAY = new[size](ARRAY); \ 02058 m_sc.status = 1; \ 02059 end \ 02060 end 02061 02062 // OVM_FIELD_SET_ARRAY_OBJECT 02063 // ----------------------------- 02064 02065 // The cast to ovm_object allows these macros to work 02066 // with ARG base types not derived from ovm_object. 02067 02068 `define OVM_FIELD_SET_ARRAY_OBJECT(ARG,FLAG) \ 02069 `OVM_FIELD_SET_ARRAY_OBJECT_TYPE(ARG, FLAG) \ 02070 if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \ 02071 ovm_object obj; \ 02072 for(int index=0; index<ARG.size(); ++index) begin \ 02073 if($cast(obj,ARG[index]) && (obj!=null)) \ 02074 obj.m_field_automation(null, what__, str__); \ 02075 end \ 02076 end 02077 02078 // OVM_FIELD_SET_QUEUE_OBJECT 02079 // ----------------------------- 02080 02081 `define OVM_FIELD_SET_QUEUE_OBJECT(ARG,FLAG) \ 02082 `OVM_FIELD_SET_QUEUE_OBJECT_TYPE(ARG, FLAG) \ 02083 if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \ 02084 ovm_object obj; \ 02085 for(int index=0; index<ARG.size(); ++index) begin \ 02086 if($cast(obj,ARG[index]) && (obj!=null)) \ 02087 obj.m_field_automation(null, what__, str__); \ 02088 end \ 02089 end 02090 02091 `endif //OVM_EMPTY_MACROS 02092 02093 `endif // OVM_OBJECT_DEFINES_SVH 02094
![]() Intelligent Design Verification Project: OVM, Revision: 1.0.1 |
Copyright (c) 2008-2010 Intelligent Design Verification. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included here: http://www.intelligentdv.com/licenses/fdl.txt |
![]() Doxygen Version: 1.6.3 IDV SV Filter Version: 2.6.3 Sat Jun 19 11:16:37 2010 |