00001 /// Class which base concet of a queue. All queues must extend this class 00002 /// and implement the queue API. 00003 class cl_syoscb_queue extends uvm_component; 00004 //------------------------------------- 00005 // Non randomizable variables 00006 //------------------------------------- 00007 /// Handle to the configuration 00008 protected cl_syoscb_cfg cfg; 00009 00010 /// List of iterators registered with queue 00011 protected cl_syoscb_queue_iterator_base iterators[cl_syoscb_queue_iterator_base]; 00012 00013 /// Current number of iterators 00014 protected int unsigned iter_idx; 00015 00016 /// Semaphore guarding exclusive access to the queue when 00017 /// multiple iterators are in play 00018 protected semaphore iter_sem; 00019 00020 //------------------------------------- 00021 // UVM Macros 00022 //------------------------------------- 00023 `uvm_component_utils_begin(cl_syoscb_queue) 00024 `uvm_field_object(cfg, UVM_DEFAULT) 00025 // TBD::JSA: Lacks a user defined implementation of field macro 00026 // for completeness since: `uvm_field_aa_object-object does not exist 00027 `uvm_field_int(iter_idx, UVM_DEFAULT) 00028 `uvm_component_utils_end 00029 00030 //------------------------------------- 00031 // Constructor 00032 //------------------------------------- 00033 extern function new(string name, uvm_component parent); 00034 00035 //------------------------------------- 00036 // UVM Phase methods 00037 //------------------------------------- 00038 extern function void build_phase(uvm_phase phase); 00039 extern function void check_phase(uvm_phase phase); 00040 00041 //------------------------------------- 00042 // Queue API 00043 //------------------------------------- 00044 // Basic queue functions 00045 extern virtual function bit add_item(string producer, uvm_sequence_item item); 00046 extern virtual function bit delete_item(int unsigned idx); 00047 extern virtual function cl_syoscb_item get_item(int unsigned idx); 00048 extern virtual function int unsigned get_size(); 00049 extern virtual function bit empty(); 00050 extern virtual function bit insert_item(string producer, uvm_sequence_item item, int unsigned idx); 00051 00052 // Iterator support functions 00053 extern virtual function cl_syoscb_queue_iterator_base create_iterator(); 00054 extern virtual function bit delete_iterator(cl_syoscb_queue_iterator_base iterator); 00055 00056 // Locator support functions 00057 // TBD::JSA: Locator not implemented yet 00058 endclass: cl_syoscb_queue 00059 00060 function cl_syoscb_queue::new(string name, uvm_component parent); 00061 super.new(name, parent); 00062 00063 this.iter_sem = new(1); 00064 this.iter_idx = 0; 00065 endfunction: new 00066 00067 /// Gets the global scoreboard configuration 00068 function void cl_syoscb_queue::build_phase(uvm_phase phase); 00069 if (!uvm_config_db #(cl_syoscb_cfg)::get(this, "", "cfg", this.cfg)) begin 00070 `uvm_fatal("CFG_ERROR", "Configuration object not passed.") 00071 end 00072 endfunction 00073 00074 /// Checks if the queue is empty. If not then a UVM error is issued. 00075 function void cl_syoscb_queue::check_phase(uvm_phase phase); 00076 // Check that this queue is empty. If not then issue an error 00077 if(!this.empty()) begin 00078 `uvm_error("QUEUE_ERROR", $psprintf("Queue %s not empty, entries: %0d", this.get_name(), this.get_size())); 00079 end 00080 endfunction 00081 00082 /// <b>Queue API:</b> Adds an uvm_sequence_item. The implementation must wrap this in a 00083 /// cl_syoscb_item object before the item is inserted 00084 function bit cl_syoscb_queue::add_item(string producer, uvm_sequence_item item); 00085 `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue::add_item() *MUST* be overwritten")); 00086 return(1'b0); 00087 endfunction 00088 00089 /// <b>Queue API:</b> Deletes the item at index idx from the queue 00090 function bit cl_syoscb_queue::delete_item(int unsigned idx); 00091 `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue::delete_item() *MUST* be overwritten")); 00092 return(1'b0); 00093 endfunction 00094 00095 /// <b>Queue API:</b> Gets the item at index idx from the queue 00096 function cl_syoscb_item cl_syoscb_queue::get_item(int unsigned idx); 00097 `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue::get_item() *MUST* be overwritten")); 00098 return(null); 00099 endfunction 00100 00101 /// <b>Queue API:</b> Returns the current size of the queue 00102 function int unsigned cl_syoscb_queue::get_size(); 00103 `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue::get_size() *MUST* be overwritten")); 00104 return(0); 00105 endfunction 00106 00107 /// <b>Queue API:</b> Returns whether or not the queue is empty. 1'b0 means thet te queue 00108 /// is not empty. 1'b1 means that the queue is empty 00109 function bit cl_syoscb_queue::empty(); 00110 `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue::empty() *MUST* be overwritten")); 00111 return(0); 00112 endfunction 00113 00114 /// <b>Queue API:</b> Inserts a uvm_sequence_item at index idx. The implementation must wrap 00115 /// the uvm_sequence_item in a cl_syoscb_item before it is inserted. 00116 function bit cl_syoscb_queue::insert_item(string producer, uvm_sequence_item item, int unsigned idx); 00117 `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue::insert_item() *MUST* be overwritten")); 00118 return(1'b0); 00119 endfunction 00120 00121 /// <b>Queue API:</b> Creates an iterator for this queue. 00122 function cl_syoscb_queue_iterator_base cl_syoscb_queue::create_iterator(); 00123 `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue::create_iterator() *MUST* be overwritten")); 00124 return(null); 00125 endfunction 00126 00127 /// <b>Queue API:</b> Deletes a given iterator for this queue. 00128 function bit cl_syoscb_queue::delete_iterator(cl_syoscb_queue_iterator_base iterator); 00129 `uvm_fatal("IMPL_ERROR", $sformatf("cl_syoscb_queue::delete_item() *MUST* be overwritten")); 00130 return(1'b0); 00131 endfunction
|
Project: SyoSil ApS UVM Scoreboard, Revision: 1.0.2.2 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 Wed Jul 29 14:03:55 2015 |