OpenCores
URL https://opencores.org/ocsvn/uart2bus_testbench/uart2bus_testbench/trunk

Subversion Repositories uart2bus_testbench

[/] [uart2bus_testbench/] [trunk/] [tb/] [uvm_src/] [base/] [uvm_common_phases.svh] - Blame information for rev 16

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 16 HanySalah
//----------------------------------------------------------------------
2
//   Copyright 2007-2011 Mentor Graphics Corporation
3
//   Copyright 2007-2010 Cadence Design Systems, Inc.
4
//   Copyright 2010 Synopsys, Inc.
5
//   All Rights Reserved Worldwide
6
//
7
//   Licensed under the Apache License, Version 2.0 (the
8
//   "License"); you may not use this file except in
9
//   compliance with the License.  You may obtain a copy of
10
//   the License at
11
//
12
//       http://www.apache.org/licenses/LICENSE-2.0
13
//
14
//   Unless required by applicable law or agreed to in
15
//   writing, software distributed under the License is
16
//   distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
17
//   CONDITIONS OF ANY KIND, either express or implied.  See
18
//   the License for the specific language governing
19
//   permissions and limitations under the License.
20
//----------------------------------------------------------------------
21
 
22
// Title: UVM Common Phases
23
//
24
// The common phases are the set of function and task phases that all
25
// s execute together.
26
// All s are always synchronized
27
// with respect to the common phases.
28
//
29
// The names of the UVM phases (which will be returned by get_name() for a
30
// phase instance) match the class names specified below with the "uvm_"
31
// and "_phase" removed.  For example, the build phase corresponds to the
32
// uvm_build_phase class below and has the name "build", which means that
33
// the following can be used to call foo() at the end of the build phase
34
// (after all lower levels have finished build):
35
//
36
// | function void phase_ended(uvm_phase phase) ;
37
// |    if (phase.get_name()=="build") foo() ;
38
// | endfunction
39
//
40
// The common phases are executed in the sequence they are specified below.
41
//
42
//
43
// Class: uvm_build_phase
44
//
45
// Create and configure of testbench structure
46
//
47
//  that calls the
48
//  method.
49
//
50
// Upon entry:
51
//  - The top-level components have been instantiated under .
52
//  - Current simulation time is still equal to 0 but some "delta cycles" may have occurred
53
//
54
// Typical Uses:
55
//  - Instantiate sub-components.
56
//  - Instantiate register model.
57
//  - Get configuration values for the component being built.
58
//  - Set configuration values for sub-components.
59
//
60
// Exit Criteria:
61
//  - All s have been instantiated.
62
 
63
class uvm_build_phase extends uvm_topdown_phase;
64
   virtual function void exec_func(uvm_component comp, uvm_phase phase);
65
      comp.build_phase(phase);
66
   endfunction
67
   local static uvm_build_phase m_inst;
68
   static const string type_name = "uvm_build_phase";
69
 
70
   // Function: get
71
   // Returns the singleton phase handle
72
   //
73
   static function uvm_build_phase get();
74
      if(m_inst == null)
75
         m_inst = new();
76
      return m_inst;
77
   endfunction
78
   protected function new(string name="build");
79
      super.new(name);
80
   endfunction
81
   virtual function string get_type_name();
82
      return type_name;
83
   endfunction
84
endclass
85
 
86
// Class: uvm_connect_phase
87
//
88
// Establish cross-component connections.
89
//
90
//  that calls the
91
//  method.
92
//
93
// Upon Entry:
94
// - All components have been instantiated.
95
// - Current simulation time is still equal to 0
96
//   but some "delta cycles" may have occurred.
97
//
98
// Typical Uses:
99
// - Connect TLM ports and exports.
100
// - Connect TLM initiator sockets and target sockets.
101
// - Connect register model to adapter components.
102
// - Setup explicit phase domains.
103
//
104
// Exit Criteria:
105
// - All cross-component connections have been established.
106
// - All independent phase domains are set.
107
//
108
 
109
class uvm_connect_phase extends uvm_bottomup_phase;
110
   virtual function void exec_func(uvm_component comp, uvm_phase phase);
111
      comp.connect_phase(phase);
112
   endfunction
113
   local static uvm_connect_phase m_inst;
114
   static const string type_name = "uvm_connect_phase";
115
 
116
   // Function: get
117
   // Returns the singleton phase handle
118
   static function uvm_connect_phase get();
119
      if(m_inst == null)
120
         m_inst = new();
121
      return m_inst;
122
   endfunction
123
   protected function new(string name="connect");
124
      super.new(name);
125
   endfunction
126
   virtual function string get_type_name();
127
      return type_name;
128
   endfunction
129
endclass
130
 
