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 |
|
|
/// The UVM scoreboard item. This item wraps the uvm_sequence_items. This ensures that future
|
20 |
|
|
/// extensions to the UVM scoreboard will always be able to use all uvm_sqeuence_items from
|
21 |
|
|
/// already existing testbenches etc. even though more META data is added to the wrapping item.
|
22 |
|
|
class cl_syoscb_item extends uvm_object;
|
23 |
|
|
//-------------------------------------
|
24 |
|
|
// Non randomizable variables
|
25 |
|
|
//-------------------------------------
|
26 |
|
|
/// Hold the name of the producer
|
27 |
|
|
local string producer;
|
28 |
|
|
|
29 |
|
|
/// Handle to the wrapped uvm_sequence_item
|
30 |
|
|
local uvm_sequence_item item;
|
31 |
|
|
|
32 |
|
|
//-------------------------------------
|
33 |
|
|
// UVM Macros
|
34 |
|
|
//-------------------------------------
|
35 |
|
|
`uvm_object_utils_begin(cl_syoscb_item)
|
36 |
|
|
`ifdef SYOSIL_APPLY_TLM_GP_CMP_WORKAROUND
|
37 |
|
|
// Use NOCOMPARE when do_compare is implemented. Otherwise the compare is done twice since
|
38 |
|
|
// the super of uvm field automation is called before do_compare. This will invoke the compare
|
39 |
|
|
// since the functions are virtual
|
40 |
|
|
`uvm_field_string(producer, UVM_DEFAULT | UVM_NOCOMPARE)
|
41 |
|
|
`uvm_field_object(item, UVM_DEFAULT | UVM_NOCOMPARE)
|
42 |
|
|
`else
|
43 |
|
|
`uvm_field_string(producer, UVM_DEFAULT)
|
44 |
|
|
`uvm_field_object(item, UVM_DEFAULT)
|
45 |
|
|
`endif
|
46 |
|
|
`uvm_object_utils_end
|
47 |
|
|
|
48 |
|
|
//-------------------------------------
|
49 |
|
|
// Constructor
|
50 |
|
|
//-------------------------------------
|
51 |
|
|
extern function new(string name = "cl_syoscb_item");
|
52 |
|
|
|
53 |
|
|
//-------------------------------------
|
54 |
|
|
// Item API
|
55 |
|
|
//-------------------------------------
|
56 |
|
|
extern function string get_producer();
|
57 |
|
|
extern function void set_producer(string producer);
|
58 |
|
|
extern function uvm_sequence_item get_item();
|
59 |
|
|
extern function void set_item(uvm_sequence_item item);
|
60 |
|
|
|
61 |
|
|
`ifdef SYOSIL_APPLY_TLM_GP_CMP_WORKAROUND
|
62 |
|
|
//-------------------------------------
|
63 |
|
|
// UVM TLM2 Generic Payload compare
|
64 |
|
|
// workaround
|
65 |
|
|
//-------------------------------------
|
66 |
|
|
function bit do_compare(uvm_object rhs, uvm_comparer comparer);
|
67 |
|
|
bit status = 1'b1;
|
68 |
|
|
cl_syoscb_item that;
|
69 |
|
|
|
70 |
|
|
// Code it properly using the comparer policy
|
71 |
|
|
if(!$cast(that, rhs)) begin
|
72 |
|
|
status = 1'b0;
|
73 |
|
|
end else begin
|
74 |
|
|
// "producer" compare using the comparer object
|
75 |
|
|
status &= comparer.compare_string("producer", this.producer, that.producer);
|
76 |
|
|
|
77 |
|
|
// Apply WORKAROUND:
|
78 |
|
|
// Ensure that the comparer object is properly updated at this level
|
79 |
|
|
// and propagate the compare result bit correctly
|
80 |
|
|
status &= comparer.compare_object("item", this.item, that.item);
|
81 |
|
|
end
|
82 |
|
|
return(status);
|
83 |
|
|
endfunction: do_compare
|
84 |
|
|
`endif
|
85 |
|
|
endclass: cl_syoscb_item
|
86 |
|
|
|
87 |
|
|
function cl_syoscb_item::new(string name = "cl_syoscb_item");
|
88 |
|
|
super.new(name);
|
89 |
|
|
endfunction : new
|
90 |
|
|
|
91 |
|
|
/// Item API: Returns the producer
|
92 |
|
|
function string cl_syoscb_item::get_producer();
|
93 |
|
|
return(this.producer);
|
94 |
|
|
endfunction: get_producer
|
95 |
|
|
|
96 |
|
|
/// Item API: Sets the producer
|
97 |
|
|
function void cl_syoscb_item::set_producer(string producer);
|
98 |
|
|
// The producer has been checked by the parent prior
|
99 |
|
|
// to the insertion
|
100 |
|
|
this.producer = producer;
|
101 |
|
|
endfunction: set_producer
|
102 |
|
|
|
103 |
|
|
/// Item API: Returns the wrapped uvm_sequence_item
|
104 |
|
|
function uvm_sequence_item cl_syoscb_item::get_item();
|
105 |
|
|
return(this.item);
|
106 |
|
|
endfunction: get_item
|
107 |
|
|
|
108 |
|
|
/// Item API: Sets the to be wrapped uvm_sequence_item
|
109 |
|
|
function void cl_syoscb_item::set_item(uvm_sequence_item item);
|
110 |
|
|
this.item = item;
|
111 |
|
|
endfunction: set_item
|