1 |
16 |
HanySalah |
//----------------------------------------------------------------------
|
2 |
|
|
// Copyright 2013 Cadence Design Inc
|
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 |
|
|
typedef class uvm_factory;
|
20 |
|
|
typedef class uvm_default_factory;
|
21 |
|
|
typedef class uvm_report_server;
|
22 |
|
|
typedef class uvm_default_report_server;
|
23 |
|
|
typedef class uvm_root;
|
24 |
|
|
typedef class uvm_visitor;
|
25 |
|
|
typedef class uvm_component_name_check_visitor;
|
26 |
|
|
typedef class uvm_component;
|
27 |
|
|
|
28 |
|
|
typedef class uvm_tr_database;
|
29 |
|
|
typedef class uvm_text_tr_database;
|
30 |
|
|
|
31 |
|
|
`ifndef UVM_CORESERVICE_TYPE
|
32 |
|
|
`define UVM_CORESERVICE_TYPE uvm_default_coreservice_t
|
33 |
|
|
`endif
|
34 |
|
|
|
35 |
|
|
typedef class `UVM_CORESERVICE_TYPE;
|
36 |
|
|
|
37 |
|
|
//----------------------------------------------------------------------
|
38 |
|
|
// Class: uvm_coreservice_t
|
39 |
|
|
//
|
40 |
|
|
// The singleton instance of uvm_coreservice_t provides a common point for all central
|
41 |
|
|
// uvm services such as uvm_factory, uvm_report_server, ...
|
42 |
|
|
// The service class provides a static <::get> which returns an instance adhering to uvm_coreservice_t
|
43 |
|
|
// the rest of the set_ get_ pairs provide access to the internal uvm services
|
44 |
|
|
//
|
45 |
|
|
// Custom implementations of uvm_coreservice_t can be included in uvm_pkg::*
|
46 |
|
|
// and can selected via the define UVM_CORESERVICE_TYPE. They cannot reside in another package.
|
47 |
|
|
//----------------------------------------------------------------------
|
48 |
|
|
|
49 |
|
|
virtual class uvm_coreservice_t;
|
50 |
|
|
// Function: get_factory
|
51 |
|
|
//
|
52 |
|
|
// intended to return the currently enabled uvm factory,
|
53 |
|
|
pure virtual function uvm_factory get_factory();
|
54 |
|
|
|
55 |
|
|
// Function: set_factory
|
56 |
|
|
//
|
57 |
|
|
// intended to set the current uvm factory
|
58 |
|
|
pure virtual function void set_factory(uvm_factory f);
|
59 |
|
|
|
60 |
|
|
// Function: get_report_server
|
61 |
|
|
// intended to return the current global report_server
|
62 |
|
|
pure virtual function uvm_report_server get_report_server();
|
63 |
|
|
|
64 |
|
|
// Function: set_report_server
|
65 |
|
|
// intended to set the central report server to ~server~
|
66 |
|
|
pure virtual function void set_report_server(uvm_report_server server);
|
67 |
|
|
|
68 |
|
|
// Function: get_default_tr_database
|
69 |
|
|
// intended to return the current default record database
|
70 |
|
|
pure virtual function uvm_tr_database get_default_tr_database();
|
71 |
|
|
|
72 |
|
|
// Function: set_default_tr_database
|
73 |
|
|
// intended to set the current default record database to ~db~
|
74 |
|
|
//
|
75 |
|
|
pure virtual function void set_default_tr_database(uvm_tr_database db);
|
76 |
|
|
|
77 |
|
|
// Function: set_component_visitor
|
78 |
|
|
// intended to set the component visitor to ~v~
|
79 |
|
|
// (this visitor is being used for the traversal at end_of_elaboration_phase
|
80 |
|
|
// for instance for name checking)
|
81 |
|
|
pure virtual function void set_component_visitor(uvm_visitor#(uvm_component) v);
|
82 |
|
|
|
83 |
|
|
// Function: get_component_visitor
|
84 |
|
|
// intended to retrieve the current component visitor
|
85 |
|
|
// see
|
86 |
|
|
pure virtual function uvm_visitor#(uvm_component) get_component_visitor();
|
87 |
|
|
|
88 |
|
|
// Function: get_root
|
89 |
|
|
//
|
90 |
|
|
// returns the uvm_root instance
|
91 |
|
|
pure virtual function uvm_root get_root();
|
92 |
|
|
|
93 |
|
|
local static `UVM_CORESERVICE_TYPE inst;
|
94 |
|
|
// Function: get
|
95 |
|
|
//
|
96 |
|
|
// Returns an instance providing the uvm_coreservice_t interface.
|
97 |
|
|
// The actual type of the instance is determined by the define `UVM_CORESERVICE_TYPE.
|
98 |
|
|
//
|
99 |
|
|
//| `define UVM_CORESERVICE_TYPE uvm_blocking_coreservice
|
100 |
|
|
//| class uvm_blocking_coreservice extends uvm_default_coreservice_t;
|
101 |
|
|
//| virtual function void set_factory(uvm_factory f);
|
102 |
|
|
//| `uvm_error("FACTORY","you are not allowed to override the factory")
|
103 |
|
|
//| endfunction
|
104 |
|
|
//| endclass
|
105 |
|
|
//|
|
106 |
|
|
static function uvm_coreservice_t get();
|
107 |
|
|
if(inst==null)
|
108 |
|
|
inst=new;
|
109 |
|
|
|
110 |
|
|
return inst;
|
111 |
|
|
endfunction // get
|
112 |
|
|
|
113 |
|
|
endclass
|
114 |
|
|
|
115 |
|
|
//----------------------------------------------------------------------
|
116 |
|
|
// Class: uvm_default_coreservice_t
|
117 |
|
|
//
|
118 |
|
|
// uvm_default_coreservice_t provides a default implementation of the
|
119 |
|
|
// uvm_coreservice_t API. It instantiates uvm_default_factory, uvm_default_report_server,
|
120 |
|
|
// uvm_root.
|
121 |
|
|
//----------------------------------------------------------------------
|
122 |
|
|
class uvm_default_coreservice_t extends uvm_coreservice_t;
|
123 |
|
|
local uvm_factory factory;
|
124 |
|
|
|
125 |
|
|
// Function: get_factory
|
126 |
|
|
//
|
127 |
|
|
// Returns the currently enabled uvm factory.
|
128 |
|
|
// When no factory has been set before, instantiates a uvm_default_factory
|
129 |
|
|
virtual function uvm_factory get_factory();
|
130 |
|
|
if(factory==null) begin
|
131 |
|
|
uvm_default_factory f;
|
132 |
|
|
f=new;
|
133 |
|
|
factory=f;
|
134 |
|
|
end
|
135 |
|
|
|
136 |
|
|
return factory;
|
137 |
|
|
endfunction
|
138 |
|
|
|
139 |
|
|
// Function: set_factory
|
140 |
|
|
//
|
141 |
|
|
// Sets the current uvm factory.
|
142 |
|
|
// Please note: it is up to the user to preserve the contents of the original factory or delegate calls to the original factory
|
143 |
|
|
virtual function void set_factory(uvm_factory f);
|
144 |
|
|
factory = f;
|
145 |
|
|
endfunction
|
146 |
|
|
|
147 |
|
|
local uvm_tr_database tr_database;
|
148 |
|
|
// Function: get_default_tr_database
|
149 |
|
|
// returns the current default record database
|
150 |
|
|
//
|
151 |
|
|
// If no default record database has been set before this method
|
152 |
|
|
// is called, returns an instance of
|
153 |
|
|
virtual function uvm_tr_database get_default_tr_database();
|
154 |
|
|
if (tr_database == null) begin
|
155 |
|
|
process p = process::self();
|
156 |
|
|
uvm_text_tr_database tx_db;
|
157 |
|
|
string s;
|
158 |
|
|
if(p != null)
|
159 |
|
|
s = p.get_randstate();
|
160 |
|
|
|
161 |
|
|
tx_db = new("default_tr_database");
|
162 |
|
|
tr_database = tx_db;
|
163 |
|
|
|
164 |
|
|
if(p != null)
|
165 |
|
|
p.set_randstate(s);
|
166 |
|
|
end
|
167 |
|
|
return tr_database;
|
168 |
|
|
endfunction : get_default_tr_database
|
169 |
|
|
|
170 |
|
|
// Function: set_default_tr_database
|
171 |
|
|
// Sets the current default record database to ~db~
|
172 |
|
|
virtual function void set_default_tr_database(uvm_tr_database db);
|
173 |
|
|
tr_database = db;
|
174 |
|
|
endfunction : set_default_tr_database
|
175 |
|
|
|
176 |
|
|
local uvm_report_server report_server;
|
177 |
|
|
// Function: get_report_server
|
178 |
|
|
// returns the current global report_server
|
179 |
|
|
// if no report server has been set before, returns an instance of
|
180 |
|
|
// uvm_default_report_server
|
181 |
|
|
virtual function uvm_report_server get_report_server();
|
182 |
|
|
if(report_server==null) begin
|
183 |
|
|
uvm_default_report_server f;
|
184 |
|
|
f=new;
|
185 |
|
|
report_server=f;
|
186 |
|
|
end
|
187 |
|
|
|
188 |
|
|
return report_server;
|
189 |
|
|
endfunction
|
190 |
|
|
|
191 |
|
|
// Function: set_report_server
|
192 |
|
|
// sets the central report server to ~server~
|
193 |
|
|
virtual function void set_report_server(uvm_report_server server);
|
194 |
|
|
report_server=server;
|
195 |
|
|
endfunction
|
196 |
|
|
|
197 |
|
|
virtual function uvm_root get_root();
|
198 |
|
|
return uvm_root::m_uvm_get_root();
|
199 |
|
|
endfunction
|
200 |
|
|
|
201 |
|
|
local uvm_visitor#(uvm_component) _visitor;
|
202 |
|
|
// Function: set_component_visitor
|
203 |
|
|
// sets the component visitor to ~v~
|
204 |
|
|
// (this visitor is being used for the traversal at end_of_elaboration_phase
|
205 |
|
|
// for instance for name checking)
|
206 |
|
|
virtual function void set_component_visitor(uvm_visitor#(uvm_component) v);
|
207 |
|
|
_visitor=v;
|
208 |
|
|
endfunction
|
209 |
|
|
|
210 |
|
|
// Function: get_component_visitor
|
211 |
|
|
// retrieves the current component visitor
|
212 |
|
|
// if unset(or ~null~) returns a instance
|
213 |
|
|
virtual function uvm_visitor#(uvm_component) get_component_visitor();
|
214 |
|
|
if(_visitor==null) begin
|
215 |
|
|
uvm_component_name_check_visitor v = new("name-check-visitor");
|
216 |
|
|
_visitor=v;
|
217 |
|
|
end
|
218 |
|
|
return _visitor;
|
219 |
|
|
endfunction
|
220 |
|
|
|
221 |
|
|
endclass
|
222 |
|
|
|
223 |
|
|
|