ovm_env.svh

Go to the documentation of this file.
00001 // $Id: ovm__env_8svh-source.html,v 1.1 2008/10/07 21:54:58 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 //   distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
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_threaded_component;
00045 
00046   extern function new (string name="env", ovm_component parent=null);
00047 
00048   extern virtual function string get_type_name ();
00049 
00050   extern virtual task run ();
00051 
00052   /*** DEPRECATED - Do not use in new code.  Convert code when appropriate ***/
00053   extern virtual task do_task_phase (ovm_phase phase);
00054   extern virtual task do_test ();
00055   extern static task run_test(string name="");
00056   protected bit m_do_test_mode = 0;
00057 
00058 endclass
00059 
00060 
00061 
00062 //------------------------------------------------------------------------------
00063 //
00064 // IMPLEMENTATION
00065 //
00066 //------------------------------------------------------------------------------
00067 
00068 // new
00069 // ---
00070 
00071 function ovm_env::new (string name="env", ovm_component parent=null);
00072   super.new(name,parent);
00073 endfunction
00074 
00075 
00076 // get_type_name
00077 // -------------
00078 
00079 function string ovm_env::get_type_name ();
00080   return "ovm_env";
00081 endfunction
00082 
00083 
00084 // run
00085 // ---
00086 
00087 task ovm_env::run();
00088   return; 
00089 endtask
00090 
00091 
00092 // do_phase (deprecated)
00093 // --------
00094 
00095 task ovm_env::do_task_phase (ovm_phase phase);
00096   
00097   // Top-level env has special run-phase semantic when in 'do_test' mode.
00098   // In all other cases, ovm_env's run phase behaves like any other.
00099 
00100   m_curr_phase = phase;
00101 
00102   if (!(m_do_test_mode && phase == run_ph && m_parent == ovm_top)) begin
00103     super.do_task_phase(phase);
00104     return;
00105   end
00106 
00107   // Delay 1 delta to ensure this env's process starts last, thus
00108   // allowing sub-tree of components to initialize before this
00109   // run-task starts.
00110 
00111   #0;
00112 
00113   // QUESTA
00114   `ifndef INCA  
00115 
00116      m_phase_process = process::self();
00117      phase.call_task(this);
00118 
00119   // INCISIVE
00120   `else
00121 
00122      // isolate inner process so it can be safely killed via disable fork,
00123      fork
00124      begin
00125        fork : task_phase
00126          phase.call_task(this);
00127          @m_kill_request;
00128        join_any
00129        disable task_phase;
00130      end
00131      join
00132 
00133   `endif
00134 
00135   ovm_top.stop_request(); // ends run phase
00136 
00137 endtask
00138 
00139 
00140 // do_test (deprecated)
00141 // -------
00142 
00143 task ovm_env::do_test();
00144   m_do_test_mode=1;
00145   report_header();
00146   ovm_top.run_global_phase();
00147   report_summarize();
00148 endtask
00149 
00150 
00151 // run_test (deprecated)
00152 // --------
00153 
00154 task ovm_env::run_test(string name="");
00155   ovm_top.run_test(name);
00156 endtask

Intelligent Design Verification
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
Doxygen Version: 1.4.6
Mon Sep 29 14:20:12 2008
Find a documentation bug? Report bugs to: bugs.intelligentdv.com Project: DoxygenFilterSV