131
// Class: uvm_end_of_elaboration_phase
132
//
133
// Fine-tune the testbench.
134
//
135
//  that calls the
136
//  method.
137
//
138
// Upon Entry:
139
// - The verification environment has been completely assembled.
140
// - Current simulation time is still equal to 0
141
//   but some "delta cycles" may have occurred.
142
//
143
// Typical Uses:
144
// - Display environment topology.
145
// - Open files.
146
// - Define additional configuration settings for components.
147
//
148
// Exit Criteria:
149
// - None.
150
 
151
class uvm_end_of_elaboration_phase extends uvm_bottomup_phase;
152
   virtual function void exec_func(uvm_component comp, uvm_phase phase);
153
      comp.end_of_elaboration_phase(phase);
154
   endfunction
155
   local static uvm_end_of_elaboration_phase m_inst;
156
   static const string type_name = "uvm_end_of_elaboration_phase";
157
 
158
   // Function: get
159
   // Returns the singleton phase handle
160
   static function uvm_end_of_elaboration_phase get();
161
      if(m_inst == null) begin
162
         m_inst = new();
163
      end
164
      return m_inst;
165
   endfunction
166
   protected function new(string name="end_of_elaboration");
167
      super.new(name);
168
   endfunction
169
   virtual function string get_type_name();
170
      return type_name;
171
   endfunction
172
endclass
173
 
174
// Class: uvm_start_of_simulation_phase
175
//
176
// Get ready for DUT to be simulated.
177
//
178
//  that calls the
179
//  method.
180
//
181
// Upon Entry:
182
// - Other simulation engines, debuggers, hardware assisted platforms and
183
//   all other run-time tools have been started and synchronized.
184
// - The verification environment has been completely configured
185
//   and is ready to start.
186
// - Current simulation time is still equal to 0
187
//   but some "delta cycles" may have occurred.
188
//
189
// Typical Uses:
190
// - Display environment topology
191
// - Set debugger breakpoint
192
// - Set initial run-time configuration values.
193
//
194
// Exit Criteria:
195
// - None.
196
 
197
 
198
class uvm_start_of_simulation_phase extends uvm_bottomup_phase;
199
   virtual function void exec_func(uvm_component comp, uvm_phase phase);
200
      comp.start_of_simulation_phase(phase);
201
   endfunction
202
   local static uvm_start_of_simulation_phase m_inst;
203
   static const string type_name = "uvm_start_of_simulation_phase";
204
 
205
   // Function: get
206
   // Returns the singleton phase handle
207
   static function uvm_start_of_simulation_phase get();
208
      if(m_inst == null)
209
         m_inst = new();
210
      return m_inst;
211
   endfunction
212
   protected function new(string name="start_of_simulation");
213
      super.new(name);
214
   endfunction
215
   virtual function string get_type_name();
216
      return type_name;
217
   endfunction
218
endclass
219
 
220
// Class: uvm_run_phase
221
//
222
// Stimulate the DUT.
223
//
224
// This  calls the
225
//  virtual method. This phase runs in
226
// parallel to the runtime phases,  through
227
// . All components in the testbench
228
// are synchronized with respect to the run phase regardless of
229
// the phase domain they belong to.
230
//
231
// Upon Entry:
232
// - Indicates that power has been applied.
233
// - There should not have been any active clock edges before entry
234
//   into this phase (e.g. x->1 transitions via initial blocks).
235
// - Current simulation time is still equal to 0
236
//   but some "delta cycles" may have occurred.
237
//
238
// Typical Uses:
239
// - Components implement behavior that is exhibited for the entire
240
//   run-time, across the various run-time phases.
241
// - Backward compatibility with OVM.
242
//
243
// Exit Criteria:
244
// - The DUT no longer needs to be simulated, and
245
// - The  is ready to end
246
//
247
// The run phase terminates in one of two ways.
248
//
249
// 1. All run_phase objections are dropped:
250
//
251
//   When all objections on the run_phase objection have been dropped,
252
//   the phase ends and all of its threads are killed.
253
//   If no component raises a run_phase objection immediately upon
254
//   entering the phase, the phase ends immediately.
255
//
256
//
257
// 2. Timeout:
258
//
259
//   The phase ends if the timeout expires before all objections are dropped.
260
//   By default, the timeout is set to 9200 seconds.
261
//   You may override this via .
262
//
263
//   If a timeout occurs in your simulation, or if simulation never
264
//   ends despite completion of your test stimulus, then it usually indicates
265
//   that a component continues to object to the end of a phase.
266
//
267
class uvm_run_phase extends uvm_task_phase;
268
   virtual task exec_task(uvm_component comp, uvm_phase phase);
269
      comp.run_phase(phase);
270
   endtask
271
   local static uvm_run_phase m_inst;
272
   static const string type_name = "uvm_run_phase";
273
 
274
   // Function: get
275
   // Returns the singleton phase handle
276
   static function uvm_run_phase get();
277
      if(m_inst == null)
278
         m_inst = new;
279
      return m_inst;
280
   endfunction
281
   protected function new(string name="run");
