ovm_virtual_sequencer.sv

Go to the documentation of this file.
00001 // $Id: ovm__virtual__sequencer_8sv-source.html,v 1.1 2008/10/07 21:54:58 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 
00023 `include "methodology/sequences/ovm_virtual_sequencer.svh"
00024 
00025 
00026 
00027 // new
00028 // ---
00029 
00030 function ovm_seq_cons_if::new (string name="", 
00031   ovm_component parent = null);
00032   super.new(name, parent);
00033 endfunction
00034 
00035 
00036 // do_print
00037 // --------
00038 
00039 function void ovm_seq_cons_if::do_print (ovm_printer printer);
00040   super.do_print(printer);
00041   if (seqrb_ref != null)
00042     printer.print_string("sequence consumer", seqrb_ref.get_full_name());
00043   else
00044     printer.print_string("sequence consumer", "NOT_CONNECTED");
00045 endfunction
00046 
00047 
00048 // create 
00049 // ------
00050 
00051 function ovm_object ovm_seq_cons_if::create (string name="");
00052   ovm_seq_cons_if i; i=new(name);
00053   return i;
00054 endfunction
00055 
00056 
00057 // get_type_name
00058 // -------------
00059 
00060 function string ovm_seq_cons_if::get_type_name();
00061   return "ovm_seq_cons_if";
00062 endfunction 
00063 
00064 
00065 // connect_if
00066 // ----------
00067 
00068 function void ovm_seq_cons_if::connect_if(ovm_seq_prod_if seqr_if);
00069   seqrb_ref = seqr_if.parent_as_seqr;
00070 endfunction
00071 
00072 
00073 // current_grabber
00074 // ---------------
00075 
00076 function ovm_sequence ovm_seq_cons_if::current_grabber();
00077   if ($cast(seqrnp_ref, seqrb_ref))
00078     return seqrnp_ref.current_grabber();
00079   else
00080     ovm_report_fatal("VSQGRB", "Cannot call current_grabber() for this type");
00081 endfunction
00082 
00083 
00084 // is_grabbed
00085 // ----------
00086 
00087 function bit ovm_seq_cons_if::is_grabbed();
00088   if ($cast(seqrnp_ref, seqrb_ref))
00089     return seqrnp_ref.is_grabbed();
00090   else
00091     ovm_report_fatal("VSQGRB", "Cannot call is_grabbed() for this type");
00092 endfunction
00093 
00094 
00095 // start_sequence
00096 // --------------
00097 
00098 task ovm_seq_cons_if::start_sequence(ovm_sequence this_seq);
00099   seqrb_ref.start_sequence(this_seq,seqrb_ref);
00100 endtask
00101 
00102 
00103 // grab
00104 // ----
00105 
00106 task ovm_seq_cons_if::grab(ovm_sequence this_seq);
00107   if ($cast(seqrnp_ref, seqrb_ref))
00108     seqrnp_ref.grab(this_seq);
00109   else
00110     ovm_report_fatal("VSQGRB", "Cannot call grab() for this type");
00111 endtask
00112 
00113 
00114 // ungrab
00115 // ------
00116 
00117 function void ovm_seq_cons_if::ungrab(ovm_sequence this_seq);
00118   if ($cast(seqrnp_ref, seqrb_ref))
00119     seqrnp_ref.ungrab(this_seq);
00120   else
00121     ovm_report_fatal("VSQGRB", "Cannot call ungrab() for this type");
00122 endfunction
00123 
00124 
00125 // is_connected
00126 // ------------
00127 
00128 function bit ovm_seq_cons_if::is_connected();
00129   if (seqrb_ref != null)
00130     return 1;
00131   else
00132     return 0;
00133 endfunction
00134 
00135 
00136 // is_virtual_sequencer
00137 // --------------------
00138 
00139 function bit ovm_seq_cons_if::is_virtual_sequencer();
00140   if (seqrb_ref == null)
00141     ovm_report_fatal("UNCSQR", "Cannot call connected_sequencer_type() on this unconnected interface.");
00142   else if ($cast(seqrnp_ref, seqrb_ref))
00143     return 0;
00144   else
00145     return 1;
00146 endfunction
00147 
00148 
00149 // get_sequencer_type_name
00150 // -----------------------
00151 
00152 function string ovm_seq_cons_if::get_sequencer_type_name();
00153   if(seqrb_ref != null)
00154     return seqrb_ref.get_type_name();
00155   else
00156     return "NOT_CONNECTED";
00157 endfunction
00158 
00159 
00160 
00161 // new
00162 // ---
00163 
00164 function ovm_virtual_sequencer::new (string name, ovm_component parent);
00165   super.new(name,parent);
00166 endfunction
00167 
00168 
00169 // start_default_sequence
00170 // ----------------------
00171 
00172 task ovm_virtual_sequencer::start_default_sequence();
00173   string temp_str;
00174   if(sequences.size() != 0) begin
00175     if(sequences.size() == 2) begin
00176       temp_str = "must have at least one user-defined virtual sequence.";
00177       ovm_report_fatal("NOUSEQ", $psprintf("%s %s", 
00178         get_full_name(), temp_str));
00179     end
00180     else 
00181       super.start_default_sequence();
00182   end
00183 endtask
00184 
00185 
00186 // get_type_name
00187 // -------------
00188 
00189 function string ovm_virtual_sequencer::get_type_name();
00190   return "ovm_virtual_sequencer";
00191 endfunction
00192 
00193 
00194 // do_print 
00195 // --------
00196 
00197 function void ovm_virtual_sequencer::do_print(ovm_printer printer);
00198   super.do_print(printer);
00199   if (seq_cons_if.num() != 0) begin
00200     printer.print_array_header("seq_cons_if", seq_cons_if.num());
00201     foreach(seq_cons_if[e]) begin
00202       printer.print_object({" [",e,"]"}, seq_cons_if[e], "[");
00203     end
00204     printer.print_array_footer();
00205   end
00206 endfunction
00207 
00208 
00209 // add_seq_cons_if
00210 // ---------------
00211 
00212 function void ovm_virtual_sequencer::add_seq_cons_if(string if_name);
00213   $cast(seq_cons_if[if_name], create_component("ovm_seq_cons_if", 
00214     {"seq_cons_if[\"", if_name, "\"]"}));
00215   seq_cons_if[if_name].print_enabled = 0;
00216 endfunction

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