cl_syoscb_queue_iterator_base.svh

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

Project: SyoSil ApS UVM Scoreboard, Revision: 1.0.2.3

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
Doxygen Version: 1.6.1
IDV SV Filter Version: 2.6.2
Mon Sep 28 02:57:58 2015
Find a documentation bug? Report bugs to: bugs.intelligentdv.com Project: DoxygenFilterSV