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