00001 //
00002 // -------------------------------------------------------------
00003 // Copyright 2004-2008 Synopsys, 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 `define vmm_xactor_member_begin(_class) \
00024 \
00025 function void do_all(vmm_xactor::do_what_e do_what, \
00026 vmm_xactor::reset_e rst_typ = SOFT_RST); \
00027 super.do_all(do_what, rst_typ);
00028
00029
00030 `define vmm_xactor_member_scalar(_name, _do) \
00031 \
00032 case (do_what & _do) \
00033 DO_PRINT: begin \
00034 $sformat(this.__vmm_image, `"%s\n%s%s: %0d`", this.__vmm_image, \
00035 this.__vmm_prefix, `"_name`", this._name); \
00036 end \
00037 endcase
00038
00039
00040 `define vmm_xactor_member_scalar_array(_name, _do) \
00041 \
00042 case (do_what & _do) \
00043 DO_PRINT: begin \
00044 foreach (this._name[i]) begin \
00045 $sformat(this.__vmm_image, `"%s\n%s%s[%0d]: %0d`", \
00046 this.__vmm_image, this.__vmm_prefix, \
00047 `"_name`", i, this._name[i]); \
00048 end \
00049 end \
00050 endcase
00051
00052
00053 `define vmm_xactor_member_scalar_aa_scalar(_name, _do) \
00054 \
00055 `vmm_xactor_member_scalar_array(_name, _do)
00056
00057
00058 `define vmm_xactor_member_scalar_aa_string(_name, _do) \
00059 \
00060 case (do_what & _do) \
00061 DO_PRINT: begin \
00062 foreach (this._name[i]) begin \
00063 $sformat(this.__vmm_image, `"%s\n%s%s[%s]: %0d`", \
00064 this.__vmm_image, this.__vmm_prefix, \
00065 `"_name`", i, this._name[i]); \
00066 end \
00067 end \
00068 endcase
00069
00070
00071 `define vmm_xactor_member_enum(_name, _do) \
00072 \
00073 case (do_what & _do) \
00074 DO_PRINT: begin \
00075 $sformat(this.__vmm_image, `"%s\n%s%s: %0s`", this.__vmm_image, \
00076 this.__vmm_prefix, `"_name`", this._name.name()); \
00077 end \
00078 endcase
00079
00080
00081 `define vmm_xactor_member_enum_array(_name, _do) \
00082 \
00083 case (do_what & _do) \
00084 DO_PRINT: begin \
00085 foreach (this._name[i]) begin \
00086 $sformat(this.__vmm_image, `"%s\n%s%s[%0d]: %0s`", \
00087 this.__vmm_image, this.__vmm_prefix, \
00088 `"_name`", i, this._name[i].name()); \
00089 end \
00090 end \
00091 endcase
00092
00093
00094 `define vmm_xactor_member_enum_aa_scalar(_name, _do) \
00095 \
00096 `define vmm_xactor_member_enum_array(_name, _do)
00097
00098
00099 `define vmm_xactor_member_enum_aa_string(_name, _do) \
00100 \
00101 case (do_what & _do) \
00102 DO_PRINT: begin \
00103 foreach (this._name[i]) begin \
00104 $sformat(this.__vmm_image, `"%s\n%s%s[%s]: %s`", \
00105 this.__vmm_image, this.__vmm_prefix, \
00106 `"_name`", i, this._name[i].name()); \
00107 end \
00108 end \
00109 endcase
00110
00111
00112 `define vmm_xactor_member_string(_name, _do) \
00113 \
00114 case (do_what & _do) \
00115 DO_PRINT: begin \
00116 $sformat(this.__vmm_image, `"%s\n%s%s: %s`", this.__vmm_image, \
00117 this.__vmm_prefix, `"_name`", this._name); \
00118 end \
00119 endcase
00120
00121
00122 `define vmm_xactor_member_string_array(_name, _do) \
00123 \
00124 case (do_what & _do) \
00125 DO_PRINT: begin \
00126 foreach (this._name[i]) begin \
00127 $sformat(this.__vmm_image, `"%s\n%s%s[%0d]: %s`", \
00128 this.__vmm_image, this.__vmm_prefix, \
00129 `"_name`", i, this._name[i]); \
00130 end \
00131 end \
00132 endcase
00133
00134
00135 `define vmm_xactor_member_string_aa_scalar(_name, _do) \
00136 \
00137 `vmm_xactor_member_string_array(_name, _do)
00138
00139
00140 `define vmm_xactor_member_string_aa_string(_name, _do) \
00141 \
00142 case (do_what & _do) \
00143 DO_PRINT: begin \
00144 foreach (this._name[i]) begin \
00145 $sformat(this.__vmm_image, `"%s\n%s%s[%s]: %s`", \
00146 this.__vmm_image, this.__vmm_prefix, \
00147 `"_name`", i, this._name[i]); \
00148 end \
00149 end \
00150 endcase
00151
00152
00153 `define vmm_xactor_member_vmm_data(_name, _do) \
00154 \
00155 case (do_what & _do) \
00156 DO_PRINT: begin \
00157 $sformat(this.__vmm_image, `"%s\n%s`", this.__vmm_image, \
00158 this._name.psdisplay({this.__vmm_prefix, `"_name: `"})); \
00159 end \
00160 endcase
00161
00162
00163 `define vmm_xactor_member_vmm_data_array(_name, _do) \
00164 \
00165 case (do_what & _do) \
00166 DO_PRINT: begin \
00167 foreach (this._name[i]) begin \
00168 $sformat(this.__vmm_image, `"%s\n%s`", this.__vmm_image, \
00169 this._name[i].psdisplay(`vmm_sformatf("%s%s[%0d]: ", \
00170 this.__vmm_prefix, \
00171 `"_name`", i))); \
00172 end \
00173 end \
00174 endcase
00175
00176
00177 `define vmm_xactor_member_vmm_data_aa_scalar(_name, _do) \
00178 \
00179 `vmm_xactor_member_vmm_data_array(_name, _do)
00180
00181
00182 `define vmm_xactor_member_vmm_data_aa_string(_name, _do) \
00183 \
00184 case (do_what & _do) \
00185 DO_PRINT: begin \
00186 foreach (this._name[i]) begin \
00187 $sformat(this.__vmm_image, `"%s\n%s`", this.__vmm_image, \
00188 this._name[i].psdisplay(`vmm_sformatf("%s%s[%s]: ", \
00189 this.__vmm_prefix, \
00190 `"_name`", i))); \
00191 end \
00192 end \
00193 endcase
00194
00195
00196 `define vmm_xactor_member_channel(_name, _do) \
00197 \
00198 case (do_what & _do) \
00199 DO_PRINT: begin \
00200 $sformat(this.__vmm_image, `"%s\n%s`", this.__vmm_image, \
00201 this._name.psdisplay({this.__vmm_prefix, `"_name: `"})); \
00202 end \
00203 DO_RESET: begin \
00204 this._name.flush(); \
00205 end \
00206 DO_KILL: begin \
00207 this._name.kill(); \
00208 end \
00209 endcase
00210
00211
00212 `define vmm_xactor_member_channel_array(_name, _do) \
00213 \
00214 case (do_what & _do) \
00215 DO_PRINT: begin \
00216 foreach (this._name[i]) begin \
00217 $sformat(this.__vmm_image, `"%s\n%s`", this.__vmm_image, \
00218 this._name[i].psdisplay(`vmm_sformatf("%s%s[%0d]: ", \
00219 this.__vmm_prefix, \
00220 `"_name`", i))); \
00221 end \
00222 end \
00223 DO_RESET: begin \
00224 foreach (this._name[i]) begin \
00225 this._name[i].flush(); \
00226 end \
00227 end \
00228 DO_KILL: begin \
00229 foreach (this._name[i]) begin \
00230 this._name[i].kill(); \
00231 end \
00232 end \
00233 endcase
00234
00235
00236 `define vmm_xactor_member_channel_aa_scalar(_name, _do) \
00237 \
00238 `vmm_xactor_member_channel_array(_name, _do)
00239
00240
00241 `define vmm_xactor_member_channel_aa_string(_name, _do) \
00242 \
00243 case (do_what & _do) \
00244 DO_PRINT: begin \
00245 foreach (this._name[i]) begin \
00246 $sformat(this.__vmm_image, `"%s\n%s`", this.__vmm_image, \
00247 this._name[i].psdisplay(`vmm_sformatf("%s%s[%s]: ", \
00248 this.__vmm_prefix, \
00249 `"_name`", i))); \
00250 end \
00251 end \
00252 DO_RESET: begin \
00253 foreach (this._name[i]) begin \
00254 this._name[i].flush(); \
00255 end \
00256 end \
00257 DO_KILL: begin \
00258 foreach (this._name[i]) begin \
00259 this._name[i].kill(); \
00260 end \
00261 end \
00262 endcase
00263
00264
00265 `define vmm_xactor_member_xactor(_name, _do) \
00266 \
00267 case (do_what & _do) \
00268 DO_PRINT: begin \
00269 string _prefix = this.__vmm_prefix; \
00270 $sformat(this.__vmm_image, `"%s\n%s`", this.__vmm_image, \
00271 this._name.psdisplay({this.__vmm_prefix, `"_name: `"})); \
00272 this.__vmm_prefix = _prefix; \
00273 end \
00274 DO_START: begin \
00275 this._name.start_xactor(); \
00276 end \
00277 DO_STOP: begin \
00278 this._name.stop_xactor(); \
00279 end \
00280 DO_RESET: begin \
00281 this._name.reset_xactor(rst_typ); \
00282 end \
00283 DO_KILL: begin \
00284 this._name.kill(); \
00285 end \
00286 endcase
00287
00288
00289 `define vmm_xactor_member_xactor_array(_name, _do) \
00290 \
00291 case (do_what & _do) \
00292 DO_PRINT: begin \
00293 string _prefix = this.__vmm_prefix; \
00294 foreach (this._name[i]) begin \
00295 $sformat(this.__vmm_image, `"%s\n%s`", this.__vmm_image, \
00296 this._name[i].psdisplay(`vmm_sformatf("%s%s[%0d]: ", \
00297 _prefix, \
00298 `"_name`", i))); \
00299 end \
00300 this.__vmm_prefix = _prefix; \
00301 end \
00302 DO_START: begin \
00303 foreach (this._name[i]) begin \
00304 this._name[i].start_xactor(); \
00305 end \
00306 end \
00307 DO_STOP: begin \
00308 foreach (this._name[i]) begin \
00309 this._name[i].stop_xactor(); \
00310 end \
00311 end \
00312 DO_RESET: begin \
00313 foreach (this._name[i]) begin \
00314 this._name[i].reset_xactor(rst_typ); \
00315 end \
00316 end \
00317 DO_KILL: begin \
00318 foreach (this._name[i]) begin \
00319 this._name[i].kill(); \
00320 end \
00321 end \
00322 endcase
00323
00324
00325 `define vmm_xactor_member_xactor_aa_scalar(_name, _do) \
00326 \
00327 `vmm_xactor_member_xactor_array(_name, _do)
00328
00329
00330 `define vmm_xactor_member_xactor_aa_string(_name, _do) \
00331 \
00332 case (do_what & _do) \
00333 DO_PRINT: begin \
00334 string _prefix = this.__vmm_prefix; \
00335 foreach (this._name[i]) begin \
00336 $sformat(this.__vmm_image, `"%s\n%s`", this.__vmm_image, \
00337 this._name[i].psdisplay(`vmm_sformatf("%s%s[%s]: ", \
00338 _prefix, \
00339 `"_name`", i))); \
00340 end \
00341 this.__vmm_prefix = _prefix; \
00342 end \
00343 DO_START: begin \
00344 foreach (this._name[i]) begin \
00345 this._name[i].start_xactor(); \
00346 end \
00347 end \
00348 DO_STOP: begin \
00349 foreach (this._name[i]) begin \
00350 this._name[i].stop_xactor(); \
00351 end \
00352 end \
00353 DO_RESET: begin \
00354 foreach (this._name[i]) begin \
00355 this._name[i].reset_xactor(rst_typ); \
00356 end \
00357 end \
00358 DO_KILL: begin \
00359 foreach (this._name[i]) begin \
00360 this._name[i].kill(); \
00361 end \
00362 end \
00363 endcase
00364
00365
00366 `define vmm_xactor_member_user_defined(_name) \
00367 \
00368 void'(this.do_``_name(do_what, rst_typ));
00369
00370
00371 `define vmm_xactor_member_end(_class) \
00372 endfunction \
00373 \
00374 virtual function string psdisplay(string prefix = `"`"); \
00375 this.__vmm_done_user = 1; \
00376 psdisplay = this.do_psdisplay(prefix); \
00377 if (this.__vmm_done_user) return psdisplay; \
00378 \
00379 this.__vmm_image = super.psdisplay(prefix); \
00380 this.__vmm_prefix = prefix; \
00381 if (`vmm_str_match(prefix, ": $")) begin \
00382 this.__vmm_prefix = {`vmm_str_prematch(prefix), "."}; \
00383 end \
00384 this.do_all(DO_PRINT); \
00385 return this.__vmm_image; \
00386 endfunction \
00387 \
00388 virtual function void start_xactor(); \
00389 super.start_xactor(); \
00390 this.__vmm_done_user = 1; \
00391 this.do_start_xactor(); \
00392 if (this.__vmm_done_user) return; \
00393 \
00394 this.do_all(DO_START); \
00395 endfunction \
00396 \
00397 virtual function void stop_xactor(); \
00398 super.stop_xactor(); \
00399 this.__vmm_done_user = 1; \
00400 this.do_stop_xactor(); \
00401 if (this.__vmm_done_user) return; \
00402 \
00403 this.do_all(DO_STOP); \
00404 endfunction \
00405 \
00406 virtual function void reset_xactor(vmm_xactor::reset_e rst_typ = SOFT_RST); \
00407 super.reset_xactor(rst_typ); \
00408 this.__vmm_done_user = 1; \
00409 this.do_reset_xactor(rst_typ); \
00410 if (this.__vmm_done_user) return; \
00411 \
00412 this.do_all(DO_RESET, rst_typ); \
00413 endfunction \
00414 \
00415 virtual function void kill(); \
00416 super.kill(); \
00417 this.__vmm_done_user = 1; \
00418 this.do_kill_xactor(); \
00419 if (this.__vmm_done_user) return; \
00420 \
00421 this.do_all(DO_KILL); \
00422 endfunction