ovm_sequencer.svh

Go to the documentation of this file.
00001 // $Id: ovm__sequencer_8svh-source.html,v 1.1 2008/10/07 21:54:30 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_SEQUENCER_SVH
00023 `define OVM_SEQUENCER_SVH
00024 
00025 `include "methodology/ovm_meth_defines.svh"
00026 
00027 typedef class ovm_sequencer;
00028 typedef class ovm_seq_item_prod_if;
00029 
00030 
00031 //------------------------------------------------------------------------------
00032 //
00033 // CLASS: ovm_seq_item_cons_if
00034 //
00035 //------------------------------------------------------------------------------
00036 
00037 class ovm_seq_item_cons_if extends ovm_component;
00038 
00039   // sequencer type variable to hold parent
00040   ovm_sequencer parent_as_seqr;
00041 
00042   // component type variable to hold consumer that the interface is connected to
00043   ovm_component consumer;
00044 
00045   // constructor
00046   extern function new (string name="", ovm_component parent = null);
00047 
00048   // data functions
00049   extern function void do_print (ovm_printer printer);
00050 
00051   // create for factory usage
00052   extern function ovm_object create (string name="");
00053 
00054   // implement get_type_name
00055   extern virtual function string get_type_name();
00056 
00057   // connection method
00058   extern function void connect_if(ovm_seq_item_prod_if item_prod_if);
00059 
00060   // Macro to enable factory creation
00061   `ovm_component_registry(ovm_seq_item_cons_if, ovm_seq_item_cons_if)
00062 
00063 endclass
00064 
00065 
00066 //------------------------------------------------------------------------------
00067 //
00068 // CLASS: ovm_sequencer
00069 //
00070 //------------------------------------------------------------------------------
00071 
00072 class ovm_sequencer extends ovm_sequencer_base;
00073 
00074   // sequence item consumer interface
00075   ovm_seq_item_cons_if seq_item_cons_if;
00076 
00077   // Constructor
00078   extern function new (string name, ovm_component parent);
00079 
00080   // get_type_name implementation
00081   extern function string get_type_name();
00082 
00083   // Defines how the sequencer interacts with sequencer: pull (default), or push
00084   protected bit pull_mode = 1;               
00085 
00086   // events used by the sequencer for communication with others
00087   // driver triggers when item is done
00088   ovm_event      item_done;     
00089 
00090   // sequence triggers when item available
00091   ovm_event      item_ready;    
00092 
00093   //Used for setting the maximum depth inside random sequences. 
00094   //(Beyond that depth, random creates only simple sequences.)
00095   int unsigned max_random_depth = 4;
00096 
00097   // used to place actions (functionaly this sequencers action queue)
00098   protected ovm_sequence m_action_q[$];
00099 
00100   // used to place an event of the parent seq process for acknowledgement
00101   protected ovm_event m_action_e[$];
00102 
00103   // emitted by ovm_sequencer::sync when a "do(item)" macro is executed
00104   local event m_eval_queue_e;
00105   local event m_ungrab_e;
00106 
00107   // task to determine when to evaluate the action queue
00108   extern task m_wait_for_activate();
00109 
00110   // task to support single item from outside
00111   extern task execute_item(input ovm_sequence_item item, ovm_sequence seq =
00112     null);
00113 
00114   // task to support single item from outside
00115   extern task apply(input ovm_sequence_item item, ovm_sequence seq = null);
00116 
00117   //queue of grabbing sequences
00118   local ovm_sequence m_grabbers[$];
00119 
00120   //accessor methods for sequences using local ovm_events
00121   extern function void m_item_ready_trigger( input ovm_object m_item=null);
00122 
00123   extern task item_done_wait_trigger_data(output ovm_sequence_item item);
00124 
00125   // Called by sequences to register a request to process an action
00126   extern virtual task m_sequencer_sync(input string item_name, 
00127     ovm_sequence parent_seq, ovm_event ack_process);
00128 
00129   // buffer used by sequences to store the currently generated item
00130   protected ovm_sequence_item m_last_queue[$];
00131 
00132   // variable to control the depth of the last queue
00133   protected int unsigned num_last_items = 1;
00134 
00135   // Set the item history buffer size.
00136   extern function void set_num_last_items (int unsigned max);
00137 
00138   // method that returns the item out of the last queue.  this method returns
00139   // the non specific type.
00140   extern function ovm_sequence_item last(int unsigned n);
00141 
00142   // Called by a sequence to place a sequence into the "last" buffer
00143   extern function void m_last_push_front(ovm_sequence_item item);
00144 
00145   // Called by run_forever, processes the action queue
00146   extern protected function bit process_queue(output int index);
00147 
00148   //invoked when a user sequence wants to gain sole access
00149   extern virtual task grab(ovm_sequence seq);
00150 
00151   //invoked when a user sequence releases sole access
00152   extern virtual function void ungrab(ovm_sequence seq);
00153 
00154   //used by m_grab to block sequences not associated with the current grabber
00155   extern local virtual task m_block_grabber(ovm_sequence seq);
00156 
00157   //called by m_grab(), returns true if seq qualifies as grabber
00158   extern local function bit m_is_current_grabber(ovm_sequence seq);
00159 
00160   //called by user to determine which sequence (if any) has the sequencer 
00161   //grabbed 
00162   extern function ovm_sequence current_grabber();
00163 
00164   //called by user to determine which sequence (if any) has the sequencer 
00165   //grabbed
00166   extern function bit is_grabbed();
00167 
00168   // Used by the sequencer in pull mode to retrieve randomized items from 
00169   // sequences.
00170   extern task get_next_item (output ovm_sequence_item item);
00171 
00172   // Used by the sequencer in pull mode to retrieve randomized items from 
00173   // sequences.
00174   extern task try_next_item (output ovm_sequence_item item);
00175 
00176   // wait delta cycles (by default) to see if an item is provided by a sequence
00177   // otherwise try_next_item() returns null
00178   extern virtual task wait_for_sequences ();
00179 
00180   //invoked by the sequencer after processing of a received item is completed.
00181   //optionally, provides the processed item
00182   extern function void item_done_trigger(ovm_sequence_item item=null);
00183 
00184   //invoked by the sequencer to determine if a relevant action is available
00185   extern function bit has_do_available();
00186 
00187   //Implement data functions
00188   extern function void do_copy (ovm_object rhs);
00189   extern function bit  do_compare (ovm_object rhs, ovm_comparer comparer);
00190   extern function void do_print (ovm_printer printer);
00191   extern function void do_record (ovm_recorder recorder);
00192 
00193 endclass: ovm_sequencer
00194 
00195 
00196 `endif // OVM_SEQUENCER_SVH
00197 

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