cl_syoscb_compare_ooo.svh

Go to the documentation of this file.
00001 class cl_syoscb_compare_ooo extends cl_syoscb_compare_base;
00002   `uvm_object_utils(cl_syoscb_compare_ooo)
00003 
00004   // TBD: max_search_window for OOO compare?
00005 
00006   extern function new(string name = "cl_syoscb_compare_ooo");
00007   extern virtual function bit compare();
00008   extern function bit compare_do();
00009 
00010 endclass: cl_syoscb_compare_ooo
00011 
00012 function cl_syoscb_compare_ooo::new(string name = "cl_syoscb_compare_ooo");
00013   super.new(name);
00014 endfunction: new
00015 
00016 function bit cl_syoscb_compare_ooo::compare();
00017   // Here any state variables should be queried
00018   // to compute if the compare should be done or not
00019   return(this.compare_do());
00020 endfunction: compare
00021 
00022 function bit cl_syoscb_compare_ooo::compare_do();
00023   string primary_queue_name;
00024   cl_syoscb_queue primary_queue;
00025   cl_syoscb_queue_iterator_base primary_queue_iter;
00026   string queue_names[];
00027   int unsigned secondary_item_found[string];
00028   bit compare_continue = 1'b1;
00029   bit compare_result = 1'b0;
00030   uvm_sequence_item primary_item;
00031 
00032   primary_queue_name = this.get_primary_queue_name();
00033   this.get_cfg.get_queues(queue_names);
00034 
00035   `uvm_info("DEBUG", $sformatf("cmp-ooo: primary queue: %s", primary_queue_name), UVM_FULL);
00036   `uvm_info("DEBUG", $sformatf("cmp-ooo: number of queues: %0d", queue_names.size()), UVM_FULL);
00037 
00038   if(!$cast(primary_queue, this.get_cfg().queues[primary_queue_name])) begin
00039     `uvm_fatal("TYPE_ERROR", $sformatf("Unable to cast type %0s to type %0s",
00040                                        this.get_cfg().queues[primary_queue_name].get_type_name(),
00041                                        primary_queue.get_type_name()));
00042   end
00043 
00044   primary_queue_iter = primary_queue.create_iterator();
00045 
00046   // Outer loop loops through all
00047   while (!primary_queue_iter.is_done()) begin
00048     primary_item = primary_queue_iter.get_item();
00049 
00050     // Inner loop through all queues
00051     foreach(queue_names[i]) begin
00052       `uvm_info("DEBUG", $sformatf("Looking at queue: %s", queue_names[i]), UVM_FULL);
00053 
00054       if(queue_names[i] != primary_queue_name) begin
00055         cl_syoscb_queue secondary_queue;
00056         cl_syoscb_queue_iterator_base secondary_queue_iter;
00057 
00058         `uvm_info("DEBUG", $sformatf("%s is a secondary queue - now comparing", queue_names[i]), UVM_FULL);
00059 
00060         if(!$cast(secondary_queue, this.get_cfg().queues[queue_names[i]])) begin
00061           `uvm_fatal("TYPE_ERROR", $sformatf("Unable to cast type %0s to type %0s",
00062                                              this.get_cfg().queues[primary_queue_name].get_type_name(),
00063                                              primary_queue.get_type_name()));
00064         end
00065         secondary_queue_iter = secondary_queue.create_iterator();
00066 
00067         // Only the first match is removed
00068         while(!secondary_queue_iter.is_done()) begin
00069           if(secondary_queue_iter.get_item().compare(primary_item) == 1'b1) begin
00070             secondary_item_found[queue_names[i]] = secondary_queue_iter.get_idx();
00071             `uvm_info("DEBUG", $sformatf("Secondary item found at index: %0d", secondary_queue_iter.get_idx()),
00072                       UVM_FULL);
00073             break;
00074           end
00075           if(!secondary_queue_iter.next()) begin
00076             `uvm_fatal("QUEUE_ERROR", $sformatf("Unable to get next element from iterator on secondary queue: %s", queue_names[i]));
00077           end    
00078         end
00079         if(!secondary_queue.delete_iterator(secondary_queue_iter)) begin
00080           `uvm_fatal("QUEUE_ERROR", $sformatf("Unable to delete iterator from secondaery queue: %s", queue_names[i]));
00081         end
00082       end else begin
00083         `uvm_info("DEBUG", $sformatf("%s is the primary queue - skipping", queue_names[i]), UVM_FULL);
00084       end
00085     end
00086 
00087     if(secondary_item_found.size() != 0) begin
00088       string queue_name;
00089       `uvm_info("DEBUG", $sformatf("Found match for primary queue item : %s",
00090                                    primary_queue_iter.get_item().sprint()), UVM_FULL);
00091 
00092       // Remove from primary
00093       if(!primary_queue.delete_item(primary_queue_iter.get_idx())) begin
00094         `uvm_error("QUEUE_ERROR", $sformatf("Unable to delete item idx %0d from queue %s",
00095                                             primary_queue_iter.get_idx(), primary_queue.get_name()));
00096       end
00097 
00098       // Remove from all secondaries
00099       while(secondary_item_found.next(queue_name)) begin
00100         cl_syoscb_queue secondary_queue;
00101 
00102         if(!$cast(secondary_queue, this.get_cfg().queues[queue_name])) begin
00103           `uvm_fatal("TYPE_ERROR", $sformatf("Unable to cast type %0s to type %0s",
00104                                              this.get_cfg().queues[primary_queue_name].get_type_name(),
00105                                              primary_queue.get_type_name()));
00106         end
00107         if(!secondary_queue.delete_item(secondary_item_found[queue_name])) begin
00108           `uvm_error("QUEUE_ERROR", $sformatf("Unable to delete item idx %0d from queue %s",
00109                                               secondary_item_found[queue_name], secondary_queue.get_name()));
00110         end
00111       end
00112     end
00113 
00114     if(!primary_queue_iter.next()) begin
00115       `uvm_fatal("QUEUE_ERROR", $sformatf("Unable to get next element from iterator on parimary queue: %s", primary_queue_name));
00116     end
00117   end
00118 
00119   if(!primary_queue.delete_iterator(primary_queue_iter)) begin
00120     `uvm_fatal("QUEUE_ERROR", $sformatf("Unable to delete iterator from primary queue: %s", primary_queue_name));
00121   end
00122 
00123   // TBD: See note in cl_scbsyo_compare_base.svh
00124   return(1'b1);
00125 endfunction : compare_do
 All Classes Namespaces Files Functions Variables

Project: SyoSil ApS UVM Scoreboard, Revision: 1.0.0.0
Copyright 2014 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
Thu Oct 30 05:34:49 2014
Find a documentation bug? Report bugs to: bugs.intelligentdv.com Project: DoxygenFilterSV