1 |
4 |
vladimirar |
//----------------------------------------------------------------------
|
2 |
|
|
// Copyright 2014-2015 SyoSil ApS
|
3 |
|
|
// All Rights Reserved Worldwide
|
4 |
|
|
//
|
5 |
|
|
// Licensed under the Apache License, Version 2.0 (the
|
6 |
|
|
// "License"); you may not use this file except in
|
7 |
|
|
// compliance with the License. You may obtain a copy of
|
8 |
|
|
// the License at
|
9 |
|
|
//
|
10 |
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
11 |
|
|
//
|
12 |
|
|
// Unless required by applicable law or agreed to in
|
13 |
|
|
// writing, software distributed under the License is
|
14 |
|
|
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
15 |
|
|
// CONDITIONS OF ANY KIND, either express or implied. See
|
16 |
|
|
// the License for the specific language governing
|
17 |
|
|
// permissions and limitations under the License.
|
18 |
|
|
//----------------------------------------------------------------------
|
19 |
|
|
/// Class which act as the root of the compare algorithm. It instantiates the chosen compare
|
20 |
|
|
/// algorithm.
|
21 |
|
|
class cl_syoscb_compare extends uvm_component;
|
22 |
|
|
//-------------------------------------
|
23 |
|
|
// Non randomizable variables
|
24 |
|
|
//-------------------------------------
|
25 |
|
|
/// Handle to the configuration
|
26 |
|
|
local cl_syoscb_cfg cfg;
|
27 |
|
|
|
28 |
|
|
/// Handle to the actual compare algorithm to be used
|
29 |
|
|
local cl_syoscb_compare_base compare_algo;
|
30 |
|
|
|
31 |
|
|
//-------------------------------------
|
32 |
|
|
// UVM Macros
|
33 |
|
|
//-------------------------------------
|
34 |
|
|
`uvm_component_utils_begin(cl_syoscb_compare)
|
35 |
|
|
`uvm_field_object(cfg, UVM_DEFAULT)
|
36 |
|
|
`uvm_field_object(compare_algo, UVM_DEFAULT)
|
37 |
|
|
`uvm_component_utils_end
|
38 |
|
|
|
39 |
|
|
//-------------------------------------
|
40 |
|
|
// Constructor
|
41 |
|
|
//-------------------------------------
|
42 |
|
|
extern function new(string name, uvm_component parent);
|
43 |
|
|
|
44 |
|
|
//-------------------------------------
|
45 |
|
|
// UVM Phase methods
|
46 |
|
|
//-------------------------------------
|
47 |
|
|
extern function void build_phase(uvm_phase phase);
|
48 |
|
|
|
49 |
|
|
//-------------------------------------
|
50 |
|
|
// Class methods
|
51 |
|
|
//-------------------------------------
|
52 |
|
|
extern function void compare();
|
53 |
|
|
endclass : cl_syoscb_compare
|
54 |
|
|
|
55 |
|
|
function cl_syoscb_compare::new(string name, uvm_component parent);
|
56 |
|
|
super.new(name, parent);
|
57 |
|
|
endfunction : new
|
58 |
|
|
|
59 |
|
|
/// Gets the global scoreboard configuration and creates the compare algorithm, e.g. out-of-order.
|
60 |
|
|
function void cl_syoscb_compare::build_phase(uvm_phase phase);
|
61 |
|
|
if (!uvm_config_db #(cl_syoscb_cfg)::get(this, "", "cfg", this.cfg)) begin
|
62 |
|
|
`uvm_fatal("CFG_ERROR", $sformatf("[%s]: Configuration object not passed.", this.cfg.get_scb_name()))
|
63 |
|
|
end
|
64 |
|
|
|
65 |
|
|
this.compare_algo = cl_syoscb_compare_base::type_id::create("compare_algo", this);
|
66 |
|
|
this.compare_algo.set_cfg(this.cfg);
|
67 |
|
|
endfunction
|
68 |
|
|
|
69 |
|
|
/// Invokes the compare algorithms compare method.
|
70 |
|
|
function void cl_syoscb_compare::compare();
|
71 |
|
|
this.compare_algo.compare();
|
72 |
|
|
endfunction : compare
|