00001 class cl_syoscb extends uvm_scoreboard; 00002 00003 cl_syoscb_cfg cfg; 00004 cl_syoscb_queue queues[]; 00005 cl_syoscb_compare compare_strategy; 00006 00007 `uvm_component_utils_begin(cl_syoscb) 00008 `uvm_field_object(cfg, UVM_ALL_ON) 00009 `uvm_field_array_object(queues, UVM_ALL_ON) 00010 `uvm_field_object(compare_strategy, UVM_ALL_ON) 00011 `uvm_component_utils_end 00012 00013 extern function new(string name, uvm_component parent); 00014 extern function void build_phase(uvm_phase phase); 00015 extern function void check_phase(uvm_phase phase); 00016 extern function void report_phase(uvm_phase phase); 00017 extern function bit compare(); 00018 extern function void add_item(string queue_name, string producer, uvm_sequence_item item); 00019 endclass: cl_syoscb 00020 00021 function cl_syoscb::new(string name, uvm_component parent); 00022 super.new(name, parent); 00023 endfunction : new 00024 00025 function void cl_syoscb::build_phase(uvm_phase phase); 00026 // TBD: This contradicts the paper. It states that a default one is created 00027 // TBD push config further down? 00028 if (!uvm_config_db #(cl_syoscb_cfg)::get(this, "", "cfg", this.cfg)) 00029 `uvm_fatal("CFG", "Configuration object not passed.") 00030 // TBD: This is snooping directly in the CFG - use get/set functions instead? 00031 this.queues = new[this.cfg.queues.size()]; 00032 begin 00033 int unsigned idx = 0; 00034 foreach(this.cfg.queues[queue_name]) begin 00035 this.queues[idx] = cl_syoscb_queue::type_id::create({"queue", $psprintf("%0d",idx)}, this); 00036 this.cfg.queues[queue_name] = this.queues[idx++]; 00037 end 00038 end 00039 00040 this.compare_strategy = cl_syoscb_compare::type_id::create(.name("compare_strategy"), .parent(this)); 00041 00042 // TBD: This should either be passed as args to constructor 00043 // or the objects should query the CFG DB directly if possible 00044 // The parent path is not available anymore after we changed to uvm_object 00045 this.compare_strategy.compare_algo.set_cfg(this.cfg); 00046 00047 begin 00048 cl_syoscb_report_catcher catcher = new(); 00049 uvm_report_cb::add(null, catcher); 00050 end 00051 endfunction : build_phase 00052 00053 function bit cl_syoscb::compare(); 00054 return(this.compare_strategy.compare()); 00055 endfunction: compare 00056 00057 /////////////////////////////////////// 00058 // Function based API 00059 /////////////////////////////////////// 00060 function void cl_syoscb::add_item(string queue_name, string producer, uvm_sequence_item item); 00061 // TBD: Add checks of correct queue and producer 00062 if(!this.cfg.queues[queue_name].add_item(producer, item)) begin 00063 `uvm_fatal("QUEUE_ERROR", $sformatf("Unable to add item to queue: %s", queue_name)); 00064 end 00065 00066 // TBD: This should be revised according to how it was in the old SCB 00067 // TBD: Return value from compare() should also be handled 00068 void'(this.compare()); 00069 endfunction : add_item 00070 00071 /////////////////////////////////////// 00072 // Transaction based API 00073 /////////////////////////////////////// 00074 // TBD 00075 00076 function void cl_syoscb::check_phase(uvm_phase phase); 00077 string queue_names[]; 00078 cl_syoscb_queue_std queue; 00079 super.check_phase(phase); 00080 00081 this.cfg.get_queues(queue_names); 00082 foreach (queue_names[i]) begin 00083 $cast(queue, this.cfg.queues[queue_names[i]]); 00084 if (queue.items.size()!=0) begin 00085 string firstitem = queue.items[0].sprint(); 00086 `uvm_error("SYOSCB", $psprintf("Queue %s not empty, entries : %d, first element : \n%s", queue_names[i], queue.items.size(), firstitem)); 00087 // TBD dump first parts of each queue ! 00088 // will we use std UVM report mechanisms or a special channel we can redirect ? 00089 end 00090 end 00091 endfunction : check_phase 00092 00093 function void cl_syoscb::report_phase(uvm_phase phase); 00094 super.report_phase(phase); 00095 // TBD this should NOT call the report phase of the compare method ! 00096 // as cl_syoscb_compare_base extends uvm_component the compare method should just perform its end of test checks in 00097 // uvm_check_phase, from the UVM 1.1 class ref manual: 00098 // uvm_build_phase Create and configure of testbench structure 00099 // uvm_connect_phase Establish cross-component connections. 00100 // uvm_end_of_elaboration_phase Fine-tune the testbench. 00101 // uvm_start_of_simulation_phase Get ready for DUT to be simulated. 00102 // uvm_run_phase Stimulate the DUT. 00103 // uvm_extract_phase Extract data from different points of the verficiation environment. 00104 // uvm_check_phase Check for any unexpected conditions in the verification environment. 00105 // uvm_report_phase Report results of the test. 00106 // uvm_final_phase Tie up loose ends. 00107 endfunction : report_phase
|
Project: SyoSil ApS UVM Scoreboard, Revision: 1.0.0.1 |
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 Version: 1.6.1 IDV SV Filter Version: 2.6.2 Mon Nov 24 09:24:22 2014 |