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

Subversion Repositories uart2bus_testbench

[/] [uart2bus_testbench/] [trunk/] [tb/] [uvm_src/] [macros/] [uvm_phase_defines.svh] - Blame information for rev 16

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 16 HanySalah
`ifndef UVM_PHASE_DEFINES_SVH
2
`define UVM_PHASE_DEFINES_SVH
3
//
4
//----------------------------------------------------------------------
5
//   Copyright 2007-2011 Mentor Graphics Corporation
6
//   Copyright 2007-2011 Cadence Design Systems, Inc.
7
//   Copyright 2011 Synopsys, Inc.
8
//   All Rights Reserved Worldwide
9
//
10
//   Licensed under the Apache License, Version 2.0 (the
11
//   "License"); you may not use this file except in
12
//   compliance with the License.  You may obtain a copy of
13
//   the License at
14
//
15
//       http://www.apache.org/licenses/LICENSE-2.0
16
//
17
//   Unless required by applicable law or agreed to in
18
//   writing, software distributed under the License is
19
//   distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
20
//   CONDITIONS OF ANY KIND, either express or implied.  See
21
//   the License for the specific language governing
22
//   permissions and limitations under the License.
23
//----------------------------------------------------------------------
24
 
25
 
26
// uvm_root.svh uses these macros to simplify creation of all the phases.
27
// they are only to be used for UVM builtin phases, because they are simple
28
// delegate imps that call the corresponding methods on uvm_component.
29
// Also, they declare classes (uvm_XXXXX_phase) and singleton instances (XXXXX_ph)
30
 
31
// If you require more complex phase functors for your custom phase, code your
32
// own imp class extending uvm_task/topdown/bottomup_phase base classes, following
33
// the pattern of the macros below, but customize the exec_task() or exec_func()
34
// contents to suit your enhanced functionality or derived component type/methods.
35
// The uvm_user_xxx_phase() macros are provided for your convenience.
36
 
37
 
38
`define m_uvm_task_phase(PHASE,COMP,PREFIX) \
39
        class PREFIX``PHASE``_phase extends uvm_task_phase; \
40
          virtual task exec_task(uvm_component comp, uvm_phase phase); \
41
            COMP comp_; \
42
            if ($cast(comp_,comp)) \
43
              comp_.``PHASE``_phase(phase); \
44
          endtask \
45
          local static PREFIX``PHASE``_phase m_inst; \
46
          static const string type_name = `"PREFIX``PHASE``_phase`"; \
47
          static function PREFIX``PHASE``_phase get(); \
48
            if(m_inst == null) begin \
49
              m_inst = new; \
50
            end \
51
            return m_inst; \
52
          endfunction \
53
          protected function new(string name=`"PHASE`"); \
54
            super.new(name); \
55
          endfunction \
56
          virtual function string get_type_name(); \
57
            return type_name; \
58
          endfunction \
59
        endclass \
60
        //PREFIX``PHASE``_phase PREFIX``PHASE``_ph = PREFIX``PHASE``_phase::get();
61
 
62
`define m_uvm_topdown_phase(PHASE,COMP,PREFIX) \
63
        class PREFIX``PHASE``_phase extends uvm_topdown_phase; \
64
          virtual function void exec_func(uvm_component comp, uvm_phase phase); \
65
            COMP comp_; \
66
            if ($cast(comp_,comp)) \
67
              comp_.``PHASE``_phase(phase); \
68
          endfunction \
69
          local static PREFIX``PHASE``_phase m_inst; \
70
          static const string type_name = `"PREFIX``PHASE``_phase`"; \
71
          static function PREFIX``PHASE``_phase get(); \
72
            if(m_inst == null) begin \
73
              m_inst = new(); \
74
            end \
75
            return m_inst; \
76
          endfunction \
77
          protected function new(string name=`"PHASE`"); \
78
            super.new(name); \
79
          endfunction \
80
          virtual function string get_type_name(); \
81
            return type_name; \
82
          endfunction \
83
        endclass \
84
        //PREFIX``PHASE``_phase PREFIX``PHASE``_ph = PREFIX``PHASE``_phase::get();
85
 
86
`define m_uvm_bottomup_phase(PHASE,COMP,PREFIX) \
87
        class PREFIX``PHASE``_phase extends uvm_bottomup_phase; \
88
          virtual function void exec_func(uvm_component comp, uvm_phase phase); \
89
            COMP comp_; \
90
            if ($cast(comp_,comp)) \
91
              comp_.``PHASE``_phase(phase); \
92
          endfunction \
93
          static PREFIX``PHASE``_phase m_inst; \
94
          static const string type_name = `"PREFIX``PHASE``_phase`"; \
95
          static function PREFIX``PHASE``_phase get(); \
96
            if(m_inst == null) begin \
97
              m_inst = new(); \
98
            end \
99
            return m_inst; \
100
          endfunction \
101
          protected function new(string name=`"PHASE`"); \
102
            super.new(name); \
103
          endfunction \
104
          virtual function string get_type_name(); \
105
            return type_name; \
106
          endfunction \
107
        endclass \
108
        //PREFIX``PHASE``_phase PREFIX``PHASE``_ph = PREFIX``PHASE``_phase::get();
109
 
110
`define uvm_builtin_task_phase(PHASE) \
111
        `m_uvm_task_phase(PHASE,uvm_component,uvm_)
112
 
113
`define uvm_builtin_topdown_phase(PHASE) \
114
        `m_uvm_topdown_phase(PHASE,uvm_component,uvm_)
115
 
116
`define uvm_builtin_bottomup_phase(PHASE) \
117
        `m_uvm_bottomup_phase(PHASE,uvm_component,uvm_)
118
 
119
 
120
`define uvm_user_task_phase(PHASE,COMP,PREFIX) \
121
        `m_uvm_task_phase(PHASE,COMP,PREFIX)
122
 
123
`define uvm_user_topdown_phase(PHASE,COMP,PREFIX) \
124
        `m_uvm_topdown_phase(PHASE,COMP,PREFIX)
125
 
126
`define uvm_user_bottomup_phase(PHASE,COMP,PREFIX) \
127
        `m_uvm_bottomup_phase(PHASE,COMP,PREFIX)
128
 
129
`endif

powered by: WebSVN 2.1.0

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