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.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.cfg.queues[primary_queue_name])) begin
00039     `uvm_fatal("TYPE_ERROR", $sformatf("Unable to cast type %0s to type %0s",
00040                                        this.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.cfg.queues[queue_names[i]])) begin
00061           `uvm_fatal("TYPE_ERROR", $sformatf("Unable to cast type %0s to type %0s",
00062                                              this.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    
00070      // TBD: This is not correct!!! WRONG type ??
00071      uvm_sequence_item sih = secondary_queue_iter.get_item();
00072 
00073           if(sih.compare(primary_item) == 1'b1) begin
00074             secondary_item_found[queue_names[i]] = secondary_queue_iter.get_idx();
00075             `uvm_info("DEBUG", $sformatf("Secondary item found at index: %0d", secondary_queue_iter.get_idx()),
00076                       UVM_FULL);
00077             break;
00078           end
00079           if(!secondary_queue_iter.next()) begin
00080             `uvm_fatal("QUEUE_ERROR", $sformatf("Unable to get next element from iterator on secondary queue: %s", queue_names[i]));
00081           end    
00082         end
00083         if(!secondary_queue.delete_iterator(secondary_queue_iter)) begin
00084           `uvm_fatal("QUEUE_ERROR", $sformatf("Unable to delete iterator from secondaery queue: %s", queue_names[i]));
00085         end
00086       end else begin
00087         `uvm_info("DEBUG", $sformatf("%s is the primary queue - skipping", queue_names[i]), UVM_FULL);
00088       end
00089     end
00090 
00091     // Only start to remove items if all slave items are found (One from each slave queue)
00092     if(secondary_item_found.size() == queue_names.size()-1) begin
00093       string queue_name;
00094 
00095       // TBD: This is not correct!!! WRONG type ??
00096       uvm_sequence_item pih = primary_queue_iter.get_item();
00097 
00098 
00099       `uvm_info("DEBUG", $sformatf("Found match for primary queue item : %s",
00100                                    pih.sprint()), UVM_FULL);
00101 
00102       // Remove from primary
00103       if(!primary_queue.delete_item(primary_queue_iter.get_idx())) begin
00104         `uvm_error("QUEUE_ERROR", $sformatf("Unable to delete item idx %0d from queue %s",
00105                                             primary_queue_iter.get_idx(), primary_queue.get_name()));
00106       end
00107 
00108       // Remove from all secondaries
00109       while(secondary_item_found.next(queue_name)) begin
00110         cl_syoscb_queue secondary_queue;
00111 
00112         if(!$cast(secondary_queue, this.cfg.queues[queue_name])) begin
00113           `uvm_fatal("TYPE_ERROR", $sformatf("Unable to cast type %0s to type %0s",
00114                                              this.cfg.queues[primary_queue_name].get_type_name(),
00115                                              primary_queue.get_type_name()));
00116         end
00117         if(!secondary_queue.delete_item(secondary_item_found[queue_name])) begin
00118           `uvm_error("QUEUE_ERROR", $sformatf("Unable to delete item idx %0d from queue %s",
00119                                               secondary_item_found[queue_name], secondary_queue.get_name()));
00120         end
00121       end
00122     end
00123 
00124     // Call .next() blindly since we do not care about the
00125     // return value, since we might be at the end of the queue.
00126     // Thus, .next() will return 1'b0 at the end of the queue
00127     void'(primary_queue_iter.next());
00128   end
00129 
00130   if(!primary_queue.delete_iterator(primary_queue_iter)) begin
00131     `uvm_fatal("QUEUE_ERROR", $sformatf("Unable to delete iterator from primary queue: %s", primary_queue_name));
00132   end
00133 
00134   // TBD: See note in cl_scbsyo_compare_base.svh
00135   return(1'b1);
00136 endfunction : compare_do
 All Classes Namespaces Files Functions Variables

Project: SyoSil ApS UVM Scoreboard, Revision: 1.0.0.2
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
Wed Feb 25 04:01:40 2015
Find a documentation bug? Report bugs to: bugs.intelligentdv.com Project: DoxygenFilterSV