ovm_object_defines.svh

Go to the documentation of this file.
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_param_utils(T) 
00030 `define ovm_object_utils_begin(T) 
00031 `define ovm_object_param_utils_begin(T) 
00032 `define ovm_object_utils_end
00033 `define ovm_component_utils(T)
00034 `define ovm_component_param_utils(T)
00035 `define ovm_component_utils_begin(T)
00036 `define ovm_component_param_utils_begin(T)
00037 `define ovm_component_utils_end
00038 `define ovm_field_int(ARG,FLAG)
00039 `define ovm_field_enum(T,ARG,FLAG)
00040 `define ovm_field_object(ARG,FLAG)
00041 `define ovm_field_event(ARG,FLAG)
00042 `define ovm_field_string(ARG,FLAG)
00043 `define ovm_field_array_enum(ARG,FLAG)
00044 `define ovm_field_array_int(ARG,FLAG)
00045 `define ovm_field_sarray_int(ARG,FLAG)
00046 `define ovm_field_sarray_enum(ARG,FLAG)
00047 `define ovm_field_array_object(ARG,FLAG)
00048 `define ovm_field_sarray_object(ARG,FLAG)
00049 `define ovm_field_array_string(ARG,FLAG)
00050 `define ovm_field_sarray_string(ARG,FLAG)
00051 `define ovm_field_queue_enum(ARG,FLAG)
00052 `define ovm_field_queue_int(ARG,FLAG)
00053 `define ovm_field_queue_object(ARG,FLAG)
00054 `define ovm_field_queue_string(ARG,FLAG)
00055 `define ovm_field_aa_int_string(ARG, FLAG)
00056 `define ovm_field_aa_string_string(ARG, FLAG)
00057 `define ovm_field_aa_object_string(ARG, FLAG)
00058 `define ovm_field_aa_int_int(ARG, FLAG)
00059 `define ovm_field_aa_int_int(ARG, FLAG)
00060 `define ovm_field_aa_int_int_unsigned(ARG, FLAG)
00061 `define ovm_field_aa_int_integer(ARG, FLAG)
00062 `define ovm_field_aa_int_integer_unsigned(ARG, FLAG)
00063 `define ovm_field_aa_int_byte(ARG, FLAG)
00064 `define ovm_field_aa_int_byte_unsigned(ARG, FLAG)
00065 `define ovm_field_aa_int_shortint(ARG, FLAG)
00066 `define ovm_field_aa_int_shortint_unsigned(ARG, FLAG)
00067 `define ovm_field_aa_int_longint(ARG, FLAG)
00068 `define ovm_field_aa_int_longint_unsigned(ARG, FLAG)
00069 `define ovm_field_aa_int_key(KEY, ARG, FLAG)
00070 `define ovm_field_aa_string_int(ARG, FLAG)
00071 `define ovm_field_aa_object_int(ARG, FLAG)
00072 
00073 `else
00074 
00075 //------------------------------------------------------------------------------
00076 //
00077 // MACROS: utils 
00078 //
00079 //------------------------------------------------------------------------------
00080 
00081 // Definitions for the user to use inside their derived data class declarations.
00082 
00083 // ovm_field_utils
00084 // ---------------
00085 
00086 // This macro is for consistency
00087 `define ovm_field_utils
00088 
00089 
00090 // ovm_field_utils_begin
00091 // ---------------------
00092 
00093 `define ovm_field_utils_begin(T) \
00094    static bit m_fields_checked = 0; \
00095    function void m_field_automation (ovm_object tmp_data__=null, \
00096                                      int what__=0, \
00097                                      string str__=""); \
00098    begin \
00099      T local_data__; /* Used for copy and compare */ \
00100      typedef T ___local_type____; \
00101      string string_aa_key; /* Used for associative array lookups */ \
00102      /* Check the fields if not already checked */ \
00103      if(what__ == OVM_CHECK_FIELDS) begin \
00104        if(! ___local_type____``::m_fields_checked) \
00105          ___local_type____``::m_fields_checked=1; \
00106        else \
00107          return; \
00108      end \
00109      /* Type is verified by ovm_object::compare() */ \
00110      super.m_field_automation(tmp_data__, what__, str__); \
00111      if(tmp_data__ != null) \
00112        /* Allow objects in same hierarchy to be copied/compared */ \
00113        if(!$cast(local_data__, tmp_data__)) return; \
00114      if(what__ == OVM_CHECK_FIELDS) begin \
00115        m_field_array.delete(); \
00116      end
00117 
00118 // ovm_field_utils_end
00119 // -------------------
00120 
00121 `define ovm_field_utils_end \
00122      end \
00123    endfunction \
00124 
00125 
00126 // ovm_object_utils
00127 // ----------------
00128 // Purpose: provide a single macro when no fields will be defined, mainly used
00129 // by components, but can be used by raw data.
00130 
00131 `define ovm_object_utils(T) \
00132   `ovm_object_utils_begin(T) \
00133   `ovm_object_utils_end
00134 
00135 
00136 // ovm_object_param_utils
00137 // ----------------------
00138 // Purpose: same as for obm_object_utils, except for parameterized
00139 // classes
00140 
00141 `define ovm_object_param_utils(T) \
00142   `ovm_object_param_utils_begin(T) \
00143   `ovm_object_utils_end
00144 
00145 
00146 // ovm_object_utils_begin
00147 // ----------------------
00148 // Purpose: Implements factory methods and get_type_name and 
00149 // starts the implementation of the superfunction m_field_automation. 
00150 // Requires a default ctor (e.g. all args MUST have a default value).
00151 //
00152 // Precondition: T is the type name of the current user class
00153 //
00154 
00155 `define ovm_object_utils_begin(T) \
00156    `ovm_object_registry_internal(T,T)  \
00157    `ovm_object_create_func(T) \
00158    `ovm_get_type_name_func(T) \
00159    `ovm_field_utils_begin(T) 
00160 
00161 
00162 // ovm_object_param_utils_begin
00163 // ----------------------------
00164 // Purpose: same as for ovm_object_utils_begin, except for use with
00165 // parameterized classed
00166 
00167 `define ovm_object_param_utils_begin(T) \
00168    `ovm_object_registry_param(T)  \
00169    `ovm_object_create_func(T) \
00170    `ovm_field_utils_begin(T) 
00171 
00172 
00173 // ovm_object_utils_end
00174 // --------------------
00175 // Purpose: finishes the superfunction implementation. This is the same as
00176 // the ovm_utils_end, but is expected to be used in conjunction with 
00177 // ovm_object_utils_begin().
00178 //
00179 
00180 `define ovm_object_utils_end \
00181      end \
00182    endfunction \
00183 
00184 
00185 // ovm_component_utils
00186 // --------------
00187 // Purpose: provide a single macro when no fields will be defined, mainly used
00188 // by components, but can be used by raw data. Requires two arg ctor.
00189 
00190 `define ovm_component_utils(T) \
00191   `ovm_component_utils_begin(T) \
00192   `ovm_component_utils_end
00193 
00194 
00195 // ovm_component_param_utils
00196 // -------------------------
00197 // Purpose: same as for ovm_component_utils, except for use with
00198 // parameterized classes
00199 
00200 `define ovm_component_param_utils(T) \
00201   `ovm_component_param_utils_begin(T) \
00202   `ovm_component_utils_end
00203 
00204 
00205 // ovm_component_utils_begin
00206 // --------------------
00207 // Purpose: implements factory methods and get_type_name and 
00208 // starts the implementation of the superfunction m_field_automation. 
00209 // Requires a 2 arg ctor (name and parent are required args).
00210 //
00211 // Precondition: T is the type name of the current user class
00212 //
00213 
00214 `define ovm_component_utils_begin(T) \
00215    `ovm_component_registry_internal(T,T) \
00216    `ovm_get_type_name_func(T) \
00217    `ovm_field_utils_begin(T) 
00218 
00219 
00220 // ovm_component_param_utils_begin
00221 // -------------------------------
00222 // Purpose: same as for ovm_component_utils_begin, except for use with
00223 // parameterized classes
00224 
00225 `define ovm_component_param_utils_begin(T) \
00226    `ovm_component_registry_param(T) \
00227    `ovm_field_utils_begin(T) 
00228 
00229 
00230 // ovm_component_utils_end
00231 // ------------------
00232 // Purpose: finishes the superfunction implementation.
00233 
00234 `define ovm_component_utils_end \
00235      end \
00236    endfunction
00237 
00238 
00239 //------------------------------------------------------------------------------
00240 //
00241 // MACROS: fields
00242 //
00243 // Use between begin/end utils macros, above
00244 //------------------------------------------------------------------------------
00245 
00246 // ovm_field_int
00247 // -------------
00248 
00249 // Purpose: provide implementation of all of the ovm functions for the given
00250 // integral field. This implementation is inside of the m_field_automation 
00251 // function which allows a single macro declaration per field.
00252 //
00253 // Precondition: ARG is one of the fields of the class. FLAG is a unary anded
00254 // set of flags turning off fields. The ALL_ON flag turns all fields on. ARG
00255 // must not be a class object type or unpacked struct type, use 
00256 // `ovm_field_object for a class object.
00257 
00258 `define ovm_field_int(ARG,FLAG) \
00259   begin \
00260   if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00261   m_sc.scope.set_arg(`"ARG`"); \
00262   `OVM_FIELD_DATA(ARG,FLAG) \
00263   `OVM_FIELD_SET(ARG,FLAG) \
00264   m_sc.scope.unset_arg(`"ARG`"); \
00265   end
00266 
00267 // Need a special macro for enums so that the enumerated value can be used
00268 `define ovm_field_enum(T,ARG,FLAG) \
00269   begin \
00270   m_sc.scope.set_arg(`"ARG`"); \
00271   `OVM_FIELD_ENUM(T,ARG,FLAG) \
00272   m_sc.scope.unset_arg(`"ARG`"); \
00273   end
00274 
00275 
00276 // ovm_field_object
00277 // ----------------
00278 
00279 // Purpose: provide implementation of all of the ovm functions for the given
00280 // ovm_object derived argument.
00281 //
00282 // Precondition: ARG is one of the fields of the class. ARG must be a class
00283 // object.
00284 
00285 `define ovm_field_object(ARG,FLAG) \
00286   if((ARG==null) || !m_sc.scope.in_hierarchy(ARG)) begin \
00287     if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00288     m_sc.scope.down(`"ARG`", ARG); \
00289     `OVM_FIELD_DATA_OBJECT(ARG,FLAG) \
00290     `OVM_FIELD_SET_OBJECT(ARG,FLAG) \
00291     m_sc.scope.up(ARG); \
00292   end
00293 
00294 
00295 // ovm_field_event
00296 // ---------------
00297    
00298 // Purpose: provide implementation of all of the ovm functions for the given
00299 // event argument.
00300 //   
00301 // Precondition: ARG is one of the fields of the class. ARG must be an
00302 // event type.
00303 
00304 `define ovm_field_event(ARG,FLAG) \
00305   begin \
00306   if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00307   m_sc.scope.down(`"ARG`", null); \
00308   `OVM_FIELD_DATA_EVENT(ARG,FLAG) \
00309   m_sc.scope.up(null); \
00310   end
00311      
00312 
00313 // ovm_field_string
00314 // ----------------
00315 
00316 // Purpose: provide implementation of all of the ovm functions for the given
00317 // string field.
00318 //
00319 // Precondition: ARG is one of the fields of the class. ARG must be a string
00320 // object.
00321 
00322 `define ovm_field_string(ARG,FLAG) \
00323   begin \
00324   if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00325   m_sc.scope.down(`"ARG`",null); \
00326   `OVM_FIELD_DATA_STRING(ARG,FLAG) \
00327   `OVM_FIELD_SET_STRING(ARG,FLAG) \
00328   m_sc.scope.up(null); \
00329   end
00330 
00331 
00332 // ovm_field_array_int
00333 // -------------------
00334 
00335 // Purpose: provide implementation of all of the ovm functions for the given
00336 // array of integral objects  field.
00337 //
00338 // Precondition: ARG is one of the fields of the class. ARG must be a array
00339 // of integral objects. The flags apply to fields within the array.
00340 
00341 `define ovm_field_array_int(ARG,FLAG) \
00342   begin \
00343   if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00344   m_sc.scope.down(`"ARG`",null); \
00345   if(what__==OVM_COPY && !((FLAG)&OVM_NOCOPY)) begin \
00346     if(local_data__!=null) begin \
00347       ARG = new [local_data__.ARG.size()](local_data__.ARG); \
00348     end \
00349     else begin \
00350       ARG.delete(); \
00351     end \
00352   end \
00353   `OVM_FIELD_DATA_ARRAY(ARG,FLAG) \
00354   `OVM_FIELD_ARRAY_INT_PACK(ARG,FLAG) \
00355   `OVM_FIELD_SET_ARRAY_TYPE(INT, ARG, m_sc.bitstream, FLAG) \
00356   m_sc.scope.up(null); \
00357   end
00358 
00359 // ovm_field_array_enum
00360 // --------------------
00361 
00362 `define ovm_field_array_enum(T,ARG,FLAG) \
00363   begin \
00364     `ovm_field_qda_enum(T,ARG,FLAG) \
00365     `ovm_unpack_array_enum(T,ARG,FLAG) \
00366     `OVM_FIELD_SET_ARRAY_ENUM(T, ARG, m_sc.bitstream, FLAG) \
00367   end
00368 
00369 `define ovm_field_queue_enum(T,ARG,FLAG) \
00370   begin \
00371     `ovm_field_qda_enum(T,ARG,FLAG) \
00372     `ovm_unpack_queue_enum(T,ARG,FLAG) \
00373     `OVM_FIELD_SET_QUEUE_ENUM(T, ARG, m_sc.bitstream, FLAG) \
00374   end
00375 
00376 `define ovm_field_sarray_enum(T,ARG,FLAG) \
00377   begin \
00378     T lh__, rh__; \
00379     if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00380     m_sc.scope.down(`"ARG`",null); \
00381     if((what__ == OVM_PRINT) && !(OVM_NOPRINT&(FLAG))) \
00382       `ovm_print_qda_enum(ARG, ovm_auto_options_object.printer, array, T) \
00383     else if((what__ == OVM_COPY) && !(OVM_NOCOPY&(FLAG))) begin \
00384       $cast(local_data__, tmp_data__); \
00385       if(local_data__ != null) foreach(ARG[i]) ARG[i] = local_data__.ARG[i]; \
00386     end \
00387     else if((what__ == OVM_RECORD) && !(OVM_NORECORD&(FLAG))) \
00388       `ovm_record_qda_enum(T,ARG, ovm_auto_options_object.recorder) \
00389     else if((what__ == OVM_COMPARE) && !(OVM_NOCOMPARE&(FLAG))) begin \
00390       foreach(ARG[i__]) \
00391         if(ARG[i__] !== local_data__.ARG[i__]) begin \
00392           lh__ = ARG[i__]; \
00393           rh__ = local_data__.ARG[i__]; \
00394           ovm_auto_options_object.comparer.scope.down_element(i__, null);\
00395           $swrite(m_sc.stringv, "lhs = %0s : rhs = %0s", \
00396             lh__.name(), rh__.name()); \
00397           ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \
00398           ovm_auto_options_object.comparer.scope.up_element(null);\
00399         end \
00400     end \
00401     `ovm_pack_unpack_sarray_enum(T,ARG,FLAG) \
00402     `OVM_FIELD_SET_SARRAY_ENUM(T, ARG, m_sc.bitstream, FLAG) \
00403   end
00404 
00405 `define ovm_field_qda_enum(T,ARG,FLAG) \
00406   begin \
00407     T lh__, rh__; \
00408     if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00409     m_sc.scope.down(`"ARG`",null); \
00410     if((what__ == OVM_PRINT) && !(OVM_NOPRINT&(FLAG))) \
00411       `ovm_print_qda_enum(ARG, ovm_auto_options_object.printer, array, T) \
00412     else if((what__ == OVM_RECORD) && !(OVM_NORECORD&(FLAG))) \
00413       `ovm_record_qda_enum(T,ARG, ovm_auto_options_object.recorder) \
00414     else if((what__ == OVM_COMPARE) && !(OVM_NOCOMPARE&(FLAG))) begin \
00415       $cast(local_data__, tmp_data__); \
00416       if(ARG.size() != local_data__.ARG.size()) begin \
00417         int s1__, s2__; \
00418         m_sc.stringv = ""; \
00419         s1__ = ARG.size(); s2__ = local_data__.ARG.size(); \
00420         $swrite(m_sc.stringv, "lhs size = %0d : rhs size = %0d", s1__, s2__);\
00421         ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \
00422       end \
00423       for(int i__=0; i__<ARG.size() && i__<local_data__.ARG.size(); ++i__) \
00424         if(ARG[i__] !== local_data__.ARG[i__]) begin \
00425           lh__ = ARG[i__]; \
00426           rh__ = local_data__.ARG[i__]; \
00427           ovm_auto_options_object.comparer.scope.down_element(i__, null);\
00428           $swrite(m_sc.stringv, "lhs = %0s : rhs = %0s", \
00429             lh__.name(), rh__.name()); \
00430           ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \
00431           ovm_auto_options_object.comparer.scope.up_element(null);\
00432         end \
00433     end \
00434     if((what__ == OVM_COPY) && !(OVM_NOCOPY&(FLAG))) begin \
00435       $cast(local_data__, tmp_data__); \
00436       if(local_data__ != null) ARG = local_data__.ARG; \
00437     end \
00438     else if((what__ == OVM_PACK) && !(OVM_NOPACK&(FLAG))) begin \
00439       if((((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.abstract) || \
00440           (!((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.physical)) begin \
00441         if(ovm_auto_options_object.packer.use_metadata == 1) \
00442           ovm_auto_options_object.packer.pack_field_int(ARG.size(), 32); \
00443         foreach(ARG[i]) \
00444           ovm_auto_options_object.packer.pack_field(int'(ARG[i]), $bits(ARG[i])); \
00445       end \
00446     end \
00447     m_sc.scope.up(null); \
00448   end
00449 
00450 `define ovm_unpack_array_enum(T,ARG,FLAG) \
00451   if((what__ == OVM_UNPACK) && !(OVM_NOPACK&(FLAG))) begin \
00452     if((((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.abstract) || \
00453         (!((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.physical)) begin \
00454       if(ovm_auto_options_object.packer.use_metadata) begin \
00455         int s_; \
00456         s_ = ovm_auto_options_object.packer.unpack_field_int(32); \
00457         ARG = new[s_]; \
00458       end \
00459       foreach(ARG[i]) \
00460         ARG[i] = T'(ovm_auto_options_object.packer.unpack_field($bits(ARG[i]))); \
00461     end \
00462   end \
00463 
00464 `define ovm_unpack_queue_enum(T,ARG,FLAG) \
00465   if((what__ == OVM_UNPACK) && !(OVM_NOPACK&(FLAG))) begin \
00466     if((((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.abstract) || \
00467         (!((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.physical)) begin \
00468       if(ovm_auto_options_object.packer.use_metadata) begin \
00469         int s_; \
00470         s_ = ovm_auto_options_object.packer.unpack_field_int(32); \
00471         while(ARG.size() > s_) void'(ARG.pop_front()); \
00472         while(ARG.size() < s_) ARG.push_back(T'(0)); \
00473       end \
00474       foreach(ARG[i]) \
00475         ARG[i] = T'(ovm_auto_options_object.packer.unpack_field($bits(ARG[i]))); \
00476     end \
00477   end \
00478 
00479 `define ovm_pack_unpack_sarray_enum(T,ARG,FLAG) \
00480   if((what__ == OVM_PACK) && !(OVM_NOPACK&(FLAG))) begin \
00481     if((((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.abstract) || \
00482         (!((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.physical)) \
00483       foreach(ARG[i]) \
00484         ovm_auto_options_object.packer.pack_field(ARG[i],$bits(ARG[i])); \
00485   end \
00486   else if((what__ == OVM_UNPACK) && !(OVM_NOPACK&(FLAG))) begin \
00487     if((((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.abstract) || \
00488         (!((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.physical)) \
00489       foreach(ARG[i]) \
00490         ARG[i] = T'(ovm_auto_options_object.packer.unpack_field($bits(ARG[i]))); \
00491   end \
00492 
00493 
00494 // Purpose: provide implementation of all of the ovm functions for the given
00495 // ovm_field_sarray_int
00496 // -------------------
00497 
00498 // Purpose: provide implementation of all of the ovm functions for the given
00499 // a static array of integral objects  field.
00500 //
00501 // Precondition: ARG is one of the fields of the class. ARG must be a array
00502 // of integral objects. The flags apply to fields within the array.
00503 
00504 `define ovm_field_sarray_int(ARG,FLAG) \
00505   begin \
00506   if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00507   m_sc.scope.down(`"ARG`",null); \
00508   `OVM_FIELD_DATA_SARRAY(ARG,FLAG) \
00509   `OVM_FIELD_SET_SARRAY_TYPE(INT,ARG,m_sc.bitstream,FLAG) \
00510   m_sc.scope.up(null); \
00511   end
00512 
00513 // ovm_field_array_object
00514 // ----------------------
00515 
00516 // Purpose: provide implementation of all of the ovm functions for the given
00517 // array of ovm_object objects  field.
00518 //
00519 // Precondition: ARG is one of the fields of the class. ARG must be a array
00520 // of ovm_object objects. The flags apply to fields within the array.
00521 
00522 `define ovm_field_array_object(ARG,FLAG) \
00523   begin \
00524     if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00525     m_sc.scope.down(`"ARG`", null); \
00526     if(what__==OVM_COPY && !((FLAG)&OVM_NOCOPY)) begin \
00527       if(local_data__!=null) begin \
00528          ARG = new[local_data__.ARG.size()]; \
00529       end \
00530       else begin \
00531         ARG.delete(); \
00532       end \
00533     end \
00534     `OVM_FIELD_DATA_ARRAY_OBJECT(ARG,FLAG) \
00535     `OVM_FIELD_ARRAY_OBJ_PACK(ARG,FLAG) \
00536     `OVM_FIELD_SET_ARRAY_OBJECT(ARG,FLAG) \
00537     m_sc.scope.up(null); \
00538   end 
00539 
00540 // ovm_field_sarray_object
00541 // -----------------------
00542 
00543 // Purpose: provide implementation of all of the ovm functions for the given
00544 // a static array of integral objects  field.
00545 //
00546 // Precondition: ARG is one of the fields of the class. ARG must be a array
00547 // of integral objects. The flags apply to fields within the array.
00548 
00549 `define ovm_field_sarray_object(ARG,FLAG) \
00550   begin \
00551   if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00552   m_sc.scope.down(`"ARG`",null); \
00553   `OVM_FIELD_DATA_SARRAY_OBJECT(ARG,FLAG) \
00554   `OVM_FIELD_SET_SARRAY_OBJECT(ARG,FLAG) \
00555   m_sc.scope.up(null); \
00556   end
00557 
00558 
00559 // ovm_field_array_string
00560 // ----------------------
00561 
00562 // Purpose: provide implementation of all of the ovm functions for the given
00563 // array of string objects  field.
00564 //
00565 // Precondition: ARG is one of the fields of the class. ARG must be a array
00566 // of string objects. The flags apply to fields within the array.
00567 
00568 `define ovm_field_array_string(ARG,FLAG) \
00569   begin \
00570   if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00571   m_sc.scope.down(`"ARG`", null); \
00572   if(what__==OVM_COPY && !((FLAG)&OVM_NOCOPY)) begin \
00573     if(local_data__!=null) begin \
00574        ARG = new[local_data__.ARG.size()]; \
00575     end \
00576     else begin \
00577       ARG.delete(); \
00578     end \
00579   end \
00580   `OVM_FIELD_DATA_ARRAY_STRING(ARG,FLAG) \
00581   `OVM_FIELD_ARRAY_STR_PACK(ARG,FLAG) \
00582   `OVM_FIELD_SET_ARRAY_TYPE(STR, ARG, m_sc.stringv, FLAG) \
00583   m_sc.scope.up(null); \
00584   end 
00585 
00586 `define ovm_field_sarray_string(ARG,FLAG) \
00587   begin \
00588   if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00589   m_sc.scope.down(`"ARG`", null); \
00590   `OVM_FIELD_DATA_SARRAY_STRING(ARG,FLAG) \
00591   `OVM_FIELD_SET_SARRAY_TYPE(STR, ARG, m_sc.stringv, FLAG) \
00592   m_sc.scope.up(null); \
00593   end 
00594 
00595 // ovm_field_queue_int
00596 `define ovm_field_queue_int(ARG,FLAG) \
00597   begin \
00598   if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00599   m_sc.scope.down(`"ARG`", null); \
00600   if(what__==OVM_COPY && !((FLAG)&OVM_NOCOPY)) begin \
00601     if(local_data__!=null) begin \
00602       `RESIZE_QUEUE_NOCOPY(ovm_bitstream_t, ARG, local_data__.ARG.size()) \
00603     end \
00604     else begin \
00605       `RESIZE_QUEUE_NOCOPY(ovm_bitstream_t, ARG, 0) \
00606     end \
00607   end \
00608   `OVM_FIELD_DATA_ARRAY(ARG,FLAG) \
00609   `OVM_FIELD_QUEUE_INT_PACK(ARG,FLAG) \
00610   `OVM_FIELD_SET_QUEUE_TYPE(INT, ARG, m_sc.bitstream, FLAG) \
00611   m_sc.scope.up(null); \
00612   end
00613 
00614 
00615 // ovm_field_queue_object
00616 // ----------------------
00617 
00618 // Purpose: provide implementation of all of the ovm functions for the given
00619 // queue of ovm_object objects  field.
00620 //
00621 // Precondition: ARG is one of the fields of the class. ARG must be a queue
00622 // of ovm_object objects. The flags apply to fields within the queue.
00623 
00624 `define ovm_field_queue_object(ARG,FLAG) \
00625   begin \
00626     if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00627     m_sc.scope.down(`"ARG`", null); \
00628     if(what__==OVM_COPY && !((FLAG)&OVM_NOCOPY)) begin \
00629       if(local_data__!=null) begin \
00630         `RESIZE_QUEUE_OBJECT_NOCOPY(ARG, local_data__.ARG.size()) \
00631       end \
00632       else begin \
00633         `RESIZE_QUEUE_OBJECT_NOCOPY(ARG, 0) \
00634       end \
00635     end \
00636     `OVM_FIELD_DATA_ARRAY_OBJECT(ARG,FLAG) \
00637     `OVM_FIELD_QUEUE_OBJ_PACK(ARG,FLAG) \
00638     `OVM_FIELD_SET_QUEUE_OBJECT(ARG,FLAG) \
00639     m_sc.scope.up(null); \
00640   end
00641 
00642 
00643 // ovm_field_queue_string
00644 // ----------------------
00645 
00646 // Purpose: provide implementation of all of the ovm functions for the given
00647 // queue of string objects  field.
00648 //
00649 // Precondition: ARG is one of the fields of the class. ARG must be a queue
00650 // of string objects. The flags apply to fields within the queue.
00651 
00652 `define ovm_field_queue_string(ARG,FLAG) \
00653   begin \
00654   if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00655   m_sc.scope.down(`"ARG`", null); \
00656   if(what__==OVM_COPY && !((FLAG)&OVM_NOCOPY)) begin \
00657     if(local_data__!=null) begin \
00658       `RESIZE_QUEUE_NOCOPY(string, ARG, local_data__.ARG.size()) \
00659     end \
00660     else begin \
00661       `RESIZE_QUEUE_NOCOPY(string, ARG, 0) \
00662     end \
00663   end \
00664   `OVM_FIELD_DATA_ARRAY_STRING(ARG,FLAG) \
00665   `OVM_FIELD_QUEUE_STR_PACK(ARG,FLAG) \
00666   `OVM_FIELD_SET_QUEUE_TYPE(STR, ARG, m_sc.stringv, FLAG) \
00667   m_sc.scope.up(null); \
00668   end
00669 
00670 
00671 // ovm_field_aa_int_string
00672 // -----------------------
00673 
00674 `define ovm_field_aa_int_string(ARG, FLAG) \
00675   begin \
00676   if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00677   m_sc.scope.down(`"ARG`", null); \
00678   `OVM_FIELD_DATA_AA_int_string(ARG,FLAG) \
00679   `OVM_FIELD_SET_AA_TYPE(string, INT, ARG, m_sc.bitstream, FLAG)  \
00680   m_sc.scope.up(null); \
00681   end
00682 
00683 
00684 // ovm_field_aa_object_string
00685 // --------------------------
00686 
00687 `define ovm_field_aa_object_string(ARG, FLAG) \
00688   begin \
00689   if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00690   m_sc.scope.down(`"ARG`", null); \
00691   `OVM_FIELD_DATA_AA_object_string(ARG,FLAG) \
00692   `OVM_FIELD_SET_AA_OBJECT_TYPE(string, ARG, FLAG)  \
00693   m_sc.scope.up(null); \
00694   end
00695 
00696 
00697 // ovm_field_aa_string_string
00698 // --------------------------
00699 
00700 `define ovm_field_aa_string_string(ARG, FLAG) \
00701   begin \
00702   if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00703   m_sc.scope.down(`"ARG`", null); \
00704   `OVM_FIELD_DATA_AA_string_string(ARG,FLAG) \
00705   `OVM_FIELD_SET_AA_TYPE(string, STR, ARG, m_sc.stringv, FLAG)  \
00706   m_sc.scope.up(null); \
00707   end
00708 
00709 // ovm_field_aa_object_int
00710 // --------------------------
00711 
00712 `define ovm_field_aa_object_int(ARG, FLAG) \
00713   begin \
00714   if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00715   m_sc.scope.down(`"ARG`", null); \
00716   `OVM_FIELD_DATA_AA_object_int(ARG,FLAG) \
00717   `OVM_FIELD_SET_AA_OBJECT_TYPE(int, ARG, FLAG)  \
00718   m_sc.scope.up(null); \
00719   end
00720 
00721 // ovm_field_aa_int_int
00722 // --------------------------
00723 
00724 `define ovm_field_aa_int_int(ARG, FLAG) \
00725   `ovm_field_aa_int_key(int, ARG, FLAG) \
00726 
00727 `define ovm_field_aa_int_int_unsigned(ARG, FLAG) \
00728   `ovm_field_aa_int_key(int unsigned, ARG, FLAG)
00729 
00730 `define ovm_field_aa_int_integer(ARG, FLAG) \
00731   `ovm_field_aa_int_key(integer, ARG, FLAG)
00732 
00733 `define ovm_field_aa_int_integer_unsigned(ARG, FLAG) \
00734   `ovm_field_aa_int_key(integer unsigned, ARG, FLAG)
00735 
00736 `define ovm_field_aa_int_byte(ARG, FLAG) \
00737   `ovm_field_aa_int_key(byte, ARG, FLAG)
00738 
00739 `define ovm_field_aa_int_byte_unsigned(ARG, FLAG) \
00740   `ovm_field_aa_int_key(byte unsigned, ARG, FLAG)
00741 
00742 `define ovm_field_aa_int_shortint(ARG, FLAG) \
00743   `ovm_field_aa_int_key(shortint, ARG, FLAG)
00744 
00745 `define ovm_field_aa_int_shortint_unsigned(ARG, FLAG) \
00746   `ovm_field_aa_int_key(shortint unsigned, ARG, FLAG)
00747 
00748 `define ovm_field_aa_int_longint(ARG, FLAG) \
00749   `ovm_field_aa_int_key(longint, ARG, FLAG)
00750 
00751 `define ovm_field_aa_int_longint_unsigned(ARG, FLAG) \
00752   `ovm_field_aa_int_key(longint unsigned, ARG, FLAG)
00753 
00754 `define ovm_field_aa_int_key(KEY, ARG, FLAG) \
00755   begin \
00756   if(what__==OVM_CHECK_FIELDS) m_do_field_check(`"ARG`"); \
00757   m_sc.scope.down(`"ARG`", null); \
00758   `OVM_FIELD_DATA_AA_int_key(KEY,ARG,FLAG) \
00759   `OVM_FIELD_SET_AA_INT_TYPE(KEY, INT, ARG, m_sc.bitstream, FLAG)  \
00760   m_sc.scope.up(null); \
00761   end
00762 
00763 
00764 // Purpose: Provide a way for a derived class to override the flag settings in
00765 // the base class.
00766 //
00767 
00768 `define ovm_set_flags(ARG,FLAG) \
00769   begin \
00770    if(what__ == OVM_FLAGS) begin \
00771    end \
00772   end
00773 
00774 
00775 // ovm_print_msg_enum
00776 // ------------------
00777 
00778 `define ovm_print_msg_enum(LHS,RHS) \
00779   begin \
00780     ovm_comparer comparer; \
00781     comparer = ovm_auto_options_object.comparer; \
00782     if(comparer==null) comparer = ovm_default_comparer; \
00783     comparer.result++; \
00784 /*    $swrite(comparer.miscompares,"%s%s: lhs = %s : rhs = %s\n",*/ \
00785 /*       comparer.miscompares, comparer.scope.get_arg(), LHS, RHS );*/ \
00786     $swrite(comparer.miscompares,"%s%s: lhs = %0d : rhs = %0d\n", \
00787        comparer.miscompares, comparer.scope.get_arg(), LHS, RHS ); \
00788   end
00789 
00790 
00791 //-----------------------------------------------------------------------------
00792 //
00793 // MACROS: recording
00794 //
00795 //-----------------------------------------------------------------------------
00796 
00797 // TBD
00798 
00799 // ovm_record_int
00800 // --------------
00801 
00802 // Purpose: provide print functionality for a specific integral field. This
00803 // macro is available for user access. If used externally, a record_options
00804 // object must be avaialble and must have the name opt.
00805 // 
00806 // Postcondition: ARG is printed using the format set by the FLAGS.
00807 
00808 `define ovm_record_int(ARG,FLAG) \
00809   begin \
00810     int radix__; \
00811     ovm_bitstream_t value; \
00812     value = ARG; \
00813     radix__ = ovm_radix_enum'((FLAG)&(OVM_RADIX)); \
00814     if(recorder==null) \
00815       recorder=ovm_auto_options_object.recorder; \
00816     recorder.record_field(`"ARG`", ARG, radix__, $bits(ARG); \
00817   end 
00818 
00819 
00820 // ovm_record_string
00821 // -----------------
00822 
00823 // Purpose: provide record functionality for a specific string field. This
00824 // macro is available for user access. If used externally, a record_options
00825 // object must be avaialble and must have the name recorder.
00826 //  
00827 // Postcondition: ARG is recorded in string format.
00828       
00829 
00830 `define ovm_record_string(ARG) \
00831   recorder.record_string(`"ARG`", ARG); \
00832 
00833 
00834 // ovm_record_object
00835 // -----------------
00836 
00837 // Purpose: provide record functionality for a specific ovm_object field. This
00838 // macro is available for user access. If used externally, a record_options
00839 // object must be avaialble and must have the name recorder.
00840 //
00841 // Postcondition: ARG is recorded. The record is done recursively where the
00842 // depth to record is set in the recorder object.
00843 
00844 
00845 `define ovm_record_object(ARG,FLAG) \
00846   begin \
00847      ovm_object v__; \
00848      if(ARG != null) begin \
00849        if($cast(v__,ARG)) begin \
00850          ovm_record_object__(`"ARG`", v__, recorder); \
00851        end \
00852      end \
00853      else begin \
00854        `ovm_record_any_object(ARG); \
00855      end \
00856   end
00857 
00858 
00859 // ovm_record_any_object
00860 // ---------------------
00861 
00862 // Purpose: provide record functionality for a user specific class object. This
00863 // macro is available for user access. If used externally, a record_options
00864 // object must be availble and must have the name recorder.
00865 //
00866 // Postcondition: The reference value of ARG is recorded.
00867 
00868 `define ovm_record_any_object(ARG) \
00869   //recorder.record_object(`"ARG`", ARG);  
00870 
00871 
00872 //-----------------------------------------------------------------------------
00873 //
00874 // INTERNAL MACROS - do not use directly
00875 //
00876 //-----------------------------------------------------------------------------
00877 
00878 // MACROS: for composing the utils and field macro sets
00879 
00880 // ovm_new_func
00881 // ------------
00882 
00883 `define ovm_new_func \
00884   function new (string name, ovm_component parent); \
00885     super.new(name, parent); \
00886   endfunction
00887 
00888 `define ovm_component_new_func \
00889   `ovm_new_func
00890 
00891 `define ovm_new_func_data \
00892   function new (string name=""); \
00893     super.new(name); \
00894   endfunction
00895 
00896 `define ovm_object_new_func \
00897   `ovm_new_func_data
00898 
00899 `define ovm_named_object_new_func \
00900   function new (string name, ovm_component parent); \
00901     super.new(name, parent); \
00902   endfunction
00903 
00904 
00905 // ovm_object_create_func
00906 // ----------------------
00907 
00908 // Zero argument create function, requires default constructor
00909 `define ovm_object_create_func(T) \
00910    function ovm_object create (string name=""); \
00911      T tmp; \
00912      tmp = new(); \
00913      tmp.set_name(name); \
00914      return tmp; \
00915    endfunction
00916 
00917 
00918 // ovm_named_object_create_func
00919 // ----------------------------
00920 
00921 `define ovm_named_object_create_func(T) \
00922    function ovm_named_object create_named_object (string name, ovm_named_object parent); \
00923      T tmp; \
00924      tmp = new(.name(name), .parent(parent)); \
00925      return tmp; \
00926    endfunction
00927 
00928 
00929 `define ovm_named_object_factory_create_func(T) \
00930   `ovm_named_object_create_func(T) \
00931 
00932 
00933 // ovm_object_factory_create_func
00934 // ------------------------------
00935 
00936 `define ovm_object_factory_create_func(T) \
00937    function ovm_object create_object (string name=""); \
00938      T tmp; \
00939      tmp = new(); \
00940      tmp.set_name(name); \
00941      return tmp; \
00942    endfunction \
00943    \
00944    static function T create(string name="", ovm_component parent=null, string contxt=""); \
00945      ovm_factory f; \
00946      f = ovm_factory::get(); \
00947      if (contxt == "" && parent != null) \
00948        contxt = parent.get_full_name(); \
00949      assert ($cast(create,f.create_object_by_type(get(),contxt,name))) \
00950      else $fatal(0,"Factory did not return an object of type, ",type_name); \
00951    endfunction
00952 
00953 
00954 // ovm_component_factory_create_func
00955 // ---------------------------------
00956 
00957 `define ovm_component_factory_create_func(T) \
00958    function ovm_component create_component (string name, ovm_component parent); \
00959      T tmp; \
00960      tmp = new(.name(name), .parent(parent)); \
00961      return tmp; \
00962    endfunction \
00963    \
00964    static function T create(string name, ovm_component parent, string contxt=""); \
00965      ovm_factory f; \
00966      f = ovm_factory::get(); \
00967      if (contxt == "" && parent != null) \
00968        contxt = parent.get_full_name(); \
00969      assert ($cast(create, f.create_component_by_type(get(),contxt,name,parent))) \
00970      else $fatal(0,"Factory did not return a component of type, ",type_name); \
00971    endfunction
00972 
00973 
00974 // ovm_get_type_name_func
00975 // ----------------------
00976 
00977 `define ovm_get_type_name_func(T) \
00978    const static string type_name = `"T`"; \
00979    virtual function string get_type_name (); \
00980      return type_name; \
00981    endfunction 
00982 
00983 
00984 // ovm_register_self_func
00985 // ----------------------
00986 
00987 `ifndef INCA
00988 `define USE_PARAMETERIZED_WRAPPER
00989 `endif
00990 
00991 `ifndef USE_PARAMETERIZED_WRAPPER
00992 `define ovm_register_self_func(T) \
00993   \
00994   local static type_id me = get(); \
00995   \
00996   static function type_id get(); \
00997     ovm_factory f; \
00998     f = ovm_factory::get(); \
00999     if (me == null) begin \
01000       me = new(); \
01001       factory.register(me); \
01002     end \
01003     return me; \
01004   endfunction
01005 `else
01006 `define ovm_register_self_func(T)
01007 `endif
01008 
01009 
01010 `ifndef USE_PARAMETERIZED_WRAPPER
01011 `define ovm_factory_override_func \
01012   static function void set_type_override(ovm_object_wrapper override, bit replace=1); \
01013     factory.set_type_override_by_type(get(),override,replace); \
01014   endfunction \
01015 \
01016   static function void set_inst_override(ovm_object_wrapper override, \
01017                                          string inst_path, \
01018                                          ovm_component parent=null); \
01019     string full_inst_path; \
01020     if (parent != null) begin \
01021       if (inst_path == "") \
01022         inst_path = parent.get_full_name(); \
01023       else \
01024         inst_path = {parent.get_full_name(),".",inst_path}; \
01025     end \
01026     factory.set_inst_override_by_type(get(),override,inst_path); \
01027   endfunction
01028 `else
01029 `define ovm_factory_override_func
01030 `endif
01031  
01032 
01033 // ovm_object_derived_wrapper_class
01034 // --------------------------------
01035 
01036 //Requires S to be a constant string
01037 `ifndef USE_PARAMETERIZED_WRAPPER
01038 `define ovm_object_registry(T,S) \
01039    class type_id extends ovm_object_wrapper; \
01040      const static string type_name = S; \
01041      virtual function string get_type_name (); \
01042        return type_name; \
01043      endfunction \
01044      `ovm_object_factory_create_func(T) \
01045      `ovm_factory_override_func \
01046      `ovm_register_self_func(T) \
01047    endclass  \
01048    static function type_id get_type(); \
01049      return type_id::get(); \
01050    endfunction 
01051 //This is needed due to an issue in IUS of passing down strings
01052 //created by args to lower level macros.
01053 `define ovm_object_registry_internal(T,S) \
01054    class type_id extends ovm_object_wrapper; \
01055      const static string type_name = `"S`"; \
01056      virtual function string get_type_name (); \
01057        return type_name; \
01058      endfunction \
01059      `ovm_object_factory_create_func(T) \
01060      `ovm_factory_override_func \
01061      `ovm_register_self_func(T) \
01062    endclass  \
01063    static function type_id get_type(); \
01064      return type_id::get(); \
01065    endfunction 
01066 `else
01067 `ifndef SVPP
01068 `define ovm_object_registry(T,S) \
01069    typedef ovm_object_registry#(T,S) type_id; \
01070    static function type_id get_type(); \
01071      return type_id::get(); \
01072    endfunction 
01073 //This is needed due to an issue in IUS of passing down strings
01074 //created by args to lower level macros.
01075 `define ovm_object_registry_internal(T,S) \
01076    typedef ovm_object_registry#(T,`"S`") type_id; \
01077    static function type_id get_type(); \
01078      return type_id::get(); \
01079    endfunction 
01080 `endif //SVPP
01081 `endif //USE_PARAMETERIZED_WRAPPER
01082 
01083 
01084 // versions of the ovm_object_registry macros above which are to be used
01085 // with parameterized classes
01086 
01087 `ifndef USE_PARAMETERIZED_WRAPPER
01088 `define ovm_object_registry_param(T) \
01089    class type_id extends ovm_object_wrapper; \
01090      const static string type_name = "<unknown>"; \
01091      virtual function string get_type_name (); \
01092        return type_name; \
01093      endfunction \
01094      `ovm_object_factory_create_func(T) \
01095      `ovm_factory_override_func \
01096      `ovm_register_self_func(T) \
01097    endclass  \
01098    static function type_id get_type(); \
01099      return type_id::get(); \
01100    endfunction 
01101 `else
01102 `ifndef SVPP
01103 `define ovm_object_registry_param(T) \
01104    typedef ovm_object_registry#(T) type_id; \
01105    static function type_id get_type(); \
01106      return type_id::get(); \
01107    endfunction 
01108 `endif //SVPP
01109 `endif //USE_PARAMETERIZED_WRAPPER
01110 
01111 
01112 // ovm_component_derived_wrapper_class
01113 // ---------------------------------
01114 
01115 `ifndef USE_PARAMETERIZED_WRAPPER
01116 `define ovm_component_registry(T,S) \
01117    class type_id extends ovm_object_wrapper; \
01118      const static string type_name = S; \
01119      virtual function string get_type_name (); \
01120        return type_name; \
01121      endfunction \
01122      `ovm_component_factory_create_func(T) \
01123      `ovm_factory_override_func \
01124      `ovm_register_self_func(T) \
01125    endclass  \
01126    static function type_id get_type(); \
01127      return type_id::get(); \
01128    endfunction 
01129 //This is needed due to an issue in IUS of passing down strings
01130 //created by args to lower level macros.
01131 `define ovm_component_registry_internal(T,S) \
01132    class type_id extends ovm_object_wrapper; \
01133      const static string type_name = `"S`"; \
01134      virtual function string get_type_name (); \
01135        return type_name; \
01136      endfunction \
01137      `ovm_component_factory_create_func(T) \
01138      `ovm_factory_override_func \
01139      `ovm_register_self_func(T) \
01140    endclass  \
01141    static function type_id get_type(); \
01142      return type_id::get(); \
01143    endfunction 
01144 `else
01145 `ifndef SVPP
01146 `define ovm_component_registry(T,S) \
01147    typedef ovm_component_registry #(T,S) type_id; \
01148    static function type_id get_type(); \
01149      return type_id::get(); \
01150    endfunction 
01151 //This is needed due to an issue in IUS of passing down strings
01152 //created by args to lower level macros.
01153 `define ovm_component_registry_internal(T,S) \
01154    typedef ovm_component_registry #(T,`"S`") type_id; \
01155    static function type_id get_type(); \
01156      return type_id::get(); \
01157    endfunction 
01158 `endif //SVPP
01159 `endif //USE_PARAMETERIZED_WRAPPER
01160 
01161 // versions of the ovm_component_registry macros to be used with
01162 // parameterized classes
01163 
01164 `ifndef USE_PARAMETERIZED_WRAPPER
01165 `define ovm_component_registry_param(T) \
01166    class type_id extends ovm_object_wrapper; \
01167      const static string type_name = "<unknown>"; \
01168      virtual function string get_type_name (); \
01169        return type_name; \
01170      endfunction \
01171      `ovm_component_factory_create_func(T) \
01172      `ovm_factory_override_func \
01173      `ovm_register_self_func(T) \
01174    endclass  \
01175    static function type_id get_type(); \
01176      return type_id::get(); \
01177    endfunction 
01178 `else
01179 `ifndef SVPP
01180 `define ovm_component_registry_param(T) \
01181    typedef ovm_component_registry #(T) type_id; \
01182    static function type_id get_type(); \
01183      return type_id::get(); \
01184    endfunction 
01185 `endif //SVPP
01186 `endif //USE_PARAMETERIZED_WRAPPER
01187 
01188 
01189 // OVM_FIELD_DATA
01190 // --------------
01191 
01192 `define OVM_FIELD_DATA(ARG,FLAG) \
01193   begin \
01194     int r__; \
01195     if((what__ == OVM_PRINT) && (((FLAG)&OVM_NOPRINT) == 0) && (((FLAG)&OVM_RADIX) == OVM_ENUM) && \
01196         (ovm_auto_options_object.printer.knobs.print_fields == 1)) begin \
01197       $swrite(m_sc.stringv, "%0d", ARG); \
01198       ovm_auto_options_object.printer.print_generic(`"ARG`", "enum", \
01199           $bits(ARG), m_sc.stringv); \
01200     end \
01201     else if((what__ == OVM_RECORD) && (((FLAG)&OVM_NORECORD) == 0) && (((FLAG)&OVM_RADIX) == OVM_ENUM)) \
01202     begin \
01203       $swrite(m_sc.stringv, "%0d", ARG); \
01204       ovm_auto_options_object.recorder.record_string(`"ARG`",m_sc.stringv); \
01205     end \
01206     else if(tmp_data__!=null) begin \
01207       if($cast(local_data__, tmp_data__)) begin \
01208         r__ = m_do_data(`"ARG`", ARG, local_data__.ARG, what__, $bits(ARG), FLAG); \
01209       end \
01210     end \
01211     else begin \
01212       if(what__ != OVM_COMPARE && what__ != OVM_COPY) begin \
01213         r__ = m_do_data(`"ARG`", ARG, 0, what__, $bits(ARG), FLAG); \
01214       end \
01215     end \
01216     if((what__ == OVM_COMPARE) && r__) begin \
01217       if(((FLAG)&OVM_RADIX) == OVM_ENUM) begin \
01218         if(local_data__!=null) begin \
01219           `ovm_print_msg_enum(ARG, local_data__.ARG) \
01220         end \
01221         else begin \
01222           `ovm_print_msg_enum(ARG, 0) \
01223         end \
01224       end \
01225     end \
01226   end 
01227 
01228 `define OVM_FIELD_ENUM(T, ARG,FLAG) \
01229   begin \
01230     T lh__=ARG, rh__; \
01231     if((what__ == OVM_PRINT) && (((FLAG)&OVM_NOPRINT) == 0) && \
01232         (ovm_auto_options_object.printer.knobs.print_fields == 1)) begin \
01233       ovm_auto_options_object.printer.print_generic(`"ARG`", `"T`", \
01234           $bits(ARG), lh__.name()); \
01235     end \
01236     else if((what__ == OVM_RECORD) && (((FLAG)&OVM_NORECORD) == 0)) \
01237     begin \
01238       ovm_auto_options_object.recorder.record_string(`"ARG`",lh__.name()); \
01239     end \
01240     else if(tmp_data__!=null) begin \
01241       if($cast(local_data__, tmp_data__)) begin \
01242         case(what__) \
01243           OVM_COPY: \
01244             if(((FLAG)&OVM_NOCOPY) == 0) \
01245                ARG = local_data__.ARG; \
01246           OVM_COMPARE: \
01247             if((((FLAG)&OVM_NOCOMPARE) == 0) && (ARG != local_data__.ARG)) begin \
01248                rh__ = local_data__.ARG; \
01249                ovm_auto_options_object.comparer.print_msg({"lhs = ", lh__.name(), " : rhs = ", rh__.name()}); \
01250             end \
01251         endcase \
01252       end \
01253     end \
01254     else begin \
01255       case(what__) \
01256         OVM_PACK: \
01257           if(((FLAG)&OVM_NOPACK) == 0) \
01258             if((((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.abstract) || \
01259                 (!((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.physical)) begin \
01260               ovm_auto_options_object.packer.pack_field_int(int'(ARG), $bits(ARG)); \
01261             end \
01262         OVM_UNPACK: \
01263           begin \
01264           if((((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.abstract) || \
01265               (!((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.physical)) \
01266             if(((FLAG)&OVM_NOPACK) == 0) begin \
01267               ARG = T'(ovm_auto_options_object.packer.unpack_field_int($bits(ARG))); \
01268             end \
01269           end \
01270         OVM_SETINT: \
01271           begin \
01272             if(ovm_is_match(str__ ,m_sc.scope.get_arg()) && (((FLAG)&OVM_READONLY) == 0)) begin \
01273                print_field_match("set_int()", str__); \
01274                ARG = T'(ovm_object::m_sc.bitstream); \
01275                ovm_object::m_sc.status = 1; \
01276             end \
01277           end \
01278       endcase \
01279     end \
01280   end 
01281 
01282 // OVM_FIELD_DATA_EVENT
01283 // --------------------
01284 
01285 `define OVM_FIELD_DATA_EVENT(ARG,FLAG) \
01286   begin \
01287     if(what__ == OVM_PRINT && ( (FLAG)&OVM_NOPRINT != 0) && \
01288                           ovm_auto_options_object.printer.knobs.print_fields == 1) \
01289        ovm_auto_options_object.printer.print_generic(`"ARG`", "event", -1, "-"); \
01290     else if((what__ == OVM_COMPARE) && ( (FLAG)&OVM_NOCOMPARE != 0) && \
01291             local_data__ && ARG != local_data__.ARG) \
01292     begin \
01293       ovm_auto_options_object.comparer.print_msg(""); \
01294     end \
01295     else if((what__ == OVM_COPY) && local_data__ && ( (FLAG)&OVM_NOCOPY != 0 ) ) \
01296     begin \
01297       ARG = local_data__.ARG; \
01298     end \
01299   end
01300 
01301 
01302 // OVM_FIELD_DATA_OBJECT
01303 // ---------------------
01304 
01305 `define OVM_FIELD_DATA_OBJECT(ARG,FLAG) \
01306   begin \
01307     int r__; \
01308     ovm_object lhs__, rhs__; \
01309     r__ = 0; \
01310     if(ARG == null) \
01311       lhs__ = null; \
01312     else if(!$cast(lhs__,ARG)) begin \
01313       ovm_object::m_sc.scratch1 = \
01314         `"Cast failed for ARG to ovm_object type (ovm_field_object not implemented)`";  \
01315       _global_reporter.ovm_report_warning("CSTFLD",ovm_object::m_sc.scratch1); \
01316     end \
01317     if(tmp_data__ != null) begin \
01318       if($cast(local_data__, tmp_data__)) begin \
01319         r__ = m_do_data_object(`"ARG`", lhs__, local_data__.ARG, what__, FLAG); \
01320       end \
01321       else if(tmp_data__!=null) begin \
01322         ovm_object::m_sc.scratch1 = `"Type check failed for ARG for copy/compare`"; \
01323         _global_reporter.ovm_report_error("TCKFLD", ovm_object::m_sc.scratch1); \
01324       end \
01325     end \
01326     else begin \
01327       r__ = m_do_data_object(`"ARG`", lhs__, null, what__, FLAG); \
01328       if (what__ == OVM_UNPACK) begin \
01329         if (lhs__ == null) ARG = null; \
01330         else if (!$cast(ARG,lhs__)) ARG = null; \
01331       end \
01332     end \
01333     /* if return is 1 then upack of the object failed, don't want to continue. */ \
01334     if(r__ == 1 && what__ == OVM_UNPACK) \
01335        return; \
01336     if((what__ == OVM_COPY) && (r__ == OVM_SHALLOW)) begin \
01337       ovm_object v__; \
01338       v__ = ovm_global_copy_map.get(local_data__.ARG); \
01339       if(v__ != null) begin \
01340         $cast(ARG, v__); \
01341       end \
01342       else begin \
01343         /* Can't do shallow copy right now due to */ \
01344          /* an issue with abstract classes */ \
01345         /* like ovm_object, so do a deep copy instead. */ \
01346         if(local_data__.ARG==null) ARG = null; \
01347         else if(ARG!=null) ARG.copy(local_data__.ARG); \
01348         else begin \
01349           ovm_object cobj; \
01350           cobj = local_data__.ARG.clone(); \
01351           if(cobj == null) ARG = null; \
01352           else begin \
01353             $cast(ARG, local_data__.ARG.clone()); \
01354             ARG.set_name(`"ARG`"); \
01355           end \
01356         end \
01357       end \
01358     end \
01359     else if((what__ == OVM_COPY) && (r__ == OVM_REFERENCE)) begin \
01360       if((lhs__ == null)&&(local_data__.ARG != null)) begin \
01361         if(!$cast(ARG,local_data__.ARG)) begin \
01362           ovm_object::m_sc.scratch1 = `"Copy cast failed for ARG`"; \
01363           _global_reporter.ovm_report_error("CSTFLD",ovm_object::m_sc.scratch1); \
01364         end \
01365       end \
01366       else if(lhs__==null) \
01367         ARG = null; \
01368       else \
01369         $cast(ARG, lhs__); \
01370     end \
01371   end
01372 
01373 
01374 // OVM_FIELD_DATA_STRING
01375 // ---------------------
01376 
01377 `define OVM_FIELD_DATA_STRING(ARG,FLAG) \
01378   begin \
01379     int r__; \
01380     if(local_data__ != null) begin \
01381       if($cast(local_data__, tmp_data__)) begin \
01382         r__ = m_do_data_string(`"ARG`", ARG, local_data__.ARG, what__, FLAG); \
01383       end \
01384     end \
01385     else \
01386       r__ = m_do_data_string(`"ARG`", ARG, "", what__, FLAG); \
01387   end 
01388 
01389 
01390 // RESIZE_QUEUE_NOCOPY
01391 // -------------------
01392 
01393 `define RESIZE_QUEUE_NOCOPY(T, ARG, SIZE) \
01394    begin \
01395      T tmp__; \
01396      while(ARG.size()) void'(ARG.pop_front()); \
01397      while(ARG.size() != SIZE) ARG.push_back(tmp__); \
01398    end 
01399 
01400 
01401 // RESIZE_QUEUE_COPY
01402 // -----------------
01403 
01404 `define RESIZE_QUEUE_COPY(T, ARG, SIZE) \
01405    begin \
01406      T tmp__; \
01407      while(ARG.size()>SIZE) void'(ARG.pop_back()); \
01408      while(ARG.size() != SIZE) ARG.push_back(tmp__); \
01409    end
01410 
01411 
01412 // RESIZE_QUEUE_OBJECT_NOCOPY
01413 // --------------------------
01414 
01415 `define RESIZE_QUEUE_OBJECT_NOCOPY(ARG, SIZE) \
01416    begin \
01417      while(ARG.size()) void'(ARG.pop_front()); \
01418      while(ARG.size() != SIZE) ARG.push_back(null); \
01419    end
01420 
01421 
01422 // RESIZE_QUEUE_OBJECT_COPY
01423 // ------------------------
01424 
01425 `define RESIZE_QUEUE_OBJECT_COPY(ARG, SIZE) \
01426    begin \
01427      while(ARG.size()>SIZE) void'(ARG.pop_front()); \
01428      while(ARG.size() != SIZE) ARG.push_back(null); \
01429    end
01430 
01431 // ovm_record_array_int
01432 // --------------------
01433 
01434 `define ovm_record_array_int(ARG, RADIX, RECORDER) \
01435   begin \
01436     if(RECORDER.tr_handle != 0) begin\
01437       if(RADIX == OVM_ENUM) begin \
01438         if(!m_sc.array_warning_done) begin \
01439            m_sc.array_warning_done = 1; \
01440            ovm_object::m_sc.scratch1 = \
01441              `"Recording not supported for array enumerations: ARG`"; \
01442            _global_reporter.ovm_report_warning("RCDNTS", ovm_object::m_sc.scratch1); \
01443         end \
01444       end \
01445       else begin \
01446         for(int i__=0; i__<ARG.size(); ++i__) \
01447           RECORDER.record_field($psprintf(`"ARG[%0d]`",i__), ARG[i__], $bits(ARG[i__]), ovm_radix_enum'(RADIX)); \
01448       end \
01449     end \
01450   end
01451 
01452 
01453 // ovm_record_qda_enum
01454 // ---------------------
01455 
01456 `define ovm_record_qda_enum(T, ARG, RECORDER) \
01457   begin \
01458     if(RECORDER.tr_handle != 0) begin\
01459       foreach(ARG[i__]) begin \
01460         T lh__=ARG[i__]; \
01461         RECORDER.record_string($psprintf(`"ARG[%0d]`",i__), lh__.name()); \
01462       end \
01463     end \
01464   end
01465 
01466 
01467 // OVM_FIELD_DATA_ARRAY
01468 // --------------------
01469 
01470 `define OVM_FIELD_DATA_ARRAY(ARG,FLAG) \
01471    begin \
01472      case (what__) \
01473        OVM_COMPARE: \
01474          if ( !((FLAG)&OVM_NOCOMPARE) && (tmp_data__ != null) ) begin \
01475            int i__; \
01476            $cast(local_data__, tmp_data__); \
01477            if(ARG.size() != local_data__.ARG.size()) begin \
01478              int s1__, s2__; \
01479              m_sc.stringv = ""; \
01480              s1__ = ARG.size(); s2__ = local_data__.ARG.size(); \
01481              $swrite(m_sc.stringv, "lhs size = %0d : rhs size = %0d", s1__, s2__);\
01482              ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \
01483            end \
01484            for(i__=0; i__<ARG.size() && i__<local_data__.ARG.size(); ++i__) begin \
01485              if(ARG[i__] !== local_data__.``ARG[i__]) begin \
01486                ovm_auto_options_object.comparer.scope.down_element(i__, null);\
01487                case(OVM_RADIX&(FLAG)) \
01488                  OVM_BIN: $swrite(m_sc.stringv, "lhs = 'b%0b : rhs = 'b%0b", \
01489                                 ARG[i__], local_data__.ARG[i__]); \
01490                  OVM_OCT: $swrite(m_sc.stringv, "lhs = 'o%0o : rhs = 'o%0o", \
01491                                 ARG[i__], local_data__.ARG[i__]); \
01492                  OVM_DEC: $swrite(m_sc.stringv, "lhs = %0d : rhs = %0d", \
01493                                 ARG[i__], local_data__.ARG[i__]); \
01494                  OVM_UNSIGNED: $swrite(m_sc.stringv, "lhs = %0d : rhs = %0d", \
01495                                 ARG[i__], local_data__.ARG[i__]); \
01496                  OVM_HEX: $swrite(m_sc.stringv, "lhs = 'h%0x : rhs = 'h%0x", \
01497                                 ARG[i__], local_data__.ARG[i__]); \
01498                  OVM_STRING: $swrite(m_sc.stringv, "lhs = %0s : rhs = %0s", \
01499                                 ARG[i__], local_data__.ARG[i__]); \
01500                  OVM_TIME: $swrite(m_sc.stringv, "lhs = %0t : rhs = %0t", \
01501                                 ARG[i__], local_data__.ARG[i__]); \
01502                  default: $swrite(m_sc.stringv, "lhs = %0d : rhs = %0d", \
01503                                 ARG[i__], local_data__.ARG[i__]); \
01504                endcase \
01505                ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \
01506                ovm_auto_options_object.comparer.scope.up_element(null);\
01507              end \
01508            end \
01509          end \
01510        OVM_COPY: \
01511          if(!((FLAG)&OVM_NOCOPY) && (tmp_data__ != null)) \
01512           begin \
01513            int i__; \
01514            $cast(local_data__, tmp_data__); \
01515            /*Resizing of array is done in ovm_field*/ \
01516            for(i__=0; i__ < ARG``.size(); ++i__) begin \
01517              ARG[i__] = local_data__.``ARG[i__] ; \
01518            end \
01519          end \
01520        OVM_PRINT: \
01521          begin \
01522            if(((FLAG)&OVM_NOPRINT) == 0 && \
01523                           ovm_auto_options_object.printer.knobs.print_fields == 1) begin \
01524              `ovm_print_array_int3(ARG, ovm_radix_enum'((FLAG)&(OVM_RADIX)), \
01525                                    ovm_auto_options_object.printer) \
01526            end \
01527          end \
01528        OVM_RECORD: \
01529          begin \
01530            if(((FLAG)&OVM_NORECORD) == 0) begin \
01531              `ovm_record_array_int(ARG, ovm_radix_enum'((FLAG)&(OVM_RADIX)), \
01532                                    ovm_auto_options_object.recorder) \
01533            end \
01534          end \
01535      endcase \
01536    end
01537 
01538 `define OVM_FIELD_ARRAY_INT_PACK(ARG,FLAG) \
01539    case(what__) \
01540       OVM_PACK: \
01541         if(((FLAG)&OVM_NOPACK) == 0) \
01542         begin \
01543           if((((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.abstract) || \
01544               (!((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.physical)) begin \
01545             if(ovm_auto_options_object.packer.use_metadata == 1) \
01546               ovm_auto_options_object.packer.pack_field_int(ARG.size(), 32); \
01547             foreach(ARG[i]) \
01548               ovm_auto_options_object.packer.pack_field(ARG[i], $bits(ARG[i])); \
01549           end \
01550         end \
01551       OVM_UNPACK: \
01552         if(((FLAG)&OVM_NOPACK) == 0) \
01553         begin \
01554           if((((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.abstract) || \
01555               (!((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.physical)) begin \
01556             if(ovm_auto_options_object.packer.use_metadata) begin \
01557               int s_; \
01558               s_ = ovm_auto_options_object.packer.unpack_field_int(32); \
01559               ARG = new[s_]; \
01560             end \
01561             foreach(ARG[i]) \
01562               ARG[i] = ovm_auto_options_object.packer.unpack_field($bits(ARG[i])); \
01563           end \
01564         end \
01565   endcase
01566 
01567 `define OVM_FIELD_QUEUE_INT_PACK(ARG,FLAG) \
01568    case(what__) \
01569       OVM_PACK: \
01570         if(((FLAG)&OVM_NOPACK) == 0) \
01571         begin \
01572           if((((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.abstract) || \
01573               (!((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.physical)) begin \
01574             if(ovm_auto_options_object.packer.use_metadata == 1) \
01575               ovm_auto_options_object.packer.pack_field_int(ARG.size(), 32); \
01576             foreach(ARG[i]) \
01577               ovm_auto_options_object.packer.pack_field(ARG[i], $bits(ARG[i])); \
01578           end \
01579         end \
01580       OVM_UNPACK: \
01581         if(((FLAG)&OVM_NOPACK) == 0) \
01582         begin \
01583           if((((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.abstract) || \
01584               (!((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.physical)) begin \
01585             if(ovm_auto_options_object.packer.use_metadata) begin \
01586               int s_; \
01587               s_ = ovm_auto_options_object.packer.unpack_field_int(32); \
01588               while(ARG.size() < s_) ARG.push_back(0); \
01589               while(ARG.size() > s_) void'(ARG.pop_front()); \
01590             end \
01591             foreach(ARG[i]) \
01592               ARG[i] = ovm_auto_options_object.packer.unpack_field($bits(ARG[i])); \
01593           end \
01594         end \
01595   endcase
01596 
01597 `define OVM_FIELD_DATA_SARRAY(ARG,FLAG) \
01598   begin \
01599     if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \
01600       if(what__ == OVM_PRINT) \
01601         `ovm_print_sarray_int3(ARG, ovm_radix_enum'((FLAG)&(OVM_RADIX)), \
01602                                    ovm_auto_options_object.printer) \
01603       else if(tmp_data__!=null) begin \
01604         foreach(ARG[i__]) \
01605           if($cast(local_data__, tmp_data__)) begin \
01606             void'(m_do_data($psprintf(`"ARG[%0d]`",i__), ARG[i__], local_data__.ARG[i__], what__, $bits(ARG[i__]), FLAG)); \
01607           end \
01608       end \
01609       else begin \
01610         foreach(ARG[i__]) \
01611           if($cast(local_data__, tmp_data__)) begin \
01612             void'(m_do_data($psprintf(`"ARG[%0d]`",i__), ARG[i__], 0, what__, $bits(ARG[i__]), FLAG)); \
01613           end \
01614       end \
01615     end \
01616   end
01617 
01618 
01619 // OVM_FIELD_DATA_ARRAY_OBJECT
01620 // ---------------------------
01621 
01622 // ovm_record_array_object
01623 // --------------------
01624 
01625 `define ovm_record_array_object(ARG, RECORDER) \
01626   begin \
01627     if(RECORDER.tr_handle != 0) begin\
01628       ovm_object obj__; \
01629       for(int i__=0; i__<ARG.size(); ++i__) begin \
01630         if($cast(obj__, ARG[i__]))\
01631           if(obj__ != null) begin \
01632             m_sc.scope.down_element(i__, null);\
01633             obj__.m_field_automation(null, what__, str__); \
01634             m_sc.scope.up_element(null);\
01635           end \
01636       end \
01637     end \
01638   end
01639 
01640 `define OVM_FIELD_DATA_ARRAY_OBJECT(ARG,FLAG) \
01641    begin \
01642    if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \
01643      ovm_object this_d__, from_d__; \
01644      case (what__) \
01645        OVM_COMPARE: \
01646          if ( !((FLAG)&OVM_NOCOMPARE) && (tmp_data__ != null)) begin \
01647            int i__; \
01648            ovm_recursion_policy_enum orig_policy; \
01649            orig_policy = ovm_auto_options_object.comparer.policy; \
01650            if(((FLAG)&OVM_REFERENCE) != 0) begin \
01651              ovm_auto_options_object.comparer.policy = OVM_REFERENCE; \
01652            end \
01653            $cast(local_data__, tmp_data__); \
01654            if(ARG.size() != local_data__.``ARG.size()) begin \
01655              int s1__, s2__; \
01656              m_sc.stringv = ""; \
01657              s1__ = ARG.size(); s2__ = local_data__.ARG.size(); \
01658              $swrite(m_sc.stringv, "lhs size = %0d : rhs size = %0d", s1__, s2__);\
01659              ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \
01660            end \
01661            for(i__=0; i__<ARG.size() && i__<local_data__.ARG.size(); ++i__) \
01662              void'(ovm_auto_options_object.comparer.compare_object($psprintf(`"ARG[%0d]`",i__), ARG[i__], local_data__.ARG[i__])); \
01663            ovm_auto_options_object.comparer.policy = orig_policy; \
01664          end \
01665        OVM_COPY: \
01666          if(!((FLAG)&OVM_NOCOPY) && (tmp_data__ != null) ) \
01667           begin \
01668            int i__; \
01669            $cast(local_data__, tmp_data__); \
01670            /*Resizing of array is done in ovm_field_array* macro*/ \
01671            for(i__=0; i__ < ARG``.size(); ++i__) begin \
01672              `DOSHALLOWCOPY(ARG[i__], local_data__.ARG[i__], FLAG) \
01673              `DODEEPCOPY(ARG[i__], FLAG) \
01674            end \
01675          end \
01676        OVM_PRINT: \
01677            if((((FLAG)&OVM_NOPRINT) == 0) && \
01678               ovm_auto_options_object.printer.knobs.print_fields == 1) \
01679            begin \
01680              `ovm_print_array_object3(ARG, ovm_auto_options_object.printer,FLAG) \
01681            end \
01682        OVM_RECORD: \
01683          begin \
01684            if((((FLAG)&OVM_NORECORD) == 0) && (((FLAG)&OVM_SHALLOW) == 0)) begin \
01685              `ovm_record_array_object(ARG,ovm_auto_options_object.recorder) \
01686            end \
01687          end \
01688      endcase \
01689    end \
01690    end
01691 
01692 `define OVM_FIELD_ARRAY_OBJ_PACK(ARG,FLAG) \
01693    case(what__) \
01694       OVM_PACK: \
01695         if(((FLAG)&OVM_NOPACK) == 0) \
01696         begin \
01697           if((((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.abstract) || \
01698               (!((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.physical)) begin \
01699             if(ovm_auto_options_object.packer.use_metadata == 1) \
01700               ovm_auto_options_object.packer.pack_field_int(ARG.size(), 32); \
01701             foreach(ARG[i]) begin \
01702               ovm_auto_options_object.packer.pack_object(ARG[i]); \
01703             end \
01704           end \
01705         end \
01706       OVM_UNPACK: \
01707         if(((FLAG)&OVM_NOPACK) == 0) \
01708         begin \
01709           if((((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.abstract) || \
01710               (!((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.physical)) begin \
01711             if(ovm_auto_options_object.packer.use_metadata) begin \
01712               int s_; \
01713               s_ = ovm_auto_options_object.packer.unpack_field_int(32); \
01714               if(ARG.size() < s_) \
01715                 _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())); \
01716             end \
01717             foreach(ARG[i]) begin \
01718               ovm_auto_options_object.packer.unpack_object(ARG[i]); \
01719               if(ovm_auto_options_object.packer.use_metadata == 0 && ARG[i] == null) \
01720                 return; \
01721             end \
01722           end \
01723         end \
01724   endcase
01725 
01726 `define OVM_FIELD_QUEUE_OBJ_PACK(ARG,FLAG) \
01727    case(what__) \
01728       OVM_PACK: \
01729         if(((FLAG)&OVM_NOPACK) == 0) \
01730         begin \
01731           if((((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.abstract) || \
01732               (!((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.physical)) begin \
01733             if(ovm_auto_options_object.packer.use_metadata == 1) \
01734               ovm_auto_options_object.packer.pack_field_int(ARG.size(), 32); \
01735             foreach(ARG[i]) begin \
01736               ovm_auto_options_object.packer.pack_object(ARG[i]); \
01737             end \
01738           end \
01739         end \
01740       OVM_UNPACK: \
01741         if(((FLAG)&OVM_NOPACK) == 0) \
01742         begin \
01743           if((((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.abstract) || \
01744               (!((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.physical)) begin \
01745             if(ovm_auto_options_object.packer.use_metadata) begin \
01746               int s_; \
01747               s_ = ovm_auto_options_object.packer.unpack_field_int(32); \
01748               if(ARG.size() < s_) \
01749                 _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())); \
01750             end \
01751             foreach(ARG[i]) begin \
01752               ovm_auto_options_object.packer.unpack_object(ARG[i]); \
01753               if(ovm_auto_options_object.packer.use_metadata == 0 && ARG[i] == null) \
01754                 return; \
01755             end \
01756 //          while(ARG.size() < s_) ARG.push_back(null); \
01757 //          while(ARG.size() > s_) void'(ARG.pop_front()); \
01758 //          foreach(ARG[i]) begin \
01759 //            if(!ovm_auto_options_object.packer.is_null()) ARG[i] = new; \
01760 //            ovm_auto_options_object.packer.unpack_object(ARG[i]); \
01761 //          end \
01762           end \
01763         end \
01764   endcase
01765 
01766 `define OVM_FIELD_DATA_SARRAY_OBJECT(ARG,FLAG) \
01767   begin \
01768     if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \
01769       ovm_object lhs__; \
01770       if(what__ == OVM_PRINT) \
01771         `ovm_print_sarray_object3(ARG, ovm_auto_options_object.printer, FLAG) \
01772       else if((what__ == OVM_COPY) && ((FLAG)&OVM_NOCOPY)==0) begin \
01773         $cast(local_data__, tmp_data__); \
01774         foreach(ARG[i__]) begin \
01775           if(local_data__.ARG[i__] == null || (((FLAG)&OVM_REFERENCE) != 0)) \
01776             ARG[i__] = local_data__.ARG[i__]; \
01777           else if(((FLAG)&OVM_SHALLOW) != 0) \
01778             ARG[i__] = new local_data__.ARG[i__]; \
01779           else if(ARG[i__] == null) \
01780             ARG[i__].copy(local_data__.ARG[i__]); \
01781           else \
01782             $cast(ARG[i__],local_data__.ARG[i__].clone()); \
01783         end \
01784       end \
01785       else if((what__ != OVM_COPY) && (tmp_data__!=null)) begin \
01786         $cast(local_data__, tmp_data__); \
01787         foreach(ARG[i__]) begin \
01788           lhs__ = ARG[i__]; \
01789           if($cast(local_data__, tmp_data__)) \
01790             void'(m_do_data_object($psprintf(`"ARG[%0d]`",i__), lhs__, local_data__.ARG[i__], what__, FLAG)); \
01791           else \
01792             void'(m_do_data_object($psprintf(`"ARG[%0d]`",i__), lhs__, null, what__, FLAG)); \
01793         end \
01794       end \
01795       else if (what__ != OVM_COPY) begin \
01796         foreach(ARG[i__]) begin \
01797           lhs__ = ARG[i__]; \
01798           void'(m_do_data_object($psprintf(`"ARG[%0d]`",i__), lhs__, null, what__, FLAG)); \
01799         end \
01800       end \
01801     end \
01802   end
01803 
01804 
01805 // OVM_FIELD_DATA_ARRAY_STRING
01806 // ---------------------------
01807 
01808 // ovm_record_array_string
01809 // ------------------------
01810 
01811 `define ovm_record_array_string(ARG, RECORDER) \
01812   begin \
01813     if(RECORDER.tr_handle != 0) begin\
01814       for(int i__=0; i__<ARG.size(); ++i__) \
01815         RECORDER.record_string($psprintf(`"ARG[%0d]`", i__), ARG[i__]); \
01816     end \
01817   end
01818 
01819 `define OVM_FIELD_DATA_ARRAY_STRING(ARG,FLAG) \
01820    begin \
01821    if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \
01822      case (what__) \
01823        OVM_COMPARE: \
01824          if ( !((FLAG)&OVM_NOCOMPARE) && (tmp_data__ != null) ) begin \
01825            int i__; \
01826            $cast(local_data__, tmp_data__); \
01827            if(ARG.size() != local_data__.``ARG.size()) begin \
01828              int s1__, s2__; \
01829              m_sc.stringv = ""; \
01830              s1__ = ARG.size(); s2__ = local_data__.ARG.size(); \
01831              $swrite(m_sc.stringv, "lhs size = %0d : rhs size = %0d", s1__, s2__);\
01832              ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \
01833            end \
01834            for(i__=0; i__<ARG.size() && i__<local_data__.ARG.size(); ++i__) \
01835              if(ARG[i__] != local_data__.ARG[i__]) begin \
01836                string ls__, rs__; \
01837                ls__ = ARG[i__]; rs__ = local_data__.ARG[i__]; \
01838                ovm_auto_options_object.comparer.scope.down_element(i__, null);\
01839                $swrite(m_sc.stringv, "lhs = %0s : rhs = %0s", ls__, rs__); \
01840                ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \
01841                ovm_auto_options_object.comparer.scope.up_element(null);\
01842              end \
01843          end \
01844        OVM_COPY: \
01845          if(!((FLAG)&OVM_NOCOPY) && (tmp_data__ != null) ) \
01846           begin \
01847            int i__; \
01848            $cast(local_data__, tmp_data__); \
01849            /*Resizing of array is done in ovm_field_array* macro*/ \
01850            for(i__=0; i__ < ARG.size(); ++i__) \
01851              ARG[i__] = local_data__.ARG[i__] ; \
01852          end \
01853        OVM_PRINT: \
01854          begin \
01855            if((FLAG)&OVM_NOPRINT != 0 && \
01856                           ovm_auto_options_object.printer.knobs.print_fields == 1) \
01857              `ovm_print_array_string2(ARG, ovm_auto_options_object.printer) \
01858          end \
01859        OVM_RECORD: \
01860          begin \
01861            if(((FLAG)&OVM_NORECORD) == 0 && !m_sc.array_warning_done) begin \
01862              `ovm_record_array_string(ARG, ovm_auto_options_object.recorder) \
01863            end \
01864          end \
01865      endcase \
01866    end \
01867    end 
01868 
01869 `define OVM_FIELD_DATA_SARRAY_STRING(ARG,FLAG) \
01870   begin \
01871     if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \
01872       if(what__ == OVM_PRINT) \
01873         `ovm_print_sarray_string2(ARG, ovm_auto_options_object.printer) \
01874       else if(tmp_data__!=null) begin \
01875         foreach(ARG[i__]) \
01876           if($cast(local_data__, tmp_data__)) begin \
01877             void'(m_do_data_string($psprintf(`"ARG[%0d]`",i__), ARG[i__], local_data__.ARG[i__], what__, FLAG)); \
01878           end \
01879       end \
01880       else begin \
01881         foreach(ARG[i__]) \
01882           if($cast(local_data__, tmp_data__)) begin \
01883             void'(m_do_data_string($psprintf(`"ARG[%0d]`",i__), ARG[i__], "", what__, FLAG)); \
01884           end \
01885       end \
01886     end \
01887   end
01888 
01889 `define OVM_FIELD_ARRAY_STR_PACK(ARG,FLAG) \
01890    case(what__) \
01891       OVM_PACK: \
01892         if(((FLAG)&OVM_NOPACK) == 0) \
01893         begin \
01894           if((((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.abstract) || \
01895               (!((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.physical)) begin \
01896             if(ovm_auto_options_object.packer.use_metadata == 1) \
01897               ovm_auto_options_object.packer.pack_field_int(ARG.size(), 32); \
01898             foreach(ARG[i]) \
01899               ovm_auto_options_object.packer.pack_string(ARG[i]); \
01900           end \
01901         end \
01902       OVM_UNPACK: \
01903         if(((FLAG)&OVM_NOPACK) == 0) \
01904         begin \
01905           if((((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.abstract) || \
01906               (!((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.physical)) begin \
01907             if(ovm_auto_options_object.packer.use_metadata) begin \
01908               int s_; \
01909               s_ = ovm_auto_options_object.packer.unpack_field_int(32); \
01910               ARG = new[s_]; \
01911             end \
01912             foreach(ARG[i]) begin \
01913               ARG[i] = ovm_auto_options_object.packer.unpack_string(-1); \
01914             end \
01915           end \
01916         end \
01917   endcase
01918 
01919 `define OVM_FIELD_QUEUE_STR_PACK(ARG,FLAG) \
01920    case(what__) \
01921       OVM_PACK: \
01922         if(((FLAG)&OVM_NOPACK) == 0) \
01923         begin \
01924           if((((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.abstract) || \
01925               (!((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.physical)) begin \
01926             if(ovm_auto_options_object.packer.use_metadata == 1) \
01927               ovm_auto_options_object.packer.pack_field_int(ARG.size(), 32); \
01928             foreach(ARG[i]) \
01929               ovm_auto_options_object.packer.pack_string(ARG[i]); \
01930           end \
01931         end \
01932       OVM_UNPACK: \
01933         if(((FLAG)&OVM_NOPACK) == 0) \
01934         begin \
01935           if((((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.abstract) || \
01936               (!((FLAG)&OVM_ABSTRACT) && ovm_auto_options_object.packer.physical)) begin \
01937             if(ovm_auto_options_object.packer.use_metadata) begin \
01938               int s_; \
01939               s_ = ovm_auto_options_object.packer.unpack_field_int(32); \
01940               while(ARG.size() < s_) ARG.push_back(""); \
01941               while(ARG.size() > s_) void'(ARG.pop_front()); \
01942             end \
01943             foreach(ARG[i]) begin \
01944               ARG[i] = ovm_auto_options_object.packer.unpack_string(-1); \
01945             end \
01946           end \
01947         end \
01948   endcase
01949 
01950 // OVM_COMPARE_FIELD
01951 // -----------------
01952 
01953 `define OVM_COMPARE_FAILED(ARG) \
01954 begin \
01955   ovm_object::m_sc.scratch1 = `"Compare failed ARG`"; \
01956    ovm_auto_options_object.comparer.result++; \
01957    if(ovm_auto_options_object.comparer.result <=  \
01958       ovm_auto_options_object.comparer.show_max) \
01959    begin \
01960      ovm_object::m_sc.scratch1 = `"Miscompare for field ARG`"; \
01961      _global_reporter.ovm_report_info("MISCMP", ovm_object::m_sc.scratch1, OVM_MEDIUM) \
01962    end \
01963 end
01964 
01965 
01966 // OVM_FIELD_DATA_AA_generic
01967 // -------------------------
01968 
01969 `define OVM_FIELD_DATA_AA_generic(TYPE, KEY, ARG, FLAG) \
01970   begin \
01971     if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \
01972       case (what__) \
01973         OVM_COMPARE: \
01974            begin \
01975             if(!((FLAG)&OVM_NOCOMPARE) && (tmp_data__ != null) ) \
01976             begin \
01977               $cast(local_data__, tmp_data__); \
01978               if(ARG.num() != local_data__.ARG.num()) begin \
01979                  int s1__, s2__; \
01980                  m_sc.stringv = ""; \
01981                  s1__ = ARG.num(); s2__ = local_data__.ARG.num(); \
01982                  $swrite(m_sc.stringv, "lhs size = %0d : rhs size = %0d", \
01983                     s1__, s2__);\
01984                  ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \
01985               end \
01986               string_aa_key = ""; \
01987               while(ARG.next(string_aa_key)) begin \
01988                 ovm_auto_options_object.comparer.scope.set_arg({"[",string_aa_key,"]"}); \
01989                 void'(m_do_data({`"ARG[`", string_aa_key, "]"}, \
01990                     ARG[string_aa_key], \
01991                     local_data__.ARG[string_aa_key], what__, \
01992                     $bits(ARG[string_aa_key]), FLAG)); \
01993                 ovm_auto_options_object.comparer.scope.unset_arg(string_aa_key); \
01994               end \
01995             end \
01996            end \
01997         OVM_COPY: \
01998           begin \
01999             if(!((FLAG)&OVM_NOCOPY) && (tmp_data__ != null) ) \
02000             begin \
02001               $cast(local_data__, tmp_data__); \
02002               ARG.delete(); \
02003               string_aa_key = ""; \
02004               while(local_data__.ARG.next(string_aa_key)) \
02005                 ARG[string_aa_key] = local_data__.ARG[string_aa_key]; \
02006             end \
02007           end \
02008         OVM_PRINT: \
02009           `ovm_print_aa_``KEY``_``TYPE``3(ARG, ovm_radix_enum'((FLAG)&(OVM_RADIX)), \
02010              ovm_auto_options_object.printer) \
02011       endcase \
02012     end \
02013   end
02014 
02015 
02016 // OVM_FIELD_DATA_AA_int_string
02017 // ----------------------------
02018 
02019 `define OVM_FIELD_DATA_AA_int_string(ARG, FLAG) \
02020   `OVM_FIELD_DATA_AA_generic(int, string, ARG, FLAG)
02021 
02022 // OVM_FIELD_DATA_AA_int_int
02023 // ----------------------------
02024 
02025 `define OVM_FIELD_DATA_AA_int_key(KEY, ARG, FLAG) \
02026   begin \
02027     if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \
02028       KEY aa_key; \
02029       case (what__) \
02030         OVM_COMPARE: \
02031            begin \
02032             if(!((FLAG)&OVM_NOCOMPARE) && (tmp_data__ != null) ) \
02033             begin \
02034               $cast(local_data__, tmp_data__); \
02035               if(ARG.num() != local_data__.ARG.num()) begin \
02036                  int s1__, s2__; \
02037                  m_sc.stringv = ""; \
02038                  s1__ = ARG.num(); s2__ = local_data__.ARG.num(); \
02039                  $swrite(m_sc.stringv, "lhs size = %0d : rhs size = %0d", \
02040                     s1__, s2__);\
02041                  ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \
02042               end \
02043               ovm_auto_options_object.comparer.scope.up(null); \
02044               if(ARG.first(aa_key)) \
02045                 do begin \
02046                   $swrite(string_aa_key, "%0d", aa_key); \
02047                   ovm_auto_options_object.comparer.scope.set_arg({"[",string_aa_key,"]"}); \
02048                   void'(m_do_data({`"ARG[`", string_aa_key, "]"}, \
02049                     ARG[aa_key], \
02050                     local_data__.ARG[aa_key], what__, \
02051                     $bits(ARG[aa_key]), FLAG)); \
02052                   ovm_auto_options_object.comparer.scope.unset_arg(string_aa_key); \
02053                 end while(ARG.next(aa_key)); \
02054               ovm_auto_options_object.comparer.scope.down(`"ARG`",null); \
02055             end \
02056            end \
02057         OVM_COPY: \
02058           begin \
02059             if(!((FLAG)&OVM_NOCOPY) && (tmp_data__ != null) ) \
02060             begin \
02061               $cast(local_data__, tmp_data__); \
02062               ARG.delete(); \
02063               if(local_data__.ARG.first(aa_key)) \
02064                 do begin \
02065                   ARG[aa_key] = local_data__.ARG[aa_key]; \
02066                 end while(local_data__.ARG.next(aa_key)); \
02067             end \
02068           end \
02069         OVM_PRINT: \
02070           `ovm_print_aa_int_key4(KEY,ARG, ovm_radix_enum'((FLAG)&(OVM_RADIX)), \
02071              ovm_auto_options_object.printer) \
02072       endcase \
02073     end \
02074   end
02075 
02076 
02077 
02078 // OVM_FIELD_DATA_AA_object_string
02079 // -------------------------------
02080 
02081 `define OVM_FIELD_DATA_AA_object_string(ARG, FLAG) \
02082   begin \
02083     if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \
02084       case (what__) \
02085         OVM_COMPARE: \
02086            begin \
02087             if(!((FLAG)&OVM_NOCOMPARE) && (tmp_data__ != null) ) \
02088             begin \
02089               $cast(local_data__, tmp_data__); \
02090               if(ARG.num() != local_data__.ARG.num()) begin \
02091                  int s1__, s2__; \
02092                  m_sc.stringv = ""; \
02093                  s1__ = ARG.num(); s2__ = local_data__.ARG.num(); \
02094                  $swrite(m_sc.stringv, "lhs size = %0d : rhs size = %0d", \
02095                           s1__, s2__);\
02096                  ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \
02097               end \
02098               string_aa_key = ""; \
02099               while(ARG.next(string_aa_key)) begin \
02100                 ovm_object tmp; \
02101                 /* Since m_do_data_object is inout, need a ovm_object for */ \
02102                 /* assignment compatibility. We must cast back the return. */ \
02103                 tmp = ARG[string_aa_key]; \
02104                 ovm_auto_options_object.comparer.scope.down({"[",string_aa_key,"]"},tmp); \
02105                 void'(m_do_data_object({"[", string_aa_key, "]"}, tmp, \
02106                     local_data__.ARG[string_aa_key], what__, FLAG)); \
02107                 ovm_auto_options_object.comparer.scope.up(tmp,"["); \
02108               end \
02109             end \
02110           end \
02111         OVM_COPY: \
02112           begin \
02113            if(!((FLAG)&OVM_NOCOPY) && (tmp_data__ != null) ) \
02114            begin \
02115             $cast(local_data__, tmp_data__); \
02116             ARG.delete(); \
02117             if(local_data__.ARG.first(string_aa_key)) \
02118              do \
02119                if((FLAG)&OVM_REFERENCE) \
02120                 ARG[string_aa_key] = local_data__.ARG[string_aa_key]; \
02121              /*else if((FLAG)&OVM_SHALLOW)*/ \
02122              /* ARG[string_aa_key] = new local_data__.ARG[string_aa_key];*/ \
02123                else begin\
02124                 $cast(ARG[string_aa_key],local_data__.ARG[string_aa_key].clone());\
02125                 ARG[string_aa_key].set_name({`"ARG`","[",string_aa_key, "]"});\
02126                end \
02127              while(local_data__.ARG.next(string_aa_key)); \
02128            end \
02129           end \
02130         OVM_PRINT: \
02131           `ovm_print_aa_string_object3(ARG, ovm_auto_options_object.printer,FLAG) \
02132       endcase \
02133     end \
02134   end
02135 
02136 // OVM_FIELD_DATA_AA_object_int
02137 // -------------------------------
02138 
02139 `define OVM_FIELD_DATA_AA_object_int(ARG, FLAG) \
02140   begin \
02141     int key__; \
02142     if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \
02143       case (what__) \
02144         OVM_COMPARE: \
02145            begin \
02146             if(!((FLAG)&OVM_NOCOMPARE) && (tmp_data__ != null) ) \
02147             begin \
02148               $cast(local_data__, tmp_data__); \
02149               if(ARG.num() != local_data__.ARG.num()) begin \
02150                  int s1__, s2__; \
02151                  m_sc.stringv = ""; \
02152                  s1__ = ARG.num(); s2__ = local_data__.ARG.num(); \
02153                  $swrite(m_sc.stringv, "lhs size = %0d : rhs size = %0d", \
02154                           s1__, s2__);\
02155                  ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \
02156               end \
02157               if(ARG.first(key__)) begin \
02158                 do begin \
02159                   ovm_object tmp__; \
02160                   /* Since m_do_data_object is inout, need a ovm_object for */ \
02161                   /* assignment compatibility. We must cast back the return. */ \
02162                   tmp__ = ARG[key__]; \
02163                   $swrite(m_sc.stringv, "[%0d]", key__); \
02164                   ovm_auto_options_object.comparer.scope.down_element(key__,tmp__); \
02165                   void'(m_do_data_object(m_sc.stringv, tmp__, \
02166                       local_data__.ARG[key__], what__, FLAG)); \
02167                   ovm_auto_options_object.comparer.scope.up_element(tmp__); \
02168                 end while(ARG.next(key__)); \
02169               end \
02170             end \
02171           end \
02172         OVM_COPY: \
02173           begin \
02174            if(!((FLAG)&OVM_NOCOPY) && (tmp_data__ != null) ) \
02175            begin \
02176             $cast(local_data__, tmp_data__); \
02177             ARG.delete(); \
02178             if(local_data__.ARG.first(key__)) \
02179              do begin \
02180                if((FLAG)&OVM_REFERENCE) \
02181                 ARG[key__] = local_data__.ARG[key__]; \
02182              /*else if((FLAG)&OVM_SHALLOW)*/ \
02183              /* ARG[key__] = new local_data__.ARG[key__];*/ \
02184                else begin\
02185                  ovm_object tmp_obj; \
02186                  tmp_obj = local_data__.ARG[key__].clone(); \
02187                  if(tmp_obj != null) \
02188                    $cast(ARG[key__], tmp_obj); \
02189                  else \
02190                    ARG[key__]=null; \
02191                end \
02192              end while(local_data__.ARG.next(key__)); \
02193            end \
02194          end \
02195         OVM_PRINT: \
02196           `ovm_print_aa_int_object3(ARG, ovm_auto_options_object.printer,FLAG) \
02197       endcase \
02198     end \
02199   end
02200 
02201 // OVM_FIELD_DATA_AA_string_string
02202 // -------------------------------
02203 
02204 `define OVM_FIELD_DATA_AA_string_string(ARG, FLAG) \
02205   begin \
02206     if((what__ & (FLAG)) || (what__ >= OVM_MACRO_EXTRAS)) begin \
02207       case (what__) \
02208         OVM_COMPARE: \
02209            begin \
02210             if(!((FLAG)&OVM_NOCOMPARE) && (tmp_data__ != null) ) \
02211             begin \
02212               $cast(local_data__, tmp_data__); \
02213               if(ARG.num() != local_data__.ARG.num()) begin \
02214                  int s1__, s2__; \
02215                  m_sc.stringv = ""; \
02216                  s1__ = ARG.num(); s2__ = local_data__.ARG.num(); \
02217                  $swrite(m_sc.stringv, "lhs size = %0d : rhs size = %0d", \
02218                     s1__, s2__);\
02219                  ovm_auto_options_object.comparer.print_msg(m_sc.stringv); \
02220               end \
02221               string_aa_key = ""; \
02222               while(ARG.next(string_aa_key)) begin \
02223                 ovm_auto_options_object.comparer.scope.set_arg({"[",string_aa_key,"]"}); \
02224                 void'(m_do_data_string({`"ARG[`", string_aa_key, "]"}, \
02225                     ARG[string_aa_key], \
02226                     local_data__.ARG[string_aa_key], what__, FLAG) ); \
02227                 ovm_auto_options_object.comparer.scope.unset_arg(string_aa_key); \
02228               end \
02229             end \
02230            end \
02231         OVM_COPY: \
02232           begin \
02233             if(!((FLAG)&OVM_NOCOPY) && (local_data__ !=null)) \
02234             begin \
02235               ARG.delete(); \
02236               string_aa_key = ""; \
02237               while(local_data__.ARG.next(string_aa_key)) \
02238                 ARG[string_aa_key] = local_data__.ARG[string_aa_key]; \
02239             end \
02240           end \
02241         OVM_PRINT: \
02242           `ovm_print_aa_string_string2(ARG, ovm_auto_options_object.printer) \
02243       endcase \
02244     end \
02245   end
02246 
02247 
02248 // DOREFERENCECOPY
02249 // ---------------
02250 
02251 `define DOREFERENCECOPY(ARG,FLAG) \
02252   if( (FLAG)&OVM_REFERENCE)) \
02253       ARG = local_data__.``ARG; \
02254 
02255 // DODEEPCOPY
02256 // ----------
02257 
02258 `define DODEEPCOPY(ARG,FLAG) \
02259   begin \
02260     ovm_object this_d__, from_d__; \
02261     if(tmp_data__ != null) \
02262       if(!$cast(local_data__, tmp_data__)) begin \
02263         ovm_object::m_sc.scratch1 = `"Cast failed for argument: ARG`"; \
02264       end \
02265     if(ARG != null) $cast(this_d__,ARG); \
02266     if(local_data__.ARG != null) $cast(from_d__,local_data__.ARG); \
02267 \
02268     if((this_d__==null) && (from_d__!=null)) begin \
02269       this_d__ = from_d__.clone(); \
02270       this_d__.set_name(`"ARG`"); \
02271     end \
02272     else if(from_d__ == null) \
02273       this_d__ = from_d__; \
02274     else begin \
02275       this_d__.copy(from_d__); \
02276     end \
02277     if((this_d__ == null) || !$cast(ARG, this_d__)) begin \
02278       ovm_object::m_sc.scratch1 = `"Cast failed for ARG during copy`"; \
02279       _global_reporter.ovm_report_error("CSTFLD", ovm_object::m_sc.scratch1); \
02280     end \
02281   end    
02282 
02283 
02284 // DOSHALLOWCOPY
02285 // -------------
02286 
02287 `define DOSHALLOWCOPY(ARG1,ARG2,FLAG) \
02288   if( (FLAG)&OVM_SHALLOW) \
02289     begin \
02290       ovm_object lhs__, rhs__; \
02291       ovm_object::m_sc.scratch1 = `"Executing shallow copy of arg ARG`"; \
02292 /* Can't do shallow copy right now due to an issue with abstract classes */ \
02293 /* like ovm_object, so do a deep copy instead. */ \
02294       if(ARG2==null) ARG1 = ARG2; \
02295       else begin \
02296         if(ARG1 != null) $cast(lhs__, ARG1); \
02297         if(ARG2 != null) $cast(rhs__, ARG2); \
02298         if(rhs__!=null && lhs__!=null) \
02299           lhs__.copy(rhs__); \
02300         else if(rhs__ != null) begin \
02301           $cast(lhs__, rhs__.clone()); \
02302           if (lhs__ != null) \
02303             $cast(ARG1, lhs__); \
02304         end \
02305         else \
02306           ARG1 = null; \
02307 /*          ARG = new local_data__.ARG; */ \
02308       end \
02309     end \
02310   else \
02311     begin \
02312       ovm_object::m_sc.scratch1 = `"Shallow copy off for arg ARG`"; \
02313     end 
02314 
02315 
02316 // OVM_FIELD_SET
02317 // ----------------
02318 
02319 `define OVM_FIELD_SET(ARG,FLAG) \
02320   if(ovm_object::m_do_set (str__, `"ARG`", ARG, what__, FLAG)) begin \
02321     m_sc.scope.up(null); \
02322     return; \
02323   end
02324 
02325 
02326 // OVM_FIELD_SET_EVENT
02327 // ----------------------
02328 
02329 `define OVM_FIELD_SET_EVENT(ARG,FLAG) \
02330   /*Not implemented*/
02331 
02332 
02333 // OVM_FIELD_SET_OBJECT
02334 // -----------------------
02335 
02336 `define OVM_FIELD_SET_OBJECT(ARG,FLAG) \
02337   begin \
02338     ovm_object arg_obj__; \
02339     int r__; /*return 1 if get succeeds*/ \
02340     if(ARG != null) $cast(arg_obj__, ARG); \
02341     r__ = ovm_object::m_do_set_object(str__, `"ARG`", \
02342         arg_obj__, what__, FLAG); \
02343     /*in case of a set, cast back */ \
02344     if(r__ && (what__ == OVM_SETOBJ) && (arg_obj__ != null)) \
02345       $cast(ARG, arg_obj__); \
02346     else if(arg_obj__ == null) \
02347       ARG = null; \
02348   end
02349 
02350 
02351 // OVM_FIELD_SET_STRING
02352 // -----------------------
02353 
02354 `define OVM_FIELD_SET_STRING(ARG,FLAG) \
02355   if(ovm_object::m_do_set_string (str__, `"ARG`", ARG, what__, FLAG)) begin \
02356     m_sc.scope.up(null); \
02357     return; \
02358   end
02359 
02360 `define OVM_FIELD_SET_QUEUE_TYPE(ATYPE, ARRAY, RHS, FLAG) \
02361   if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \
02362     bit wildcard_index__; \
02363     int index__; \
02364     index__ = ovm_get_array_index_int(str__, wildcard_index__); \
02365     if(what__==OVM_SET``ATYPE) \
02366     begin \
02367       if(ovm_is_array(str__)  && (index__ != -1)) begin\
02368         if(wildcard_index__) begin \
02369           for(index__=0; index__<ARRAY.size(); ++index__) begin \
02370             if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index__)})) begin \
02371               ARRAY[index__] = RHS; \
02372               m_sc.status = 1; \
02373             end \
02374           end \
02375         end \
02376         else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index__)})) begin \
02377           ARRAY[index__] =  RHS; \
02378           m_sc.status = 1; \
02379         end \
02380       end \
02381     end \
02382  end
02383 
02384 `define OVM_FIELD_SET_QUEUE_ENUM(T, ARRAY, RHS, FLAG) \
02385   if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \
02386     bit wildcard_index__; \
02387     int index__; \
02388     index__ = ovm_get_array_index_int(str__, wildcard_index__); \
02389     if(what__==OVM_SETINT) \
02390     begin \
02391       if(ovm_is_array(str__)  && (index__ != -1)) begin\
02392         if(wildcard_index__) begin \
02393           for(index__=0; index__<ARRAY.size(); ++index__) begin \
02394             if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index__)})) begin \
02395               ARRAY[index__] = T'(RHS); \
02396               m_sc.status = 1; \
02397             end \
02398           end \
02399         end \
02400         else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index__)})) begin \
02401           ARRAY[index__] =  T'(RHS); \
02402           m_sc.status = 1; \
02403         end \
02404       end \
02405     end \
02406  end
02407 
02408 `define OVM_FIELD_SET_QUEUE_OBJECT_TYPE(ARRAY, FLAG) \
02409   if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \
02410     bit wildcard_index__; \
02411     int index__; \
02412     index__ = ovm_get_array_index_int(str__, wildcard_index__); \
02413     if(what__==OVM_SETOBJ) \
02414     begin \
02415       if(ovm_is_array(str__) ) begin\
02416         if(wildcard_index__) begin \
02417           for(index__=0; index__<ARRAY.size(); ++index__) begin \
02418             if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index__)})) begin \
02419               if (m_sc.object != null) \
02420                 $cast(ARRAY[index__], m_sc.object); \
02421               m_sc.status = 1; \
02422             end \
02423           end \
02424         end \
02425         else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index__)})) begin \
02426           if (m_sc.object != null) \
02427             $cast(ARRAY[index__], m_sc.object); \
02428           m_sc.status = 1; \
02429         end \
02430       end \
02431     end \
02432  end
02433 
02434 `define OVM_FIELD_SET_AA_TYPE(INDEX_TYPE, ARRAY_TYPE, ARRAY, RHS, FLAG) \
02435   if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \
02436     bit wildcard_index__; \
02437     INDEX_TYPE index__; \
02438     index__ = ovm_get_array_index_``INDEX_TYPE(str__, wildcard_index__); \
02439     if(what__==OVM_SET``ARRAY_TYPE) \
02440     begin \
02441       if(ovm_is_array(str__) ) begin\
02442         if(wildcard_index__) begin \
02443           if(ARRAY.first(index__)) \
02444           do begin \
02445             if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index__)}) ||  \
02446                ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0s]", index__)})) begin \
02447               ARRAY[index__] = RHS; \
02448               m_sc.status = 1; \
02449             end \
02450           end while(ARRAY.next(index__));\
02451         end \
02452         else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index__)})) begin \
02453           ARRAY[index__] = RHS; \
02454           m_sc.status = 1; \
02455         end \
02456         else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0s]", index__)})) begin \
02457           ARRAY[index__] = RHS; \
02458           m_sc.status = 1; \
02459         end \
02460       end \
02461     end \
02462  end
02463 
02464 `define OVM_FIELD_SET_AA_OBJECT_TYPE(INDEX_TYPE, ARRAY, FLAG) \
02465   if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \
02466     bit wildcard_index__; \
02467     INDEX_TYPE index__; \
02468     index__ = ovm_get_array_index_``INDEX_TYPE(str__, wildcard_index__); \
02469     if(what__==OVM_SETOBJ) \
02470     begin \
02471       if(ovm_is_array(str__) ) begin\
02472         if(wildcard_index__) begin \
02473           if(ARRAY.first(index__)) \
02474           do begin \
02475             if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index__)}) || \
02476                ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0s]", index__)})) begin \
02477               if (m_sc.object != null) \
02478                 $cast(ARRAY[index__], m_sc.object); \
02479               m_sc.status = 1; \
02480             end \
02481           end while(ARRAY.next(index__));\
02482         end \
02483         else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index__)})) begin \
02484           if (m_sc.object != null) \
02485             $cast(ARRAY[index__], m_sc.object); \
02486           m_sc.status = 1; \
02487         end \
02488         else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0s]", index__)})) begin \
02489           if (m_sc.object != null) \
02490             $cast(ARRAY[index__], m_sc.object); \
02491           m_sc.status = 1; \
02492         end \
02493       end \
02494     end \
02495  end
02496 
02497 `define OVM_FIELD_SET_AA_INT_TYPE(INDEX_TYPE, ARRAY_TYPE, ARRAY, RHS, FLAG) \
02498   if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \
02499     bit wildcard_index__; \
02500     INDEX_TYPE index__; \
02501     index__ = ovm_get_array_index_int(str__, wildcard_index__); \
02502     if(what__==OVM_SET``ARRAY_TYPE) \
02503     begin \
02504       if(ovm_is_array(str__) ) begin\
02505         if(wildcard_index__) begin \
02506           if(ARRAY.first(index__)) \
02507           do begin \
02508             if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index__)})) begin \
02509               ARRAY[index__] = RHS; \
02510               m_sc.status = 1; \
02511             end \
02512           end while(ARRAY.next(index__));\
02513         end \
02514         else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index__)})) begin \
02515           ARRAY[index__] = RHS; \
02516           m_sc.status = 1; \
02517         end  \
02518       end \
02519     end \
02520  end
02521 
02522 `define OVM_FIELD_SET_ARRAY_TYPE(ARRAY_TYPE, ARRAY, RHS, FLAG) \
02523   if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \
02524     int index__; \
02525     bit wildcard_index__; \
02526     index__ = ovm_get_array_index_int(str__, wildcard_index__); \
02527     if(what__==OVM_SET``ARRAY_TYPE) \
02528     begin \
02529       if(ovm_is_array(str__) ) begin\
02530         if(wildcard_index__) begin \
02531           for(int index__=0; index__<ARRAY.size(); ++index__) begin \
02532             if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index__)})) begin \
02533               ARRAY[index__] = RHS; \
02534               m_sc.status = 1; \
02535             end \
02536           end \
02537         end \
02538         else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index__)})) begin \
02539           ARRAY[index__] = RHS; \
02540           m_sc.status = 1; \
02541         end \
02542         else if(what__==OVM_SET && ovm_is_match(str__, m_sc.scope.get_arg())) begin \
02543           int size__; \
02544           size__ = m_sc.bitstream; \
02545           ARRAY = new[size__](ARRAY); \
02546           m_sc.status = 1; \
02547         end \
02548       end \
02549       else if(what__==OVM_SET && ovm_is_match(str__, m_sc.scope.get_arg())) begin \
02550         int size__; \
02551         size__ = m_sc.bitstream; \
02552         ARRAY = new[size__](ARRAY); \
02553         m_sc.status = 1; \
02554       end \
02555     end \
02556     else if(what__==OVM_SET && ovm_is_match(str__, m_sc.scope.get_arg())) begin \
02557      int size__; \
02558      size__ = m_sc.bitstream; \
02559      ARRAY = new[size__](ARRAY); \
02560      m_sc.status = 1; \
02561     end \
02562  end
02563 
02564 `define OVM_FIELD_SET_ARRAY_ENUM(T, ARRAY, RHS, FLAG) \
02565   if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \
02566     int index__; \
02567     bit wildcard_index__; \
02568     index__ = ovm_get_array_index_int(str__, wildcard_index__); \
02569     if(what__==OVM_SETINT) \
02570     begin \
02571       if(ovm_is_array(str__) ) begin\
02572         if(wildcard_index__) begin \
02573           for(int index__=0; index__<ARRAY.size(); ++index__) begin \
02574             if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index__)})) begin \
02575               ARRAY[index__] = T'(RHS); \
02576               m_sc.status = 1; \
02577             end \
02578           end \
02579         end \
02580         else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index__)})) begin \
02581           ARRAY[index__] = T'(RHS); \
02582           m_sc.status = 1; \
02583         end \
02584         else if(what__==OVM_SET && ovm_is_match(str__, m_sc.scope.get_arg())) begin \
02585           int size__; \
02586           size__ = m_sc.bitstream; \
02587           ARRAY = new[size__](ARRAY); \
02588           m_sc.status = 1; \
02589         end \
02590       end \
02591       else if(what__==OVM_SET && ovm_is_match(str__, m_sc.scope.get_arg())) begin \
02592         int size__; \
02593         size__ = m_sc.bitstream; \
02594         ARRAY = new[size__](ARRAY); \
02595         m_sc.status = 1; \
02596       end \
02597     end \
02598     else if(what__==OVM_SET && ovm_is_match(str__, m_sc.scope.get_arg())) begin \
02599      int size__; \
02600      size__ = m_sc.bitstream; \
02601      ARRAY = new[size__](ARRAY); \
02602      m_sc.status = 1; \
02603     end \
02604  end
02605 
02606 `define OVM_FIELD_SET_SARRAY_TYPE(ARRAY_TYPE, ARRAY, RHS, FLAG) \
02607   if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \
02608     int index__; \
02609     bit wildcard_index__; \
02610     index__ = ovm_get_array_index_int(str__, wildcard_index__); \
02611     if(what__==OVM_SET``ARRAY_TYPE) \
02612     begin \
02613       if(ovm_is_array(str__) ) begin\
02614         if(wildcard_index__) begin \
02615           foreach(ARRAY[index__]) begin \
02616             if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index__)})) begin \
02617               ARRAY[index__] = RHS; \
02618               m_sc.status = 1; \
02619             end \
02620           end \
02621         end \
02622         else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index__)})) begin \
02623           ARRAY[index__] = RHS; \
02624           m_sc.status = 1; \
02625         end \
02626       end \
02627     end \
02628   end
02629 
02630 `define OVM_FIELD_SET_SARRAY_ENUM(T, ARRAY, RHS, FLAG) \
02631   if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \
02632     int index__; \
02633     bit wildcard_index__; \
02634     index__ = ovm_get_array_index_int(str__, wildcard_index__); \
02635     if(what__==OVM_SETINT) \
02636     begin \
02637       if(ovm_is_array(str__) ) begin\
02638         if(wildcard_index__) begin \
02639           foreach(ARRAY[index__]) begin \
02640             if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index__)})) begin \
02641               ARRAY[index__] = T'(RHS); \
02642               m_sc.status = 1; \
02643             end \
02644           end \
02645         end \
02646         else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index__)})) begin \
02647           ARRAY[index__] = T'(RHS); \
02648           m_sc.status = 1; \
02649         end \
02650       end \
02651     end \
02652   end
02653 
02654 `define OVM_FIELD_SET_ARRAY_OBJECT_TYPE(ARRAY, FLAG) \
02655   if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \
02656     int index__; \
02657     bit wildcard_index__; \
02658     index__ = ovm_get_array_index_int(str__, wildcard_index__); \
02659     if(what__==OVM_SETOBJ) \
02660     begin \
02661       if(ovm_is_array(str__) ) begin\
02662         if(wildcard_index__) begin \
02663           for(int index__=0; index__<ARRAY.size(); ++index__) begin \
02664             if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index__)})) begin \
02665               if (m_sc.object != null) begin \
02666                 $cast(ARRAY[index__], m_sc.object); \
02667               end \
02668               m_sc.status = 1; \
02669             end \
02670           end \
02671         end \
02672         else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index__)})) begin \
02673           if (m_sc.object != null) begin \
02674             $cast(ARRAY[index__], m_sc.object); \
02675           end \
02676           m_sc.status = 1; \
02677         end \
02678       end \
02679     end \
02680     else if(what__==OVM_SET && !ovm_is_array(str__) && ovm_is_match(str__, m_sc.scope.get_arg())) begin \
02681      int size__; \
02682      size__ = m_sc.bitstream; \
02683      ARRAY = new[size__](ARRAY); \
02684      m_sc.status = 1; \
02685     end \
02686  end
02687 
02688 `define OVM_FIELD_SET_SARRAY_OBJECT_TYPE(ARRAY, FLAG) \
02689   if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \
02690     int index__; \
02691     bit wildcard_index__; \
02692     index__ = ovm_get_array_index_int(str__, wildcard_index__); \
02693     if(what__==OVM_SETOBJ) \
02694     begin \
02695       if(ovm_is_array(str__) ) begin\
02696         if(wildcard_index__) begin \
02697           foreach(ARRAY[index__]) begin \
02698             if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index__)})) begin \
02699               if (m_sc.object != null) begin \
02700                 $cast(ARRAY[index__], m_sc.object); \
02701               end \
02702               else \
02703                 ARRAY[index__] = null; \
02704               m_sc.status = 1; \
02705             end \
02706           end \
02707         end \
02708         else if(ovm_is_match(str__, {m_sc.scope.get_arg(),$psprintf("[%0d]", index__)})) begin \
02709           if (m_sc.object != null) begin \
02710             $cast(ARRAY[index__], m_sc.object); \
02711           end \
02712           else \
02713             ARRAY[index__] = null; \
02714           m_sc.status = 1; \
02715         end \
02716       end \
02717     end \
02718   end 
02719 
02720 // OVM_FIELD_SET_ARRAY_OBJECT
02721 // -----------------------------
02722 
02723 // The cast to ovm_object allows these macros to work
02724 // with ARG base types not derived from ovm_object.
02725 
02726 `define OVM_FIELD_SET_ARRAY_OBJECT(ARG,FLAG) \
02727   `OVM_FIELD_SET_ARRAY_OBJECT_TYPE(ARG, FLAG) \
02728   if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \
02729     ovm_object obj__; \
02730     for(int index__=0; index__<ARG.size(); ++index__) begin \
02731        if($cast(obj__,ARG[index__]) && (obj__!=null)) \
02732           obj__.m_field_automation(null, what__, str__); \
02733     end \
02734   end
02735 
02736 `define OVM_FIELD_SET_SARRAY_OBJECT(ARG,FLAG) \
02737   `OVM_FIELD_SET_SARRAY_OBJECT_TYPE(ARG, FLAG) \
02738   if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \
02739     ovm_object obj__; \
02740     foreach(ARG[index__]) begin \
02741        if($cast(obj__,ARG[index__]) && (obj__!=null)) \
02742           obj__.m_field_automation(null, what__, str__); \
02743     end \
02744   end
02745 
02746 // OVM_FIELD_SET_QUEUE_OBJECT
02747 // -----------------------------
02748 
02749 `define OVM_FIELD_SET_QUEUE_OBJECT(ARG,FLAG) \
02750   `OVM_FIELD_SET_QUEUE_OBJECT_TYPE(ARG, FLAG) \
02751   if((what__ >= OVM_START_FUNCS && what__ <= OVM_END_FUNCS) && (((FLAG)&OVM_READONLY) == 0)) begin \
02752     ovm_object obj__; \
02753     for(int index__=0; index__<ARG.size(); ++index__) begin \
02754        if($cast(obj__,ARG[index__]) && (obj__!=null)) \
02755           obj__.m_field_automation(null, what__, str__); \
02756     end \
02757   end
02758 
02759 `endif //OVM_EMPTY_MACROS
02760 
02761 `endif  // OVM_OBJECT_DEFINES_SVH
02762 

Intelligent Design Verification
Intelligent Design Verification
Project: OVM, Revision: 2.0.1
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
Doxygen Version: 1.5.5
Wed Jan 7 19:27:18 2009
Find a documentation bug? Report bugs to: bugs.intelligentdv.com Project: DoxygenFilterSV