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

Intelligent Design Verification
Intelligent Design Verification
Project: OVM, Revision: 1.1.0
Copyright (c) 2008 Intelligent Design Verification.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included here:
http://www.intelligentdv.com/licenses/fdl.txt
doxygen
Doxygen Version: 1.4.6
Mon Sep 29 14:23:30 2008
Find a documentation bug? Report bugs to: bugs.intelligentdv.com Project: DoxygenFilterSV