VMM OpenSource - sv/std_lib/vmm_subenv.sv

sv/std_lib/vmm_subenv.sv expanded source

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_subenv::new(string         name,
00024                          string         inst,
00025                          `VMM_CONSENSUS end_test
00026                          `VMM_SUBENV_BASE_NEW_EXTERN_ARGS);
00027 `ifdef VMM_SUBENV_BASE_NEW_CALL
00028    super.new(`VMM_SUBENV_BASE_NEW_CALL);
00029 `endif
00030    this.log = new(name, inst);
00031    this.end_test = end_test;
00032 endfunction: new
00033 
00034 
00035 function string vmm_subenv::psdisplay(string prefix = "");
00036    $sformat(psdisplay, "%sSub-Environment %s(%s): ", prefix,
00037             this.log.get_name(), this.log.get_instance());
00038    return psdisplay;
00039 endfunction
00040 
00041 
00042 function vmm_consensus vmm_subenv::get_consensus();
00043    return this.end_test;
00044 endfunction
00045 
00046 
00047 function void vmm_subenv:: configured();
00048    this.state = CONFIGURED;
00049 endfunction: configured
00050 
00051 
00052 task vmm_subenv::start();
00053    if (this.state == NEWED) begin
00054       `vmm_error(this.log, "Sub-environment started before being configured");
00055    end
00056    this.state = STARTED;
00057 endtask: start
00058 
00059 
00060 task vmm_subenv::stop();
00061    if (this.state != STARTED) begin
00062       `vmm_warning(this.log, "Attempting to stop a sub-environment that has not been started");
00063    end
00064    this.state = STOPPED;
00065 endtask: stop
00066 
00067 
00068 task vmm_subenv::reset(vmm_env::restart_e kind = vmm_env::FIRM);
00069    this.state = STOPPED;
00070 endtask: reset
00071 
00072 
00073 task vmm_subenv::cleanup();
00074    if (this.state != STOPPED) begin
00075       `vmm_warning(this.log, "Attempting to clean-up a sub-environment that has not been stopped");
00076    end
00077    this.state = CLEANED;
00078 endtask: cleanup
00079    
00080 
00081 function void vmm_subenv::report();
00082 endfunction: report
00083 
00084 
00085 function string vmm_subenv::do_psdisplay(string prefix = "");
00086    this.__vmm_done_user = 0;
00087 endfunction
00088 
00089 
00090 task vmm_subenv::do_vote();
00091    this.__vmm_done_user = 0;
00092 endtask
00093 
00094 
00095 task vmm_subenv::do_start();
00096    this.__vmm_done_user = 0;
00097 endtask
00098 
00099 
00100 task vmm_subenv::do_stop();
00101    this.__vmm_done_user = 0;
00102 endtask
00103 
00104 
00105 task vmm_subenv::do_reset(vmm_env::restart_e kind);
00106    this.__vmm_done_user = 0;
00107 endtask