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_enum(T,ARG,FLAG) 00036 `define ovm_field_object(ARG,FLAG) 00037 `define ovm_field_event(ARG,FLAG) 00038 `define ovm_field_string(ARG,FLAG) 00039 `define ovm_field_array_int(ARG,FLAG) 00040 `define ovm_field_sarray_int(ARG,FLAG) 00041 `define ovm_field_array_object(ARG,FLAG) 00042 `define ovm_field_sarray_object(ARG,FLAG) 00043 `define ovm_field_array_string(ARG,FLAG) 00044 `define ovm_field_sarray_string(ARG,FLAG) 00045 `define ovm_field_queue_int(ARG,FLAG) 00046 `define ovm_field_queue_object(ARG,FLAG) 00047 `define ovm_field_queue_string(ARG,FLAG) 00048 `define ovm_field_aa_int_string(ARG, FLAG) 00049 `define ovm_field_aa_string_string(ARG, FLAG) 00050 `define ovm_field_aa_object_string(ARG, FLAG) 00051 `define ovm_field_aa_int_int(ARG, FLAG) 00052 `define ovm_field_aa_int_int(ARG, FLAG) 00053 `define ovm_field_aa_int_int_unsigned(ARG, FLAG) 00054 `define ovm_field_aa_int_integer(ARG, FLAG) 00055 `define ovm_field_aa_int_integer_unsigned(ARG, FLAG) 00056 `define ovm_field_aa_int_byte(ARG, FLAG) 00057 `define ovm_field_aa_int_byte_unsigned(ARG, FLAG) 00058 `define ovm_field_aa_int_shortint(ARG, FLAG) 00059 `define ovm_field_aa_int_shortint_unsigned(ARG, FLAG) 00060 `define ovm_field_aa_int_longint(ARG, FLAG) 00061 `define ovm_field_aa_int_longint_unsigned(ARG, FLAG) 00062 `define ovm_field_aa_int_key(KEY, ARG, FLAG) 00063 `define ovm_field_aa_string_int(ARG, FLAG) 00064 `define ovm_field_aa_object_int(ARG, FLAG) 00065 00066 `else 00067 00068 //------------------------------------------------------------------------------ 00069 // 00070 // MACROS: utils 00071 // 00072 //------------------------------------------------------------------------------ 00073 00074 // Definitions for the user to use inside their derived data class declarations. 00075 00076 // ovm_field_utils 00077 // --------------- 00078 00079 // This macro is for consistency 00080 `define ovm_field_utils 00081 00082 00083 // ovm_field_utils_begin 00084 // --------------------- 00085 00086 `define ovm_field_utils_begin(T) \ 00087 static bit m_fields_checked = 0; \ 00088 function void m_field_automation (ovm_object tmp_data__=null, \ 00089 int what__=0, \ 00090 string str__=""); \ 00091 begin \ 00092 T local_data__; /* Used for copy and compare */ \ 00093 string string_aa_key; /* Used for associative array lookups */ \ 00094 /* Check the fields if not already checked */ \ 00095 if(what__ == OVM_CHECK_FIELDS) begin \ 00096 if(! T``::m_fields_checked) \ 00097 T``::m_fields_checked=1; \ 00098 else \ 00099 return; \ 00100 end \ 00101 /* Type is verified by ovm_object::compare() */ \ 00102 if(tmp_data__ != null) $cast(local_data__, tmp_data__); \ 00103 super.m_field_automation(tmp_data__, what__, str__); \ 00104 if(what__ == OVM_CHECK_FIELDS) begin \ 00105 m_field_array.delete(); \ 00106 end 00107 00108 // ovm_field_utils_end 00109 // ------------------- 00110 00111 `define ovm_field_utils_end \ 00112 end \ 00113 endfunction \ 00114 00115 00116 // ovm_object_utils 00117 // ---------------- 00118 // Purpose: provide a single macro when no fields will be defined, mainly used 00119 // by components, but can be used by raw data. 00120 00121 `define ovm_object_utils(T) \ 00122 `ovm_object_utils_begin(T) \ 00123 `ovm_object_utils_end 00124 00125 00126 // ovm_object_utils_begin 00127 // ---------------------- 00128 // Purpose: Implements factory methods and get_type_name and 00129 // starts the implementation of the superfunction m_field_automation. 00130 // Requires a default ctor (e.g. all args MUST have a default value). 00131 // 00132 // Precondition: T is the type name of the current user class 00133 // 00134 00135 `define ovm_object_utils_begin(T) \ 00136 `ovm_object_registry(T,T) \ 00137 `ovm_object_create_func(T) \ 00138 `ovm_get_type_name_func(T) \ 00139 `ovm_field_utils_begin(T) 00140 00141 00142 // ovm_object_utils_end 00143 // -------------------- 00144 // Purpose: finishes the superfunction implementation. This is the same as 00145 // the ovm_utils_end, but is expected to be used in conjunction with 00146 // ovm_object_utils_begin(). 00147 // 00148 00149 `define ovm_object_utils_end \ 00150 end \ 00151 endfunction \ 00152 00153 00154 // ovm_component_utils 00155 // -------------- 00156 // Purpose: provide a single macro when no fields will be defined, mainly used 00157 // by components, but can be used by raw data. Requires two arg ctor. 00158 00159 `define ovm_component_utils(T) \ 00160 `ovm_component_utils_begin(T) \ 00161 `ovm_component_utils_end 00162 00163 00164 // ovm_component_utils_begin 00165 // -------------------- 00166 // Purpose: implements factory methods and get_type_name and 00167 // starts the implementation of the superfunction m_field_automation. 00168 // Requires a 2 arg ctor (name and parent are required args). 00169 // 00170 // Precondition: T is the type name of the current user class 00171 // 00172 00173 `define ovm_component_utils_begin(T) \ 00174 `ovm_component_registry(T,T) \ 00175 `ovm_get_type_name_func(T) \ 00176 `ovm_field_utils_begin(T) 00177 00178 00179 // ovm_component_utils_end 00180 // ------------------ 00181 // Purpose: finishes the superfunction implementation. 00182 00183 `define ovm_component_utils_end \ 00184 end \ 00185 endfunction 00186 00187 00188 //------------------------------------------------------------------------------ 00189 // 00190 // MACROS: fields 00191 // 00192 // Use between begin/end utils macros, above 00193 //------------------------------------------------------------------------------ 00194 00195 // ovm_field_int 00196 // ------------- 00197 00198 // Purpose: provide implementation of all of the ovm functions for the given 00199 // integral field. This implementation is inside of the m_field_automation 00200 // function which allows a single macro declaration per field. 00201 // 00202 // Precondition: ARG is one of the fields of the class. FLAG is a unary anded 00203 // set of flags turning off fields. The ALL_ON flag turns all fields on. ARG 00204 // must not be a class object type or unpacked struct type, use 00205 // `ovm_field_object for a class object. 00206 00207 `define ovm_field_int(ARG,FLAG) \ 00208 begin \ 00209 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \ 00210 m_sc.scope.set_arg(`"ARG`"); \ 00211 `OVM_FIELD_DATA(ARG,FLAG) \ 00212 `OVM_FIELD_SET(ARG,FLAG) \ 00213 m_sc.scope.unset_arg(`"ARG`"); \ 00214 end 00215 00216 // Need a special macro for enums so that the enumerated value can be used 00217 `define ovm_field_enum(T,ARG,FLAG) \ 00218 begin \ 00219 m_sc.scope.set_arg(`"ARG`"); \ 00220 `OVM_FIELD_ENUM(T,ARG,FLAG) \ 00221 m_sc.scope.unset_arg(`"ARG`"); \ 00222 end 00223 00224 00225 // ovm_field_object 00226 // ---------------- 00227 00228 // Purpose: provide implementation of all of the ovm functions for the given 00229 // ovm_object derived argument. 00230 // 00231 // Precondition: ARG is one of the fields of the class. ARG must be a class 00232 // object. 00233 00234 `define ovm_field_object(ARG,FLAG) \ 00235 if((ARG==null) || !m_sc.scope.in_hierarchy(ARG)) begin \ 00236 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \ 00237 m_sc.scope.down(`"ARG`", ARG); \ 00238 `OVM_FIELD_DATA_OBJECT(ARG,FLAG) \ 00239 `OVM_FIELD_SET_OBJECT(ARG,FLAG) \ 00240 m_sc.scope.up(ARG); \ 00241 end 00242 00243 00244 // ovm_field_event 00245 // --------------- 00246 00247 // Purpose: provide implementation of all of the ovm functions for the given 00248 // event argument. 00249 // 00250 // Precondition: ARG is one of the fields of the class. ARG must be an 00251 // event type. 00252 00253 `define ovm_field_event(ARG,FLAG) \ 00254 begin \ 00255 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \ 00256 m_sc.scope.down(`"ARG`", null); \ 00257 `OVM_FIELD_DATA_EVENT(ARG,FLAG) \ 00258 m_sc.scope.up(null); \ 00259 end 00260 00261 00262 // ovm_field_string 00263 // ---------------- 00264 00265 // Purpose: provide implementation of all of the ovm functions for the given 00266 // string field. 00267 // 00268 // Precondition: ARG is one of the fields of the class. ARG must be a string 00269 // object. 00270 00271 `define ovm_field_string(ARG,FLAG) \ 00272 begin \ 00273 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \ 00274 m_sc.scope.down(`"ARG`",null); \ 00275 `OVM_FIELD_DATA_STRING(ARG,FLAG) \ 00276 `OVM_FIELD_SET_STRING(ARG,FLAG) \ 00277 m_sc.scope.up(null); \ 00278 end 00279 00280 00281 // ovm_field_array_int 00282 // ------------------- 00283 00284 // Purpose: provide implementation of all of the ovm functions for the given 00285 // array of integral objects field. 00286 // 00287 // Precondition: ARG is one of the fields of the class. ARG must be a array 00288 // of integral objects. The flags apply to fields within the array. 00289 00290 `define ovm_field_array_int(ARG,FLAG) \ 00291 begin \ 00292 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \ 00293 m_sc.scope.down(`"ARG`",null); \ 00294 if(what__==OVM_COPY && !((FLAG)&OVM_NOCOPY)) begin \ 00295 if(local_data__!=null) begin \ 00296 ARG = new [local_data__.ARG.size()](local_data__.ARG); \ 00297 end \ 00298 else begin \ 00299 ARG.delete(); \ 00300 end \ 00301 end \ 00302 `OVM_FIELD_DATA_ARRAY(ARG,FLAG) \ 00303 `OVM_FIELD_ARRAY_INT_PACK(ARG,FLAG) \ 00304 `OVM_FIELD_SET_ARRAY_TYPE(INT, ARG, m_sc.bitstream, FLAG) \ 00305 m_sc.scope.up(null); \ 00306 end 00307 00308 // ovm_field_sarray_int 00309 // ------------------- 00310 00311 // Purpose: provide implementation of all of the ovm functions for the given 00312 // a static array of integral objects field. 00313 // 00314 // Precondition: ARG is one of the fields of the class. ARG must be a array 00315 // of integral objects. The flags apply to fields within the array. 00316 00317 `define ovm_field_sarray_int(ARG,FLAG) \ 00318 begin \ 00319 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \ 00320 m_sc.scope.down(`"ARG`",null); \ 00321 `OVM_FIELD_DATA_SARRAY(ARG,FLAG) \ 00322 `OVM_FIELD_SET_SARRAY_TYPE(INT,ARG,m_sc.bitstream,FLAG) \ 00323 m_sc.scope.up(null); \ 00324 end 00325 00326 // ovm_field_array_object 00327 // ---------------------- 00328 00329 // Purpose: provide implementation of all of the ovm functions for the given 00330 // array of ovm_object objects field. 00331 // 00332 // Precondition: ARG is one of the fields of the class. ARG must be a array 00333 // of ovm_object objects. The flags apply to fields within the array. 00334 00335 `define ovm_field_array_object(ARG,FLAG) \ 00336 begin \ 00337 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \ 00338 m_sc.scope.down(`"ARG`", null); \ 00339 if(what__==OVM_COPY && !((FLAG)&OVM_NOCOPY)) begin \ 00340 if(local_data__!=null) begin \ 00341 ARG = new[local_data__.ARG.size()]; \ 00342 end \ 00343 else begin \ 00344 ARG.delete(); \ 00345 end \ 00346 end \ 00347 `OVM_FIELD_DATA_ARRAY_OBJECT(ARG,FLAG) \ 00348 `OVM_FIELD_ARRAY_OBJ_PACK(ARG,FLAG) \ 00349 `OVM_FIELD_SET_ARRAY_OBJECT(ARG,FLAG) \ 00350 m_sc.scope.up(null); \ 00351 end 00352 00353 // ovm_field_sarray_object 00354 // ----------------------- 00355 00356 // Purpose: provide implementation of all of the ovm functions for the given 00357 // a static array of integral objects field. 00358 // 00359 // Precondition: ARG is one of the fields of the class. ARG must be a array 00360 // of integral objects. The flags apply to fields within the array. 00361 00362 `define ovm_field_sarray_object(ARG,FLAG) \ 00363 begin \ 00364 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \ 00365 m_sc.scope.down(`"ARG`",null); \ 00366 `OVM_FIELD_DATA_SARRAY_OBJECT(ARG,FLAG) \ 00367 `OVM_FIELD_SET_SARRAY_OBJECT(ARG,FLAG) \ 00368 m_sc.scope.up(null); \ 00369 end 00370 00371 00372 // ovm_field_array_string 00373 // ---------------------- 00374 00375 // Purpose: provide implementation of all of the ovm functions for the given 00376 // array of string objects field. 00377 // 00378 // Precondition: ARG is one of the fields of the class. ARG must be a array 00379 // of string objects. The flags apply to fields within the array. 00380 00381 `define ovm_field_array_string(ARG,FLAG) \ 00382 begin \ 00383 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \ 00384 m_sc.scope.down(`"ARG`", null); \ 00385 if(what__==OVM_COPY && !((FLAG)&OVM_NOCOPY)) begin \ 00386 if(local_data__!=null) begin \ 00387 ARG = new[local_data__.ARG.size()]; \ 00388 end \ 00389 else begin \ 00390 ARG.delete(); \ 00391 end \ 00392 end \ 00393 `OVM_FIELD_DATA_ARRAY_STRING(ARG,FLAG) \ 00394 `OVM_FIELD_ARRAY_STR_PACK(ARG,FLAG) \ 00395 `OVM_FIELD_SET_ARRAY_TYPE(STR, ARG, m_sc.stringv, FLAG) \ 00396 m_sc.scope.up(null); \ 00397 end 00398 00399 `define ovm_field_sarray_string(ARG,FLAG) \ 00400 begin \ 00401 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \ 00402 m_sc.scope.down(`"ARG`", null); \ 00403 `OVM_FIELD_DATA_SARRAY_STRING(ARG,FLAG) \ 00404 `OVM_FIELD_SET_SARRAY_TYPE(STR, ARG, m_sc.stringv, FLAG) \ 00405 m_sc.scope.up(null); \ 00406 end 00407 00408 // ovm_field_queue_int 00409 `define ovm_field_queue_int(ARG,FLAG) \ 00410 begin \ 00411 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \ 00412 m_sc.scope.down(`"ARG`", null); \ 00413 if(what__==OVM_COPY && !((FLAG)&OVM_NOCOPY)) begin \ 00414 if(local_data__!=null) begin \ 00415 `RESIZE_QUEUE_NOCOPY(ovm_bitstream_t, ARG, local_data__.ARG.size()) \ 00416 end \ 00417 else begin \ 00418 `RESIZE_QUEUE_NOCOPY(ovm_bitstream_t, ARG, 0) \ 00419 end \ 00420 end \ 00421 `OVM_FIELD_DATA_ARRAY(ARG,FLAG) \ 00422 `OVM_FIELD_QUEUE_INT_PACK(ARG,FLAG) \ 00423 `OVM_FIELD_SET_QUEUE_TYPE(INT, ARG, m_sc.bitstream, FLAG) \ 00424 m_sc.scope.up(null); \ 00425 end 00426 00427 00428 // ovm_field_queue_object 00429 // ---------------------- 00430 00431 // Purpose: provide implementation of all of the ovm functions for the given 00432 // queue of ovm_object objects field. 00433 // 00434 // Precondition: ARG is one of the fields of the class. ARG must be a queue 00435 // of ovm_object objects. The flags apply to fields within the queue. 00436 00437 `define ovm_field_queue_object(ARG,FLAG) \ 00438 begin \ 00439 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \ 00440 m_sc.scope.down(`"ARG`", null); \ 00441 if(what__==OVM_COPY && !((FLAG)&OVM_NOCOPY)) begin \ 00442 if(local_data__!=null) begin \ 00443 `RESIZE_QUEUE_OBJECT_NOCOPY(ARG, local_data__.ARG.size()) \ 00444 end \ 00445 else begin \ 00446 `RESIZE_QUEUE_OBJECT_NOCOPY(ARG, 0) \ 00447 end \ 00448 end \ 00449 `OVM_FIELD_DATA_ARRAY_OBJECT(ARG,FLAG) \ 00450 `OVM_FIELD_QUEUE_OBJ_PACK(ARG,FLAG) \ 00451 `OVM_FIELD_SET_QUEUE_OBJECT(ARG,FLAG) \ 00452 m_sc.scope.up(null); \ 00453 end 00454 00455 00456 // ovm_field_queue_string 00457 // ---------------------- 00458 00459 // Purpose: provide implementation of all of the ovm functions for the given 00460 // queue of string objects field. 00461 // 00462 // Precondition: ARG is one of the fields of the class. ARG must be a queue 00463 // of string objects. The flags apply to fields within the queue. 00464 00465 `define ovm_field_queue_string(ARG,FLAG) \ 00466 begin \ 00467 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \ 00468 m_sc.scope.down(`"ARG`", null); \ 00469 if(what__==OVM_COPY && !((FLAG)&OVM_NOCOPY)) begin \ 00470 if(local_data__!=null) begin \ 00471 `RESIZE_QUEUE_NOCOPY(string, ARG, local_data__.ARG.size()) \ 00472 end \ 00473 else begin \ 00474 `RESIZE_QUEUE_NOCOPY(string, ARG, 0) \ 00475 end \ 00476 end \ 00477 `OVM_FIELD_DATA_ARRAY_STRING(ARG,FLAG) \ 00478 `OVM_FIELD_QUEUE_STR_PACK(ARG,FLAG) \ 00479 `OVM_FIELD_SET_QUEUE_TYPE(STR, ARG, m_sc.stringv, FLAG) \ 00480 m_sc.scope.up(null); \ 00481 end 00482 00483 00484 // ovm_field_aa_int_string 00485 // ----------------------- 00486 00487 `define ovm_field_aa_int_string(ARG, FLAG) \ 00488 begin \ 00489 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \ 00490 m_sc.scope.down(`"ARG`", null); \ 00491 `OVM_FIELD_DATA_AA_int_string(ARG,FLAG) \ 00492 `OVM_FIELD_SET_AA_TYPE(string, INT, ARG, m_sc.bitstream, FLAG) \ 00493 m_sc.scope.up(null); \ 00494 end 00495 00496 00497 // ovm_field_aa_object_string 00498 // -------------------------- 00499 00500 `define ovm_field_aa_object_string(ARG, FLAG) \ 00501 begin \ 00502 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \ 00503 m_sc.scope.down(`"ARG`", null); \ 00504 `OVM_FIELD_DATA_AA_object_string(ARG,FLAG) \ 00505 `OVM_FIELD_SET_AA_OBJECT_TYPE(string, ARG, FLAG) \ 00506 m_sc.scope.up(null); \ 00507 end 00508 00509 00510 // ovm_field_aa_string_string 00511 // -------------------------- 00512 00513 `define ovm_field_aa_string_string(ARG, FLAG) \ 00514 begin \ 00515 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \ 00516 m_sc.scope.down(`"ARG`", null); \ 00517 `OVM_FIELD_DATA_AA_string_string(ARG,FLAG) \ 00518 `OVM_FIELD_SET_AA_TYPE(string, STR, ARG, m_sc.stringv, FLAG) \ 00519 m_sc.scope.up(null); \ 00520 end 00521 00522 // ovm_field_aa_object_int 00523 // -------------------------- 00524 00525 `define ovm_field_aa_object_int(ARG, FLAG) \ 00526 begin \ 00527 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \ 00528 m_sc.scope.down(`"ARG`", null); \ 00529 `OVM_FIELD_DATA_AA_object_int(ARG,FLAG) \ 00530 `OVM_FIELD_SET_AA_OBJECT_TYPE(int, ARG, FLAG) \ 00531 m_sc.scope.up(null); \ 00532 end 00533 00534 // ovm_field_aa_int_int 00535 // -------------------------- 00536 00537 `define ovm_field_aa_int_int(ARG, FLAG) \ 00538 `ovm_field_aa_int_key(int, ARG, FLAG) \ 00539 00540 `define ovm_field_aa_int_int_unsigned(ARG, FLAG) \ 00541 `ovm_field_aa_int_key(int unsigned, ARG, FLAG) 00542 00543 `define ovm_field_aa_int_integer(ARG, FLAG) \ 00544 `ovm_field_aa_int_key(integer, ARG, FLAG) 00545 00546 `define ovm_field_aa_int_integer_unsigned(ARG, FLAG) \ 00547 `ovm_field_aa_int_key(integer unsigned, ARG, FLAG) 00548 00549 `define ovm_field_aa_int_byte(ARG, FLAG) \ 00550 `ovm_field_aa_int_key(byte, ARG, FLAG) 00551 00552 `define ovm_field_aa_int_byte_unsigned(ARG, FLAG) \ 00553 `ovm_field_aa_int_key(byte unsigned, ARG, FLAG) 00554 00555 `define ovm_field_aa_int_shortint(ARG, FLAG) \ 00556 `ovm_field_aa_int_key(shortint, ARG, FLAG) 00557 00558 `define ovm_field_aa_int_shortint_unsigned(ARG, FLAG) \ 00559 `ovm_field_aa_int_key(shortint unsigned, ARG, FLAG) 00560 00561 `define ovm_field_aa_int_longint(ARG, FLAG) \ 00562 `ovm_field_aa_int_key(longint, ARG, FLAG) 00563 00564 `define ovm_field_aa_int_longint_unsigned(ARG, FLAG) \ 00565 `ovm_field_aa_int_key(longint unsigned, ARG, FLAG) 00566 00567 `define ovm_field_aa_int_key(KEY, ARG, FLAG) \ 00568 begin \ 00569 if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \ 00570 m_sc.scope.down(`"ARG`", null); \ 00571 `OVM_FIELD_DATA_AA_int_key(KEY,ARG,FLAG) \ 00572 `OVM_FIELD_SET_AA_INT_TYPE(KEY, INT, ARG, m_sc.bitstream, FLAG) \ 00573 m_sc.scope.up(null); \ 00574 end 00575 00576 00577 // Purpose: Provide a way for a derived class to override the flag settings in 00578 // the base class. 00579 // 00580 00581 `define ovm_set_flags(ARG,FLAG) \ 00582 begin \ 00583 if(what__ == OVM_FLAGS) begin \ 00584 end \ 00585 end 00586 00587 00588 // ovm_print_msg_enum 00589 // ------------------ 00590 00591 `define ovm_print_msg_enum(LHS,RHS) \ 00592 begin \ 00593 ovm_comparer comparer; \ 00594 comparer = ovm_auto_options_object.comparer; \ 00595 if(comparer==null) comparer = ovm_default_comparer; \ 00596 comparer.result++; \ 00597 /* $swrite(comparer.miscompares,"%s%s: lhs = %s : rhs = %s\n",*/ \ 00598 /* comparer.miscompares, comparer.scope.get_arg(), LHS, RHS );*/ \ 00599 $swrite(comparer.miscompares,"%s%s: lhs = %0d : rhs = %0d\n", \ 00600 comparer.miscompares, comparer.scope.get_arg(), LHS, RHS ); \ 00601 end 00602 00603 00604 //----------------------------------------------------------------------------- 00605 // 00606 // MACROS: recording 00607 // 00608 //----------------------------------------------------------------------------- 00609 00610 // TBD 00611 00612 // ovm_record_int 00613 // -------------- 00614 00615 // Purpose: provide print functionality for a specific integral field. This 00616 // macro is available for user access. If used externally, a record_options 00617 // object must be avaialble and must have the name opt. 00618 // 00619 // Postcondition: ARG is printed using the format set by the FLAGS. 00620 00621 `define ovm_record_int(ARG,FLAG) \ 00622 begin \ 00623 integer h; \ 00624 int radix; \ 00625 ovm_bitstream_t value; \ 00626 value = ARG; \ 00627 radix = ovm_radix_enum'((FLAG)&(OVM_RADIX)); \ 00628 if(recorder==null) \ 00629 recorder=ovm_auto_options_object.recorder; \ 00630 recorder.record_field(`"ARG`", ARG, radix, $bits(ARG); \ 00631 end 00632 00633 00634 // ovm_record_string 00635 // ----------------- 00636 00637 // Purpose: provide record functionality for a specific string field. This 00638 // macro is available for user access. If used externally, a record_options 00639 // object must be avaialble and must have the name recorder. 00640 // 00641 // Postcondition: ARG is recorded in string format. 00642 00643 00644 `define ovm_record_string(ARG) \ 00645 recorder.record_string(`"ARG`", ARG); \ 00646 00647 00648 // ovm_record_object 00649 // ----------------- 00650 00651 // Purpose: provide record functionality for a specific ovm_object field. This 00652 // macro is available for user access. If used externally, a record_options 00653 // object must be avaialble and must have the name recorder. 00654 // 00655 // Postcondition: ARG is recorded. The record is done recursively where the 00656 // depth to record is set in the recorder object. 00657 00658 00659 `define ovm_record_object(ARG,FLAG) \ 00660 begin \ 00661 ovm_object v; \ 00662 if(ARG != null) begin \ 00663 if($cast(v,ARG)) begin \ 00664 ovm_record_object__(`"ARG`", v, recorder); \ 00665 end \ 00666 end \ 00667 else begin \ 00668 `ovm_record_any_object(ARG); \ 00669 end \ 00670 end 00671 00672 00673 // ovm_record_any_object 00674 // --------------------- 00675 00676 // Purpose: provide record functionality for a user specific class object. This 00677 // macro is available for user access. If used externally, a record_options 00678 // object must be availble and must have the name recorder. 00679 // 00680 // Postcondition: The reference value of ARG is recorded. 00681 00682 `define ovm_record_any_object(ARG) \ 00683 //recorder.record_object(`"ARG`", ARG); 00684 00685 00686 //----------------------------------------------------------------------------- 00687 // 00688 // INTERNAL MACROS - do not use directly 00689 // 00690 //----------------------------------------------------------------------------- 00691 00692 // MACROS: for composing the utils and field macro sets 00693 00694 // ovm_new_func 00695 // ------------ 00696 00697 `define ovm_new_func \ 00698 function new (string name, ovm_component parent); \ 00699 super.new(name, parent); \ 00700 endfunction 00701 00702 `define ovm_component_new_func \ 00703 `ovm_new_func 00704 00705 `define ovm_new_func_data \ 00706 function new (string name=""); \ 00707 super.new(name); \ 00708 endfunction 00709 00710 `define ovm_object_new_func \ 00711 `ovm_new_func_data 00712 00713 `define ovm_named_object_new_func \ 00714 function new (string name, ovm_component parent); \ 00715 super.new(name, parent); \ 00716 endfunction 00717 00718 // ovm_object_create_func 00719 // ---------------------- 00720 00721 // Zero argument create function, requires default constructor 00722 `define ovm_object_create_func(T) \ 00723 function ovm_object create (string name=""); \ 00724 T tmp; \ 00725 tmp = new(); \ 00726 tmp.set_name(name); \ 00727 return tmp; \ 00728 endfunction 00729 00730 `define ovm_object_factory_create_func(T) \ 00731 function ovm_object create_object (string name=""); \ 00732 T tmp; \ 00733 tmp = new(); \ 00734 tmp.set_name(name); \ 00735 return tmp; \ 00736 endfunction 00737 00738 // ovm_named_object_create_func 00739 // ---------------------------- 00740 00741 `define ovm_named_object_create_func(T) \ 00742 function ovm_named_object create_named_object (string name, ovm_named_object parent); \ 00743 T tmp; \ 00744 tmp = new(.name(name), .parent(parent)); \ 00745 return tmp; \ 00746 endfunction 00747 00748 `define ovm_named_object_factory_create_func(T) \ 00749 `ovm_named_object_create_func(T) 00750 00751 `define ovm_component_factory_create_func(T) \ 00752 function ovm_component create_component (string name, ovm_component parent); \ 00753 T tmp; \ 00754 tmp = new(.name(name), .parent(parent)); \ 00755 return tmp; \ 00756 endfunction 00757 00758 00759 // ovm_get_type_name_func 00760 // ---------------------- 00761 00762 `define ovm_get_type_name_func(T) \ 00763 virtual function string get_type_name (); \ 00764 return `"T`"; \ 00765 endfunction 00766 00767 00768 // ovm_register_self_func 00769 // ---------------------- 00770 00771 `ifndef INCA 00772 `define USE_PARAMETERIZED_WRAPPER 00773 `endif 00774 00775 `ifndef USE_PARAMETERIZED_WRAPPER 00776 `define ovm_register_self_func(T) \ 00777 \ 00778 static bit is_auto_registered = register_self(); \ 00779 \ 00780 static function bit register_self(); \ 00781 T``wrapper obj_wrapper; \ 00782 obj_wrapper = new(); \ 00783 ovm_factory::auto_register(obj_wrapper); \ 00784 return 1; \ 00785 endfunction // bit 00786 `else 00787 `define ovm_register_self_func(T) 00788 `endif 00789 00790 00791 // ovm_object_derived_wrapper_class 00792 // -------------------------------- 00793 00794 `ifndef USE_PARAMETERIZED_WRAPPER 00795 `define ovm_object_registry(T,S) \ 00796 class T``wrapper extends ovm_object_wrapper; \ 00797 virtual function string get_type_name (); \ 00798 return `"S`"; \ 00799 endfunction \ 00800 `ovm_object_factory_create_func(T) \ 00801 `ovm_register_self_func(T) \ 00802 endclass 00803 `else 00804 `ifndef SVPP 00805 `define ovm_object_registry(T,S) \ 00806 static ovm_object_registry#(T,`"S`") is_auto_registered; 00807 `endif //SVPP 00808 `endif //USE_PARAMETERIZED_WRAPPER 00809 00810 00811 // ovm_component_derived_wrapper_class 00812 // --------------------------------- 00813 00814 `ifndef USE_PARAMETERIZED_WRAPPER 00815 `define ovm_component_registry(T,S) \ 00816 class T``wrapper extends ovm_object_wrapper; \ 00817 virtual function string get_type_name (); \ 00818 return `"S`"; \ 00819 endfunction \ 00820 `ovm_component_factory_create_func(T) \ 00821 `ovm_register_self_func(T) \ 00822 endclass 00823 `else 00824 `ifndef SVPP 00825 `define ovm_component_registry(T,S) \ 00826 ovm_component_registry#(T,`"S`") is_auto_registered; 00827 `endif //SVPP 00828 `endif //USE_PARAMETERIZED_WRAPPER 00829 00830 00831 // OVM_FIELD_DATA 00832 // -------------- 00833 00834 `define OVM_FIELD_DATA(ARG,FLAG) \ 00835 begin \ 00836 int r; \ 00837 if((what__ == OVM_PRINT) && (((FLAG)&OVM_NOPRINT) == 0) && (((FLAG)&OVM_RADIX) == OVM_ENUM) && \ 00838 (ovm_auto_options_object.printer.knobs.print_fields == 1)) begin \ 00839 $swrite(m_sc.stringv, `"`OVM_ENUM`", ARG); \ 00840 ovm_auto_options_object.printer.print_generic(`"ARG`", "enum", \ 00841 $bits(ARG), m_sc.stringv); \ 00842 end \ 00843 else if((what__ == OVM_RECORD) && (((FLAG)&OVM_NORECORD) == 0) && (((FLAG)&OVM_RADIX) == OVM_ENUM)) \ 00844 begin \ 00845 $swrite(m_sc.stringv, `"`OVM_ENUM`", ARG); \ 00846 ovm_auto_options_object.recorder.record_string(`"ARG`",m_sc.stringv); \ 00847 end \ 00848 else if(tmp_data__!=null) begin \ 00849 if($cast(local_data__, tmp_data__)) begin \ 00850 r = m_do_data(`"ARG`", ARG, local_data__.ARG, what__, $bits(ARG), FLAG); \ 00851 end \ 00852 end \ 00853 else begin \ 00854 if(what__ != OVM_COMPARE && what__ != OVM_COPY) begin \ 00855 r = m_do_data(`"ARG`", ARG, 0, what__, $bits(ARG), FLAG); \ 00856 end \ 00857 end \ 00858 if((what__ == OVM_COMPARE) && r) begin \ 00859 if(((FLAG)&OVM_RADIX) == OVM_ENUM) begin \ 00860 if(local_data__!=null) begin \ 00861 `ovm_print_msg_enum(ARG, local_data__.ARG) \ 00862 end \ 00863 else begin \ 00864 `ovm_print_msg_enum(ARG, 0) \ 00865 end \ 00866 end \ 00867 end \ 00868 end 00869 00870 `define OVM_FIELD_ENUM(T, ARG,FLAG) \ 00871 begin \ 00872 if((what__ == OVM_PRINT) && (((FLAG)&OVM_NOPRINT) == 0) && \ 00873 (ovm_auto_options_object.printer.knobs.print_fields == 1)) begin \ 00874 ovm_auto_options_object.printer.print_generic(`"ARG`", `"T`", \ 00875 $bits(ARG), ARG.name()); \ 00876 end \ 00877 else if((what__ == OVM_RECORD) && (((FLAG)&OVM_NORECORD) == 0)) \ 00878 begin \ 00879 ovm_auto_options_object.recorder.record_string(`"ARG`",ARG.name()); \ 00880 end \ 00881 else if(tmp_data__!=null) begin \ 00882 if($cast(local_data__, tmp_data__)) begin \ 00883 case(what__) \ 00884 OVM_COPY: \ 00885 if(((FLAG)&OVM_NOCOPY) == 0) \ 00886 ARG = local_data__.ARG; \ 00887 OVM_COMPARE: \ 00888 if((((FLAG)&OVM_NOCOMPARE) == 0) && (ARG != local_data__.ARG)) \ 00889 ovm_auto_options_object.comparer.print_msg({"lhs = ", ARG.name(), " : rhs = ", local_data__.ARG.name()}); \ 00890 endcase \ 00891 end \ 00892 end \ 00893 else begin \ 00894 case(what__) \ 00895 OVM_PACK: \ 00896 ovm_auto_options_object.packer.pack_field_int(int'(ARG), $bits(ARG)); \ 00897 OVM_UNPACK: \ 00898 begin \ 00899 ARG = T'(ovm_auto_options_object.packer.unpack_field_int($bits(ARG))); \ 00900 end \ 00901 OVM_SETINT: \ 00902 begin \ 00903 if(ovm_is_match(str__ ,m_sc.scope.get_arg()) && (((FLAG)&OVM_READONLY) == 0)) begin \ 00904 print_field_match("set_int()", str__); \ 00905 ARG = T'(ovm_object::m_sc.bitstream); \ 00906 ovm_object::m_sc.status = 1; \ 00907 end \ 00908 end \ 00909 endcase \ 00910 end \ 00911 end 00912 00913 // OVM_FIELD_DATA_EVENT 00914 // -------------------- 00915 00916 `define OVM_FIELD_DATA_EVENT(ARG,FLAG) \ 00917 begin \ 00918 int r; \ 00919 if(what__ == OVM_PRINT && ( (FLAG)&OVM_NOPRINT != 0) && \ 00920 ovm_auto_options_object.printer.knobs.print_fields == 1) \ 00921 ovm_auto_options_object.printer.print_generic(`"ARG`", "event", -1, "-"); \ 00922 else if((what__ == OVM_COMPARE) && ( (FLAG)&OVM_NOCOMPARE != 0) && \ 00923 local_data__ && ARG != local_data__.ARG) \ 00924 begin \ 00925 ovm_auto_options_object.comparer.print_msg(""); \ 00926 end \ 00927 else if((what__ == OVM_COPY) && local_data__ && ( (FLAG)&OVM_NOCOPY != 0 ) ) \ 00928 begin \ 00929 ARG = local_data__.ARG; \ 00930 end \ 00931 end 00932 00933 00934 // OVM_FIELD_DATA_OBJECT 00935 // --------------------- 00936 00937 `define OVM_FIELD_DATA_OBJECT(ARG,FLAG) \ 00938 begin \ 00939 int r; \ 00940 ovm_object lhs__, rhs__; \ 00941 r = 0; \ 00942 if(ARG == null) \ 00943 lhs__ = null; \ 00944 else if(!$cast(lhs__,ARG)) begin \ 00945 ovm_object::m_sc.scratch1 = \ 00946 `"Cast failed for ARG to ovm_object type (ovm_field_object not implemented)`"; \ 00947 _global_reporter.ovm_report_warning("CSTFLD",ovm_object::m_sc.scratch1); \ 00948 end \ 00949 if(tmp_data__ != null) begin \ 00950 if($cast(local_data__, tmp_data__)) begin \ 00951 r = m_do_data_object(`"ARG`", lhs__, local_data__.ARG, what__, FLAG); \ 00952 end \ 00953 else if(tmp_data__!=null) begin \ 00954 ovm_object::m_sc.scratch1 = `"Type check failed for ARG for copy/compare`"; \ 00955 _global_reporter.ovm_report_error("TCKFLD", ovm_object::m_sc.scratch1); \ 00956 end \ 00957 end \ 00958 else begin \ 00959 r = m_do_data_object(`"ARG`", lhs__, null, what__, FLAG); \ 00960 end \ 00961 if((what__ == OVM_COPY) && (r == OVM_SHALLOW)) begin \ 00962 ovm_object v; \ 00963 v = ovm_global_copy_map.get(local_data__.ARG); \ 00964 if(v != null) begin \ 00965 $cast(ARG, v); \ 00966 end \ 00967 else begin \ 00968 /* Can't do shallow copy right now due to */ \ 00969 /* an issue with abstract classes */ \ 00970 /* like ovm_object, so do a deep copy instead. */ \ 00971 if(local_data__.ARG==null) ARG = null; \ 00972 else if(ARG!=null) ARG.copy(local_data__.ARG); \ 00973 else begin \ 00974 ovm_object cobj; \ 00975 cobj = local_data__.ARG.clone(); \ 00976 if(cobj == null) ARG = null; \ 00977 else begin \ 00978 $cast(ARG, local_data__.ARG.clone()); \ 00979 ARG.set_name(`"ARG`"); \ 00980 end \ 00981 end \ 00982 end \ 00983 end \ 00984 else if((what__ == OVM_COPY) && (r == OVM_REFERENCE)) begin \ 00985 if((lhs__ == null)&&(local_data__.ARG != null)) begin \ 00986 if(!$cast(ARG,local_data__.ARG)) begin \ 00987 ovm_object::m_sc.scratch1 = `"Copy cast failed for ARG`"; \ 00988 _global_reporter.ovm_report_error("CSTFLD",ovm_object::m_sc.scratch1); \ 00989 end \ 00990 end \ 00991 else if(lhs__==null) \ 00992 ARG = null; \ 00993 else \ 00994 $cast(ARG, lhs__); \ 00995 end \ 00996 end 00997 00998 00999 // OVM_FIELD_DATA_STRING 01000 // --------------------- 01001 01002 `define OVM_FIELD_DATA_STRING(ARG,FLAG) \ 01003 begin \ 01004 int r; \ 01005 if(local_data__ != null) begin \ 01006 if($cast(local_data__, tmp_data__)) begin \ 01007 r = m_do_data_string(`"ARG`", ARG, local_data__.ARG, what__, FLAG); \ 01008 end \ 01009 end \ 01010 else \ 01011 r = m_do_data_string(`"ARG`", ARG, "", what__, FLAG); \ 01012 end 01013 01014 01015 // RESIZE_QUEUE_NOCOPY 01016 // ------------------- 01017 01018 `define RESIZE_QUEUE_NOCOPY(T, ARG, SIZE) \ 01019 begin \ 01020 T tmp; \ 01021 while(ARG.size()) void'(ARG.pop_front()); \ 01022 while(ARG.size() != SIZE) ARG.push_back(tmp); \ 01023 end 01024 01025 01026 // RESIZE_QUEUE_COPY 01027 // ----------------- 01028 01029 `define RESIZE_QUEUE_COPY(T, ARG, SIZE) \ 01030 begin \ 01031 T tmp; \ 01032 while(ARG.size()>SIZE) void'(ARG.pop_back()); \ 01033 while(ARG.size() != SIZE) ARG.push_back(tmp); \ 01034 end 01035 01036 01037 // RESIZE_QUEUE_OBJECT_NOCOPY 01038 // -------------------------- 01039 01040 `define RESIZE_QUEUE_OBJECT_NOCOPY(ARG, SIZE) \ 01041 begin \ 01042 while(ARG.size()) void'(ARG.pop_front()); \ 01043 while(ARG.size() != SIZE) ARG.push_back(null); \ 01044 end 01045 01046 01047 // RESIZE_QUEUE_OBJECT_COPY 01048 // ------------------------ 01049 01050 `define RESIZE_QUEUE_OBJECT_COPY(ARG, SIZE) \ 01051 begin \ 01052 while(ARG.size()>SIZE) void'(ARG.pop_front()); \ 01053 while(ARG.size() != SIZE) ARG.push_back(null); \ 01054 end 01055 01056 // ovm_record_array_int 01057 // -------------------- 01058 01059 `define ovm_record_array_int(ARG, RADIX, RECORDER) \ 01060 begin \ 01061 if(RECORDER.tr_handle != 0) begin\ 01062 if(RADIX == OVM_ENUM) begin \ 01063 if(!m_sc.array_warning_done) begin \ 01064 m_sc.array_warning_done = 1; \ 01065 ovm_object::m_sc.scratch1 = \ 01066 `"Recording not supported for array enumerations: ARG`"; \ 01067 _global_reporter.ovm_report_warning("RCDNTS", ovm_object::m_sc.scratch1); \ 01068 end \ 01069 end \ 01070 else begin \ 01071 for(int i__=0; i__<ARG.size(); ++i__) \ 01072 RECORDER.record_field($psprintf(`"ARG[%0d]`",i__), ARG[i__], $bits(ARG[i__]), ovm_radix_enum'(RADIX)); \ 01073 end \ 01074 end \ 01075 end 01076 01077 // OVM_FIELD_DATA_ARRAY 01078 // -------------------- 01079 01080 `define OVM_FIELD_DATA_ARRAY(ARG,FLAG) \ 01081 begin \ 01082 if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \ 01083 case (what__) \ 01084 OVM_COMPARE: \ 01085 if ( !((FLAG)&OVM_NOCOMPARE) && (tmp_data__ != null) ) begin \ 01086 int i__; \ 01087 $cast(local_data__, tmp_data__); \ 01088 if(ARG.size() != local_data__.ARG.size()) begin \ 01089 int s1, s2; \ 01090 m_sc.stringv = ""; \ 01091 s1 = ARG.size(); s2 = local_data__.ARG.size(); \ 01092 $swrite(m_sc.stringv, "lhs size = %0d : rhs size = %0d", s1, s2);\ 01093 ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \ 01094 end \ 01095 for(i__=0; i__<ARG.size() && i__<local_data__.ARG.size(); ++i__) \ 01096 if(ARG[i__] !== local_data__.``ARG[i__]) begin \ 01097 ovm_auto_options_object.comparer.scope.down_element(i__, null);\ 01098 $swrite(m_sc.stringv, "lhs = %0d : rhs = %0d", \ 01099 ARG[i__], local_data__.ARG[i__]); \ 01100 ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \ 01101 ovm_auto_options_object.comparer.scope.up_element(null);\ 01102 end \ 01103 end \ 01104 OVM_COPY: \ 01105 if(!((FLAG)&OVM_NOCOPY) && (tmp_data__ != null)) \ 01106 begin \ 01107 int i__; \ 01108 $cast(local_data__, tmp_data__); \ 01109 /*Resizing of array is done in ovm_field*/ \ 01110 for(i__=0; i__ < ARG``.size(); ++i__) begin \ 01111 ARG[i__] = local_data__.``ARG[i__] ; \ 01112 end \ 01113 end \ 01114 OVM_PRINT: \ 01115 begin \ 01116 if(((FLAG)&OVM_NOPRINT) == 0 && \ 01117 ovm_auto_options_object.printer.knobs.print_fields == 1) begin \ 01118 `ovm_print_array_int3(ARG, ovm_radix_enum'((FLAG)&(OVM_RADIX)), \ 01119 ovm_auto_options_object.printer) \ 01120 end \ 01121 end \ 01122 OVM_RECORD: \ 01123 begin \ 01124 if(((FLAG)&OVM_NORECORD) == 0) begin \ 01125 `ovm_record_array_int(ARG, ovm_radix_enum'((FLAG)&(OVM_RADIX)), \ 01126 ovm_auto_options_object.recorder) \ 01127 end \ 01128 end \ 01129 endcase \ 01130 end \ 01131 end 01132 01133 `define OVM_FIELD_ARRAY_INT_PACK(ARG,FLAG) \ 01134 case(what__) \ 01135 OVM_PACK: \ 01136 if(((FLAG)&OVM_NOPACK) == 0) \ 01137 begin \ 01138 if(ovm_auto_options_object.packer.use_metadata == 1) \ 01139 ovm_auto_options_object.packer.pack_field_int(ARG.size(), 32); \ 01140 foreach(ARG[i]) \ 01141 ovm_auto_options_object.packer.pack_field(ARG[i], $bits(ARG[i])); \ 01142 end \ 01143 OVM_UNPACK: \ 01144 if(((FLAG)&OVM_NOPACK) == 0) \ 01145 begin \ 01146 int s_; \ 01147 s_ = ovm_auto_options_object.packer.unpack_field_int(32); \ 01148 ARG = new[s_]; \ 01149 foreach(ARG[i]) \ 01150 ARG[i] = ovm_auto_options_object.packer.unpack_field($bits(ARG[i])); \ 01151 end \ 01152 endcase 01153 01154 `define OVM_FIELD_QUEUE_INT_PACK(ARG,FLAG) \ 01155 case(what__) \ 01156 OVM_PACK: \ 01157 if(((FLAG)&OVM_NOPACK) == 0) \ 01158 begin \ 01159 if(ovm_auto_options_object.packer.use_metadata == 1) \ 01160 ovm_auto_options_object.packer.pack_field_int(ARG.size(), 32); \ 01161 foreach(ARG[i]) \ 01162 ovm_auto_options_object.packer.pack_field(ARG[i], $bits(ARG[i])); \ 01163 end \ 01164 OVM_UNPACK: \ 01165 if(((FLAG)&OVM_NOPACK) == 0) \ 01166 begin \ 01167 int s_; \ 01168 s_ = ovm_auto_options_object.packer.unpack_field_int(32); \ 01169 while(ARG.size() < s_) ARG.push_back(0); \ 01170 while(ARG.size() > s_) void'(ARG.pop_front()); \ 01171 foreach(ARG[i]) \ 01172 ARG[i] = ovm_auto_options_object.packer.unpack_field($bits(ARG[i])); \ 01173 end \ 01174 endcase 01175 01176 `define OVM_FIELD_DATA_SARRAY(ARG,FLAG) \ 01177 begin \ 01178 if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \ 01179 if(what__ == OVM_PRINT) \ 01180 `ovm_print_sarray_int3(ARG, ovm_radix_enum'((FLAG)&(OVM_RADIX)), \ 01181 ovm_auto_options_object.printer) \ 01182 else if(tmp_data__!=null) begin \ 01183 foreach(ARG[i__]) \ 01184 if($cast(local_data__, tmp_data__)) begin \ 01185 void'(m_do_data($psprintf(`"ARG[%0d]`",i__), ARG[i__], local_data__.ARG[i__], what__, $bits(ARG[i__]), FLAG)); \ 01186 end \ 01187 end \ 01188 else begin \ 01189 foreach(ARG[i__]) \ 01190 if($cast(local_data__, tmp_data__)) begin \ 01191 void'(m_do_data($psprintf(`"ARG[%0d]`",i__), ARG[i__], 0, what__, $bits(ARG[i__]), FLAG)); \ 01192 end \ 01193 end \ 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 `define OVM_FIELD_DATA_SARRAY_OBJECT(ARG,FLAG) \ 01331 begin \ 01332 if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \ 01333 ovm_object lhs__; \ 01334 if(what__ == OVM_PRINT) \ 01335 `ovm_print_sarray_object3(ARG, ovm_auto_options_object.printer, FLAG) \ 01336 else if((what__ == OVM_COPY) && ((FLAG)&OVM_NOCOPY)==0) begin \ 01337 $cast(local_data__, tmp_data__); \ 01338 foreach(ARG[i__]) begin \ 01339 if(local_data__.ARG[i__] == null || (((FLAG)&OVM_REFERENCE) != 0)) \ 01340 ARG[i__] = local_data__.ARG[i__]; \ 01341 else if(((FLAG)&OVM_SHALLOW) != 0) \ 01342 ARG[i__] = new local_data__.ARG[i__]; \ 01343 else if(ARG[i__] == null) \ 01344 ARG[i__].copy(local_data__.ARG[i__]); \ 01345 else \ 01346 $cast(ARG[i__],local_data__.ARG[i__].clone()); \ 01347 end \ 01348 end \ 01349 else if((what__ != OVM_COPY) && (tmp_data__!=null)) begin \ 01350 $cast(local_data__, tmp_data__); \ 01351 foreach(ARG[i__]) begin \ 01352 lhs__ = ARG[i__]; \ 01353 if($cast(local_data__, tmp_data__)) \ 01354 void'(m_do_data_object($psprintf(`"ARG[%0d]`",i__), lhs__, local_data__.ARG[i__], what__, FLAG)); \ 01355 else \ 01356 void'(m_do_data_object($psprintf(`"ARG[%0d]`",i__), lhs__, null, what__, FLAG)); \ 01357 end \ 01358 end \ 01359 else if (what__ != OVM_COPY) begin \ 01360 foreach(ARG[i__]) begin \ 01361 lhs__ = ARG[i__]; \ 01362 void'(m_do_data_object($psprintf(`"ARG[%0d]`",i__), lhs__, null, what__, FLAG)); \ 01363 end \ 01364 end \ 01365 end \ 01366 end 01367 01368 01369 // OVM_FIELD_DATA_ARRAY_STRING 01370 // --------------------------- 01371 01372 // ovm_record_array_string 01373 // ------------------------ 01374 01375 `define ovm_record_array_string(ARG, RECORDER) \ 01376 begin \ 01377 if(RECORDER.tr_handle != 0) begin\ 01378 for(int i__=0; i__<ARG.size(); ++i__) \ 01379 RECORDER.record_string($psprintf(`"ARG[%0d]`", i__), ARG[i__]); \ 01380 end \ 01381 end 01382 01383 `define OVM_FIELD_DATA_ARRAY_STRING(ARG,FLAG) \ 01384 begin \ 01385 if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \ 01386 case (what__) \ 01387 OVM_COMPARE: \ 01388 if ( !((FLAG)&OVM_NOCOMPARE) && (tmp_data__ != null) ) begin \ 01389 int i__; \ 01390 $cast(local_data__, tmp_data__); \ 01391 if(ARG.size() != local_data__.``ARG.size()) begin \ 01392 int s1, s2; \ 01393 m_sc.stringv = ""; \ 01394 s1 = ARG.size(); s2 = local_data__.ARG.size(); \ 01395 $swrite(m_sc.stringv, "lhs size = %0d : rhs size = %0d", s1, s2);\ 01396 ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \ 01397 end \ 01398 for(i__=0; i__<ARG.size() && i__<local_data__.ARG.size(); ++i__) \ 01399 if(ARG[i__] != local_data__.ARG[i__]) begin \ 01400 string ls, rs; \ 01401 ls = ARG[i__]; rs = local_data__.ARG[i__]; \ 01402 ovm_auto_options_object.comparer.scope.down_element(i__, null);\ 01403 $swrite(m_sc.stringv, "lhs = %0s : rhs = %0s", ls, rs); \ 01404 ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \ 01405 ovm_auto_options_object.comparer.scope.up_element(null);\ 01406 end \ 01407 end \ 01408 OVM_COPY: \ 01409 if(!((FLAG)&OVM_NOCOPY) && (tmp_data__ != null) ) \ 01410 begin \ 01411 int i__; \ 01412 $cast(local_data__, tmp_data__); \ 01413 /*Resizing of array is done in ovm_field_array* macro*/ \ 01414 for(i__=0; i__ < ARG.size(); ++i__) \ 01415 ARG[i__] = local_data__.ARG[i__] ; \ 01416 end \ 01417 OVM_PRINT: \ 01418 begin \ 01419 if((FLAG)&OVM_NOPRINT != 0 && \ 01420 ovm_auto_options_object.printer.knobs.print_fields == 1) \ 01421 `ovm_print_array_string2(ARG, ovm_auto_options_object.printer) \ 01422 end \ 01423 OVM_RECORD: \ 01424 begin \ 01425 if(((FLAG)&OVM_NORECORD) == 0 && !m_sc.array_warning_done) begin \ 01426 `ovm_record_array_string(ARG, ovm_auto_options_object.recorder) \ 01427 end \ 01428 end \ 01429 endcase \ 01430 end \ 01431 end 01432 01433 `define OVM_FIELD_DATA_SARRAY_STRING(ARG,FLAG) \ 01434 begin \ 01435 if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \ 01436 if(what__ == OVM_PRINT) \ 01437 `ovm_print_sarray_string2(ARG, ovm_auto_options_object.printer) \ 01438 else if(tmp_data__!=null) begin \ 01439 foreach(ARG[i__]) \ 01440 if($cast(local_data__, tmp_data__)) begin \ 01441 void'(m_do_data_string($psprintf(`"ARG[%0d]`",i__), ARG[i__], local_data__.ARG[i__], what__, FLAG)); \ 01442 end \ 01443 end \ 01444 else begin \ 01445 foreach(ARG[i__]) \ 01446 if($cast(local_data__, tmp_data__)) begin \ 01447 void'(m_do_data_string($psprintf(`"ARG[%0d]`",i__), ARG[i__], "", what__, FLAG)); \ 01448 end \ 01449 end \ 01450 end \ 01451 end 01452 01453 `define OVM_FIELD_ARRAY_STR_PACK(ARG,FLAG) \ 01454 case(what__) \ 01455 OVM_PACK: \ 01456 if(((FLAG)&OVM_NOPACK) == 0) \ 01457 begin \ 01458 if(ovm_auto_options_object.packer.use_metadata == 1) \ 01459 ovm_auto_options_object.packer.pack_field_int(ARG.size(), 32); \ 01460 foreach(ARG[i]) \ 01461 ovm_auto_options_object.packer.pack_string(ARG[i]); \ 01462 end \ 01463 OVM_UNPACK: \ 01464 if(((FLAG)&OVM_NOPACK) == 0) \ 01465 begin \ 01466 int s_; \ 01467 s_ = ovm_auto_options_object.packer.unpack_field_int(32); \ 01468 ARG = new[s_]; \ 01469 foreach(ARG[i]) begin \ 01470 ARG[i] = ovm_auto_options_object.packer.unpack_string(-1); \ 01471 end \ 01472 end \ 01473 endcase 01474 01475 `define OVM_FIELD_QUEUE_STR_PACK(ARG,FLAG) \ 01476 case(what__) \ 01477 OVM_PACK: \ 01478 if(((FLAG)&OVM_NOPACK) == 0) \ 01479 begin \ 01480 if(ovm_auto_options_object.packer.use_metadata == 1) \ 01481 ovm_auto_options_object.packer.pack_field_int(ARG.size(), 32); \ 01482 foreach(ARG[i]) \ 01483 ovm_auto_options_object.packer.pack_string(ARG[i]); \ 01484 end \ 01485 OVM_UNPACK: \ 01486 if(((FLAG)&OVM_NOPACK) == 0) \ 01487 begin \ 01488 int s_; \ 01489 s_ = ovm_auto_options_object.packer.unpack_field_int(32); \ 01490 while(ARG.size() < s_) ARG.push_back(""); \ 01491 while(ARG.size() > s_) void'(ARG.pop_front()); \ 01492 foreach(ARG[i]) begin \ 01493 ARG[i] = ovm_auto_options_object.packer.unpack_string(-1); \ 01494 end \ 01495 end \ 01496 endcase 01497 01498 // OVM_COMPARE_FIELD 01499 // ----------------- 01500 01501 `define OVM_COMPARE_FAILED(ARG) \ 01502 begin \ 01503 ovm_object::m_sc.scratch1 = `"Compare failed ARG`"; \ 01504 ovm_auto_options_object.comparer.result++; \ 01505 if(ovm_auto_options_object.comparer.result <= \ 01506 ovm_auto_options_object.comparer.show_max) \ 01507 begin \ 01508 ovm_object::m_sc.scratch1 = `"Miscompare for field ARG`"; \ 01509 _global_reporter.ovm_report_info("MISCMP", ovm_object::m_sc.scratch1, 500) \ 01510 end \ 01511 end 01512 01513 01514 // OVM_FIELD_DATA_AA_generic 01515 // ------------------------- 01516 01517 `define OVM_FIELD_DATA_AA_generic(TYPE, KEY, ARG, FLAG) \ 01518 begin \ 01519 if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \ 01520 case (what__) \ 01521 OVM_COMPARE: \ 01522 begin \ 01523 if(!((FLAG)&OVM_NOCOMPARE) && (tmp_data__ != null) ) \ 01524 begin \ 01525 $cast(local_data__, tmp_data__); \ 01526 if(ARG.num() != local_data__.ARG.num()) begin \ 01527 int s1, s2; \ 01528 m_sc.stringv = ""; \ 01529 s1 = ARG.num(); s2 = local_data__.ARG.num(); \ 01530 $swrite(m_sc.stringv, "lhs size = %0d : rhs size = %0d", \ 01531 s1, s2);\ 01532 ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \ 01533 end \ 01534 string_aa_key = ""; \ 01535 while(ARG.next(string_aa_key)) begin \ 01536 ovm_auto_options_object.comparer.scope.set_arg({"[",string_aa_key,"]"}); \ 01537 void'(m_do_data({`"ARG[`", string_aa_key, "]"}, \ 01538 ARG[string_aa_key], \ 01539 local_data__.ARG[string_aa_key], what__, \ 01540 $bits(ARG[string_aa_key]), FLAG)); \ 01541 ovm_auto_options_object.comparer.scope.unset_arg(string_aa_key); \ 01542 end \ 01543 end \ 01544 end \ 01545 OVM_COPY: \ 01546 begin \ 01547 if(!((FLAG)&OVM_NOCOPY) && (tmp_data__ != null) ) \ 01548 begin \ 01549 $cast(local_data__, tmp_data__); \ 01550 ARG.delete(); \ 01551 string_aa_key = ""; \ 01552 while(local_data__.ARG.next(string_aa_key)) \ 01553 ARG[string_aa_key] = local_data__.ARG[string_aa_key]; \ 01554 end \ 01555 end \ 01556 OVM_PRINT: \ 01557 `ovm_print_aa_``KEY``_``TYPE``3(ARG, ovm_radix_enum'((FLAG)&(OVM_RADIX)), \ 01558 ovm_auto_options_object.printer) \ 01559 endcase \ 01560 end \ 01561 end 01562 01563 01564 // OVM_FIELD_DATA_AA_int_string 01565 // ---------------------------- 01566 01567 `define OVM_FIELD_DATA_AA_int_string(ARG, FLAG) \ 01568 `OVM_FIELD_DATA_AA_generic(int, string, ARG, FLAG) 01569 01570 // OVM_FIELD_DATA_AA_int_int 01571 // ---------------------------- 01572 01573 `define OVM_FIELD_DATA_AA_int_key(KEY, ARG, FLAG) \ 01574 begin \ 01575 if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \ 01576 KEY aa_key; \ 01577 case (what__) \ 01578 OVM_COMPARE: \ 01579 begin \ 01580 if(!((FLAG)&OVM_NOCOMPARE) && (tmp_data__ != null) ) \ 01581 begin \ 01582 $cast(local_data__, tmp_data__); \ 01583 if(ARG.num() != local_data__.ARG.num()) begin \ 01584 int s1, s2; \ 01585 m_sc.stringv = ""; \ 01586 s1 = ARG.num(); s2 = local_data__.ARG.num(); \ 01587 $swrite(m_sc.stringv, "lhs size = %0d : rhs size = %0d", \ 01588 s1, s2);\ 01589 ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \ 01590 end \ 01591 ovm_auto_options_object.comparer.scope.up(null); \ 01592 if(ARG.first(aa_key)) \ 01593 do begin \ 01594 $swrite(string_aa_key, "%0d", aa_key); \ 01595 ovm_auto_options_object.comparer.scope.set_arg({"[",string_aa_key,"]"}); \ 01596 void'(m_do_data({`"ARG[`", string_aa_key, "]"}, \ 01597 ARG[aa_key], \ 01598 local_data__.ARG[aa_key], what__, \ 01599 $bits(ARG[aa_key]), FLAG)); \ 01600 ovm_auto_options_object.comparer.scope.unset_arg(string_aa_key); \ 01601 end while(ARG.next(aa_key)); \ 01602 ovm_auto_options_object.comparer.scope.down(`"ARG`",null); \ 01603 end \ 01604 end \ 01605 OVM_COPY: \ 01606 begin \ 01607 if(!((FLAG)&OVM_NOCOPY) && (tmp_data__ != null) ) \ 01608 begin \ 01609 $cast(local_data__, tmp_data__); \ 01610 ARG.delete(); \ 01611 if(local_data__.ARG.first(aa_key)) \ 01612 do begin \ 01613 ARG[aa_key] = local_data__.ARG[aa_key]; \ 01614 end while(local_data__.ARG.next(aa_key)); \ 01615 end \ 01616 end \ 01617 OVM_PRINT: \ 01618 `ovm_print_aa_int_key4(KEY,ARG, ovm_radix_enum'((FLAG)&(OVM_RADIX)), \ 01619 ovm_auto_options_object.printer) \ 01620 endcase \ 01621 end \ 01622 end 01623 01624 01625 01626 // OVM_FIELD_DATA_AA_object_string 01627 // ------------------------------- 01628 01629 `define OVM_FIELD_DATA_AA_object_string(ARG, FLAG) \ 01630 begin \ 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 string_aa_key = ""; \ 01647 while(ARG.next(string_aa_key)) 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[string_aa_key]; \ 01652 ovm_auto_options_object.comparer.scope.down({"[",string_aa_key,"]"},tmp); \ 01653 void'(m_do_data_object({"[", string_aa_key, "]"}, tmp, \ 01654 local_data__.ARG[string_aa_key], what__, FLAG)); \ 01655 ovm_auto_options_object.comparer.scope.up(tmp,"["); \ 01656 end \ 01657 end \ 01658 end \ 01659 OVM_COPY: \ 01660 begin \ 01661 if(!((FLAG)&OVM_NOCOPY) && (tmp_data__ != null) ) \ 01662 begin \ 01663 $cast(local_data__, tmp_data__); \ 01664 ARG.delete(); \ 01665 if(local_data__.ARG.first(string_aa_key)) \ 01666 do \ 01667 if((FLAG)&OVM_REFERENCE) \ 01668 ARG[string_aa_key] = local_data__.ARG[string_aa_key]; \ 01669 /*else if((FLAG)&OVM_SHALLOW)*/ \ 01670 /* ARG[string_aa_key] = new local_data__.ARG[string_aa_key];*/ \ 01671 else begin\ 01672 $cast(ARG[string_aa_key],local_data__.ARG[string_aa_key].clone());\ 01673 ARG[string_aa_key].set_name({`"ARG`","[",string_aa_key, "]"});\ 01674 end \ 01675 while(local_data__.ARG.next(string_aa_key)); \ 01676 end \ 01677 end \ 01678 OVM_PRINT: \ 01679 `ovm_print_aa_string_object3(ARG, ovm_auto_options_object.printer,FLAG) \ 01680 endcase \ 01681 end \ 01682 end 01683 01684 // OVM_FIELD_DATA_AA_object_int 01685 // ------------------------------- 01686 01687 `define OVM_FIELD_DATA_AA_object_int(ARG, FLAG) \ 01688 begin \ 01689 int key; \ 01690 if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \ 01691 case (what__) \ 01692 OVM_COMPARE: \ 01693 begin \ 01694 if(!((FLAG)&OVM_NOCOMPARE) && (tmp_data__ != null) ) \ 01695 begin \ 01696 $cast(local_data__, tmp_data__); \ 01697 if(ARG.num() != local_data__.ARG.num()) begin \ 01698 int s1, s2; \ 01699 m_sc.stringv = ""; \ 01700 s1 = ARG.num(); s2 = local_data__.ARG.num(); \ 01701 $swrite(m_sc.stringv, "lhs size = %0d : rhs size = %0d", \ 01702 s1, s2);\ 01703 ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \ 01704 end \ 01705 if(ARG.first(key)) begin \ 01706 do begin \ 01707 ovm_object tmp; \ 01708 /* Since m_do_data_object is inout, need a ovm_object for */ \ 01709 /* assignment compatibility. We must cast back the return. */ \ 01710 tmp = ARG[key]; \ 01711 $swrite(m_sc.stringv, "[%0d]", key); \ 01712 ovm_auto_options_object.comparer.scope.down_element(key,tmp); \ 01713 void'(m_do_data_object(m_sc.stringv, tmp, \ 01714 local_data__.ARG[key], what__, FLAG)); \ 01715 ovm_auto_options_object.comparer.scope.up_element(tmp); \ 01716 end while(ARG.next(key)); \ 01717 end \ 01718 end \ 01719 end \ 01720 OVM_COPY: \ 01721 begin \ 01722 if(!((FLAG)&OVM_NOCOPY) && (tmp_data__ != null) ) \ 01723 begin \ 01724 $cast(local_data__, tmp_data__); \ 01725 ARG.delete(); \ 01726 if(local_data__.ARG.first(key)) \ 01727 do begin \ 01728 if((FLAG)&OVM_REFERENCE) \ 01729 ARG[key] = local_data__.ARG[key]; \ 01730 /*else if((FLAG)&OVM_SHALLOW)*/ \ 01731 /* ARG[key] = new local_data__.ARG[key];*/ \ 01732 else begin\ 01733 ovm_object tmp_obj; \ 01734 tmp_obj = local_data__.ARG[key].clone(); \ 01735 if(tmp_obj != null) \ 01736 $cast(ARG[key], tmp_obj); \ 01737 else \ 01738 ARG[key]=null; \ 01739 end \ 01740 end while(local_data__.ARG.next(key)); \ 01741 end \ 01742 end \ 01743 OVM_PRINT: \ 01744 `ovm_print_aa_int_object3(ARG, ovm_auto_options_object.printer,FLAG) \ 01745 endcase \ 01746 end \ 01747 end 01748 01749 // OVM_FIELD_DATA_AA_string_string 01750 // ------------------------------- 01751 01752 `define OVM_FIELD_DATA_AA_string_string(ARG, FLAG) \ 01753 begin \ 01754 if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \ 01755 case (what__) \ 01756 OVM_COMPARE: \ 01757 begin \ 01758 if(!((FLAG)&OVM_NOCOMPARE) && (tmp_data__ != null) ) \ 01759 begin \ 01760 $cast(local_data__, tmp_data__); \ 01761 if(ARG.num() != local_data__.ARG.num()) begin \ 01762 int s1, s2; \ 01763 m_sc.stringv = ""; \ 01764 s1 = ARG.num(); s2 = local_data__.ARG.num(); \ 01765 $swrite(m_sc.stringv, "lhs size = %0d : rhs size = %0d", \ 01766 s1, s2);\ 01767 ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \ 01768 end \ 01769 string_aa_key = ""; \ 01770 while(ARG.next(string_aa_key)) begin \ 01771 ovm_auto_options_object.comparer.scope.set_arg({"[",string_aa_key,"]"}); \ 01772 void'(m_do_data_string({`"ARG[`", string_aa_key, "]"}, \ 01773 ARG[string_aa_key], \ 01774 local_data__.ARG[string_aa_key], what__, FLAG) ); \ 01775 ovm_auto_options_object.comparer.scope.unset_arg(string_aa_key); \ 01776 end \ 01777 end \ 01778 end \ 01779 OVM_COPY: \ 01780 begin \ 01781 if(!((FLAG)&OVM_NOCOPY) && (local_data__ !=null)) \ 01782 begin \ 01783 ARG.delete(); \ 01784 string_aa_key = ""; \ 01785 while(local_data__.ARG.next(string_aa_key)) \ 01786 ARG[string_aa_key] = local_data__.ARG[string_aa_key]; \ 01787 end \ 01788 end \ 01789 OVM_PRINT: \ 01790 `ovm_print_aa_string_string2(ARG, ovm_auto_options_object.printer) \ 01791 endcase \ 01792 end \ 01793 end 01794 01795 01796 // DOREFERENCECOPY 01797 // --------------- 01798 01799 `define DOREFERENCECOPY(ARG,FLAG) \ 01800 if( (FLAG)&OVM_REFERENCE)) \ 01801 ARG = local_data__.``ARG; \ 01802 01803 // DODEEPCOPY 01804 // ---------- 01805 01806 `define DODEEPCOPY(ARG,FLAG) \ 01807 begin \ 01808 ovm_object this_d__, from_d__; \ 01809 if(tmp_data__ != null) \ 01810 if(!$cast(local_data__, tmp_data__)) begin \ 01811 ovm_object::m_sc.scratch1 = `"Cast failed for argument: ARG`"; \ 01812 end \ 01813 if(ARG != null) $cast(this_d__,ARG); \ 01814 if(local_data__.ARG != null) $cast(from_d__,local_data__.ARG); \ 01815 \ 01816 if((this_d__==null) && (from_d__!=null)) begin \ 01817 this_d__ = from_d__.clone(); \ 01818 this_d__.set_name(`"ARG`"); \ 01819 end \ 01820 else if(from_d__ == null) \ 01821 this_d__ = from_d__; \ 01822 else begin \ 01823 this_d__.copy(from_d__); \ 01824 end \ 01825 if((this_d__ == null) || !$cast(ARG, this_d__)) begin \ 01826 ovm_object::m_sc.scratch1 = `"Cast failed for ARG during copy`"; \ 01827 _global_reporter.ovm_report_error("CSTFLD", ovm_object::m_sc.scratch1); \ 01828 end \ 01829 end 01830 01831 01832 // DOSHALLOWCOPY 01833 // ------------- 01834 01835 `define DOSHALLOWCOPY(ARG1,ARG2,FLAG) \ 01836 if( (FLAG)&OVM_SHALLOW) \ 01837 begin \ 01838 ovm_object lhs__, rhs__; \ 01839 ovm_object::m_sc.scratch1 = `"Executing shallow copy of arg ARG`"; \ 01840 /* Can't do shallow copy right now due to an issue with abstract classes */ \ 01841 /* like ovm_object, so do a deep copy instead. */ \ 01842 if(ARG2==null) ARG1 = ARG2; \ 01843 else begin \ 01844 if(ARG1 != null) $cast(lhs__, ARG1); \ 01845 if(ARG2 != null) $cast(rhs__, ARG2); \ 01846 if(rhs__!=null && lhs__!=null) \ 01847 lhs__.copy(rhs__); \ 01848 else if(rhs__ != null) begin \ 01849 $cast(lhs__, rhs__.clone()); \ 01850 if (lhs__ != null) \ 01851 $cast(ARG1, lhs__); \ 01852 end \ 01853 else \ 01854 ARG1 = null; \ 01855 /* ARG = new local_data__.ARG; */ \ 01856 end \ 01857 end \ 01858 else \ 01859 begin \ 01860 ovm_object::m_sc.scratch1 = `"Shallow copy off for arg ARG`"; \ 01861 end 01862 01863 01864 // OVM_FIELD_SET 01865 // ---------------- 01866 01867 `define OVM_FIELD_SET(ARG,FLAG) \ 01868 if(ovm_object::m_do_set (str__, `"ARG`", ARG, what__, FLAG)) begin \ 01869 m_sc.scope.up(null); \ 01870 return; \ 01871 end 01872 01873 01874 // OVM_FIELD_SET_EVENT 01875 // ---------------------- 01876 01877 `define OVM_FIELD_SET_EVENT(ARG,FLAG) \ 01878 /*Not implemented*/ 01879 01880 01881 // OVM_FIELD_SET_OBJECT 01882 // ----------------------- 01883 01884 `define OVM_FIELD_SET_OBJECT(ARG,FLAG) \ 01885 begin \ 01886 ovm_object arg_obj; \ 01887 int r; /*return 1 if get succeeds*/ \ 01888 if(ARG != null) $cast(arg_obj, ARG); \ 01889 r = ovm_object::m_do_set_object(str__, `"ARG`", \ 01890 arg_obj, what__, FLAG); \ 01891 /*in case of a set, cast back */ \ 01892 if(r && (what__ == OVM_SETOBJ) && (arg_obj != null)) \ 01893 $cast(ARG, arg_obj); \ 01894 else if(arg_obj == null) \ 01895 ARG = null; \ 01896 end 01897 01898 01899 // OVM_FIELD_SET_STRING 01900 // ----------------------- 01901 01902 `define OVM_FIELD_SET_STRING(ARG,FLAG) \ 01903 if(ovm_object::m_do_set_string (str__, `"ARG`", ARG, what__, FLAG)) begin \ 01904 m_sc.scope.up(null); \ 01905 return; \ 01906 end 01907 01908 `define OVM_FIELD_SET_QUEUE_TYPE(ATYPE, ARRAY, RHS, FLAG) \ 01909 if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \ 01910 bit wildcard_index; \ 01911 int index; \ 01912 index = ovm_get_array_index_int(str__, wildcard_index); \ 01913 if(what__==OVM_SET``ATYPE) \ 01914 begin \ 01915 if(ovm_is_array(str__) && (index != -1)) begin\ 01916 if(wildcard_index) begin \ 01917 for(index=0; index<ARRAY.size(); ++index) begin \ 01918 if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 01919 ARRAY[index] = RHS; \ 01920 m_sc.status = 1; \ 01921 end \ 01922 end \ 01923 end \ 01924 else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 01925 ARRAY[index] = RHS; \ 01926 m_sc.status = 1; \ 01927 end \ 01928 end \ 01929 end \ 01930 end 01931 01932 `define OVM_FIELD_SET_QUEUE_OBJECT_TYPE(ARRAY, FLAG) \ 01933 if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \ 01934 bit wildcard_index; \ 01935 int index; \ 01936 index = ovm_get_array_index_int(str__, wildcard_index); \ 01937 if(what__==OVM_SETOBJ) \ 01938 begin \ 01939 if(ovm_is_array(str__) ) begin\ 01940 if(wildcard_index) begin \ 01941 for(index=0; index<ARRAY.size(); ++index) begin \ 01942 if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 01943 if (m_sc.object != null) \ 01944 $cast(ARRAY[index], m_sc.object); \ 01945 m_sc.status = 1; \ 01946 end \ 01947 end \ 01948 end \ 01949 else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 01950 if (m_sc.object != null) \ 01951 $cast(ARRAY[index], m_sc.object); \ 01952 m_sc.status = 1; \ 01953 end \ 01954 end \ 01955 end \ 01956 end 01957 01958 `define OVM_FIELD_SET_AA_TYPE(INDEX_TYPE, ARRAY_TYPE, ARRAY, RHS, FLAG) \ 01959 if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \ 01960 bit wildcard_index; \ 01961 INDEX_TYPE index; \ 01962 index = ovm_get_array_index_``INDEX_TYPE(str__, wildcard_index); \ 01963 if(what__==OVM_SET``ARRAY_TYPE) \ 01964 begin \ 01965 if(ovm_is_array(str__) ) begin\ 01966 if(wildcard_index) begin \ 01967 if(ARRAY.first(index)) \ 01968 do begin \ 01969 if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)}) || \ 01970 ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0s]", index)})) begin \ 01971 ARRAY[index] = RHS; \ 01972 m_sc.status = 1; \ 01973 end \ 01974 end while(ARRAY.next(index));\ 01975 end \ 01976 else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 01977 ARRAY[index] = RHS; \ 01978 m_sc.status = 1; \ 01979 end \ 01980 else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0s]", index)})) begin \ 01981 ARRAY[index] = RHS; \ 01982 m_sc.status = 1; \ 01983 end \ 01984 end \ 01985 end \ 01986 end 01987 01988 `define OVM_FIELD_SET_AA_OBJECT_TYPE(INDEX_TYPE, ARRAY, FLAG) \ 01989 if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \ 01990 bit wildcard_index; \ 01991 INDEX_TYPE index; \ 01992 index = ovm_get_array_index_``INDEX_TYPE(str__, wildcard_index); \ 01993 if(what__==OVM_SETOBJ) \ 01994 begin \ 01995 if(ovm_is_array(str__) ) begin\ 01996 if(wildcard_index) begin \ 01997 if(ARRAY.first(index)) \ 01998 do begin \ 01999 if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)}) || \ 02000 ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0s]", index)})) begin \ 02001 if (m_sc.object != null) \ 02002 $cast(ARRAY[index], m_sc.object); \ 02003 m_sc.status = 1; \ 02004 end \ 02005 end while(ARRAY.next(index));\ 02006 end \ 02007 else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 02008 if (m_sc.object != null) \ 02009 $cast(ARRAY[index], m_sc.object); \ 02010 m_sc.status = 1; \ 02011 end \ 02012 else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0s]", index)})) begin \ 02013 if (m_sc.object != null) \ 02014 $cast(ARRAY[index], m_sc.object); \ 02015 m_sc.status = 1; \ 02016 end \ 02017 end \ 02018 end \ 02019 end 02020 02021 `define OVM_FIELD_SET_AA_INT_TYPE(INDEX_TYPE, ARRAY_TYPE, ARRAY, RHS, FLAG) \ 02022 if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \ 02023 bit wildcard_index; \ 02024 INDEX_TYPE index; \ 02025 index = ovm_get_array_index_int(str__, wildcard_index); \ 02026 if(what__==OVM_SET``ARRAY_TYPE) \ 02027 begin \ 02028 if(ovm_is_array(str__) ) begin\ 02029 if(wildcard_index) begin \ 02030 if(ARRAY.first(index)) \ 02031 do begin \ 02032 if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 02033 ARRAY[index] = RHS; \ 02034 m_sc.status = 1; \ 02035 end \ 02036 end while(ARRAY.next(index));\ 02037 end \ 02038 else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 02039 ARRAY[index] = RHS; \ 02040 m_sc.status = 1; \ 02041 end \ 02042 end \ 02043 end \ 02044 end 02045 02046 `define OVM_FIELD_SET_ARRAY_TYPE(ARRAY_TYPE, ARRAY, RHS, FLAG) \ 02047 if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \ 02048 int index; \ 02049 bit wildcard_index; \ 02050 index = ovm_get_array_index_int(str__, wildcard_index); \ 02051 if(what__==OVM_SET``ARRAY_TYPE) \ 02052 begin \ 02053 if(ovm_is_array(str__) ) begin\ 02054 if(wildcard_index) begin \ 02055 for(int index=0; index<ARRAY.size(); ++index) begin \ 02056 if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 02057 ARRAY[index] = RHS; \ 02058 m_sc.status = 1; \ 02059 end \ 02060 end \ 02061 end \ 02062 else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 02063 ARRAY[index] = RHS; \ 02064 m_sc.status = 1; \ 02065 end \ 02066 else if(what__==OVM_SET && ovm_is_match(str__, m_sc.scope.get_arg())) begin \ 02067 int size; \ 02068 size = m_sc.bitstream; \ 02069 ARRAY = new[size](ARRAY); \ 02070 m_sc.status = 1; \ 02071 end \ 02072 end \ 02073 else if(what__==OVM_SET && ovm_is_match(str__, m_sc.scope.get_arg())) begin \ 02074 int size; \ 02075 size = m_sc.bitstream; \ 02076 ARRAY = new[size](ARRAY); \ 02077 m_sc.status = 1; \ 02078 end \ 02079 end \ 02080 else if(what__==OVM_SET && ovm_is_match(str__, m_sc.scope.get_arg())) begin \ 02081 int size; \ 02082 size = m_sc.bitstream; \ 02083 ARRAY = new[size](ARRAY); \ 02084 m_sc.status = 1; \ 02085 end \ 02086 end 02087 02088 `define OVM_FIELD_SET_SARRAY_TYPE(ARRAY_TYPE, ARRAY, RHS, FLAG) \ 02089 if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \ 02090 int index; \ 02091 bit wildcard_index; \ 02092 index = ovm_get_array_index_int(str__, wildcard_index); \ 02093 if(what__==OVM_SET``ARRAY_TYPE) \ 02094 begin \ 02095 if(ovm_is_array(str__) ) begin\ 02096 if(wildcard_index) begin \ 02097 foreach(ARRAY[index]) begin \ 02098 if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 02099 ARRAY[index] = RHS; \ 02100 m_sc.status = 1; \ 02101 end \ 02102 end \ 02103 end \ 02104 else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 02105 ARRAY[index] = RHS; \ 02106 m_sc.status = 1; \ 02107 end \ 02108 end \ 02109 end \ 02110 end 02111 02112 `define OVM_FIELD_SET_ARRAY_OBJECT_TYPE(ARRAY, FLAG) \ 02113 if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \ 02114 int index; \ 02115 bit wildcard_index; \ 02116 index = ovm_get_array_index_int(str__, wildcard_index); \ 02117 if(what__==OVM_SETOBJ) \ 02118 begin \ 02119 if(ovm_is_array(str__) ) begin\ 02120 if(wildcard_index) begin \ 02121 for(int index=0; index<ARRAY.size(); ++index) begin \ 02122 if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 02123 if (m_sc.object != null) begin \ 02124 $cast(ARRAY[index], m_sc.object); \ 02125 end \ 02126 m_sc.status = 1; \ 02127 end \ 02128 end \ 02129 end \ 02130 else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 02131 if (m_sc.object != null) begin \ 02132 $cast(ARRAY[index], m_sc.object); \ 02133 end \ 02134 m_sc.status = 1; \ 02135 end \ 02136 end \ 02137 end \ 02138 else if(what__==OVM_SET && !ovm_is_array(str__) && ovm_is_match(str__, m_sc.scope.get_arg())) begin \ 02139 int size; \ 02140 size = m_sc.bitstream; \ 02141 ARRAY = new[size](ARRAY); \ 02142 m_sc.status = 1; \ 02143 end \ 02144 end 02145 02146 `define OVM_FIELD_SET_SARRAY_OBJECT_TYPE(ARRAY, FLAG) \ 02147 if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \ 02148 int index; \ 02149 bit wildcard_index; \ 02150 index = ovm_get_array_index_int(str__, wildcard_index); \ 02151 if(what__==OVM_SETOBJ) \ 02152 begin \ 02153 if(ovm_is_array(str__) ) begin\ 02154 if(wildcard_index) begin \ 02155 foreach(ARRAY[index]) begin \ 02156 if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 02157 if (m_sc.object != null) begin \ 02158 $cast(ARRAY[index], m_sc.object); \ 02159 end \ 02160 else \ 02161 ARRAY[index] = null; \ 02162 m_sc.status = 1; \ 02163 end \ 02164 end \ 02165 end \ 02166 else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index)})) begin \ 02167 if (m_sc.object != null) begin \ 02168 $cast(ARRAY[index], m_sc.object); \ 02169 end \ 02170 else \ 02171 ARRAY[index] = null; \ 02172 m_sc.status = 1; \ 02173 end \ 02174 end \ 02175 end \ 02176 end 02177 02178 // OVM_FIELD_SET_ARRAY_OBJECT 02179 // ----------------------------- 02180 02181 // The cast to ovm_object allows these macros to work 02182 // with ARG base types not derived from ovm_object. 02183 02184 `define OVM_FIELD_SET_ARRAY_OBJECT(ARG,FLAG) \ 02185 `OVM_FIELD_SET_ARRAY_OBJECT_TYPE(ARG, FLAG) \ 02186 if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \ 02187 ovm_object obj; \ 02188 for(int index=0; index<ARG.size(); ++index) begin \ 02189 if($cast(obj,ARG[index]) && (obj!=null)) \ 02190 obj.m_field_automation(null, what__, str__); \ 02191 end \ 02192 end 02193 02194 `define OVM_FIELD_SET_SARRAY_OBJECT(ARG,FLAG) \ 02195 `OVM_FIELD_SET_SARRAY_OBJECT_TYPE(ARG, FLAG) \ 02196 if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \ 02197 ovm_object obj; \ 02198 foreach(ARG[index]) begin \ 02199 if($cast(obj,ARG[index]) && (obj!=null)) \ 02200 obj.m_field_automation(null, what__, str__); \ 02201 end \ 02202 end 02203 02204 // OVM_FIELD_SET_QUEUE_OBJECT 02205 // ----------------------------- 02206 02207 `define OVM_FIELD_SET_QUEUE_OBJECT(ARG,FLAG) \ 02208 `OVM_FIELD_SET_QUEUE_OBJECT_TYPE(ARG, FLAG) \ 02209 if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \ 02210 ovm_object obj; \ 02211 for(int index=0; index<ARG.size(); ++index) begin \ 02212 if($cast(obj,ARG[index]) && (obj!=null)) \ 02213 obj.m_field_automation(null, what__, str__); \ 02214 end \ 02215 end 02216 02217 `endif //OVM_EMPTY_MACROS 02218 02219 `endif // OVM_OBJECT_DEFINES_SVH 02220
![]() Intelligent Design Verification Project: OVM, Revision: 1.1.0 |
Copyright (c) 2008 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.4.6 Mon Sep 29 14:20:12 2008 |