282
      super.new(name);
283
   endfunction
284
   virtual function string get_type_name();
285
      return type_name;
286
   endfunction
287
endclass
288
 
289
 
290
// Class: uvm_extract_phase
291
//
292
// Extract data from different points of the verification environment.
293
//
294
//  that calls the
295
//  method.
296
//
297
// Upon Entry:
298
// - The DUT no longer needs to be simulated.
299
// - Simulation time will no longer advance.
300
//
301
// Typical Uses:
302
// - Extract any remaining data and final state information
303
//   from scoreboard and testbench components
304
// - Probe the DUT (via zero-time hierarchical references
305
//   and/or backdoor accesses) for final state information.
306
// - Compute statistics and summaries.
307
// - Display final state information
308
// - Close files.
309
//
310
// Exit Criteria:
311
// - All data has been collected and summarized.
312
//
313
class uvm_extract_phase extends uvm_bottomup_phase;
314
   virtual function void exec_func(uvm_component comp, uvm_phase phase);
315
      comp.extract_phase(phase);
316
   endfunction
317
   local static uvm_extract_phase m_inst;
318
   static const string type_name = "uvm_extract_phase";
319
 
320
   // Function: get
321
   // Returns the singleton phase handle
322
   static function uvm_extract_phase get();
323
      if(m_inst == null)
324
         m_inst = new();
325
      return m_inst;
326
   endfunction
327
   protected function new(string name="extract");
328
      super.new(name);
329
   endfunction
330
   virtual function string get_type_name();
331
      return type_name;
332
   endfunction
333
endclass
334
 
335
// Class: uvm_check_phase
336
//
337
// Check for any unexpected conditions in the verification environment.
338
//
339
//  that calls the
340
//  method.
341
//
342
// Upon Entry:
343
// - All data has been collected.
344
//
345
// Typical Uses:
346
// - Check that no unaccounted-for data remain.
347
//
348
// Exit Criteria:
349
// - Test is known to have passed or failed.
350
//
351
class uvm_check_phase extends uvm_bottomup_phase;
352
   virtual function void exec_func(uvm_component comp, uvm_phase phase);
353
      comp.check_phase(phase);
354
   endfunction
355
   local static uvm_check_phase m_inst;
356
   static const string type_name = "uvm_check_phase";
357
 
358
   // Function: get
359
   // Returns the singleton phase handle
360
   static function uvm_check_phase get();
361
      if(m_inst == null)
362
         m_inst = new();
363
      return m_inst;
364
   endfunction
365
   protected function new(string name="check");
366
      super.new(name);
367
   endfunction
368
   virtual function string get_type_name();
369
      return type_name;
370
   endfunction
371
endclass
372
 
373
// Class: uvm_report_phase
374
//
375
// Report results of the test.
376
//
377
//  that calls the
378
//  method.
379
//
380
// Upon Entry:
381
// - Test is known to have passed or failed.
382
//
383
// Typical Uses:
384
// - Report test results.
385
// - Write results to file.
386
//
387
// Exit Criteria:
388
// - End of test.
389
//
390
class uvm_report_phase extends uvm_bottomup_phase;
391
   virtual function void exec_func(uvm_component comp, uvm_phase phase);
392
      comp.report_phase(phase);
393
   endfunction
394
   local static uvm_report_phase m_inst;
395
   static const string type_name = "uvm_report_phase";
396
 
397
   // Function: get
398
   // Returns the singleton phase handle
399
   static function uvm_report_phase get();
400
      if(m_inst == null)
401
         m_inst = new();
402
      return m_inst;
403
   endfunction
404
   protected function new(string name="report");
405
      super.new(name);
406
   endfunction
407
   virtual function string get_type_name();
408
      return type_name;
409
   endfunction
410
endclass
411
 
412
 
413
// Class: uvm_final_phase
414
//
415
// Tie up loose ends.
416
//
417
//  that calls the
418
//  method.
419
//
420
// Upon Entry:
421
// - All test-related activity has completed.
422
//
423
// Typical Uses:
424
// - Close files.
425
// - Terminate co-simulation engines.
426
//
427
// Exit Criteria:
428
// - Ready to exit simulator.
429
//
430
 
431
class uvm_final_phase extends uvm_topdown_phase;
432
   virtual function void exec_func(uvm_component comp, uvm_phase phase);
433
      comp.final_phase(phase);
434
   endfunction
435
   local static uvm_final_phase m_inst;
436
   static const string type_name = "uvm_final_phase";
437
 
438
   // Function: get
439
   // Returns the singleton phase handle
440
   static function uvm_final_phase get();
441
      if(m_inst == null)
442
         m_inst = new();
443
      return m_inst;
444
   endfunction
445
   protected function new(string name="final");
446
      super.new(name);
447
   endfunction
448
   virtual function string get_type_name();
449
      return type_name;
450
   endfunction
451
endclass

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.