Expanded versions of source files are the output of the preprocessor. Lines subject to
conditional compilation are not shown and all compiler pragmas have been stripped. Macros
have been completely expanded.
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: function vmm_ms_scenario::new(vmm_scenario parent
00024: );
00025: super.new(this.log );
00026: if(this.log == null) begin
00027: this.log = new("Multi Stream Scenario", "Class");
00028: this.notify.log = this.log;
00029: end
00030: this.set_parent_scenario(parent);
00031: endfunction: new
00032:
00033:
00034: task vmm_ms_scenario::execute(ref int n);
00035:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text("User needs to define the 'execute' for their multi stream scenarios"));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00036: endtask: execute
00037:
00038:
00039: /*local*/ function void vmm_ms_scenario::Xset_context_genX(vmm_ms_scenario_gen gen);
00040: this.context_scenario_gen = gen;
00041: endfunction: Xset_context_genX
00042:
00043:
00044: /*local*/ function vmm_ms_scenario_gen vmm_ms_scenario::Xget_context_genX();
00045: Xget_context_genX = this.context_scenario_gen;
00046: endfunction: Xget_context_genX
00047:
00048:
00049: function string vmm_ms_scenario::psdisplay(string prefix);
00050: return super.psdisplay(prefix);
00051: endfunction: psdisplay
00052:
00053:
00054: function vmm_ms_scenario vmm_ms_scenario::get_ms_scenario(string scenario, string gen);
00055: if(this.context_scenario_gen == null) begin
00056:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text("User needs to set the context ms scenario generator for this scenario"));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00057: return null;
00058: end
00059: if(gen == "") begin
00060: return this.context_scenario_gen.get_ms_scenario(scenario);
00061: end
00062: else begin
00063: vmm_ms_scenario_gen ext_gen;
00064: ext_gen=this.context_scenario_gen.get_ms_scenario_gen(gen);
00065: if(ext_gen == null) begin
00066:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("Got a null handle for scenario generator %s", gen)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00067: return null;
00068: end
00069: return ext_gen.get_ms_scenario(scenario);
00070: end
00071: endfunction: get_ms_scenario
00072:
00073:
00074: function vmm_channel vmm_ms_scenario::get_channel(string name);
00075: if(this.context_scenario_gen == null) begin
00076:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text("User needs to set the context ms scenario generator for this scenario"));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00077: return null;
00078: end
00079: return this.context_scenario_gen.get_channel(name);
00080: endfunction: get_channel
00081:
00082:
00083: task vmm_ms_scenario::grab_channels(ref vmm_channel channels[$]);
00084: forever begin: retry_all
00085: foreach (channels[i]) begin
00086: if (!channels[i].try_grab(this)) begin
00087: for (int j = 0; j < i; j++) channels[j].ungrab(this);
00088: channels[i].notify.wait_for(vmm_channel::UNGRABBED);
00089: disable retry_all;
00090: end
00091: end
00092: return;
00093: end
00094: endtask
00095:
00096:
00097: function vmm_ms_scenario_gen::new(string inst,
00098: int stream_id
00099: );
00100: super.new("VMM Multistream Scenario Generator", inst, stream_id
00101: );
00102:
00103: this.scenario_count = 0;
00104: this.inst_count = 0;
00105: this.stop_after_n_insts = 0;
00106: this.stop_after_n_scenarios = 0;
00107:
00108: this.select_scenario = new;
00109:
00110: void'(this.notify.configure(GENERATED));
00111: void'(this.notify.configure(DONE, vmm_notify::ON_OFF));
00112: endfunction: new
00113:
00114:
00115: function string vmm_ms_scenario_gen::psdisplay(string prefix = "");
00116: psdisplay = super.psdisplay(prefix);
00117: $sformat(psdisplay, "%s [stops after #insts %0d>%0d or #scenarios %0d>%0d]",
00118: psdisplay, this.inst_count, this.stop_after_n_insts,
00119: this.scenario_count, this.stop_after_n_scenarios);
00120:
00121: foreach (this.channel_registry[i]) begin
00122: string pfx;
00123: $sformat(pfx, "%s Channel \"%s\": ", prefix, i);
00124: psdisplay = {psdisplay, "\n", this.channel_registry[i].psdisplay(pfx)};
00125: end
00126:
00127: foreach (this.mss_registry[i]) begin
00128: string pfx;
00129: $sformat(pfx, "%s Scenario \"%s\": ", prefix, i);
00130: psdisplay = {psdisplay, "\n", this.mss_registry[i].psdisplay(pfx)};
00131: end
00132:
00133: foreach (this.mssg_registry[i]) begin
00134: string pfx;
00135: $sformat(pfx, "%s SubGen'tor \"%s\": ", prefix, i);
00136: psdisplay = {psdisplay, "\n", this.mssg_registry[i].psdisplay(pfx)};
00137: end
00138: return psdisplay;
00139: endfunction
00140:
00141:
00142: function int unsigned vmm_ms_scenario_gen::get_n_insts();
00143: get_n_insts = this.inst_count;
00144: endfunction: get_n_insts
00145:
00146:
00147: function int unsigned vmm_ms_scenario_gen::get_n_scenarios();
00148: get_n_scenarios = this.scenario_count;
00149: endfunction: get_n_scenarios
00150:
00151:
00152: function void vmm_ms_scenario_gen::reset_xactor(vmm_xactor::reset_e rst_typ);
00153: super.reset_xactor(rst_typ);
00154: this.scenario_count = 0;
00155: this.inst_count = 0;
00156: _q = '{};
00157:
00158: if(rst_typ >= FIRM_RST) begin
00159: this.notify.reset( , vmm_notify::HARD);
00160: end
00161:
00162: if(rst_typ >= HARD_RST) begin
00163: this.stop_after_n_insts = 0;
00164: this.stop_after_n_scenarios = 0;
00165: this.select_scenario = new;
00166: end
00167: endfunction: reset_xactor
00168:
00169:
00170: function void vmm_ms_scenario_gen::register_channel(string name,
00171: vmm_channel chan);
00172: if(name == "") begin
00173:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("Invalid '%s' string was passed", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00174: return;
00175: end
00176: if(this.channel_registry.exists(name)) begin
00177:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("%s already has an entry in the channel registry", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00178: return;
00179: end
00180: if(chan == null) begin
00181:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("channel passed for %s is a null value", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00182: return;
00183: end
00184:
00185: this.channel_registry[name] = chan;
00186: endfunction: register_channel
00187:
00188:
00189: function bit vmm_ms_scenario_gen::channel_exists(string name);
00190: if(name == "") begin
00191:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("Invalid '%s' string was passed", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00192: return 0;
00193: end
00194: return this.channel_registry.exists(name);
00195: endfunction: channel_exists
00196:
00197:
00198: function void vmm_ms_scenario_gen::replace_channel(string name,
00199: vmm_channel chan);
00200: if(name == "") begin
00201:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("Invalid '%s' string was passed", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00202: return;
00203: end
00204:
00205: if(chan == null) begin
00206:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("channel passed for %s is a null value", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00207: return;
00208: end
00209:
00210: if(!this.channel_registry.exists(name)) begin
00211:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("cannot replace a unregistered %s entry [use register_channel]", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00212: return;
00213: end
00214:
00215: this.channel_registry[name]=chan;
00216: endfunction: replace_channel
00217:
00218:
00219: function void vmm_ms_scenario_gen::get_all_channel_names(ref string name[$]);
00220: string s;
00221:
00222: if(this.channel_registry.first(s)) begin
00223: do begin
00224: name.push_back(s);
00225: end while(this.channel_registry.next(s));
00226: end
00227: else begin
00228:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::WARNING_SEV, "", -1)) begin
: void'(this.log.text("There are no entries in the channel registry"));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while(0);
00229: end
00230: endfunction: get_all_channel_names
00231:
00232:
00233: function void vmm_ms_scenario_gen::get_names_by_channel(vmm_channel chan,
00234: ref string name[$]);
00235: string s;
00236:
00237: if(chan == null) begin
00238:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("channel passed is a null value")));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00239: return;
00240: end
00241:
00242: if(this.channel_registry.first(s)) begin
00243: do begin
00244: if(this.channel_registry[s] == chan) begin
00245: name.push_back(s);
00246: end
00247: end while(this.channel_registry.next(s));
00248: end
00249: if(name.size() == 0) begin
00250:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::WARNING_SEV, "", -1)) begin
: void'(this.log.text("There are no entries in the channel registry"));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while(0);
00251: end
00252: endfunction: get_names_by_channel
00253:
00254:
00255: function string vmm_ms_scenario_gen::get_channel_name(vmm_channel chan);
00256: string s[$];
00257:
00258: if(chan == null) begin
00259:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("channel passed is a null value")));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00260: return "";
00261: end
00262:
00263: this.get_names_by_channel(chan, s);
00264: if (s.size() > 0) return s[0];
00265:
00266: return "";
00267: endfunction: get_channel_name
00268:
00269:
00270: function bit vmm_ms_scenario_gen::unregister_channel(vmm_channel chan);
00271: string s;
00272:
00273: unregister_channel = 0;
00274:
00275: if(chan == null) begin
00276:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("channel passed is a null value")));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00277: return 0;
00278: end
00279:
00280: if(this.channel_registry.first(s)) begin
00281: do begin
00282: if(this.channel_registry[s] == chan) begin
00283: this.channel_registry.delete(s);
00284: unregister_channel = 1;
00285: end
00286: end while(this.channel_registry.next(s));
00287: end
00288: if(unregister_channel==0) begin
00289:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::WARNING_SEV, "", -1)) begin
: void'(this.log.text("There are no entries in the channel registry"));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while(0);
00290: end
00291: endfunction: unregister_channel
00292:
00293:
00294: function vmm_channel vmm_ms_scenario_gen::unregister_channel_by_name(string name);
00295: if(name == "") begin
00296:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("Invalid '%s' string was passed", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00297: return null;
00298: end
00299:
00300: if(!this.channel_registry.exists(name)) begin
00301:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::WARNING_SEV, "", -1)) begin
: void'(this.log.text($psprintf("There is no entry for %s in the channel registry", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while(0);
00302: return null;
00303: end
00304: else begin
00305: unregister_channel_by_name = this.channel_registry[name];
00306: this.channel_registry.delete(name);
00307: end
00308: endfunction: unregister_channel_by_name
00309:
00310:
00311: function vmm_channel vmm_ms_scenario_gen::get_channel(string name);
00312: if (name == "") begin
00313:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("Invalid '%s' string was passed", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00314: return null;
00315: end
00316:
00317: if(!this.channel_registry.exists(name)) begin
00318:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("%s does not have an entry in the channel registry", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00319: return null;
00320: end
00321:
00322: get_channel = this.channel_registry[name];
00323:
00324: // If null, issue a warning
00325: if(get_channel == null)
00326:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::WARNING_SEV, "", -1)) begin
: void'(this.log.text($psprintf("%s has a null channel associated with it in the channel registry", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while(0);
00327: endfunction: get_channel
00328:
00329:
00330: function void vmm_ms_scenario_gen::register_ms_scenario(string name,
00331: vmm_ms_scenario scenario);
00332: int i;
00333:
00334: if(name == "") begin
00335:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("Invalid '%s' string was passed", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00336: return;
00337: end
00338:
00339: if(this.mss_registry.exists(name)) begin
00340:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("%s already has an entry in the multistream scenario registry", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00341: return;
00342: end
00343: if(scenario == null) begin
00344:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("scenario passed for %s is a null value", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00345: return;
00346: end
00347:
00348: // set the context generator for this scenario
00349: scenario.Xset_context_genX(this);
00350: this.mss_registry[name] = scenario;
00351:
00352: // add the ms_scenario to the scenario_set only
00353: // if this scenario was not previously added
00354: foreach(this.scenario_set[i]) begin
00355: if(this.scenario_set[i] == scenario)
00356: return;
00357: end
00358: this.scenario_set.push_back(scenario);
00359: endfunction: register_ms_scenario
00360:
00361:
00362: function bit vmm_ms_scenario_gen::ms_scenario_exists(string name);
00363: if (name == "") begin
00364:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("Invalid '%s' string was passed", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00365: return 0;
00366: end
00367:
00368: return this.mss_registry.exists(name);
00369: endfunction: ms_scenario_exists
00370:
00371:
00372: function void vmm_ms_scenario_gen::replace_ms_scenario(string name,
00373: vmm_ms_scenario scenario);
00374: if(name == "") begin
00375:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("Invalid '%s' string was passed", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00376: return;
00377: end
00378: if(scenario == null) begin
00379:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("scenario passed for %s is a null value", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00380: return;
00381: end
00382:
00383: if(!this.mss_registry.exists(name)) begin
00384:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("cannot replace a unregistered %s entry [use register_ms_scenario]", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00385: return;
00386: end
00387:
00388: scenario.Xset_context_genX(this);
00389:
00390: // remove the scenario from the scenario_set
00391: foreach(this.scenario_set[i]) begin
00392: if(this.scenario_set[i] == this.mss_registry[name]) begin
00393: this.scenario_set.delete(i);
00394: break;
00395: end
00396: end
00397: this.mss_registry[name] = scenario;
00398: foreach(this.scenario_set[i]) begin
00399: if(this.scenario_set[i] == scenario)
00400: return;
00401: end
00402: this.scenario_set.push_back(scenario);
00403: endfunction: replace_ms_scenario
00404:
00405:
00406: function void vmm_ms_scenario_gen::get_all_ms_scenario_names(ref string name[$]);
00407: string s;
00408:
00409: if(this.mss_registry.first(s)) begin
00410: do begin
00411: name.push_back(s);
00412: end while(this.channel_registry.next(s));
00413: end
00414: if(name.size() == 0) begin
00415:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::WARNING_SEV, "", -1)) begin
: void'(this.log.text("There are no entries in the multistream scenario registry"));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while(0);
00416: end
00417: endfunction: get_all_ms_scenario_names
00418:
00419:
00420: function void vmm_ms_scenario_gen::get_names_by_ms_scenario(vmm_ms_scenario scenario,
00421: ref string name[$]);
00422: string s;
00423:
00424: if(scenario == null) begin
00425:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("scenario passed is a null value")));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00426: return;
00427: end
00428:
00429: if(this.mss_registry.first(s)) begin
00430: do begin
00431: if(this.mss_registry[s] == scenario)
00432: name.push_back(s);
00433: end while(this.mss_registry.next(s));
00434: end
00435: if(name.size() == 0) begin
00436:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::WARNING_SEV, "", -1)) begin
: void'(this.log.text("There are no entries in the multistream scenario registry"));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while(0);
00437: end
00438: endfunction: get_names_by_ms_scenario
00439:
00440:
00441: function string vmm_ms_scenario_gen::get_ms_scenario_name(vmm_ms_scenario scenario);
00442: string s[$];
00443:
00444: if(scenario == null) begin
00445:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("scenario passed is a null value")));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00446: return "";
00447: end
00448:
00449: this.get_names_by_ms_scenario(scenario, s);
00450: if (s.size() > 0) return s[0];
00451:
00452: return "";
00453: endfunction: get_ms_scenario_name
00454:
00455:
00456: function int vmm_ms_scenario_gen::get_ms_scenario_index(vmm_ms_scenario scenario);
00457: get_ms_scenario_index = -1;
00458: foreach(this.scenario_set[i]) begin
00459: if(this.scenario_set[i] == scenario) begin
00460: return (get_ms_scenario_index = i);
00461: end
00462: end
00463: if(get_ms_scenario_index == -1) begin
00464:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::WARNING_SEV, "", -1)) begin
: void'(this.log.text($psprintf("Cannot find the index for the ms scenario")));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while(0);
00465: end
00466: endfunction: get_ms_scenario_index
00467:
00468:
00469: function bit vmm_ms_scenario_gen::unregister_ms_scenario(vmm_ms_scenario scenario);
00470: string s;
00471:
00472: unregister_ms_scenario=0;
00473:
00474: if(scenario == null) begin
00475:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("scenario passed is a null value")));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00476: return 0;
00477: end
00478:
00479: if(this.mss_registry.first(s)) begin
00480: do begin
00481: if(this.mss_registry[s] == scenario) begin
00482: this.mss_registry.delete(s);
00483: unregister_ms_scenario=1;
00484: end
00485: end while(this.mss_registry.next(s));
00486: end
00487: if(unregister_ms_scenario == 0) begin
00488:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::WARNING_SEV, "", -1)) begin
: void'(this.log.text("There are no entries in the multistream scenario registry"));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while(0);
00489: end
00490: if(unregister_ms_scenario) begin
00491: foreach(this.scenario_set[i]) begin
00492: if(this.scenario_set[i] == scenario) begin
00493: this.scenario_set.delete(i);
00494: break;
00495: end
00496: end
00497: end
00498: endfunction: unregister_ms_scenario
00499:
00500:
00501: function vmm_ms_scenario vmm_ms_scenario_gen::unregister_ms_scenario_by_name(string name);
00502: if(name == "") begin
00503:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("Invalid '%s' string was passed", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00504: return null;
00505: end
00506:
00507: if(!this.mss_registry.exists(name)) begin
00508:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::WARNING_SEV, "", -1)) begin
: void'(this.log.text($psprintf("There is no entry for %s in the multistream scenario registry", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while(0);
00509: return null;
00510: end
00511: else begin
00512: unregister_ms_scenario_by_name = this.mss_registry[name];
00513: // delete it from the scenario set
00514: foreach(this.scenario_set[i]) begin
00515: if(this.scenario_set[i] == this.mss_registry[name]) begin
00516: this.scenario_set.delete(i);
00517: break;
00518: end
00519: end
00520: this.mss_registry.delete(name);
00521: end
00522: endfunction: unregister_ms_scenario_by_name
00523:
00524:
00525: function vmm_ms_scenario vmm_ms_scenario_gen::get_ms_scenario(string name);
00526: string s = name;
00527:
00528: if(name == "") begin
00529:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("Invalid '%s' string was passed", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00530: return null;
00531: end
00532:
00533: if(!this.mss_registry.exists(name)) begin
00534:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("%s does not have an entry in the multistream scenario registry", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00535: return null;
00536: end
00537: get_ms_scenario=this.mss_registry[name];
00538:
00539: if(get_ms_scenario == null)
00540:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::WARNING_SEV, "", -1)) begin
: void'(this.log.text($psprintf("%s has a null scenario associated with it in the multistream scenario registry", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while(0);
00541: endfunction: get_ms_scenario
00542:
00543:
00544: function void vmm_ms_scenario_gen::register_ms_scenario_gen(string name,
00545: vmm_ms_scenario_gen scenario_gen);
00546:
00547: if(name == "") begin
00548:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("Invalid '%s' string was passed", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00549: return;
00550: end
00551:
00552: if(this.mssg_registry.exists(name)) begin
00553:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("%s already has an entry in the multistream scenario generator registry", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00554: return;
00555: end
00556:
00557: if(scenario_gen == null) begin
00558:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("multistream scenario generator for %s is a null value", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00559: return;
00560: end
00561:
00562: this.mssg_registry[name] = scenario_gen;
00563: endfunction: register_ms_scenario_gen
00564:
00565:
00566: function bit vmm_ms_scenario_gen::ms_scenario_gen_exists(string name);
00567: if(name == "") begin
00568:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("Invalid '%s' string was passed", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00569: return 0;
00570: end
00571:
00572: return this.mssg_registry.exists(name);
00573: endfunction: ms_scenario_gen_exists
00574:
00575:
00576: function void vmm_ms_scenario_gen::replace_ms_scenario_gen(string name,
00577: vmm_ms_scenario_gen scenario_gen);
00578: if(name == "") begin
00579:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("Invalid '%s' string was passed", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00580: return;
00581: end
00582:
00583: if(scenario_gen == null) begin
00584:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("multistream scenario generator for %s is a null value", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00585: return;
00586: end
00587:
00588: if(!this.mssg_registry.exists(name)) begin
00589:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("cannot replace a unregistered %s entry [use register_ms_scenario_gen]", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00590: return;
00591: end
00592:
00593: this.mssg_registry[name] = scenario_gen;
00594: endfunction: replace_ms_scenario_gen
00595:
00596:
00597: function void vmm_ms_scenario_gen::get_all_ms_scenario_gen_names(ref string name[$]);
00598: string s;
00599:
00600: if(this.mssg_registry.first(s)) begin
00601: do begin
00602: name.push_back(s);
00603: end while(this.mssg_registry.next(s));
00604: end
00605: if(name.size() == 0) begin
00606:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::WARNING_SEV, "", -1)) begin
: void'(this.log.text("There are no entries in the multistream scenario generator registry"));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while(0);
00607: end
00608: endfunction: get_all_ms_scenario_gen_names
00609:
00610:
00611: function void vmm_ms_scenario_gen::get_names_by_ms_scenario_gen(vmm_ms_scenario_gen scenario_gen,
00612: ref string name[$]);
00613: string s;
00614:
00615: if(scenario_gen == null) begin
00616:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("multistream scenario generator is a null value")));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00617: return;
00618: end
00619:
00620: if(this.mssg_registry.first(s)) begin
00621: do begin
00622: if(this.mssg_registry[s] == scenario_gen)
00623: name.push_back(s);
00624: end while(this.mssg_registry.next(s));
00625: end
00626: if(name.size() == 0) begin
00627:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::WARNING_SEV, "", -1)) begin
: void'(this.log.text("There are no entries in the multistream scenario generator registry"));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while(0);
00628: end
00629: endfunction: get_names_by_ms_scenario_gen
00630:
00631:
00632: function string vmm_ms_scenario_gen::get_ms_scenario_gen_name(vmm_ms_scenario_gen scenario_gen);
00633: string s[$];
00634:
00635: if(scenario_gen == null) begin
00636:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("multistream scenario generator is a null value")));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00637: return "";
00638: end
00639:
00640: this.get_names_by_ms_scenario_gen(scenario_gen, s);
00641:
00642: if (s.size() > 0) return s[0];
00643:
00644: return "";
00645: endfunction: get_ms_scenario_gen_name
00646:
00647:
00648: function bit vmm_ms_scenario_gen::unregister_ms_scenario_gen(vmm_ms_scenario_gen scenario_gen);
00649: string s;
00650:
00651: unregister_ms_scenario_gen=0;
00652:
00653: if(scenario_gen == null) begin
00654:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("multistream scenario generator is a null value")));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00655: return 0;
00656: end
00657:
00658: if(this.mssg_registry.first(s)) begin
00659: do begin
00660: if(this.mssg_registry[s] == scenario_gen) begin
00661: this.mssg_registry.delete(s);
00662: unregister_ms_scenario_gen=1;
00663: end
00664: end while(this.mssg_registry.next(s));
00665: end
00666: if(unregister_ms_scenario_gen==0) begin
00667:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::WARNING_SEV, "", -1)) begin
: void'(this.log.text("There are no entries in the multistream scenario generator registry"));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while(0);
00668: end
00669: endfunction: unregister_ms_scenario_gen
00670:
00671:
00672: function vmm_ms_scenario_gen vmm_ms_scenario_gen::unregister_ms_scenario_gen_by_name(string name);
00673: if(name == "") begin
00674:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("Invalid '%s' string was passed", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00675: return null;
00676: end
00677:
00678: if(!this.mssg_registry.exists(name)) begin
00679:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::WARNING_SEV, "", -1)) begin
: void'(this.log.text($psprintf("There is no entry for %s in the multistream scenario generator registry", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while(0);
00680: return null;
00681: end
00682: else begin
00683: unregister_ms_scenario_gen_by_name = this.mssg_registry[name];
00684: this.mssg_registry.delete(name);
00685: end
00686: endfunction: unregister_ms_scenario_gen_by_name
00687:
00688:
00689: function vmm_ms_scenario_gen vmm_ms_scenario_gen::get_ms_scenario_gen(string name);
00690: if(name == "") begin
00691:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("Invalid '%s' string was passed", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00692: return null;
00693: end
00694:
00695: if(!this.mssg_registry.exists(name)) begin
00696:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::ERROR_SEV, "", -1)) begin
: void'(this.log.text($psprintf("%s does not have an entry in the multistream scenario generator registry", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00697: return null;
00698: end
00699: get_ms_scenario_gen = this.mssg_registry[name];
00700: if(get_ms_scenario_gen == null)
00701:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::WARNING_SEV, "", -1)) begin
: void'(this.log.text($psprintf("%s has a null scenario generator associated with it in the multisteam scenario generator registry", name)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while(0);
00702: endfunction: get_ms_scenario_gen
00703:
00704:
00705: task vmm_ms_scenario_gen::main();
00706: vmm_ms_scenario the_scenario;
00707: int n_insts;
00708:
00709: fork
00710: super.main();
00711: join_none
00712:
00713: if(this.scenario_set.size() == 0) begin
00714: // do not start the main routine
00715: return;
00716: end
00717:
00718: while( (this.stop_after_n_insts <=0 || this.inst_count < this.stop_after_n_insts)
00719: && (this.stop_after_n_scenarios <= 0 || this.scenario_count < this.stop_after_n_scenarios)) begin
00720: this.wait_if_stopped();
00721:
00722: this.select_scenario.stream_id = this.stream_id;
00723: this.select_scenario.scenario_id = this.scenario_count;
00724: this.select_scenario.n_scenarios = this.scenario_set.size();
00725: this.select_scenario.scenario_set = this.scenario_set;
00726: if(this.select_scenario.last_selected.size() == 0)
00727: this.select_scenario.next_in_set = 0;
00728: else
00729: this.select_scenario.next_in_set = ((this.select_scenario.last_selected[$] + 1) % this.scenario_set.size());
00730: if(!this.select_scenario.randomize()) begin
00731:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::FATAL_SEV, "", -1)) begin
: void'(this.log.text("Cannot select multistream scenario descriptor"));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00732: continue;
00733: end
00734:
00735: if(this.select_scenario.select < 0 ||
00736: this.select_scenario.select >= this.scenario_set.size()) begin
00737:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::FATAL_SEV, "", -1)) begin
: void'(this.log.text($psprintf("Select scenario #%0d is not within available set 0-%0d",
: this.select_scenario.select, this.scenario_set.size()-1)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00739: continue;
00740: end
00741:
00742: this.select_scenario.last_selected.push_back(this.select_scenario.select);
00743: while(this.select_scenario.last_selected.size() > 10) begin
00744: void'(this.select_scenario.last_selected.pop_front());
00745: end
00746:
00747: the_scenario = this.scenario_set[this.select_scenario.select];
00748: if(the_scenario == null) begin
00749:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::FATAL_SEV, "", -1)) begin
: void'(this.log.text($psprintf("Selected scenario #%0d does not exist",
: this.select_scenario.select)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00751: continue;
00752: end
00753:
00754: the_scenario.stream_id = this.stream_id;
00755: the_scenario.scenario_id = this.scenario_count;
00756:
00757:
:
: do foreach (this.callbacks[vmm_i]) begin
: vmm_ms_scenario_gen_callbacks cb;
: if (!$cast(cb, this.callbacks[vmm_i])) continue;
:
: cb.pre_scenario_randomize(this, the_scenario);
: end while (0);
00758: if(the_scenario == null) continue;
00759:
00760: if(!the_scenario.randomize()) begin
00761:
: do
: /* synopsys translate_off */
: if (this.log.start_msg(vmm_log::FAILURE_TYP, vmm_log::FATAL_SEV, "", -1)) begin
: void'(this.log.text($psprintf("Cannot randomize scenario descriptor #%0d",
: this.select_scenario.select)));
: this.log.end_msg();
: end
: /* synopsys translate_on */
: while (0);
00763: continue;
00764: end
00765:
00766: this.scenario_count++;
00767: this.notify.indicate(GENERATED, the_scenario);
00768: n_insts=0;
00769: the_scenario.execute(n_insts);
00770: this.inst_count += n_insts;
00771: end
00772:
00773: this.notify.indicate(DONE);
00774: this.notify.indicate(XACTOR_STOPPED);
00775: this.notify.indicate(XACTOR_IDLE);
00776: this.notify.reset(XACTOR_BUSY);
00777: endtask: main