00001 /// Queue iterator base class defining the iterator API used for iterating queues. 00002 class cl_syoscb_queue_iterator_base extends uvm_object; 00003 //------------------------------------- 00004 // Non randomizable variables 00005 //------------------------------------- 00006 /// The owner of this iterator 00007 protected cl_syoscb_queue owner; 00008 00009 /// Current position in the queue 00010 protected int unsigned position = 0; 00011 00012 //------------------------------------- 00013 // UVM Macros 00014 //------------------------------------- 00015 `uvm_object_utils_begin(cl_syoscb_queue_iterator_base) 00016 `uvm_field_object(owner, UVM_DEFAULT) 00017 `uvm_field_int(position, UVM_DEFAULT) 00018 `uvm_object_utils_end 00019 00020 //------------------------------------- 00021 // Iterator API 00022 //------------------------------------- 00023 extern virtual function bit next(); // Base 'next' function. Moves iterator to next item in queue 00024 extern virtual function bit previous(); // Base 'previous' function. Moves iterator to previous item in queue 00025 extern virtual function bit first(); // Base 'first' function. Moves iterator to first item in queue 00026 extern virtual function bit last(); // Base 'last' function. Moves iterator to last item in queue 00027 extern virtual function int unsigned get_idx(); // Base 'get_idx' function. Returns current iterator position 00028 extern virtual function cl_syoscb_item get_item(); // Base 'get_item' function. Returns item at current iterator position 00029 extern virtual function bit is_done(); // Base 'is_done' function. Returns 1 if iterator is at the end of the queue, otherwise 0 00030 extern protected function cl_syoscb_queue get_queue(); // Returns the queue that this iterator is associated with 00031 extern virtual function bit set_queue(cl_syoscb_queue owner); // Sets the queue that this iterator is associated with 00032 endclass: cl_syoscb_queue_iterator_base 00033 00034 /// <b>Iterator API:</b> Moves the iterator to the next item in the queue. 00035 /// It shall return 1'b0 if there is no next item, e.g. when it is either empty or 00036 /// the iterator has reached the end of the queue. 00037 function bit cl_syoscb_queue_iterator_base::next(); 00038 `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue_iterator_base::next() *MUST* be overwritten")); 00039 return(1'b0); 00040 endfunction 00041 00042 /// <b>Iterator API:</b> Moves the iterator to the previous item in the queue. 00043 /// It shall return 1'b0 if there is no previous item, e.g. when it is either empty or 00044 /// the iterator has reached the very beginning of the queue. 00045 function bit cl_syoscb_queue_iterator_base::previous(); 00046 `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue_iterator_base::previous() *MUST* be overwritten")); 00047 return(1'b0); 00048 endfunction 00049 00050 /// <b>Iterator API:</b> Moves the iterator to the first item in the queue. 00051 /// It shall return 1'b0 if there is no first item (Queue is empty). 00052 function bit cl_syoscb_queue_iterator_base::first(); 00053 `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue_iterator_base::first() *MUST* be overwritten")); 00054 return(1'b0); 00055 endfunction 00056 00057 /// <b>Iterator API:</b> Moves the iterator to the last item in the queue. 00058 /// It shall return 1'b0 if there is no last item (Queue is empty). 00059 function bit cl_syoscb_queue_iterator_base::last(); 00060 `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue_iterator_base::last() *MUST* be overwritten")); 00061 return(1'b0); 00062 endfunction 00063 00064 /// <b>Iterator API:</b> Returns the current index 00065 function int unsigned cl_syoscb_queue_iterator_base::get_idx(); 00066 `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue_iterator_base::get_idx() *MUST* be overwritten")); 00067 return(0); 00068 endfunction 00069 00070 /// <b>Iterator API:</b> Returns the current cl_syoscb_item object at the current index 00071 function cl_syoscb_item cl_syoscb_queue_iterator_base::get_item(); 00072 `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue_iterator_base::get_item() *MUST* be overwritten")); 00073 return(null); 00074 endfunction 00075 00076 /// <b>Iterator API:</b> Returns 1'b0 as long as the iterator has not reached the end. 00077 /// When the iterator has reached the end then it returns 1'b1. 00078 function bit cl_syoscb_queue_iterator_base::is_done(); 00079 `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue_iterator_base::is_done() *MUST* be overwritten")); 00080 return(1'b0); 00081 endfunction 00082 00083 /// <b>Iterator API:</b> Returns releated queue 00084 function cl_syoscb_queue cl_syoscb_queue_iterator_base::get_queue(); 00085 if(this.owner == null) begin 00086 // An iterator should always have an associated queue 00087 `uvm_error("QUEUE_ERROR", $sformatf("Unable to find queue associated with iterator %s", this.get_name())); 00088 return null; 00089 end else begin 00090 return this.owner; 00091 end 00092 endfunction: get_queue 00093 00094 /// <b>Iterator API:</b> Sets releated queue 00095 function bit cl_syoscb_queue_iterator_base::set_queue(cl_syoscb_queue owner); 00096 `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue_iterator_base::set_queue() *MUST* be overwritten")); 00097 return(1'b0); 00098 endfunction
|
Project: SyoSil ApS UVM Scoreboard, Revision: 1.0.2.1 Copyright 2014-2015 SyoSil ApS All Rights Reserved Worldwide Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. |
![]() Doxygen Version: 1.6.1 IDV SV Filter Version: 2.6.2 Thu Jun 4 23:02:22 2015 |