ovm_sequence_item.sv

Go to the documentation of this file.
00001 // $Id: ovm__sequence__item_8sv-source.html,v 1.1 2008/10/07 21:54:52 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 `include "methodology/sequences/ovm_sequence_item.svh"
00023 
00024 //------------------------------------------------------------------------------
00025 //
00026 // CLASS: ovm_sequence_item
00027 //
00028 // implementation
00029 //------------------------------------------------------------------------------
00030 
00031 // new
00032 // ---
00033 
00034 function ovm_sequence_item::new (input string name="ovm_sequence_item", 
00035   ovm_sequencer_base sequencer=null, 
00036   ovm_sequence parent_seq = null);
00037   super.new(name);
00038   if (sequencer != null) begin
00039     this.set_sequencer(sequencer); // set value of this.m_sequencer,b_sequencer
00040                                    // and p_sequencer
00041   end
00042   if (parent_seq != null) begin
00043     m_parent_seq = parent_seq;
00044   end
00045 endfunction
00046 
00047 
00048 // do_copy
00049 // -------
00050 
00051 //Implement data functions
00052 function void ovm_sequence_item::do_copy (ovm_object rhs);
00053   ovm_sequence_item si;
00054   super.do_copy(rhs);
00055   if(rhs==null) return;
00056   if(!$cast(si, rhs)) return;
00057 
00058   print_sequence_info = si.print_sequence_info;
00059   depth = si.depth;
00060   m_parent_seq = si.m_parent_seq;
00061   m_sequencer = si.m_sequencer;
00062 endfunction
00063 
00064 
00065 // do_compare
00066 // -------
00067 
00068 //Implement data functions
00069 function bit ovm_sequence_item::do_compare (ovm_object rhs, ovm_comparer comparer);
00070   ovm_sequence_item si;
00071   do_compare = super.do_compare(rhs, comparer);
00072   if(rhs==null) return 0;
00073   if(!$cast(si, rhs)) return 0;
00074 endfunction
00075 
00076 
00077 // do_print
00078 // --------
00079 
00080 function void ovm_sequence_item::do_print (ovm_printer printer);
00081   string temp_str0;
00082   string temp_str1;
00083   super.do_print(printer);
00084   if(print_sequence_info) begin
00085     printer.print_field("depth", depth, $bits(depth), OVM_DEC, ".", "int");
00086     if(m_parent_seq != null) begin
00087       temp_str0 = m_parent_seq.get_name();
00088       temp_str1 = m_parent_seq.get_full_name();
00089     end
00090     printer.print_string("parent sequence (name)", temp_str0);
00091     printer.print_string("parent sequence (full name)", temp_str1);
00092     `ifdef INCA
00093       printer.print_object_header("parent sequence (ref)", m_parent_seq);
00094     `endif
00095     printer.print_string("root sequence (name)", m_get_root_sequence_name());
00096     `ifdef INCA
00097       printer.print_object_header("root sequence (ref)", m_get_root_sequence());
00098     `endif
00099     temp_str0 = "";
00100     temp_str1 = "";
00101     if(m_sequencer != null) begin
00102       temp_str0 = m_sequencer.get_name();
00103       temp_str1 = m_sequencer.get_full_name();
00104     end
00105     printer.print_string("sequencer (name)", temp_str0);
00106     printer.print_string("sequencer (full name)", temp_str1);
00107     `ifdef INCA
00108       printer.print_object_header("sequencer (ref)", m_sequencer);
00109     `endif
00110   end
00111 endfunction
00112 
00113 
00114 // do_record
00115 // ---------
00116 
00117 function void ovm_sequence_item::do_record (ovm_recorder recorder);
00118   super.do_record(recorder);
00119   recorder.record_field("depth", depth, $bits(depth), OVM_DEC);
00120 endfunction
00121 
00122 
00123 // set_sequencer
00124 // ------------
00125 
00126 function void ovm_sequence_item::set_sequencer(ovm_sequencer_base sequencer);
00127   /*
00128    m_sequencer is ovm_sequencer_base
00129    b_sequencer is ovm_sequencer_nonparam
00130    p_sequencer is user-derived sequencer type
00131    */
00132   m_sequencer = sequencer;
00133   this.m_set_b_sequencer(); // virtual method (see ovm_sequence.svh)
00134   this.m_set_p_sequencer(); // virtual method (see ovm_sequence.svh)
00135 endfunction
00136 
00137 
00138 // get_sequencer
00139 // ------------
00140 
00141 function ovm_sequencer_base ovm_sequence_item::get_sequencer();
00142   return this.m_sequencer ;
00143 endfunction
00144 
00145 
00146 // set_parent_seq
00147 // --------------
00148 
00149 function void ovm_sequence_item::set_parent_seq(ovm_sequence parent);
00150   if (parent != null)
00151     this.m_parent_seq = parent;
00152 endfunction
00153 
00154 
00155 // get_parent_seq
00156 // --------------
00157 
00158 function ovm_sequence ovm_sequence_item::get_parent_seq();
00159   return this.m_parent_seq ;
00160 endfunction
00161 
00162 
00163 // get_full_name
00164 // -------------
00165 
00166 function string ovm_sequence_item::get_full_name();
00167   if(m_parent_seq!=null) 
00168     get_full_name = {m_parent_seq.get_full_name(), "."};
00169   else if(m_sequencer!=null)
00170     get_full_name = {m_sequencer.get_full_name(), "."};
00171   if(get_name() != "") 
00172     get_full_name = {get_full_name, get_name()};
00173   else begin
00174     ovm_sequence_item tmp;
00175     tmp = this;
00176     $swrite(get_full_name, "%sitem_", get_full_name, tmp);
00177   end
00178 endfunction
00179 
00180 
00181 // get_sequence_path
00182 // -----------------
00183 
00184 function string ovm_sequence_item::get_sequence_path();
00185   ovm_sequence_item this_item;
00186   string seq_path;
00187   this_item = this;
00188   seq_path = this.get_name();
00189   while(1) begin
00190     if(this_item.get_parent_seq()!=null) begin
00191       this_item = this_item.get_parent_seq();
00192       seq_path = {this_item.get_name(), ".", seq_path};
00193     end
00194     else
00195       return seq_path;
00196   end
00197 endfunction
00198 
00199 
00200 // m_set_b_sequencer
00201 // --- 
00202 
00203 function void ovm_sequence_item::m_set_b_sequencer();
00204   return;
00205 endfunction
00206 
00207 
00208 // m_set_p_sequencer
00209 // --- 
00210 
00211 function void ovm_sequence_item::m_set_p_sequencer();
00212   return;
00213 endfunction
00214 
00215 
00216 // m_get_root_sequence_name
00217 // --- 
00218 
00219 function string ovm_sequence_item::m_get_root_sequence_name();
00220   ovm_sequence_item root_seq;
00221   root_seq = this;
00222   while(1) begin
00223     if(root_seq.get_parent_seq()!=null) begin
00224       root_seq = root_seq.get_parent_seq();
00225     end
00226     else
00227       return root_seq.get_name();
00228   end
00229 endfunction
00230 
00231 
00232 // m_get_root_sequence
00233 // --- 
00234 
00235 function ovm_sequence ovm_sequence_item::m_get_root_sequence();
00236   ovm_sequence_item root_seq_base;
00237   ovm_sequence root_seq;
00238   root_seq_base = this;
00239   while(1) begin
00240     if(root_seq_base.get_parent_seq()!=null) begin
00241       root_seq_base = root_seq_base.get_parent_seq();
00242       $cast(root_seq, root_seq_base);
00243     end
00244     else
00245       return root_seq;
00246   end
00247 endfunction
00248 
00249 
00250 // m_get_report_object
00251 // -------------------
00252 
00253 function ovm_report_object ovm_sequence_item::m_get_report_object();
00254   return get_sequencer();
00255 endfunction
00256 
00257 
00258 // is_item
00259 // -------
00260 
00261 function int ovm_sequence_item::is_item();
00262   return 1; 
00263 endfunction
00264 
00265 
00266 // get_depth
00267 // ---------
00268 
00269 function int ovm_sequence_item::get_depth();
00270   return depth;
00271 endfunction
00272 
00273 
00274 // create
00275 // ------
00276 
00277 function ovm_object ovm_sequence_item::create(string name="");
00278   ovm_sequence_item i; i=new(name);
00279   return i;
00280 endfunction
00281 
00282 
00283 // get_type_name
00284 // -------------
00285 
00286 function string ovm_sequence_item::get_type_name();
00287   return "ovm_sequence_item";
00288 endfunction 
00289 

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