ovm_env.svh

Go to the documentation of this file.
00001 // $Id: a00227.html,v 1.1 2009/01/07 19:30:00 alex.marin Exp $
00002 //------------------------------------------------------------------------------
00003 //   Copyright 2007-2008 Mentor Graphics Corporation
00004 //   Copyright 2007-2008 Cadence Design Systems, Inc.
00005 //   All Rights Reserved Worldwide
00006 //
00007 //   Licensed under the Apache License, Version 2.0 (the
00008 //   "License"); you may not use this file except in
00009 //   compliance with the License.  You may obtain a copy of
00010 //   the License at
00011 //
00012 //       http://www.apache.org/licenses/LICENSE-2.0
00013 //
00014 //   Unless required by applicable law or agreed to in
00015 //   writing, software distributed under the License is
00016 
00017 //   CONDITIONS OF ANY KIND, either express or implied.  See
00018 //   the License for the specific language governing
00019 //   permissions and limitations under the License.
00020 //------------------------------------------------------------------------------
00021 
00022 
00023 //------------------------------------------------------------------------------
00024 //
00025 // CLASS: ovm_env
00026 //
00027 //------------------------------------------------------------------------------
00028 // The ovm_env component is intended to be a container of components that
00029 // together comprise a complete environment. The environment may
00030 // initially consist of the entire testbench. Later, it can be reused as
00031 // a child-env of even larger system-level environments.
00032 //
00033 // AVM compatibility (do_test) mode: (deprecated, do not use in new code)
00034 //
00035 //   The top-most ovm_env's run phase has special semantics when
00036 //   simulation is started via 'do_test', i.e. AVM backward compatibility
00037 //   mode. When the top env's run task returns, an automatic global_stop_
00038 //   request is issued, thus ending the run phase. When not in 'do_test'
00039 //   mode, the run phase behaves like any other- when it returns, it does
00040 //   signify the end of the phase. Rather, an explicit global_stop_request
00041 //   must be issued to end the phase. 
00042 //------------------------------------------------------------------------------
00043 
00044 virtual class ovm_env extends ovm_component;
00045 
00046   function new (string name="env", ovm_component parent=null);
00047     super.new(name,parent);
00048   endfunction
00049 
00050   const static string type_name = "ovm_env";
00051 
00052   virtual function string get_type_name ();
00053     return type_name;
00054   endfunction
00055 
00056   bit m_do_test_mode = 0;
00057 
00058   task do_task_phase (ovm_phase phase);
00059   
00060     // Top-level env has special run-phase semantic when in 'do_test' mode.
00061     // In all other cases, ovm_env's run phase behaves like any other.
00062 
00063     m_curr_phase = phase;
00064 
00065     if (!(m_do_test_mode && phase == run_ph && m_parent == ovm_top)) begin
00066       super.do_task_phase(phase);
00067       return;
00068     end
00069 
00070     // Delay 1 delta to ensure this env's process starts last, thus
00071     // allowing sub-tree of components to initialize before this
00072     // run-task starts.
00073 
00074     #0;
00075 
00076     // QUESTA
00077     `ifndef INCA  
00078 
00079        m_phase_process = process::self();
00080        phase.call_task(this);
00081 
00082     // INCISIVE
00083     `else
00084 
00085        // isolate inner process so it can be safely killed via disable fork,
00086        fork
00087        begin
00088          fork : task_phase
00089            phase.call_task(this);
00090            @m_kill_request;
00091          join_any
00092          disable task_phase;
00093        end
00094        join
00095 
00096     `endif
00097 
00098     ovm_top.stop_request(); // ends run phase
00099 
00100   endtask
00101 
00102   task do_test();
00103    ovm_report_warning("deprecated", {"do_test mode is deprecated. Use ",
00104                      "run_test to start simulation phasing, and be ",
00105                      "sure to call global_stop_request() to end the ",
00106                      "run phase and any other task-based phase."});
00107     m_do_test_mode=1;
00108     ovm_top.run_global_phase();
00109     report_summarize();
00110   endtask
00111 
00112   task run_test(string name="");
00113     ovm_top.run_test(name);
00114   endtask
00115 
00116 endclass
00117 
00118 

Intelligent Design Verification
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
Doxygen Version: 1.5.5
Wed Jan 7 19:27:17 2009
Find a documentation bug? Report bugs to: bugs.intelligentdv.com Project: DoxygenFilterSV