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 // Local handle to the SCB sfg 00013 protected cl_syoscb_cfg cfg; 00014 00015 //------------------------------------- 00016 // UVM Macros 00017 //------------------------------------- 00018 `uvm_object_utils_begin(cl_syoscb_queue_iterator_base) 00019 `uvm_field_object(owner, UVM_DEFAULT) 00020 `uvm_field_int(position, UVM_DEFAULT) 00021 `uvm_field_object(cfg, UVM_DEFAULT) 00022 `uvm_object_utils_end 00023 00024 function new(string name = "cl_syoscb_queue_iterator_base"); 00025 super.new(name); 00026 endfunction: new 00027 00028 //------------------------------------- 00029 // Iterator API 00030 //------------------------------------- 00031 extern virtual function bit next(); // Base 'next' function. Moves iterator to next item in queue 00032 extern virtual function bit previous(); // Base 'previous' function. Moves iterator to previous item in queue 00033 extern virtual function bit first(); // Base 'first' function. Moves iterator to first item in queue 00034 extern virtual function bit last(); // Base 'last' function. Moves iterator to last item in queue 00035 extern virtual function int unsigned get_idx(); // Base 'get_idx' function. Returns current iterator position 00036 extern virtual function cl_syoscb_item get_item(); // Base 'get_item' function. Returns item at current iterator position 00037 extern virtual function bit is_done(); // Base 'is_done' function. Returns 1 if iterator is at the end of the queue, otherwise 0 00038 extern protected function cl_syoscb_queue get_queue(); // Returns the queue that this iterator is associated with 00039 extern virtual function bit set_queue(cl_syoscb_queue owner); // Sets the queue that this iterator is associated with 00040 endclass: cl_syoscb_queue_iterator_base 00041 00042 /// <b>Iterator API:</b> Moves the iterator to the next item in the queue. 00043 /// It shall return 1'b0 if there is no next item, e.g. when it is either empty or 00044 /// the iterator has reached the end of the queue. 00045 function bit cl_syoscb_queue_iterator_base::next(); 00046 `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue_iterator_base::next() *MUST* be overwritten")); 00047 return(1'b0); 00048 endfunction 00049 00050 /// <b>Iterator API:</b> Moves the iterator to the previous item in the queue. 00051 /// It shall return 1'b0 if there is no previous item, e.g. when it is either empty or 00052 /// the iterator has reached the very beginning of the queue. 00053 function bit cl_syoscb_queue_iterator_base::previous(); 00054 `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue_iterator_base::previous() *MUST* be overwritten")); 00055 return(1'b0); 00056 endfunction 00057 00058 /// <b>Iterator API:</b> Moves the iterator to the first item in the queue. 00059 /// It shall return 1'b0 if there is no first item (Queue is empty). 00060 function bit cl_syoscb_queue_iterator_base::first(); 00061 `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue_iterator_base::first() *MUST* be overwritten")); 00062 return(1'b0); 00063 endfunction 00064 00065 /// <b>Iterator API:</b> Moves the iterator to the last item in the queue. 00066 /// It shall return 1'b0 if there is no last item (Queue is empty). 00067 function bit cl_syoscb_queue_iterator_base::last(); 00068 `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue_iterator_base::last() *MUST* be overwritten")); 00069 return(1'b0); 00070 endfunction 00071 00072 /// <b>Iterator API:</b> Returns the current index 00073 function int unsigned cl_syoscb_queue_iterator_base::get_idx(); 00074 `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue_iterator_base::get_idx() *MUST* be overwritten")); 00075 return(0); 00076 endfunction 00077 00078 /// <b>Iterator API:</b> Returns the current cl_syoscb_item object at the current index 00079 function cl_syoscb_item cl_syoscb_queue_iterator_base::get_item(); 00080 `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue_iterator_base::get_item() *MUST* be overwritten")); 00081 return(null); 00082 endfunction 00083 00084 /// <b>Iterator API:</b> Returns 1'b0 as long as the iterator has not reached the end. 00085 /// When the iterator has reached the end then it returns 1'b1. 00086 function bit cl_syoscb_queue_iterator_base::is_done(); 00087 `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue_iterator_base::is_done() *MUST* be overwritten")); 00088 return(1'b0); 00089 endfunction 00090 00091 /// <b>Iterator API:</b> Returns releated queue 00092 function cl_syoscb_queue cl_syoscb_queue_iterator_base::get_queue(); 00093 if(this.owner == null) begin 00094 // An iterator should always have an associated queue 00095 `uvm_error("QUEUE_ERROR", $sformatf("Unable to find queue associated with iterator %s", this.get_name())); 00096 return null; 00097 end else begin 00098 return this.owner; 00099 end 00100 endfunction: get_queue 00101 00102 /// <b>Iterator API:</b> Sets releated queue 00103 function bit cl_syoscb_queue_iterator_base::set_queue(cl_syoscb_queue owner); 00104 `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue_iterator_base::set_queue() *MUST* be overwritten")); 00105 return(1'b0); 00106 endfunction
|
Project: SyoSil ApS UVM Scoreboard, Revision: 1.0.2.5 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 Sat Nov 28 05:41:54 2015 |