ovm_sequence_builtin.sv

Go to the documentation of this file.
00001 // $Id: ovm__sequence__builtin_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_builtin.svh"
00023 
00024 
00025 //------------------------------------------------------------------------------
00026 //
00027 // CLASS: ovm_random_sequence
00028 //
00029 // implementation
00030 //------------------------------------------------------------------------------
00031 
00032 // new
00033 // ---
00034 
00035 function ovm_random_sequence::new(string name="ovm_random_sequence", 
00036   ovm_sequencer_base sequencer=null,
00037   ovm_sequence parent_seq=null);
00038   super.new(name, sequencer, parent_seq);
00039 endfunction
00040 
00041 
00042 // body
00043 // ----
00044 
00045 task ovm_random_sequence::body();
00046   if (m_sequencer.count == -1) begin
00047     assert(randomize(l_count) with { l_count > 0 && l_count <
00048       m_sequencer.max_random_count; });
00049     m_sequencer.count = l_count;
00050   end
00051   else
00052     l_count = m_sequencer.count;
00053   max_kind = m_sequencer.sequences.size();
00054   l_exhaustive_seq_kind = m_sequencer.get_seq_kind("ovm_exhaustive_sequence");
00055   repeat (l_count) begin
00056     assert(randomize(l_kind) with { l_kind > l_exhaustive_seq_kind && 
00057       l_kind < max_kind; });
00058     do_sequence_kind(l_kind);
00059   end
00060   m_sequencer.m_random_count++;
00061   
00062 endtask 
00063 
00064 
00065 //Implement data functions
00066 function void ovm_random_sequence::do_copy (ovm_object rhs);
00067   ovm_random_sequence seq;
00068   if(rhs==null) return;
00069   if(!$cast(seq, rhs)) return;
00070   l_count = seq.l_count;
00071 endfunction
00072 
00073 function bit ovm_random_sequence::do_compare (ovm_object rhs, ovm_comparer comparer);
00074   ovm_random_sequence seq;
00075   do_compare = 1;
00076   if(rhs==null) return 0;
00077   if(!$cast(seq, rhs)) return 0;
00078   do_compare &= comparer.compare_field_int("l_count", l_count, seq.l_count, 
00079     $bits(l_count));
00080 endfunction
00081 
00082 function void ovm_random_sequence::do_print (ovm_printer printer);
00083   printer.print_field("l_count", l_count, $bits(l_count));
00084 endfunction
00085 
00086 function void ovm_random_sequence::do_record (ovm_recorder recorder);
00087   recorder.record_field("l_count", l_count, $bits(l_count));
00088 endfunction
00089 
00090 
00091 //------------------------------------------------------------------------------
00092 //
00093 // CLASS: ovm_exhaustive_sequence
00094 //
00095 // implementation
00096 //------------------------------------------------------------------------------
00097 
00098 // new
00099 // ---
00100 
00101 function ovm_exhaustive_sequence::new(string name="ovm_exhaustive_sequence", 
00102   ovm_sequencer_base sequencer=null,
00103   ovm_sequence parent_seq=null);
00104   super.new(name, sequencer, parent_seq);
00105 endfunction
00106 
00107 
00108 // body
00109 // ----
00110 
00111 task ovm_exhaustive_sequence::body();
00112   l_count = m_sequencer.sequences.size() - 2;
00113   max_kind = m_sequencer.sequences.size();
00114   l_exhaustive_seq_kind = m_sequencer.get_seq_kind("ovm_exhaustive_sequence");
00115   repeat (l_count) begin
00116     assert(randomize(l_kind) with { l_kind > l_exhaustive_seq_kind && 
00117       l_kind < max_kind; }); // l_kind is randc
00118     do_sequence_kind(l_kind);
00119   end
00120   m_sequencer.m_exhaustive_count++;
00121 endtask 
00122 
00123 
00124 //Implement data functions
00125 function void ovm_exhaustive_sequence::do_copy (ovm_object rhs);
00126   ovm_exhaustive_sequence seq;
00127   if(rhs==null) return;
00128   if(!$cast(seq, rhs)) return;
00129   l_count = seq.l_count;
00130 endfunction
00131 
00132 function bit ovm_exhaustive_sequence::do_compare (ovm_object rhs, ovm_comparer comparer);
00133   ovm_exhaustive_sequence seq;
00134   do_compare = 1;
00135   if(rhs==null) return 0;
00136   if(!$cast(seq, rhs)) return 0;
00137   do_compare &= comparer.compare_field_int("l_count", l_count, seq.l_count, 
00138     $bits(l_count));
00139 endfunction
00140 
00141 function void ovm_exhaustive_sequence::do_print (ovm_printer printer);
00142   printer.print_field("l_count", l_count, $bits(l_count));
00143 endfunction
00144 
00145 function void ovm_exhaustive_sequence::do_record (ovm_recorder recorder);
00146   recorder.record_field("l_count", l_count, $bits(l_count));
00147 endfunction
00148 
00149 
00150 //------------------------------------------------------------------------------
00151 //
00152 // CLASS: ovm_simple_sequence
00153 //
00154 // implementation
00155 //------------------------------------------------------------------------------
00156 
00157 // new
00158 // ---
00159 
00160 function ovm_simple_sequence::new (string name="ovm_simple_sequence", 
00161   ovm_sequencer_base sequencer=null,
00162   ovm_sequence parent_seq=null);
00163   super.new(name, sequencer, parent_seq);
00164 endfunction
00165 
00166 // body
00167 // ----
00168 
00169 task ovm_simple_sequence::body();
00170   `ovm_do(item)
00171   m_sequencer.m_simple_count++;
00172 endtask
00173 
00174 function void ovm_simple_sequence::do_print (ovm_printer printer);
00175   super.do_print(printer);
00176   printer.print_object("item", item);
00177 endfunction
00178 

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