OpenCores
URL https://opencores.org/ocsvn/lpffir/lpffir/trunk

Subversion Repositories lpffir

[/] [lpffir/] [trunk/] [uvm/] [tools/] [uvm_syoscb/] [src/] [cl_syoscb_queue_iterator_base.svh] - Blame information for rev 8

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 vladimirar
//----------------------------------------------------------------------
2
//   Copyright 2014-2015 SyoSil ApS
3
//   All Rights Reserved Worldwide
4
//
5
//   Licensed under the Apache License, Version 2.0 (the
6
//   "License"); you may not use this file except in
7
//   compliance with the License.  You may obtain a copy of
8
//   the License at
9
//
10
//       http://www.apache.org/licenses/LICENSE-2.0
11
//
12
//   Unless required by applicable law or agreed to in
13
//   writing, software distributed under the License is
14
//   distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
15
//   CONDITIONS OF ANY KIND, either express or implied.  See
16
//   the License for the specific language governing
17
//   permissions and limitations under the License.
18
//----------------------------------------------------------------------
19
/// Queue iterator base class defining the iterator API used for iterating queues.
20
class cl_syoscb_queue_iterator_base extends uvm_object;
21
  //-------------------------------------
22
  // Non randomizable variables
23
  //-------------------------------------
24
  /// The owner of this iterator
25
  protected cl_syoscb_queue owner;
26
 
27
  /// Current position in the queue
28
  protected int unsigned position = 0;
29
 
30
  // Local handle to the SCB sfg
31
  protected cl_syoscb_cfg cfg;
32
 
33
  //-------------------------------------
34
  // UVM Macros
35
  //-------------------------------------
36
  `uvm_object_utils_begin(cl_syoscb_queue_iterator_base)
37
    `uvm_field_object(owner, UVM_DEFAULT)
38
    `uvm_field_int(position, UVM_DEFAULT)
39
    `uvm_field_object(cfg,   UVM_DEFAULT)
40
  `uvm_object_utils_end
41
 
42
    function new(string name = "cl_syoscb_queue_iterator_base");
43
      super.new(name);
44
    endfunction: new
45
 
46
  //-------------------------------------
47
  // Iterator API
48
  //-------------------------------------
49
  extern virtual function bit next();                           // Base 'next' function. Moves iterator to next item in queue
50
  extern virtual function bit previous();                       // Base 'previous' function. Moves iterator to previous item in queue
51
  extern virtual function bit first();                          // Base 'first' function. Moves iterator to first item in queue
52
  extern virtual function bit last();                           // Base 'last' function. Moves iterator to last item in queue
53
  extern virtual function int unsigned get_idx();               // Base 'get_idx' function. Returns current iterator position
54
  extern virtual function cl_syoscb_item get_item();            // Base 'get_item' function. Returns item at current iterator position
55
  extern virtual function bit is_done();                        // Base 'is_done' function. Returns 1 if iterator is at the end of the queue, otherwise 0
56
  extern protected function cl_syoscb_queue get_queue();        // Returns the queue that this iterator is associated with
57
  extern virtual function bit set_queue(cl_syoscb_queue owner); // Sets the queue that this iterator is associated with
58
endclass: cl_syoscb_queue_iterator_base
59
 
60
/// Iterator API: Moves the iterator to the next item in the queue.
61
/// It shall return 1'b0 if there is no next item, e.g. when it is either empty or
62
/// the iterator has reached the end of the queue.
63
function bit cl_syoscb_queue_iterator_base::next();
64
  `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue_iterator_base::next() *MUST* be overwritten"));
65
  return(1'b0);
66
endfunction
67
 
68
/// Iterator API:  Moves the iterator to the previous item in the queue.
69
/// It shall return 1'b0 if there is no previous item, e.g. when it is either empty or
70
/// the iterator has reached the very beginning of the queue.
71
function bit cl_syoscb_queue_iterator_base::previous();
72
  `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue_iterator_base::previous() *MUST* be overwritten"));
73
  return(1'b0);
74
endfunction
75
 
76
/// Iterator API:  Moves the iterator to the first item in the queue.
77
/// It shall return 1'b0 if there is no first item (Queue is empty).
78
function bit cl_syoscb_queue_iterator_base::first();
79
  `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue_iterator_base::first() *MUST* be overwritten"));
80
  return(1'b0);
81
endfunction
82
 
83
/// Iterator API:  Moves the iterator to the last item in the queue.
84
/// It shall return 1'b0 if there is no last item (Queue is empty).
85
function bit cl_syoscb_queue_iterator_base::last();
86
  `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue_iterator_base::last() *MUST* be overwritten"));
87
  return(1'b0);
88
endfunction
89
 
90
/// Iterator API:  Returns the current index
91
function int unsigned cl_syoscb_queue_iterator_base::get_idx();
92
  `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue_iterator_base::get_idx() *MUST* be overwritten"));
93
  return(0);
94
endfunction
95
 
96
/// Iterator API:  Returns the current cl_syoscb_item object at the current index
97
function cl_syoscb_item cl_syoscb_queue_iterator_base::get_item();
98
  `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue_iterator_base::get_item() *MUST* be overwritten"));
99
  return(null);
100
endfunction
101
 
102
/// Iterator API:  Returns 1'b0 as long as the iterator has not reached the end.
103
/// When the iterator has reached the end then it returns 1'b1.
104
function bit cl_syoscb_queue_iterator_base::is_done();
105
  `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue_iterator_base::is_done() *MUST* be overwritten"));
106
  return(1'b0);
107
endfunction
108
 
109
/// Iterator API:  Returns releated queue
110
function cl_syoscb_queue cl_syoscb_queue_iterator_base::get_queue();
111
  if(this.owner == null) begin
112
    // An iterator should always have an associated queue
113
    `uvm_error("QUEUE_ERROR", $sformatf("Unable to find queue associated with iterator %s", this.get_name()));
114
    return null;
115
  end else begin
116
    return this.owner;
117
  end
118
endfunction: get_queue
119
 
120
/// Iterator API:  Sets releated queue
121
function bit cl_syoscb_queue_iterator_base::set_queue(cl_syoscb_queue owner);
122
  `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue_iterator_base::set_queue() *MUST* be overwritten"));
123
  return(1'b0);
124
endfunction

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.