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 00021 //------------------------------------------------------------------------------ 00022 // 00023 // MACROS for ovm_printer usage 00024 // 00025 // Provides a set of printing macros that will call appropriate print methods 00026 // inside of a ovm_printer object. All macros have two versions: one assumes 00027 // a printer named printer is available in scope; the other takes a printer 00028 // argument. 00029 // 00030 //------------------------------------------------------------------------------ 00031 00032 `ifndef OVM_PRINTER_DEFINES_SVH 00033 `define OVM_PRINTER_DEFINES_SVH 00034 00035 `define ovm_print_int(F, R) \ 00036 `ovm_print_int3(F, R, ovm_default_printer) 00037 00038 `define print_integral_field(F, R, NM, P) \ 00039 P.print_field(NM, F, $bits(F), R, "["); 00040 00041 `define print_enum_field(T, F, NM, P) \ 00042 P.print_generic(NM, `"T`", $bits(F), F.name(), "["); 00043 00044 `define ovm_print_int3(F, R, P) \ 00045 do begin \ 00046 ovm_printer p__; \ 00047 if(P!=null) p__ = P; \ 00048 else p__ = ovm_default_printer; \ 00049 `print_integral_field(F, R, `"F`", p__) \ 00050 end while(0); 00051 00052 `define ovm_print_object(F) \ 00053 `ovm_print_object2(F, ovm_default_printer) 00054 00055 `define ovm_print_object2(F, P) \ 00056 do begin \ 00057 ovm_printer p__; \ 00058 if(P!=null) p__ = P; \ 00059 else p__ = ovm_default_printer; \ 00060 p__.print_object(`"F`", F, "["); \ 00061 end while(0); 00062 00063 `define ovm_print_string(F) \ 00064 `ovm_print_string2(F, ovm_default_printer) 00065 00066 `define ovm_print_string2(F, P) \ 00067 do begin \ 00068 ovm_printer p__; \ 00069 if(P!=null) p__ = P; \ 00070 else p__ = ovm_default_printer; \ 00071 p__.print_string(`"F`", F, "["); \ 00072 end while(0); 00073 00074 `define ovm_print_array_int(F, R) \ 00075 `ovm_print_array_int3(F, R, ovm_default_printer) 00076 00077 `define ovm_print_array_int3(F, R, P) \ 00078 `ovm_print_qda_int4(F, R, P, da) 00079 00080 `define ovm_print_sarray_int3(F, R, P) \ 00081 `ovm_print_qda_int4(F, R, P, sa) 00082 00083 `define ovm_print_qda_int4(F, R, P, T) \ 00084 begin \ 00085 ovm_printer p__; \ 00086 ovm_printer_knobs k__; \ 00087 int curr, max__; max__=0; curr=0; \ 00088 if(P!=null) p__ = P; \ 00089 else p__ = ovm_default_printer; \ 00090 foreach(F[i__]) max__++; \ 00091 p__.print_array_header (`"F`", max__,`"T``(integral)`"); \ 00092 k__ = p__.knobs; \ 00093 if((p__.knobs.depth == -1) || (p__.m_scope.depth() < p__.knobs.depth+1)) \ 00094 begin \ 00095 foreach(F[i__]) begin \ 00096 if(curr < k__.begin_elements ) begin \ 00097 `print_integral_field(F[curr], R, p__.index_string(curr), p__) \ 00098 end \ 00099 else break; \ 00100 curr++; \ 00101 end \ 00102 if(curr<max__) begin \ 00103 if((max__-k__.end_elements) > curr) curr = max__-k__.end_elements; \ 00104 if(curr<k__.begin_elements) curr = k__.begin_elements; \ 00105 else begin \ 00106 p__.print_array_range(k__.begin_elements, curr-1); \ 00107 end \ 00108 for(curr=curr; curr<max__; ++curr) begin \ 00109 `print_integral_field(F[curr], R, p__.index_string(curr), p__) \ 00110 end \ 00111 end \ 00112 end \ 00113 p__.print_array_footer(max__); \ 00114 p__.print_footer(); \ 00115 end 00116 00117 `define ovm_print_qda_enum(F, P, T, ET) \ 00118 begin \ 00119 ovm_printer p__; \ 00120 ovm_printer_knobs k__; \ 00121 int curr, max__; max__=0; curr=0; \ 00122 if(P!=null) p__ = P; \ 00123 else p__ = ovm_default_printer; \ 00124 foreach(F[i__]) max__++; \ 00125 p__.print_array_header (`"F`", max__,`"T``(``ET``)`"); \ 00126 k__ = p__.knobs; \ 00127 if((p__.knobs.depth == -1) || (p__.m_scope.depth() < p__.knobs.depth+1)) \ 00128 begin \ 00129 foreach(F[i__]) begin \ 00130 if(curr < k__.begin_elements ) begin \ 00131 `print_enum_field(ET, F[curr], p__.index_string(curr), p__) \ 00132 end \ 00133 else break; \ 00134 curr++; \ 00135 end \ 00136 if(curr<max__) begin \ 00137 if((max__-k__.end_elements) > curr) curr = max__-k__.end_elements; \ 00138 if(curr<k__.begin_elements) curr = k__.begin_elements; \ 00139 else begin \ 00140 p__.print_array_range(k__.begin_elements, curr-1); \ 00141 end \ 00142 for(curr=curr; curr<max__; ++curr) begin \ 00143 `print_enum_field(ET, F[curr], p__.index_string(curr), p__) \ 00144 end \ 00145 end \ 00146 end \ 00147 p__.print_array_footer(max__); \ 00148 p__.print_footer(); \ 00149 end 00150 00151 `define ovm_print_queue_int(F, R) \ 00152 `ovm_print_queue_int3(F, R, ovm_default_printer) 00153 00154 `define ovm_print_queue_int3(F, R, P) \ 00155 `ovm_print_qda_int3(F, R, P, queue) 00156 00157 `define ovm_print_array_object(F,FLAG) \ 00158 `ovm_print_array_object3(F, ovm_default_printer,FLAG) 00159 00160 `define ovm_print_sarray_object(F,FLAG) \ 00161 `ovm_print_sarray_object3(F, ovm_default_printer,FLAG) 00162 00163 `define ovm_print_array_object3(F, P,FLAG) \ 00164 `ovm_print_object_qda4(F, P, da,FLAG) 00165 00166 `define ovm_print_sarray_object3(F, P,FLAG) \ 00167 `ovm_print_object_qda4(F, P, sa,FLAG) 00168 00169 `define ovm_print_object_qda4(F, P, T,FLAG) \ 00170 do begin \ 00171 int curr, max__; \ 00172 ovm_printer p__; \ 00173 max__=0; curr=0; \ 00174 if(P!=null) p__ = P; \ 00175 else p__ = ovm_default_printer; \ 00176 foreach(F[i__]) max__++; \ 00177 \ 00178 p__.print_header();\ 00179 \ 00180 p__.m_scope.set_arg(`"F`");\ 00181 p__.print_array_header(`"F`", max__, `"T``(object)`");\ 00182 if((p__.knobs.depth == -1) || (p__.knobs.depth+1 > p__.m_scope.depth())) \ 00183 begin\ 00184 for(curr=0; curr<max__ && curr<p__.knobs.begin_elements; ++curr) begin\ 00185 if(((FLAG)&OVM_REFERENCE) == 0) \ 00186 p__.print_object(p__.index_string(curr), F[curr], "[");\ 00187 else \ 00188 p__.print_object_header(p__.index_string(curr), F[curr], "[");\ 00189 end \ 00190 if(curr<max__) begin\ 00191 curr = max__-p__.knobs.end_elements;\ 00192 if(curr<p__.knobs.begin_elements) curr = p__.knobs.begin_elements;\ 00193 else begin\ 00194 p__.print_array_range(p__.knobs.begin_elements, curr-1);\ 00195 end\ 00196 for(curr=curr; curr<max__; ++curr) begin\ 00197 if(((FLAG)&OVM_REFERENCE) == 0) \ 00198 p__.print_object(p__.index_string(curr), F[curr], "[");\ 00199 else \ 00200 p__.print_object_header(p__.index_string(curr), F[curr], "[");\ 00201 end \ 00202 end\ 00203 end \ 00204 \ 00205 p__.print_array_footer(max__); \ 00206 p__.print_footer(); \ 00207 end while(0); 00208 00209 `define ovm_print_object_queue(F,FLAG) \ 00210 `ovm_print_object_queue3(F, ovm_default_printer,FLAG) 00211 00212 `define ovm_print_object_queue3(F, P,FLAG) \ 00213 do begin \ 00214 `ovm_print_object_qda4(F,P, queue,FLAG); \ 00215 end while(0); 00216 00217 `define ovm_print_array_string(F) \ 00218 `ovm_print_array_string2(F, ovm_default_printer) 00219 00220 `define ovm_print_array_string2(F, P) \ 00221 `ovm_print_string_qda3(F, P, da) 00222 00223 `define ovm_print_sarray_string2(F, P) \ 00224 `ovm_print_string_qda3(F, P, sa) 00225 00226 `define ovm_print_string_qda3(F, P, T) \ 00227 do begin \ 00228 int curr, max__; \ 00229 ovm_printer p__; \ 00230 max__=0; curr=0; \ 00231 foreach(F[i__]) max__++; \ 00232 if(P!=null) p__ = P; \ 00233 else p__ = ovm_default_printer; \ 00234 \ 00235 p__.print_header();\ 00236 \ 00237 p__.m_scope.set_arg(`"F`");\ 00238 p__.print_array_header(`"F`", max__, `"T``(string)`");\ 00239 if((p__.knobs.depth == -1) || (p__.knobs.depth+1 > p__.m_scope.depth())) \ 00240 begin\ 00241 for(curr=0; curr<max__ && curr<p__.knobs.begin_elements; ++curr) begin\ 00242 p__.print_string(p__.index_string(curr), F[curr], "[");\ 00243 end \ 00244 if(curr<max__) begin\ 00245 curr = max__-p__.knobs.end_elements;\ 00246 if(curr<p__.knobs.begin_elements) curr = p__.knobs.begin_elements;\ 00247 else begin\ 00248 p__.print_array_range(p__.knobs.begin_elements, curr-1);\ 00249 end\ 00250 for(curr=curr; curr<max__; ++curr) begin\ 00251 p__.print_string(p__.index_string(curr), F[curr], "[");\ 00252 end \ 00253 end\ 00254 end \ 00255 \ 00256 p__.print_array_footer(max__); \ 00257 p__.print_footer(); \ 00258 end while(0); 00259 00260 `define ovm_print_string_queue(F) \ 00261 `ovm_print_string_queue2(F, ovm_default_printer) 00262 00263 `define ovm_print_string_queue2(F, P) \ 00264 do begin \ 00265 `ovm_print_string_qda3(F,P, queue); \ 00266 end while(0); 00267 00268 //----------------------------------------------------------------------------- 00269 // 00270 // Associative array printing methods 00271 // 00272 //----------------------------------------------------------------------------- 00273 `define ovm_print_aa_string_int(F) \ 00274 `ovm_print_aa_string_int3(F, R, ovm_default_printer) 00275 00276 00277 `define ovm_print_aa_string_int3(F, R, P) \ 00278 begin \ 00279 ovm_printer p__; \ 00280 ovm_printer_knobs k__; \ 00281 if(P!=null) p__ = P; \ 00282 else p__ = ovm_default_printer; \ 00283 p__.print_array_header (`"F`", F.num(), "aa(int,string)"); \ 00284 k__ = p__.knobs; \ 00285 if((p__.knobs.depth == -1) || (p__.m_scope.depth() < p__.knobs.depth+1)) \ 00286 begin \ 00287 foreach(F[string_aa_key]) \ 00288 `print_integral_field(F[string_aa_key], R, \ 00289 {"[", string_aa_key, "]"}, p__) \ 00290 end \ 00291 p__.print_array_footer(F.num()); \ 00292 p__.print_footer(); \ 00293 end 00294 00295 `define ovm_print_aa_string_object(F,FLAG) \ 00296 `ovm_print_aa_string_object_3(F, ovm_default_printer,FLAG) 00297 00298 `define ovm_print_aa_string_object3(F, P,FLAG) \ 00299 begin \ 00300 ovm_printer p__; \ 00301 ovm_printer_knobs k__; \ 00302 ovm_object u__; \ 00303 if(P!=null) p__ = P; \ 00304 else p__ = ovm_default_printer; \ 00305 p__.print_array_header (`"F`", F.num(), "aa(object,string)"); \ 00306 k__ = p__.knobs; \ 00307 if((p__.knobs.depth == -1) || (p__.m_scope.depth() < p__.knobs.depth+1)) \ 00308 begin \ 00309 foreach(F[string_aa_key]) begin \ 00310 if(((FLAG)&OVM_REFERENCE)==0) \ 00311 p__.print_object({"[", string_aa_key, "]"}, F[string_aa_key], "[");\ 00312 else \ 00313 p__.print_object_header({"[", string_aa_key, "]"}, F[string_aa_key], "[");\ 00314 end \ 00315 end \ 00316 p__.print_array_footer(F.num()); \ 00317 p__.print_footer(); \ 00318 end 00319 00320 `define ovm_print_aa_string_string(F) \ 00321 `ovm_print_aa_string_string_2(F, ovm_default_printer) 00322 00323 `define ovm_print_aa_string_string2(F, P) \ 00324 begin \ 00325 ovm_printer p__; \ 00326 ovm_printer_knobs k__; \ 00327 if(P!=null) p__ = P; \ 00328 else p__ = ovm_default_printer; \ 00329 p__.print_array_header (`"F`", F.num(), "aa(string,string)"); \ 00330 k__ = p__.knobs; \ 00331 if((p__.knobs.depth == -1) || (p__.m_scope.depth() < p__.knobs.depth+1)) \ 00332 begin \ 00333 foreach(F[string_aa_key]) \ 00334 p__.print_string({"[", string_aa_key, "]"}, F[string_aa_key], "["); \ 00335 end \ 00336 p__.print_array_footer(F.num()); \ 00337 p__.print_footer(); \ 00338 end 00339 00340 `define ovm_print_aa_int_object(F,FLAG) \ 00341 `ovm_print_aa_int_object_3(F, ovm_default_printer,FLAG) 00342 00343 `define ovm_print_aa_int_object3(F, P,FLAG) \ 00344 begin \ 00345 ovm_printer p__; \ 00346 ovm_printer_knobs k__; \ 00347 ovm_object u__; \ 00348 int key; \ 00349 if(P!=null) p__ = P; \ 00350 else p__ = ovm_default_printer; \ 00351 p__.print_array_header (`"F`", F.num(), "aa(object,int)"); \ 00352 k__ = p__.knobs; \ 00353 if((p__.knobs.depth == -1) || (p__.m_scope.depth() < p__.knobs.depth+1)) \ 00354 begin \ 00355 foreach(F[key]) begin \ 00356 $swrite(m_sc.stringv, "[%0d]", key); \ 00357 if(((FLAG)&OVM_REFERENCE)==0) \ 00358 p__.print_object(m_sc.stringv, F[key], "[");\ 00359 else \ 00360 p__.print_object_header(m_sc.stringv, F[key], "[");\ 00361 end \ 00362 end \ 00363 p__.print_array_footer(F.num()); \ 00364 p__.print_footer(); \ 00365 end 00366 00367 `define ovm_print_aa_int_key4(KEY, F, R, P) \ 00368 begin \ 00369 ovm_printer p__; \ 00370 ovm_printer_knobs k__; \ 00371 if(P!=null) p__ = P; \ 00372 else p__ = ovm_default_printer; \ 00373 m_sc.stringv = "aa(int,int)"; \ 00374 for(int i=0; i<m_sc.stringv.len(); ++i) \ 00375 if(m_sc.stringv[i] == " ") \ 00376 m_sc.stringv[i] = "_"; \ 00377 p__.print_array_header (`"F`", F.num(), m_sc.stringv); \ 00378 k__ = p__.knobs; \ 00379 if((p__.knobs.depth == -1) || (p__.m_scope.depth() < p__.knobs.depth+1)) \ 00380 begin \ 00381 foreach(F[aa_key]) begin \ 00382 `print_integral_field(F[aa_key], R, \ 00383 {"[", $psprintf("%0d",aa_key), "]"}, p__) \ 00384 end \ 00385 end \ 00386 p__.print_array_footer(F.num()); \ 00387 p__.print_footer(); \ 00388 end 00389 00390 `endif
![]() Intelligent Design Verification Project: OVM, Revision: 2.0.1 |
Copyright (c) 2008 Intelligent Design Verification. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included here: http://www.intelligentdv.com/licenses/fdl.txt |
![]() Doxygen Version: 1.5.5 Wed Jan 7 19:27:18 2009 |