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