cl_syoscb_cfg.svh

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

Project: SyoSil ApS UVM Scoreboard, Revision: 1.0.2.5

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
Sat Nov 28 05:41:54 2015
Find a documentation bug? Report bugs to: bugs.intelligentdv.com Project: DoxygenFilterSV