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 |
|
|
/// Base class for all comapre algorithms
|
20 |
|
|
class cl_syoscb_compare_base extends uvm_object;
|
21 |
|
|
//-------------------------------------
|
22 |
|
|
// Non randomizable variables
|
23 |
|
|
//-------------------------------------
|
24 |
|
|
/// Handle to the configuration
|
25 |
|
|
protected cl_syoscb_cfg cfg;
|
26 |
|
|
|
27 |
|
|
//-------------------------------------
|
28 |
|
|
// UVM Macros
|
29 |
|
|
//-------------------------------------
|
30 |
|
|
`uvm_object_utils_begin(cl_syoscb_compare_base)
|
31 |
|
|
`uvm_field_object(cfg, UVM_DEFAULT)
|
32 |
|
|
`uvm_object_utils_end
|
33 |
|
|
|
34 |
|
|
//-------------------------------------
|
35 |
|
|
// Constructor
|
36 |
|
|
//-------------------------------------
|
37 |
|
|
extern function new(string name = "cl_syoscb_compare_base");
|
38 |
|
|
|
39 |
|
|
//-------------------------------------
|
40 |
|
|
// Compare API
|
41 |
|
|
//-------------------------------------
|
42 |
|
|
extern virtual function void compare();
|
43 |
|
|
extern virtual function void compare_do();
|
44 |
|
|
extern function void set_cfg(cl_syoscb_cfg cfg);
|
45 |
|
|
extern function cl_syoscb_cfg get_cfg();
|
46 |
|
|
extern function string get_primary_queue_name();
|
47 |
|
|
endclass: cl_syoscb_compare_base
|
48 |
|
|
|
49 |
|
|
function cl_syoscb_compare_base::new(string name = "cl_syoscb_compare_base");
|
50 |
|
|
super.new(name);
|
51 |
|
|
endfunction: new
|
52 |
|
|
|
53 |
|
|
/// Compare API: This method is the compare algorithms public compare method. It is called when the
|
54 |
|
|
/// compare algorithm is asked to do a compare. Typically, this method is used to check state variables etc. to compute if the compare shall be done or not. If so then do_compare() is called.
|
55 |
|
|
///
|
56 |
|
|
/// NOTE: This method must be implemented.
|
57 |
|
|
function void cl_syoscb_compare_base::compare();
|
58 |
|
|
`uvm_fatal("IMPL_ERROR", $sformatf("[%s]: cl_syoscb_compare_base::compare() *MUST* be overwritten", this.cfg.get_scb_name()));
|
59 |
|
|
endfunction
|
60 |
|
|
|
61 |
|
|
/// Compare API: Does the actual compare.
|
62 |
|
|
/// NOTE: This method must be implemted.
|
63 |
|
|
function void cl_syoscb_compare_base::compare_do();
|
64 |
|
|
`uvm_fatal("IMPL_ERROR", $sformatf("[%s]: cl_syoscb_compare_base::compare_do() *MUST* be overwritten", this.cfg.get_scb_name()));
|
65 |
|
|
endfunction
|
66 |
|
|
|
67 |
|
|
/// Compare API: Passes the configuration object on to the compare algorithm for faster access.
|
68 |
|
|
function void cl_syoscb_compare_base::set_cfg(cl_syoscb_cfg cfg);
|
69 |
|
|
this.cfg = cfg;
|
70 |
|
|
endfunction: set_cfg
|
71 |
|
|
|
72 |
|
|
/// Compare API: Returns the configuration object
|
73 |
|
|
function cl_syoscb_cfg cl_syoscb_compare_base::get_cfg();
|
74 |
|
|
return(this.cfg);
|
75 |
|
|
endfunction: get_cfg
|
76 |
|
|
|
77 |
|
|
/// Compare API: Gets the primary queue. Convinience method.
|
78 |
|
|
function string cl_syoscb_compare_base::get_primary_queue_name();
|
79 |
|
|
cl_syoscb_cfg ch = this.get_cfg();
|
80 |
|
|
|
81 |
|
|
return(ch.get_primary_queue());
|
82 |
|
|
endfunction: get_primary_queue_name
|