1 |
16 |
HanySalah |
//
|
2 |
|
|
//------------------------------------------------------------------------------
|
3 |
|
|
// Copyright 2007-2010 Mentor Graphics Corporation
|
4 |
|
|
// Copyright 2007-2011 Cadence Design Systems, Inc.
|
5 |
|
|
// Copyright 2010 Synopsys, Inc.
|
6 |
|
|
// All Rights Reserved Worldwide
|
7 |
|
|
//
|
8 |
|
|
// Licensed under the Apache License, Version 2.0 (the
|
9 |
|
|
// "License"); you may not use this file except in
|
10 |
|
|
// compliance with the License. You may obtain a copy of
|
11 |
|
|
// the License at
|
12 |
|
|
//
|
13 |
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
14 |
|
|
//
|
15 |
|
|
// Unless required by applicable law or agreed to in
|
16 |
|
|
// writing, software distributed under the License is
|
17 |
|
|
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
18 |
|
|
// CONDITIONS OF ANY KIND, either express or implied. See
|
19 |
|
|
// the License for the specific language governing
|
20 |
|
|
// permissions and limitations under the License.
|
21 |
|
|
//------------------------------------------------------------------------------
|
22 |
|
|
|
23 |
|
|
`ifndef UVM_REPORT_MESSAGE_SVH
|
24 |
|
|
`define UVM_REPORT_MESSAGE_SVH
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
typedef class uvm_report_server;
|
28 |
|
|
typedef class uvm_report_handler;
|
29 |
|
|
typedef class uvm_root;
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
//------------------------------------------------------------------------------
|
33 |
|
|
//
|
34 |
|
|
// CLASS: uvm_report_message_element_base
|
35 |
|
|
//
|
36 |
|
|
// Base class for report message element. Defines common interface.
|
37 |
|
|
//
|
38 |
|
|
//------------------------------------------------------------------------------
|
39 |
|
|
|
40 |
|
|
virtual class uvm_report_message_element_base;
|
41 |
|
|
protected uvm_action _action;
|
42 |
|
|
protected string _name;
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
// Function: get_name
|
46 |
|
|
//
|
47 |
|
|
|
48 |
|
|
virtual function string get_name();
|
49 |
|
|
return _name;
|
50 |
|
|
endfunction
|
51 |
|
|
|
52 |
|
|
// Function: set_name
|
53 |
|
|
//
|
54 |
|
|
// Get or set the name of the element
|
55 |
|
|
//
|
56 |
|
|
|
57 |
|
|
virtual function void set_name(string name);
|
58 |
|
|
_name = name;
|
59 |
|
|
endfunction
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
// Function: get_action
|
63 |
|
|
//
|
64 |
|
|
|
65 |
|
|
virtual function uvm_action get_action();
|
66 |
|
|
return _action;
|
67 |
|
|
endfunction
|
68 |
|
|
|
69 |
|
|
// Function: set_action
|
70 |
|
|
//
|
71 |
|
|
// Get or set the authorized action for the element
|
72 |
|
|
//
|
73 |
|
|
|
74 |
|
|
virtual function void set_action(uvm_action action);
|
75 |
|
|
_action = action;
|
76 |
|
|
endfunction
|
77 |
|
|
|
78 |
|
|
|
79 |
|
|
function void print(uvm_printer printer);
|
80 |
|
|
if (_action & (UVM_LOG | UVM_DISPLAY))
|
81 |
|
|
do_print(printer);
|
82 |
|
|
endfunction : print
|
83 |
|
|
function void record(uvm_recorder recorder);
|
84 |
|
|
if (_action & UVM_RM_RECORD)
|
85 |
|
|
do_record(recorder);
|
86 |
|
|
endfunction : record
|
87 |
|
|
function void copy(uvm_report_message_element_base rhs);
|
88 |
|
|
do_copy(rhs);
|
89 |
|
|
endfunction : copy
|
90 |
|
|
function uvm_report_message_element_base clone();
|
91 |
|
|
return do_clone();
|
92 |
|
|
endfunction : clone
|
93 |
|
|
|
94 |
|
|
pure virtual function void do_print(uvm_printer printer);
|
95 |
|
|
pure virtual function void do_record(uvm_recorder recorder);
|
96 |
|
|
pure virtual function void do_copy(uvm_report_message_element_base rhs);
|
97 |
|
|
pure virtual function uvm_report_message_element_base do_clone();
|
98 |
|
|
|
99 |
|
|
endclass : uvm_report_message_element_base
|
100 |
|
|
|
101 |
|
|
|
102 |
|
|
//------------------------------------------------------------------------------
|
103 |
|
|
//
|
104 |
|
|
// CLASS: uvm_report_message_int_element
|
105 |
|
|
//
|
106 |
|
|
// Message element class for integral type
|
107 |
|
|
//
|
108 |
|
|
//------------------------------------------------------------------------------
|
109 |
|
|
|
110 |
|
|
class uvm_report_message_int_element extends uvm_report_message_element_base;
|
111 |
|
|
typedef uvm_report_message_int_element this_type;
|
112 |
|
|
|
113 |
|
|
protected uvm_bitstream_t _val;
|
114 |
|
|
protected int _size;
|
115 |
|
|
protected uvm_radix_enum _radix;
|
116 |
|
|
|
117 |
|
|
// Function: get_value
|
118 |
|
|
//
|
119 |
|
|
|
120 |
|
|
virtual function uvm_bitstream_t get_value(output int size,
|
121 |
|
|
output uvm_radix_enum radix);
|
122 |
|
|
size = _size;
|
123 |
|
|
radix = _radix;
|
124 |
|
|
return _val;
|
125 |
|
|
endfunction
|
126 |
|
|
|
127 |
|
|
|
128 |
|
|
// Function: set_value
|
129 |
|
|
//
|
130 |
|
|
// Get or set the value (integral type) of the element, with size and radix
|
131 |
|
|
//
|
132 |
|
|
|
133 |
|
|
virtual function void set_value(uvm_bitstream_t value,
|
134 |
|
|
int size,
|
135 |
|
|
uvm_radix_enum radix);
|
136 |
|
|
_size = size;
|
137 |
|
|
_radix = radix;
|
138 |
|
|
_val = value;
|
139 |
|
|
endfunction
|
140 |
|
|
|
141 |
|
|
|
142 |
|
|
virtual function void do_print(uvm_printer printer);
|
143 |
|
|
printer.print_int(_name, _val, _size, _radix);
|
144 |
|
|
endfunction : do_print
|
145 |
|
|
|
146 |
|
|
virtual function void do_record(uvm_recorder recorder);
|
147 |
|
|
recorder.record_field(_name, _val, _size, _radix);
|
148 |
|
|
endfunction : do_record
|
149 |
|
|
|
150 |
|
|
virtual function void do_copy(uvm_report_message_element_base rhs);
|
151 |
|
|
this_type _rhs;
|
152 |
|
|
$cast(_rhs, rhs);
|
153 |
|
|
_name = _rhs._name;
|
154 |
|
|
_val = _rhs._val;
|
155 |
|
|
_size = _rhs._size;
|
156 |
|
|
_radix = _rhs._radix;
|
157 |
|
|
_action = rhs._action;
|
158 |
|
|
endfunction : do_copy
|
159 |
|
|
|
160 |
|
|
virtual function uvm_report_message_element_base do_clone();
|
161 |
|
|
this_type tmp = new;
|
162 |
|
|
tmp.copy(this);
|
163 |
|
|
return tmp;
|
164 |
|
|
endfunction : do_clone
|
165 |
|
|
endclass : uvm_report_message_int_element
|
166 |
|
|
|
167 |
|
|
|
168 |
|
|
//------------------------------------------------------------------------------
|
169 |
|
|
//
|
170 |
|
|
// CLASS: uvm_report_message_string_element
|
171 |
|
|
//
|
172 |
|
|
// Message element class for string type
|
173 |
|
|
//
|
174 |
|
|
//------------------------------------------------------------------------------
|
175 |
|
|
|
176 |
|
|
class uvm_report_message_string_element extends uvm_report_message_element_base;
|
177 |
|
|
typedef uvm_report_message_string_element this_type;
|
178 |
|
|
protected string _val;
|
179 |
|
|
|
180 |
|
|
|
181 |
|
|
// Function: get_value
|
182 |
|
|
//
|
183 |
|
|
|
184 |
|
|
virtual function string get_value();
|
185 |
|
|
return _val;
|
186 |
|
|
endfunction
|
187 |
|
|
|
188 |
|
|
// Function: set_value
|
189 |
|
|
//
|
190 |
|
|
// Get or set the value (string type) of the element
|
191 |
|
|
//
|
192 |
|
|
|
193 |
|
|
virtual function void set_value(string value);
|
194 |
|
|
_val = value;
|
195 |
|
|
endfunction
|
196 |
|
|
|
197 |
|
|
|
198 |
|
|
virtual function void do_print(uvm_printer printer);
|
199 |
|
|
printer.print_string(_name, _val);
|
200 |
|
|
endfunction : do_print
|
201 |
|
|
|
202 |
|
|
virtual function void do_record(uvm_recorder recorder);
|
203 |
|
|
recorder.record_string(_name, _val);
|
204 |
|
|
endfunction : do_record
|
205 |
|
|
|
206 |
|
|
virtual function void do_copy(uvm_report_message_element_base rhs);
|
207 |
|
|
this_type _rhs;
|
208 |
|
|
$cast(_rhs, rhs);
|
209 |
|
|
_name = _rhs._name;
|
210 |
|
|
_val = _rhs._val;
|
211 |
|
|
_action = rhs._action;
|
212 |
|
|
endfunction : do_copy
|
213 |
|
|
|
214 |
|
|
virtual function uvm_report_message_element_base do_clone();
|
215 |
|
|
this_type tmp = new;
|
216 |
|
|
tmp.copy(this);
|
217 |
|
|
return tmp;
|
218 |
|
|
endfunction : do_clone
|
219 |
|
|
endclass : uvm_report_message_string_element
|
220 |
|
|
|
221 |
|
|
|
222 |
|
|
//------------------------------------------------------------------------------
|
223 |
|
|
//
|
224 |
|
|
// CLASS: uvm_report_message_object_element
|
225 |
|
|
//
|
226 |
|
|
// Message element class for object type
|
227 |
|
|
//
|
228 |
|
|
//------------------------------------------------------------------------------
|
229 |
|
|
|
230 |
|
|
class uvm_report_message_object_element extends uvm_report_message_element_base;
|
231 |
|
|
typedef uvm_report_message_object_element this_type;
|
232 |
|
|
protected uvm_object _val;
|
233 |
|
|
|
234 |
|
|
|
235 |
|
|
// Function: get_value
|
236 |
|
|
//
|
237 |
|
|
// Get the value (object reference) of the element
|
238 |
|
|
//
|
239 |
|
|
|
240 |
|
|
virtual function uvm_object get_value();
|
241 |
|
|
return _val;
|
242 |
|
|
endfunction
|
243 |
|
|
|
244 |
|
|
// Function: set_value
|
245 |
|
|
//
|
246 |
|
|
// Get or set the value (object reference) of the element
|
247 |
|
|
//
|
248 |
|
|
|
249 |
|
|
virtual function void set_value(uvm_object value);
|
250 |
|
|
_val = value;
|
251 |
|
|
endfunction
|
252 |
|
|
|
253 |
|
|
|
254 |
|
|
virtual function void do_print(uvm_printer printer);
|
255 |
|
|
printer.print_object(_name, _val);
|
256 |
|
|
endfunction : do_print
|
257 |
|
|
|
258 |
|
|
virtual function void do_record(uvm_recorder recorder);
|
259 |
|
|
recorder.record_object(_name, _val);
|
260 |
|
|
endfunction : do_record
|
261 |
|
|
|
262 |
|
|
virtual function void do_copy(uvm_report_message_element_base rhs);
|
263 |
|
|
this_type _rhs;
|
264 |
|
|
$cast(_rhs, rhs);
|
265 |
|
|
_name = _rhs._name;
|
266 |
|
|
_val = _rhs._val;
|
267 |
|
|
_action = rhs._action;
|
268 |
|
|
endfunction : do_copy
|
269 |
|
|
|
270 |
|
|
virtual function uvm_report_message_element_base do_clone();
|
271 |
|
|
this_type tmp = new;
|
272 |
|
|
tmp.copy(this);
|
273 |
|
|
return tmp;
|
274 |
|
|
endfunction : do_clone
|
275 |
|
|
endclass : uvm_report_message_object_element
|
276 |
|
|
|
277 |
|
|
//------------------------------------------------------------------------------
|
278 |
|
|
//
|
279 |
|
|
// CLASS: uvm_report_message_element_container
|
280 |
|
|
//
|
281 |
|
|
// A container used by report message to contain the dynamically added elements,
|
282 |
|
|
// with APIs to add and delete the elements.
|
283 |
|
|
//
|
284 |
|
|
//------------------------------------------------------------------------------
|
285 |
|
|
|
286 |
|
|
class uvm_report_message_element_container extends uvm_object;
|
287 |
|
|
|
288 |
|
|
protected uvm_report_message_element_base elements[$];
|
289 |
|
|
|
290 |
|
|
`uvm_object_utils(uvm_report_message_element_container)
|
291 |
|
|
|
292 |
|
|
// Function: new
|
293 |
|
|
//
|
294 |
|
|
// Create a new uvm_report_message_element_container object
|
295 |
|
|
//
|
296 |
|
|
|
297 |
|
|
function new(string name = "element_container");
|
298 |
|
|
super.new(name);
|
299 |
|
|
endfunction
|
300 |
|
|
|
301 |
|
|
|
302 |
|
|
// Function: size
|
303 |
|
|
//
|
304 |
|
|
// Returns the size of the container, i.e. the number of elements
|
305 |
|
|
//
|
306 |
|
|
|
307 |
|
|
virtual function int size();
|
308 |
|
|
return elements.size();
|
309 |
|
|
endfunction
|
310 |
|
|
|
311 |
|
|
|
312 |
|
|
// Function: delete
|
313 |
|
|
//
|
314 |
|
|
// Delete the ~index~-th element in the container
|
315 |
|
|
//
|
316 |
|
|
|
317 |
|
|
virtual function void delete(int index);
|
318 |
|
|
elements.delete(index);
|
319 |
|
|
endfunction
|
320 |
|
|
|
321 |
|
|
|
322 |
|
|
// Function: delete_elements
|
323 |
|
|
//
|
324 |
|
|
// Delete all the elements in the container
|
325 |
|
|
//
|
326 |
|
|
|
327 |
|
|
virtual function void delete_elements();
|
328 |
|
|
elements.delete();
|
329 |
|
|
endfunction
|
330 |
|
|
|
331 |
|
|
|
332 |
|
|
// Function: get_elements
|
333 |
|
|
//
|
334 |
|
|
// Get all the elements from the container and put them in a queue
|
335 |
|
|
//
|
336 |
|
|
|
337 |
|
|
typedef uvm_report_message_element_base queue_of_element[$];
|
338 |
|
|
virtual function queue_of_element get_elements();
|
339 |
|
|
return elements;
|
340 |
|
|
endfunction
|
341 |
|
|
|
342 |
|
|
|
343 |
|
|
// Function: add_int
|
344 |
|
|
//
|
345 |
|
|
// This method adds an integral type of the name ~name~ and value ~value~ to
|
346 |
|
|
// the container. The required ~size~ field indicates the size of ~value~.
|
347 |
|
|
// The required ~radix~ field determines how to display and
|
348 |
|
|
// record the field. The optional print/record bit is to specify whether
|
349 |
|
|
// the element will be printed/recorded.
|
350 |
|
|
//
|
351 |
|
|
|
352 |
|
|
virtual function void add_int(string name, uvm_bitstream_t value,
|
353 |
|
|
int size, uvm_radix_enum radix,
|
354 |
|
|
uvm_action action = (UVM_LOG|UVM_RM_RECORD));
|
355 |
|
|
process p;
|
356 |
|
|
string rand_state;
|
357 |
|
|
uvm_report_message_int_element urme;
|
358 |
|
|
|
359 |
|
|
p = process::self();
|
360 |
|
|
if (p != null)
|
361 |
|
|
rand_state = p.get_randstate();
|
362 |
|
|
urme = new();
|
363 |
|
|
if (p != null)
|
364 |
|
|
p.set_randstate(rand_state);
|
365 |
|
|
|
366 |
|
|
urme.set_name(name);
|
367 |
|
|
urme.set_value(value, size, radix);
|
368 |
|
|
urme.set_action(action);
|
369 |
|
|
elements.push_back(urme);
|
370 |
|
|
endfunction
|
371 |
|
|
|
372 |
|
|
|
373 |
|
|
// Function: add_string
|
374 |
|
|
//
|
375 |
|
|
// This method adds a string of the name ~name~ and value ~value~ to the
|
376 |
|
|
// message. The optional print/record bit is to specify whether
|
377 |
|
|
// the element will be printed/recorded.
|
378 |
|
|
//
|
379 |
|
|
|
380 |
|
|
virtual function void add_string(string name, string value,
|
381 |
|
|
uvm_action action = (UVM_LOG|UVM_RM_RECORD));
|
382 |
|
|
process p;
|
383 |
|
|
string rand_state;
|
384 |
|
|
uvm_report_message_string_element urme;
|
385 |
|
|
|
386 |
|
|
p = process::self();
|
387 |
|
|
if (p != null)
|
388 |
|
|
rand_state = p.get_randstate();
|
389 |
|
|
urme = new();
|
390 |
|
|
if (p != null)
|
391 |
|
|
p.set_randstate(rand_state);
|
392 |
|
|
|
393 |
|
|
urme.set_name(name);
|
394 |
|
|
urme.set_value(value);
|
395 |
|
|
urme.set_action(action);
|
396 |
|
|
elements.push_back(urme);
|
397 |
|
|
endfunction
|
398 |
|
|
|
399 |
|
|
|
400 |
|
|
// Function: add_object
|
401 |
|
|
//
|
402 |
|
|
// This method adds a uvm_object of the name ~name~ and reference ~obj~ to
|
403 |
|
|
// the message. The optional print/record bit is to specify whether
|
404 |
|
|
// the element will be printed/recorded.
|
405 |
|
|
//
|
406 |
|
|
|
407 |
|
|
virtual function void add_object(string name, uvm_object obj,
|
408 |
|
|
uvm_action action = (UVM_LOG|UVM_RM_RECORD));
|
409 |
|
|
process p;
|
410 |
|
|
string rand_state;
|
411 |
|
|
uvm_report_message_object_element urme;
|
412 |
|
|
|
413 |
|
|
p = process::self();
|
414 |
|
|
if (p != null)
|
415 |
|
|
rand_state = p.get_randstate();
|
416 |
|
|
urme = new();
|
417 |
|
|
if (p != null)
|
418 |
|
|
p.set_randstate(rand_state);
|
419 |
|
|
|
420 |
|
|
urme.set_name(name);
|
421 |
|
|
urme.set_value(obj);
|
422 |
|
|
urme.set_action(action);
|
423 |
|
|
elements.push_back(urme);
|
424 |
|
|
endfunction
|
425 |
|
|
|
426 |
|
|
virtual function void do_print(uvm_printer printer);
|
427 |
|
|
super.do_print(printer);
|
428 |
|
|
for(int i = 0; i < elements.size(); i++) begin
|
429 |
|
|
elements[i].print(printer);
|
430 |
|
|
end
|
431 |
|
|
endfunction
|
432 |
|
|
|
433 |
|
|
virtual function void do_record(uvm_recorder recorder);
|
434 |
|
|
super.do_record(recorder);
|
435 |
|
|
for(int i = 0; i < elements.size(); i++) begin
|
436 |
|
|
elements[i].record(recorder);
|
437 |
|
|
end
|
438 |
|
|
endfunction
|
439 |
|
|
|
440 |
|
|
virtual function void do_copy(uvm_object rhs);
|
441 |
|
|
uvm_report_message_element_container urme_container;
|
442 |
|
|
|
443 |
|
|
super.do_copy(rhs);
|
444 |
|
|
|
445 |
|
|
if(!$cast(urme_container, rhs) || (rhs==null))
|
446 |
|
|
return;
|
447 |
|
|
|
448 |
|
|
delete_elements();
|
449 |
|
|
foreach (urme_container.elements[i])
|
450 |
|
|
elements.push_back(urme_container.elements[i].clone());
|
451 |
|
|
|
452 |
|
|
endfunction
|
453 |
|
|
|
454 |
|
|
endclass
|
455 |
|
|
|
456 |
|
|
|
457 |
|
|
|
458 |
|
|
//------------------------------------------------------------------------------
|
459 |
|
|
//
|
460 |
|
|
// CLASS: uvm_report_message
|
461 |
|
|
//
|
462 |
|
|
// The uvm_report_message is the basic UVM object message class. It provides
|
463 |
|
|
// the fields that are common to all messages. It also has a message element
|
464 |
|
|
// container and provides the APIs necessary to add integral types, strings and
|
465 |
|
|
// uvm_objects to the container. The report message object can be initialized
|
466 |
|
|
// with the common fields, and passes through the whole reporting system (i.e.
|
467 |
|
|
// report object, report handler, report server, report catcher, etc) as an
|
468 |
|
|
// object. The additional elements can be added/deleted to/from the message
|
469 |
|
|
// object anywhere in the reporting system, and can be printed or recorded
|
470 |
|
|
// along with the common fields.
|
471 |
|
|
//
|
472 |
|
|
//------------------------------------------------------------------------------
|
473 |
|
|
|
474 |
|
|
class uvm_report_message extends uvm_object;
|
475 |
|
|
|
476 |
|
|
protected uvm_report_object _report_object;
|
477 |
|
|
protected uvm_report_handler _report_handler;
|
478 |
|
|
protected uvm_report_server _report_server;
|
479 |
|
|
|
480 |
|
|
protected uvm_severity _severity;
|
481 |
|
|
protected string _id;
|
482 |
|
|
protected string _message;
|
483 |
|
|
protected int _verbosity;
|
484 |
|
|
protected string _filename;
|
485 |
|
|
protected int _line;
|
486 |
|
|
protected string _context_name;
|
487 |
|
|
protected uvm_action _action;
|
488 |
|
|
protected UVM_FILE _file;
|
489 |
|
|
|
490 |
|
|
// Not documented.
|
491 |
|
|
protected uvm_report_message_element_container _report_message_element_container;
|
492 |
|
|
|
493 |
|
|
|
494 |
|
|
// Function: new
|
495 |
|
|
//
|
496 |
|
|
// Creates a new uvm_report_message object.
|
497 |
|
|
//
|
498 |
|
|
|
499 |
|
|
function new(string name = "uvm_report_message");
|
500 |
|
|
super.new(name);
|
501 |
|
|
_report_message_element_container = new();
|
502 |
|
|
endfunction
|
503 |
|
|
|
504 |
|
|
|
505 |
|
|
// Function: new_report_message
|
506 |
|
|
//
|
507 |
|
|
// Creates a new uvm_report_message object.
|
508 |
|
|
// This function is the same as new(), but keeps the random stability.
|
509 |
|
|
//
|
510 |
|
|
|
511 |
|
|
static function uvm_report_message new_report_message(string name = "uvm_report_message");
|
512 |
|
|
process p;
|
513 |
|
|
string rand_state;
|
514 |
|
|
|
515 |
|
|
p = process::self();
|
516 |
|
|
|
517 |
|
|
if (p != null)
|
518 |
|
|
rand_state = p.get_randstate();
|
519 |
|
|
new_report_message = new(name);
|
520 |
|
|
if (p != null)
|
521 |
|
|
p.set_randstate(rand_state);
|
522 |
|
|
|
523 |
|
|
endfunction
|
524 |
|
|
|
525 |
|
|
|
526 |
|
|
// Function: print
|
527 |
|
|
//
|
528 |
|
|
// The uvm_report_message implements such that
|
529 |
|
|
// ~print~ method provides UVM printer formatted output
|
530 |
|
|
// of the message. A snippet of example output is shown here:
|
531 |
|
|
//
|
532 |
|
|
//| --------------------------------------------------------
|
533 |
|
|
//| Name Type Size Value
|
534 |
|
|
//| --------------------------------------------------------
|
535 |
|
|
//| uvm_report_message uvm_report_message - @532
|
536 |
|
|
//| severity uvm_severity 2 UVM_INFO
|
537 |
|
|
//| id string 10 TEST_ID
|
538 |
|
|
//| message string 12 A message...
|
539 |
|
|
//| verbosity uvm_verbosity 32 UVM_LOW
|
540 |
|
|
//| filename string 7 test.sv
|
541 |
|
|
//| line integral 32 'd58
|
542 |
|
|
//| context_name string 0 ""
|
543 |
|
|
//| color string 3 red
|
544 |
|
|
//| my_int integral 32 'd5
|
545 |
|
|
//| my_string string 3 foo
|
546 |
|
|
//| my_obj my_class - @531
|
547 |
|
|
//| foo integral 32 'd3
|
548 |
|
|
//| bar string 8 hi there
|
549 |
|
|
|
550 |
|
|
|
551 |
|
|
virtual function void do_print(uvm_printer printer);
|
552 |
|
|
uvm_verbosity l_verbosity;
|
553 |
|
|
|
554 |
|
|
super.do_print(printer);
|
555 |
|
|
|
556 |
|
|
printer.print_generic("severity", "uvm_severity",
|
557 |
|
|
$bits(_severity), _severity.name());
|
558 |
|
|
printer.print_string("id", _id);
|
559 |
|
|
printer.print_string("message",_message);
|
560 |
|
|
if ($cast(l_verbosity, _verbosity))
|
561 |
|
|
printer.print_generic("verbosity", "uvm_verbosity",
|
562 |
|
|
$bits(l_verbosity), l_verbosity.name());
|
563 |
|
|
else
|
564 |
|
|
printer.print_int("verbosity", _verbosity, $bits(_verbosity), UVM_HEX);
|
565 |
|
|
printer.print_string("filename", _filename);
|
566 |
|
|
printer.print_int("line", _line, $bits(_line), UVM_UNSIGNED);
|
567 |
|
|
printer.print_string("context_name", _context_name);
|
568 |
|
|
|
569 |
|
|
if (_report_message_element_container.size() != 0)
|
570 |
|
|
_report_message_element_container.print(printer);
|
571 |
|
|
endfunction
|
572 |
|
|
|
573 |
|
|
|
574 |
|
|
`uvm_object_utils(uvm_report_message)
|
575 |
|
|
|
576 |
|
|
|
577 |
|
|
|
578 |
|
|
// do_pack() not needed
|
579 |
|
|
// do_unpack() not needed
|
580 |
|
|
// do_compare() not needed
|
581 |
|
|
|
582 |
|
|
|
583 |
|
|
// Not documented.
|
584 |
|
|
virtual function void do_copy (uvm_object rhs);
|
585 |
|
|
uvm_report_message report_message;
|
586 |
|
|
|
587 |
|
|
super.do_copy(rhs);
|
588 |
|
|
|
589 |
|
|
if(!$cast(report_message, rhs) || (rhs==null))
|
590 |
|
|
return;
|
591 |
|
|
|
592 |
|
|
_report_object = report_message.get_report_object();
|
593 |
|
|
_report_handler = report_message.get_report_handler();
|
594 |
|
|
_report_server = report_message.get_report_server();
|
595 |
|
|
_context_name = report_message.get_context();
|
596 |
|
|
_file = report_message.get_file();
|
597 |
|
|
_filename = report_message.get_filename();
|
598 |
|
|
_line = report_message.get_line();
|
599 |
|
|
_action = report_message.get_action();
|
600 |
|
|
_severity = report_message.get_severity();
|
601 |
|
|
_id = report_message.get_id();
|
602 |
|
|
_message = report_message.get_message();
|
603 |
|
|
_verbosity = report_message.get_verbosity();
|
604 |
|
|
|
605 |
|
|
_report_message_element_container.copy(report_message._report_message_element_container);
|
606 |
|
|
endfunction
|
607 |
|
|
|
608 |
|
|
|
609 |
|
|
//----------------------------------------------------------------------------
|
610 |
|
|
// Group: Infrastructure References
|
611 |
|
|
//----------------------------------------------------------------------------
|
612 |
|
|
|
613 |
|
|
|
614 |
|
|
// Function: get_report_object
|
615 |
|
|
|
616 |
|
|
virtual function uvm_report_object get_report_object();
|
617 |
|
|
return _report_object;
|
618 |
|
|
endfunction
|
619 |
|
|
|
620 |
|
|
// Function: set_report_object
|
621 |
|
|
//
|
622 |
|
|
// Get or set the uvm_report_object that originated the message.
|
623 |
|
|
|
624 |
|
|
virtual function void set_report_object(uvm_report_object ro);
|
625 |
|
|
_report_object = ro;
|
626 |
|
|
endfunction
|
627 |
|
|
|
628 |
|
|
|
629 |
|
|
// Function: get_report_handler
|
630 |
|
|
|
631 |
|
|
virtual function uvm_report_handler get_report_handler();
|
632 |
|
|
return _report_handler;
|
633 |
|
|
endfunction
|
634 |
|
|
|
635 |
|
|
// Function: set_report_handler
|
636 |
|
|
//
|
637 |
|
|
// Get or set the uvm_report_handler that is responsible for checking
|
638 |
|
|
// whether the message is enabled, should be upgraded/downgraded, etc.
|
639 |
|
|
|
640 |
|
|
virtual function void set_report_handler(uvm_report_handler rh);
|
641 |
|
|
_report_handler = rh;
|
642 |
|
|
endfunction
|
643 |
|
|
|
644 |
|
|
|
645 |
|
|
// Function: get_report_server
|
646 |
|
|
|
647 |
|
|
virtual function uvm_report_server get_report_server();
|
648 |
|
|
return _report_server;
|
649 |
|
|
endfunction
|
650 |
|
|
|
651 |
|
|
// Function: set_report_server
|
652 |
|
|
//
|
653 |
|
|
// Get or set the uvm_report_server that is responsible for servicing
|
654 |
|
|
// the message's actions.
|
655 |
|
|
|
656 |
|
|
virtual function void set_report_server(uvm_report_server rs);
|
657 |
|
|
_report_server = rs;
|
658 |
|
|
endfunction
|
659 |
|
|
|
660 |
|
|
|
661 |
|
|
//----------------------------------------------------------------------------
|
662 |
|
|
// Group: Message Fields
|
663 |
|
|
//----------------------------------------------------------------------------
|
664 |
|
|
|
665 |
|
|
|
666 |
|
|
// Function: get_severity
|
667 |
|
|
|
668 |
|
|
virtual function uvm_severity get_severity();
|
669 |
|
|
return _severity;
|
670 |
|
|
endfunction
|
671 |
|
|
|
672 |
|
|
// Function: set_severity
|
673 |
|
|
//
|
674 |
|
|
// Get or set the severity (UVM_INFO, UVM_WARNING, UVM_ERROR or
|
675 |
|
|
// UVM_FATAL) of the message. The value of this field is determined via
|
676 |
|
|
// the API used (`uvm_info(), `uvm_waring(), etc.) and populated for the user.
|
677 |
|
|
|
678 |
|
|
virtual function void set_severity(uvm_severity sev);
|
679 |
|
|
_severity = sev;
|
680 |
|
|
endfunction
|
681 |
|
|
|
682 |
|
|
|
683 |
|
|
// Function: get_id
|
684 |
|
|
|
685 |
|
|
virtual function string get_id();
|
686 |
|
|
return _id;
|
687 |
|
|
endfunction
|
688 |
|
|
|
689 |
|
|
// Function: set_id
|
690 |
|
|
//
|
691 |
|
|
// Get or set the id of the message. The value of this field is
|
692 |
|
|
// completely under user discretion. Users are recommended to follow a
|
693 |
|
|
// consistent convention. Settings in the uvm_report_handler allow various
|
694 |
|
|
// messaging controls based on this field. See .
|
695 |
|
|
|
696 |
|
|
virtual function void set_id(string id);
|
697 |
|
|
_id = id;
|
698 |
|
|
endfunction
|
699 |
|
|
|
700 |
|
|
|
701 |
|
|
// Function: get_message
|
702 |
|
|
|
703 |
|
|
virtual function string get_message();
|
704 |
|
|
return _message;
|
705 |
|
|
endfunction
|
706 |
|
|
|
707 |
|
|
// Function: set_message
|
708 |
|
|
//
|
709 |
|
|
// Get or set the user message content string.
|
710 |
|
|
|
711 |
|
|
virtual function void set_message(string msg);
|
712 |
|
|
_message = msg;
|
713 |
|
|
endfunction
|
714 |
|
|
|
715 |
|
|
|
716 |
|
|
// Function: get_verbosity
|
717 |
|
|
|
718 |
|
|
virtual function int get_verbosity();
|
719 |
|
|
return _verbosity;
|
720 |
|
|
endfunction
|
721 |
|
|
|
722 |
|
|
// Function: set_verbosity
|
723 |
|
|
//
|
724 |
|
|
// Get or set the message threshold value. This value is compared
|
725 |
|
|
// against settings in the to determine whether this
|
726 |
|
|
// message should be executed.
|
727 |
|
|
|
728 |
|
|
virtual function void set_verbosity(int ver);
|
729 |
|
|
_verbosity = ver;
|
730 |
|
|
endfunction
|
731 |
|
|
|
732 |
|
|
|
733 |
|
|
// Function: get_filename
|
734 |
|
|
|
735 |
|
|
virtual function string get_filename();
|
736 |
|
|
return _filename;
|
737 |
|
|
endfunction
|
738 |
|
|
|
739 |
|
|
// Function: set_filename
|
740 |
|
|
//
|
741 |
|
|
// Get or set the file from which the message originates. This value
|
742 |
|
|
// is automatically populated by the messaging macros.
|
743 |
|
|
|
744 |
|
|
virtual function void set_filename(string fname);
|
745 |
|
|
_filename = fname;
|
746 |
|
|
endfunction
|
747 |
|
|
|
748 |
|
|
|
749 |
|
|
// Function: get_line
|
750 |
|
|
|
751 |
|
|
virtual function int get_line();
|
752 |
|
|
return _line;
|
753 |
|
|
endfunction
|
754 |
|
|
|
755 |
|
|
// Function: set_line
|
756 |
|
|
//
|
757 |
|
|
// Get or set the line in the ~file~ from which the message originates.
|
758 |
|
|
// This value is automatically populate by the messaging macros.
|
759 |
|
|
|
760 |
|
|
virtual function void set_line(int ln);
|
761 |
|
|
_line = ln;
|
762 |
|
|
endfunction
|
763 |
|
|
|
764 |
|
|
|
765 |
|
|
// Function: get_context
|
766 |
|
|
|
767 |
|
|
virtual function string get_context();
|
768 |
|
|
return _context_name;
|
769 |
|
|
endfunction
|
770 |
|
|
|
771 |
|
|
// Function: set_context
|
772 |
|
|
//
|
773 |
|
|
// Get or set the optional user-supplied string that is meant to convey
|
774 |
|
|
// the context of the message. It can be useful in scopes that are not
|
775 |
|
|
// inherently UVM like modules, interfaces, etc.
|
776 |
|
|
|
777 |
|
|
virtual function void set_context(string cn);
|
778 |
|
|
_context_name = cn;
|
779 |
|
|
endfunction
|
780 |
|
|
|
781 |
|
|
|
782 |
|
|
// Function: get_action
|
783 |
|
|
|
784 |
|
|
virtual function uvm_action get_action();
|
785 |
|
|
return _action;
|
786 |
|
|
endfunction
|
787 |
|
|
|
788 |
|
|
// Function: set_action
|
789 |
|
|
//
|
790 |
|
|
// Get or set the action(s) that the uvm_report_server should perform
|
791 |
|
|
// for this message. This field is populated by the uvm_report_handler during
|
792 |
|
|
// message execution flow.
|
793 |
|
|
|
794 |
|
|
virtual function void set_action(uvm_action act);
|
795 |
|
|
_action = act;
|
796 |
|
|
endfunction
|
797 |
|
|
|
798 |
|
|
|
799 |
|
|
// Function: get_file
|
800 |
|
|
|
801 |
|
|
virtual function UVM_FILE get_file();
|
802 |
|
|
return _file;
|
803 |
|
|
endfunction
|
804 |
|
|
|
805 |
|
|
// Function: set_file
|
806 |
|
|
//
|
807 |
|
|
// Get or set the file that the message is to be written to when the
|
808 |
|
|
// message's action is UVM_LOG. This field is populated by the
|
809 |
|
|
// uvm_report_handler during message execution flow.
|
810 |
|
|
|
811 |
|
|
virtual function void set_file(UVM_FILE fl);
|
812 |
|
|
_file = fl;
|
813 |
|
|
endfunction
|
814 |
|
|
|
815 |
|
|
|
816 |
|
|
// Function: get_element_container
|
817 |
|
|
//
|
818 |
|
|
// Get the element_container of the message
|
819 |
|
|
|
820 |
|
|
virtual function uvm_report_message_element_container get_element_container();
|
821 |
|
|
return _report_message_element_container;
|
822 |
|
|
endfunction
|
823 |
|
|
|
824 |
|
|
|
825 |
|
|
// Function: set_report_message
|
826 |
|
|
//
|
827 |
|
|
// Set all the common fields of the report message in one shot.
|
828 |
|
|
//
|
829 |
|
|
|
830 |
|
|
virtual function void set_report_message(uvm_severity severity,
|
831 |
|
|
string id,
|
832 |
|
|
string message,
|
833 |
|
|
int verbosity,
|
834 |
|
|
string filename,
|
835 |
|
|
int line,
|
836 |
|
|
string context_name);
|
837 |
|
|
this._context_name = context_name;
|
838 |
|
|
this._filename = filename;
|
839 |
|
|
this._line = line;
|
840 |
|
|
this._severity = severity;
|
841 |
|
|
this._id = id;
|
842 |
|
|
this._message = message;
|
843 |
|
|
this._verbosity = verbosity;
|
844 |
|
|
endfunction
|
845 |
|
|
|
846 |
|
|
|
847 |
|
|
//----------------------------------------------------------------------------
|
848 |
|
|
// Group- Message Recording
|
849 |
|
|
//----------------------------------------------------------------------------
|
850 |
|
|
|
851 |
|
|
// Not documented.
|
852 |
|
|
virtual function void m_record_message(uvm_recorder recorder);
|
853 |
|
|
recorder.record_string("message", _message);
|
854 |
|
|
endfunction
|
855 |
|
|
|
856 |
|
|
|
857 |
|
|
// Not documented.
|
858 |
|
|
virtual function void m_record_core_properties(uvm_recorder recorder);
|
859 |
|
|
|
860 |
|
|
string l_string;
|
861 |
|
|
uvm_verbosity l_verbosity;
|
862 |
|
|
|
863 |
|
|
if (_context_name != "")
|
864 |
|
|
recorder.record_string("context_name", _context_name);
|
865 |
|
|
recorder.record_string("filename", _filename);
|
866 |
|
|
recorder.record_field("line", _line, $bits(_line), UVM_UNSIGNED);
|
867 |
|
|
recorder.record_string("severity", _severity.name());
|
868 |
|
|
if ($cast(l_verbosity, _verbosity))
|
869 |
|
|
recorder.record_string("verbosity", l_verbosity.name());
|
870 |
|
|
else begin
|
871 |
|
|
l_string.itoa(_verbosity);
|
872 |
|
|
recorder.record_string("verbosity", l_string);
|
873 |
|
|
end
|
874 |
|
|
|
875 |
|
|
recorder.record_string("id", _id);
|
876 |
|
|
m_record_message(recorder);
|
877 |
|
|
endfunction
|
878 |
|
|
|
879 |
|
|
// Not documented.
|
880 |
|
|
virtual function void do_record(uvm_recorder recorder);
|
881 |
|
|
|
882 |
|
|
super.do_record(recorder);
|
883 |
|
|
|
884 |
|
|
m_record_core_properties(recorder);
|
885 |
|
|
_report_message_element_container.record(recorder);
|
886 |
|
|
|
887 |
|
|
endfunction
|
888 |
|
|
|
889 |
|
|
|
890 |
|
|
//----------------------------------------------------------------------------
|
891 |
|
|
// Group: Message Element APIs
|
892 |
|
|
//----------------------------------------------------------------------------
|
893 |
|
|
|
894 |
|
|
|
895 |
|
|
// Function: add_int
|
896 |
|
|
//
|
897 |
|
|
// This method adds an integral type of the name ~name~ and value ~value~ to
|
898 |
|
|
// the message. The required ~size~ field indicates the size of ~value~.
|
899 |
|
|
// The required ~radix~ field determines how to display and
|
900 |
|
|
// record the field. The optional print/record bit is to specify whether
|
901 |
|
|
// the element will be printed/recorded.
|
902 |
|
|
//
|
903 |
|
|
|
904 |
|
|
virtual function void add_int(string name, uvm_bitstream_t value,
|
905 |
|
|
int size, uvm_radix_enum radix,
|
906 |
|
|
uvm_action action = (UVM_LOG|UVM_RM_RECORD));
|
907 |
|
|
_report_message_element_container.add_int(name, value, size, radix, action);
|
908 |
|
|
endfunction
|
909 |
|
|
|
910 |
|
|
|
911 |
|
|
// Function: add_string
|
912 |
|
|
//
|
913 |
|
|
// This method adds a string of the name ~name~ and value ~value~ to the
|
914 |
|
|
// message. The optional print/record bit is to specify whether
|
915 |
|
|
// the element will be printed/recorded.
|
916 |
|
|
//
|
917 |
|
|
|
918 |
|
|
virtual function void add_string(string name, string value,
|
919 |
|
|
uvm_action action = (UVM_LOG|UVM_RM_RECORD));
|
920 |
|
|
_report_message_element_container.add_string(name, value, action);
|
921 |
|
|
endfunction
|
922 |
|
|
|
923 |
|
|
|
924 |
|
|
// Function: add_object
|
925 |
|
|
//
|
926 |
|
|
// This method adds a uvm_object of the name ~name~ and reference ~obj~ to
|
927 |
|
|
// the message. The optional print/record bit is to specify whether
|
928 |
|
|
// the element will be printed/recorded.
|
929 |
|
|
//
|
930 |
|
|
|
931 |
|
|
virtual function void add_object(string name, uvm_object obj,
|
932 |
|
|
uvm_action action = (UVM_LOG|UVM_RM_RECORD));
|
933 |
|
|
_report_message_element_container.add_object(name, obj, action);
|
934 |
|
|
endfunction
|
935 |
|
|
|
936 |
|
|
endclass
|
937 |
|
|
|
938 |
|
|
|
939 |
|
|
`endif
|