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

Subversion Repositories uart2bus_testbench

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 16 HanySalah
//
2
//------------------------------------------------------------------------------
3
//   Copyright 2007-2010 Mentor Graphics Corporation
4
//   Copyright 2007-2010 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
typedef class uvm_object;
24
typedef class uvm_event;
25
 
26
//------------------------------------------------------------------------------
27
//
28
// CLASS: uvm_event_callback
29
//
30
// The uvm_event_callback class is an abstract class that is used to create
31
// callback objects which may be attached to s. To use, you
32
// derive a new class and override any or both  and .
33
//
34
// Callbacks are an alternative to using processes that wait on events. When a
35
// callback is attached to an event, that callback object's callback function
36
// is called each time the event is triggered.
37
//
38
//------------------------------------------------------------------------------
39
 
40
virtual class uvm_event_callback#(type T=uvm_object) extends uvm_object;
41
 
42
  // Function: new
43
  //
44
  // Creates a new callback object.
45
 
46
  function new (string name="");
47
    super.new(name);
48
  endfunction
49
 
50
 
51
  // Function: pre_trigger
52
  //
53
  // This callback is called just before triggering the associated event.
54
  // In a derived class, override this method to implement any pre-trigger
55
  // functionality.
56
  //
57
  // If your callback returns 1, then the event will not trigger and the
58
  // post-trigger callback is not called. This provides a way for a callback
59
  // to prevent the event from triggering.
60
  //
61
  // In the function, ~e~ is the  that is being triggered, and ~data~
62
  // is the optional data associated with the event trigger.
63
 
64
  virtual function bit pre_trigger (uvm_event#(T) e, T data);
65
    return 0;
66
  endfunction
67
 
68
 
69
  // Function: post_trigger
70
  //
71
  // This callback is called after triggering the associated event.
72
  // In a derived class, override this method to implement any post-trigger
73
  // functionality.
74
  //
75
  //
76
  // In the function, ~e~ is the  that is being triggered, and ~data~
77
  // is the optional data associated with the event trigger.
78
 
79
  virtual function void post_trigger (uvm_event#(T) e, T data);
80
    return;
81
  endfunction
82
 
83
 
84
  virtual function uvm_object create (string name="");
85
    return null;
86
  endfunction
87
 
88
endclass
89
 
90
 

powered by: WebSVN 2.1.0

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