00001 /// Configuration class for the SyoSil UVM scoreboard 00002 class cl_syoscb_cfg extends uvm_object; 00003 //--------------------------------- 00004 // Non randomizable member variables 00005 //--------------------------------- 00006 /// Associative array holding handles to each queue. Indexed by queue name 00007 local cl_syoscb_queue queues[string]; 00008 00009 /// Associative array indexed by producer name. Returns the list of queues which 00010 /// this producer is related to. 00011 local cl_syoscb_cfg_pl producers[string]; 00012 local string primary_queue; 00013 00014 /// 1'b0 => Calls to cl_syoscb::add_item will clone the uvm_sequence_item 00015 /// 1'b1 => Calls to cl_syoscb::add_item will not clone the uvm_sequence_item 00016 local bit disable_clone = 1'b0; 00017 00018 /// Maximum number of elements in each queue before an error is signalled. 0 means no limit (default) 00019 local int unsigned max_queue_size[string]; 00020 00021 // TBD::JSA local bit full_scb_dump; 00022 // TBD::JSA local int unsigned full_max_queue_size[string]; 00023 // TBD::JSA local string full_scb_type[]; 00024 // TBD::JSA local int unsigned item_time_out_queue[string]; 00025 // TBD::JSA local int unsigned item_time_out_producer[string]; 00026 00027 //------------------------------------- 00028 // UVM Macros 00029 //------------------------------------- 00030 `uvm_object_utils_begin(cl_syoscb_cfg) 00031 `uvm_field_aa_object_string(queues, UVM_DEFAULT) 00032 `uvm_field_aa_object_string(producers, UVM_DEFAULT) 00033 `uvm_field_string(primary_queue, UVM_DEFAULT) 00034 `uvm_field_int(disable_clone, UVM_DEFAULT) 00035 `uvm_field_aa_int_string(max_queue_size, UVM_DEFAULT) 00036 `uvm_object_utils_end 00037 00038 //------------------------------------- 00039 // Constructor 00040 //------------------------------------- 00041 extern function new(string name = "cl_syoscb_cfg"); 00042 00043 //------------------------------------- 00044 // Configuration API 00045 //------------------------------------- 00046 extern function cl_syoscb_queue get_queue(string queue_name); 00047 extern function void set_queue(string queue_name, cl_syoscb_queue queue); 00048 extern function void get_queues(output string queue_names[]); 00049 extern function void set_queues(string queue_names[]); 00050 extern function bit exist_queue(string queue_name); 00051 extern function int unsigned size_queues(); 00052 extern function cl_syoscb_cfg_pl get_producer(string producer); 00053 extern function bit set_producer(string producer, queue_names[]); 00054 extern function bit exist_producer(string producer); 00055 extern function void get_producers(output string producers[]); 00056 extern function string get_primary_queue(); 00057 extern function bit set_primary_queue(string primary_queue_name); 00058 extern function void set_disable_clone(bit dc); 00059 extern function bit get_disable_clone(); 00060 extern function void set_max_queue_size(string queue_name, int unsigned mqs); 00061 extern function int unsigned get_max_queue_size(string queue_name); 00062 endclass : cl_syoscb_cfg 00063 00064 function cl_syoscb_cfg::new(string name = "cl_syoscb_cfg"); 00065 super.new(name); 00066 endfunction: new 00067 00068 /// <b>Configuration API:</b> Returns a queue handle for the specificed queue 00069 function cl_syoscb_queue cl_syoscb_cfg::get_queue(string queue_name); 00070 // If queue does not exist then return NULL 00071 if(!this.exist_queue(queue_name)) begin 00072 `uvm_info("CFG_ERROR", $sformatf("Queue: %0s is not found", queue_name), UVM_DEBUG); 00073 return(null); 00074 end 00075 00076 return(this.queues[queue_name]); 00077 endfunction: get_queue 00078 00079 /// <b>Configuration API:</b> Sets the queue object for a given queue 00080 function void cl_syoscb_cfg::set_queue(string queue_name, cl_syoscb_queue queue); 00081 this.queues[queue_name] = queue; 00082 endfunction: set_queue 00083 00084 /// <b>Configuration API:</b> Returns all queue names a string list 00085 function void cl_syoscb_cfg::get_queues(output string queue_names[]); 00086 string queue_name; 00087 int unsigned idx = 0; 00088 00089 queue_names = new[this.queues.size()]; 00090 00091 while(this.queues.next(queue_name)) begin 00092 queue_names[idx++] = queue_name; 00093 end 00094 endfunction: get_queues 00095 00096 /// <b>Configuration API:</b> Will set the legal queues when provides with a list of queue names. 00097 /// An example could be: set_queues({"Q1", "Q2"}) 00098 /// Will set the max_queue_size for each queue to 0 (no limit) as default 00099 function void cl_syoscb_cfg::set_queues(string queue_names[]); 00100 foreach(queue_names[i]) begin 00101 this.queues[queue_names[i]] = null; 00102 00103 // Set default max queue size to no limit 00104 this.max_queue_size[queue_names[i]] = 0; 00105 end 00106 endfunction: set_queues 00107 00108 /// <b>Configuration API:</b> Returns 1'b0 if the queue does not exist and 1'b1 if it exists 00109 function bit cl_syoscb_cfg::exist_queue(string queue_name); 00110 return(this.queues.exists(queue_name)==0 ? 1'b0 : 1'b1); 00111 endfunction 00112 00113 /// <b>Configuration API:</b> Returns the number of queues 00114 function int unsigned cl_syoscb_cfg::size_queues(); 00115 return(this.queues.size()); 00116 endfunction 00117 00118 /// <b>Configuration API:</b> Gets the given producer object for a specified producer 00119 function cl_syoscb_cfg_pl cl_syoscb_cfg::get_producer(string producer); 00120 if(this.exist_producer(producer)) begin 00121 return(this.producers[producer]); 00122 end else begin 00123 `uvm_info("CFG_ERROR", $sformatf("Unable to get producer: %s", producer), UVM_DEBUG); 00124 return(null); 00125 end 00126 endfunction: get_producer 00127 00128 /// <b>Configuration API:</b> Sets the given producer for the listed queues 00129 function bit cl_syoscb_cfg::set_producer(string producer, queue_names[]); 00130 cl_syoscb_cfg_pl prod_list; 00131 00132 // Check that all queues exists 00133 begin 00134 bit unique_queue_name[string]; 00135 00136 foreach (queue_names[i]) begin 00137 if(!unique_queue_name.exists(queue_names[i])) begin 00138 unique_queue_name[queue_names[i]] = 1'b1; 00139 end else begin 00140 `uvm_info("CFG_ERROR", $sformatf("Unable to set producer: %s. List of queue names contains dublicates", producer), UVM_DEBUG); 00141 return(1'b0); 00142 end 00143 00144 // If queue does not exist then return 1'b0 00145 if(!this.exist_queue(queue_names[i])) begin 00146 `uvm_info("CFG_ERROR", $sformatf("Queue: %0s is not found", queue_names[i]), UVM_DEBUG); 00147 return(1'b0); 00148 end 00149 end 00150 end 00151 00152 // All queues exist -> set the producer 00153 prod_list = new(); // Create producer list 00154 prod_list.set_list(queue_names); // Set queue names in producer list 00155 this.producers[producer] = prod_list; // Set producer list for producer 00156 00157 // Return 1'b1 since all is good 00158 return(1'b1); 00159 endfunction: set_producer 00160 00161 /// <b>Configuration API:</b> Checks if a given producer exists 00162 function bit cl_syoscb_cfg::exist_producer(string producer); 00163 return(this.producers.exists(producer)==0 ? 1'b0 : 1'b1); 00164 endfunction 00165 00166 /// <b>Configuration API:</b> Returns all producers as string list 00167 function void cl_syoscb_cfg::get_producers(output string producers[]); 00168 string producer; 00169 int unsigned idx = 0; 00170 00171 producers = new[this.producers.size()]; 00172 00173 while(this.producers.next(producer)) begin 00174 producers[idx++] = producer; 00175 end 00176 endfunction: get_producers 00177 00178 /// <b>Configuration API:</b> Gets the primary queue. 00179 /// The primary queue is used by the compare algorithms to select which queue to use as the primary one. 00180 function string cl_syoscb_cfg::get_primary_queue(); 00181 return(this.primary_queue); 00182 endfunction: get_primary_queue 00183 00184 /// <b>Configuration API:</b> Sets the primary queue. 00185 /// The primary queue is used by the compare algorithms to select which queue to use as the primary one. 00186 function bit cl_syoscb_cfg::set_primary_queue(string primary_queue_name); 00187 // If queue does not exist then return 1'b0 00188 if(!this.exist_queue(primary_queue_name)) begin 00189 `uvm_info("CFG_ERROR", $sformatf("Queue: %0s is not found", primary_queue_name), UVM_DEBUG); 00190 return(1'b0); 00191 end 00192 00193 // Set the primary queue 00194 this.primary_queue = primary_queue_name; 00195 00196 // Return 1'b1 since all is good 00197 return(1'b1); 00198 endfunction: set_primary_queue 00199 00200 /// <b>Configuration API:</b> Set the value of the disable_clone member variable 00201 function void cl_syoscb_cfg::set_disable_clone(bit dc); 00202 this.disable_clone = dc; 00203 endfunction 00204 00205 /// <b>Configuration API:</b> Get the value of the disable_clone member variable 00206 function bit cl_syoscb_cfg::get_disable_clone(); 00207 return(this.disable_clone); 00208 endfunction 00209 00210 /// <b>Configuration API:</b> Set the maximum number of items allowed for a given queue. 00211 /// 0 (no limit) is default 00212 function void cl_syoscb_cfg::set_max_queue_size(string queue_name, int unsigned mqs); 00213 if(this.exist_queue(queue_name)) begin 00214 this.max_queue_size[queue_name] = mqs; 00215 end else begin 00216 `uvm_fatal("CFG_ERROR", $sformatf("Queue: %s not found when trying to set max_queue_size", queue_name)) 00217 end 00218 endfunction 00219 00220 /// <b>Configuration API:</b> Returns the maximum number of allowed items for a given queue. 00221 /// 0 (no limit) is default 00222 function int unsigned cl_syoscb_cfg::get_max_queue_size(string queue_name); 00223 if(this.exist_queue(queue_name)) begin 00224 return(this.max_queue_size[queue_name]); 00225 end else begin 00226 `uvm_fatal("CFG_ERROR", $sformatf("Queue: %s not found when trying to get max_queue_size", queue_name)) 00227 return(0); 00228 end 00229 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 |