00001 // $Id: ovm__event_8svh-source.html,v 1.1 2008/10/07 21:54:28 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 `ifndef OVM_EVENT_SVH 00023 `define OVM_EVENT_SVH 00024 00025 typedef class ovm_object; 00026 typedef class ovm_event; 00027 00028 //------------------------------------------------------------------------------ 00029 // 00030 // CLASS: ovm_event_callback 00031 // 00032 // callbacks for ovm_event objects- users should inherit and override one or 00033 // more of the methods 00034 // 00035 //------------------------------------------------------------------------------ 00036 00037 // virtual // copy, clone, set_name 00038 class ovm_event_callback extends ovm_object; 00039 function ovm_object create (string name=""); 00040 ovm_event_callback v; v=new(name); return v; 00041 endfunction 00042 function new (string name=""); super.new(name); endfunction 00043 extern virtual function bit pre_trigger (ovm_event e, ovm_object data=null); 00044 extern virtual function void post_trigger (ovm_event e, ovm_object data=null); 00045 endclass 00046 00047 00048 //------------------------------------------------------------------------------ 00049 // 00050 // CLASS: ovm_event 00051 // 00052 //------------------------------------------------------------------------------ 00053 00054 class ovm_event extends ovm_object; 00055 function ovm_object create (string name=""); 00056 ovm_event v; v=new(name); return v; 00057 endfunction 00058 extern function new (string name=""); 00059 // waiting 00060 extern virtual task wait_on (bit delta=0); 00061 extern virtual task wait_off (bit delta=0); 00062 extern virtual task wait_trigger (); 00063 extern virtual task wait_ptrigger (); 00064 extern virtual task wait_trigger_data (output ovm_object data); 00065 extern virtual task wait_ptrigger_data(output ovm_object data); 00066 00067 // triggering 00068 extern virtual function void trigger (ovm_object data=null); 00069 extern virtual function ovm_object get_trigger_data (); 00070 extern virtual function time get_trigger_time (); 00071 00072 // state 00073 extern virtual function bit is_on (); 00074 extern virtual function bit is_off (); 00075 extern virtual function void reset (bit wakeup=0); 00076 00077 // callbacks 00078 extern virtual function void add_callback (ovm_event_callback cb, 00079 bit append=1); 00080 extern virtual function void delete_callback (ovm_event_callback cb); 00081 00082 // waiters list 00083 extern virtual function void cancel (); 00084 extern virtual function int get_num_waiters (); 00085 00086 00087 local event m_event; 00088 local int num_waiters; 00089 local bit on; 00090 local time trigger_time=0; 00091 local ovm_object trigger_data; 00092 local ovm_event_callback callbacks[$]; 00093 00094 extern virtual function void do_print (ovm_printer printer); 00095 extern virtual function void do_copy (ovm_object rhs); 00096 00097 endclass 00098 00099 00100 00101 //------------------------------------------------------------------------------ 00102 // 00103 // CLASS: ovm_event_pool 00104 // 00105 //------------------------------------------------------------------------------ 00106 00107 class ovm_event_pool extends ovm_object; 00108 function ovm_object create (string name=""); 00109 ovm_event_pool v; v=new(name); return v; 00110 endfunction 00111 00112 extern function new (string name=""); 00113 00114 extern static function ovm_event_pool get_global_pool (); 00115 00116 extern virtual function ovm_event get (string name); 00117 00118 extern virtual function int num (); 00119 extern virtual function void delete (string name); 00120 extern virtual function int exists (string name); 00121 extern virtual function int first (`ref string name); 00122 extern virtual function int last (`ref string name); 00123 extern virtual function int next (`ref string name); 00124 extern virtual function int prev (`ref string name); 00125 00126 static local ovm_event_pool m_global_pool; 00127 local ovm_event pool[string]; 00128 00129 extern virtual function void do_print (ovm_printer printer); 00130 extern virtual function void do_copy (ovm_object rhs); 00131 00132 endclass 00133 00134 00135 00136 //----------------------------------------------------------------------------- 00137 // 00138 // CLASS: ovm_barrier 00139 // 00140 //----------------------------------------------------------------------------- 00141 00142 class ovm_barrier extends ovm_object; 00143 function ovm_object create (string name=""); 00144 ovm_barrier v; v=new(name); return v; 00145 endfunction 00146 00147 extern function new (string name="", 00148 int threshold=0); 00149 00150 extern virtual task wait_for (); 00151 extern virtual function void reset (bit wakeup=1); 00152 extern virtual function void set_auto_reset (bit value=1); 00153 extern virtual function void set_threshold (int threshold); 00154 extern virtual function int get_threshold (); 00155 extern virtual function int get_num_waiters (); 00156 extern virtual function void cancel (); 00157 00158 // private 00159 extern local function bit reached_threshold (); 00160 00161 local int threshold; 00162 local int num_waiters; 00163 local bit at_threshold; 00164 local bit auto_reset; 00165 local ovm_event m_event; 00166 00167 extern local task m_trigger(); 00168 00169 extern virtual function void do_print (ovm_printer printer); 00170 extern virtual function void do_copy (ovm_object rhs); 00171 00172 endclass 00173 00174 00175 00176 //------------------------------------------------------------------------------ 00177 // 00178 // CLASS: ovm_barrier_pool 00179 // 00180 //------------------------------------------------------------------------------ 00181 00182 class ovm_barrier_pool extends ovm_object; 00183 function ovm_object create (string name=""); 00184 ovm_barrier_pool v; v=new(name); return v; 00185 endfunction 00186 00187 extern function new (string name=""); 00188 00189 extern static function ovm_barrier_pool get_global_pool (); 00190 00191 extern virtual function ovm_barrier get (string name); 00192 extern virtual function int num (); 00193 extern virtual function void delete (string name); 00194 extern virtual function int exists (string name); 00195 extern virtual function int first (`ref string name); 00196 extern virtual function int last (`ref string name); 00197 extern virtual function int next (`ref string name); 00198 extern virtual function int prev (`ref string name); 00199 00200 static local ovm_barrier_pool m_global_pool; 00201 local ovm_barrier pool[string]; 00202 00203 extern virtual function void do_print (ovm_printer printer); 00204 extern virtual function void do_copy (ovm_object rhs); 00205 00206 endclass 00207 00208 00209 `endif // OVM_EVENT_SVH 00210
![]() 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 Version: 1.4.6 Mon Sep 29 14:20:12 2008 |