cl_syoscb_queue_iterator_std.svh

00001 /// Queue iterator class defining the iterator API used for iterating std queues.
00002 class cl_syoscb_queue_iterator_std extends cl_syoscb_queue_iterator_base;
00003   //-------------------------------------
00004   // UVM Macros
00005   //-------------------------------------
00006   `uvm_object_utils(cl_syoscb_queue_iterator_std)
00007 
00008   //-------------------------------------
00009   // Iterator API
00010   //-------------------------------------
00011   extern virtual function bit next();
00012   extern virtual function bit previous();
00013   extern virtual function bit first();
00014   extern virtual function bit last();
00015   extern virtual function int unsigned get_idx();
00016   extern virtual function cl_syoscb_item get_item();
00017   extern virtual function bit is_done();
00018   extern virtual function bit set_queue(cl_syoscb_queue owner);
00019 endclass: cl_syoscb_queue_iterator_std
00020 
00021 /// <b>Iterator API:</b> See cl_syoscb_queue_iterator_base for details
00022 function bit cl_syoscb_queue_iterator_std::next();
00023   cl_syoscb_queue qh = this.get_queue();
00024 
00025   if(this.position < qh.get_size()) begin
00026     this.position++;
00027     return 1;
00028   end else begin
00029     // Debug print when unable to advance to the next element (When at the end of the queue)
00030     `uvm_info("OUT_OF_BOUNDS", $sformatf("Not possible to increment position of queue %s: at end of queue",
00031                                          qh.get_name()), UVM_DEBUG);
00032     return 0;
00033   end
00034 endfunction: next
00035 
00036 /// <b>Iterator API:</b> See cl_syoscb_queue_iterator_base for details
00037 function bit cl_syoscb_queue_iterator_std::previous();
00038   if(this.position != 0) begin
00039     this.position--;
00040     return 1;
00041   end else begin
00042     cl_syoscb_queue qh = this.get_queue();
00043 
00044     // Debug print when unable to advance to the previous element (When at the beginning of the queue)
00045     `uvm_info("OUT_OF_BOUNDS", $sformatf("Not possible to decrement position of queue %s: at end of queue",
00046                                          qh.get_name()), UVM_DEBUG);
00047     return 0;
00048   end
00049 endfunction: previous
00050 
00051 /// <b>Iterator API:</b> See cl_syoscb_queue_iterator_base for details
00052 function bit cl_syoscb_queue_iterator_std::first();
00053   // Std queue uses an SV queue for its items, first item is always 0
00054   this.position = 0;
00055   return 1;
00056 endfunction: first
00057 
00058 function bit cl_syoscb_queue_iterator_std::last();
00059   cl_syoscb_queue qh = this.get_queue();
00060 
00061   this.position = qh.get_size()-1;
00062   return 1;
00063 endfunction: last
00064 
00065 /// <b>Iterator API:</b> See cl_syoscb_queue_iterator_base for details
00066 function int unsigned cl_syoscb_queue_iterator_std::get_idx();
00067   return this.position;
00068 endfunction: get_idx
00069 
00070 /// <b>Iterator API:</b> See cl_syoscb_queue_iterator_base for details
00071 function cl_syoscb_item cl_syoscb_queue_iterator_std::get_item();
00072   cl_syoscb_queue qh = this.get_queue();
00073 
00074   return qh.get_item(this.position);
00075 endfunction: get_item
00076 
00077 /// <b>Iterator API:</b> See cl_syoscb_queue_iterator_base for details
00078 function bit cl_syoscb_queue_iterator_std::is_done();
00079   cl_syoscb_queue qh = this.get_queue();
00080 
00081   if(this.position == qh.get_size()) begin
00082     return 1;
00083   end else begin
00084     return 0;
00085   end
00086 endfunction: is_done
00087 
00088 /// <b>Iterator API:</b> See cl_syoscb_queue_iterator_base for details
00089 function bit cl_syoscb_queue_iterator_std::set_queue(cl_syoscb_queue owner);
00090   if(owner == null) begin
00091     // An iterator should always have an associated queue
00092     `uvm_error("QUEUE_ERROR", $sformatf("Unable to associate queue with iterator "));
00093     return 0;
00094   end else begin
00095     this.owner = owner;
00096     return 1;
00097   end
00098 endfunction: set_queue
 All Classes Functions Variables

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
Doxygen Version: 1.6.1
IDV SV Filter Version: 2.6.2
Thu Jun 4 23:02:22 2015
Find a documentation bug? Report bugs to: bugs.intelligentdv.com Project: DoxygenFilterSV