ovm_sequencer_base.svh

Go to the documentation of this file.
00001 // $Id: ovm__sequencer__base_8svh-source.html,v 1.1 2008/10/07 21:54:56 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_BASE_SVH
00023 `define OVM_SEQUENCER_BASE_SVH
00024 
00025 `include "methodology/ovm_meth_defines.svh"
00026 
00027 typedef class ovm_sequence;
00028 typedef class ovm_sequencer_base;
00029 typedef class ovm_seq_cons_if;
00030 
00031 
00032 //------------------------------------------------------------------------------
00033 //
00034 // CLASS: ovm_seq_prod_if
00035 //
00036 //------------------------------------------------------------------------------
00037 
00038 class ovm_seq_prod_if extends ovm_component;
00039 
00040   // variable to hold the parent a ovm_sequencer_base type
00041   ovm_sequencer_base parent_as_seqr;
00042 
00043   // variable to hold sequence producer as an ovm_component type
00044   ovm_component producer;
00045 
00046   // constructor
00047   extern function new (string name="", ovm_component parent = null);
00048 
00049   // data method do_print
00050   extern function void do_print (ovm_printer printer);
00051 
00052   // polymorphic create method
00053   extern function ovm_object create (string name="");
00054 
00055   // return proper type name string
00056   extern virtual function string get_type_name();
00057 
00058   // connect interface method for producer to consumer
00059   extern function void connect_if(ovm_seq_cons_if vseq_if);
00060 
00061   // Macro to enable factory creation
00062   `ovm_component_registry(ovm_seq_prod_if, ovm_seq_prod_if)
00063 
00064 endclass
00065 
00066 
00067 //------------------------------------------------------------------------------
00068 //
00069 // CLASS: ovm_sequencer_base
00070 //
00071 //------------------------------------------------------------------------------
00072 
00073 virtual class ovm_sequencer_base extends ovm_threaded_component;
00074 
00075   // sequence producer interface (virtual sequencer connection)
00076   ovm_seq_prod_if seq_prod_if;
00077 
00078   // This property defines which sequence will be auto-started (default=main).
00079   protected string default_sequence = "ovm_random_sequence";               
00080 
00081   // The sequeunce aray holds the type names of the sequence types registered
00082   // to this sequencer; the factory will actually create the instances on demand.
00083   string sequences[$];
00084 
00085   // The ids array associates each sequence entry (above) with an integer
00086   // number. This allows sequences to be randomly selected by randomizing
00087   // a number between 0 and the sequences array size.
00088   protected int sequence_ids[string];
00089 
00090   //set main and random sequence count variable if != -1
00091   //also accessed by ovm_main/random_sequence 
00092   int count = -1;
00093 
00094   // testing fields
00095   int m_random_count = 0;
00096   int m_exhaustive_count = 0;
00097   int m_simple_count = 0;
00098 
00099   //user settable property to limit main/random subsequences 
00100   //also accessed by ovm_main/random_sequence 
00101   int unsigned max_random_count = 10;
00102 
00103   // Constructor
00104   extern function new (string name, ovm_component parent);
00105 
00106   //Utility funciton used to copy sequence libraries.  Only used internally.
00107   extern protected function void set_sequences_queue(
00108     ref string sequencer_sequence_lib[$]);
00109 
00110   // Add a new sequence type (by name) to this sequencer's sequences queue
00111   extern protected function void add_sequence(string type_name);
00112 
00113   // Externed virtual declaration of the run() phase method.  This method
00114   // calls the necessary methods for the sequencer to operate.  Derivative 
00115   // implementations must call super.run().
00116   extern virtual task run();
00117 
00118   // Function executed on startup to process user-selected default_sequence
00119   extern protected virtual task start_default_sequence();
00120 
00121   //invokes pre_body(), body() and post_body() of a sequence.
00122   extern task start_sequence(ovm_sequence this_seq,
00123     ovm_sequencer_base this_seqr=null);
00124 
00125   // variable used to randomly select a sequence from the sequences array
00126   protected rand int seq_kind;
00127 
00128   // Returns an integer identifier of a sequence registered with a sequencer
00129   extern function int get_seq_kind(string type_name);
00130 
00131   // Returns a new sequence object given its unique kind (integer id)
00132   extern function ovm_sequence get_sequence(int req_kind);
00133 
00134   //Implement data functions
00135   extern function void do_copy (ovm_object rhs);
00136   extern function bit  do_compare (ovm_object rhs, ovm_comparer comparer);
00137   extern function void do_print (ovm_printer printer);
00138   extern function void do_record (ovm_recorder recorder);
00139 
00140 endclass: ovm_sequencer_base
00141 
00142 
00143 `endif // OVM_SEQUENCER_BASE_SVH
00144 

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