00001 // $Id: ovm__sequence_8svh-source.html,v 1.1 2008/10/07 21:54:46 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_SEQUENCE_SVH 00023 `define OVM_SEQUENCE_SVH 00024 00025 00026 typedef class ovm_sequencer; 00027 typedef class ovm_virtual_sequencer; 00028 00029 //----------------------------------------------------------------------------- 00030 // 00031 // CLASS: ovm_sequence 00032 // 00033 //----------------------------------------------------------------------------- 00034 00035 class ovm_sequence extends ovm_sequence_item; 00036 00037 // Constructor 00038 extern function new(string name="ovm_sequence", 00039 ovm_sequencer_base sequencer=null, 00040 ovm_sequence parent_seq=null); 00041 00042 // handle for called sequencer methods 00043 ovm_sequencer b_sequencer; 00044 00045 // method to cast m_sequencer into b_sequencer 00046 extern function void m_set_b_sequencer(); 00047 00048 // id counters 00049 local static int g_id = 0; 00050 local int id; 00051 00052 // get the id 00053 extern function int get_id(); 00054 00055 // events for monitoring progress from outside 00056 event started; 00057 event ended; 00058 00059 // bit to detect if is_relevant()/wait_for_relevant() is changed 00060 local bit is_rel_default; 00061 local bit wait_rel_default; 00062 00063 //invoked by ovm_sequence::start_sequence() 00064 extern virtual task pre_body(); 00065 00066 //invoked by ovm_sequence::start_sequence() and the DO macro. 00067 extern virtual task body(); 00068 00069 //invoked by ovm_sequence::start_sequence() 00070 extern virtual task post_body(); 00071 00072 //invoked by the sequence and sequence item macros after a sequence is 00073 //selected to execute, but prior to the randomization of the do action. 00074 extern virtual task pre_do(bit is_item); 00075 00076 //invoked by the sequence and sequence item macros after randomization of 00077 //the action. 00078 extern virtual function void mid_do(ovm_sequence_item this_item); 00079 00080 //Called by sequence and sequence item. Invoked after the sequencer has 00081 // triggered item_done. 00082 extern virtual function void post_do(ovm_sequence_item this_item); 00083 00084 //actions out of its action queue. 00085 extern virtual function bit is_relevant(); 00086 00087 //task to re-evaluate when sequence becomes relevant 00088 extern virtual task wait_for_relevant(); 00089 00090 //A built in function returning a "1" for ovm_sequence types. 00091 extern virtual function int is_item(); 00092 00093 //invoked by a user-defined sequence to gain sole access to a sequencer 00094 extern task grab(ovm_sequencer sequencer = null); 00095 00096 //invoked by a user-defined sequence to release sole access to a sequencer 00097 extern function void ungrab(ovm_sequencer sequencer = null); 00098 00099 //allocate a ovm_sequence_item object 00100 extern function ovm_sequence_item create_item (ovm_sequence_item type_var, 00101 ovm_sequencer_base l_sequencer); 00102 00103 //register and begin processing of ovm_sequence_item objects 00104 //call sync() & pre_do() of parent ovm_sequence for a sequence_item object 00105 //or body() for a ovm_sequence object 00106 extern task start_item(ovm_sequence_item type_var); 00107 00108 //Called by sequence and sequence item macros. Calls ovm_sequencer::sync and 00109 //waits for acknoledgement to unblock the do invocation. 00110 extern task m_sync(ovm_sequence_item item); 00111 00112 //Called by sequence and sequence item macros. Places generated item in 00113 //a sequencers "last" buffer and triggers sequencer.item_ready with the 00114 //generated item. 00115 extern task m_post_sync(ovm_sequence_item item); 00116 00117 //A user definable function which is evaluated by the sequencer when selecting 00118 //complete item processing 00119 extern task finish_item(ovm_sequence_item type_var); 00120 00121 //used as an identifier in constraints for a specific type 00122 rand int unsigned seq_kind; 00123 00124 // For user random selection. This exludes the exhaustive and 00125 // random sequences. Also handles the case of no sequencer attached, or 00126 // virtual sequencer which has no defaults except exahaustive and random. 00127 // Note that seq id 2 is simple_sequence for normal sequences. 00128 constraint pick_sequence { 00129 (num_sequences() <= 2) || (seq_kind >= 2); 00130 (seq_kind < num_sequences()) || (seq_kind == 0); } 00131 00132 // This function is useful for constraining against the size of the sequence queue 00133 function int unsigned num_sequences; 00134 if(b_sequencer == null) return 0; 00135 else return b_sequencer.sequences.size(); 00136 endfunction 00137 00138 // Returns a new sequence object given its unique kind (integer id) 00139 extern function ovm_sequence get_sequence(int req_kind); 00140 00141 //Used to get an identifier of the sequence name from the parent sequencer's 00142 //sequence library. Calls ovm_sequencer::get_kind(string type_name); 00143 //extern function int unsigned get_kind(string type_name); 00144 extern function int get_seq_kind(string type_name); 00145 00146 //Calls ovm_sequence::do_sequence_kind(). 00147 extern task do_sequence_kind(int unsigned req_kind); 00148 00149 //invoked by a user to determine block status regarding grab() invocation 00150 extern function bit is_blocked(); 00151 00152 //returned by is_blocked() and set/cleared by m_set_is_blocked() 00153 local bit m_block_status; 00154 00155 //invoked by a sequencer to set block status regarding grab() invocation 00156 extern function void m_set_is_blocked(bit block_status); 00157 00158 //disable a sequences body() 00159 extern function void stop(); 00160 00161 // pre_apply 00162 extern virtual task pre_apply(); 00163 00164 // mid_apply 00165 extern virtual task mid_apply(); 00166 00167 // post_apply 00168 extern virtual task post_apply(); 00169 00170 //apply an item 00171 extern task apply(ovm_sequence_item req, output ovm_sequence_item rsp); 00172 00173 // start 00174 extern task start(ovm_sequencer_base sequencer, ovm_sequence parent_seq = 00175 null); 00176 00177 endclass: ovm_sequence 00178 00179 `endif // OVM_SEQUENCE_SVH
![]() 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 |