1 |
16 |
HanySalah |
//------------------------------------------------------------------------------
|
2 |
|
|
// Copyright 2010-2011 Mentor Graphics Corporation
|
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 |
|
|
|
20 |
|
|
|
21 |
|
|
`ifndef UVM_NO_DEPRECATED
|
22 |
|
|
|
23 |
|
|
//-----------------------------------------------------------------------------
|
24 |
|
|
//
|
25 |
|
|
// *** DEPRECATED ***
|
26 |
|
|
// Group- Sequence Registration Macros
|
27 |
|
|
//
|
28 |
|
|
// The sequence-specific macros perform the same function as the set of
|
29 |
|
|
// `uvm_object_*_utils macros, except they also set the default sequencer type
|
30 |
|
|
// the sequence will run on.
|
31 |
|
|
//-----------------------------------------------------------------------------
|
32 |
|
|
|
33 |
|
|
`define m_uvm_register_sequence(TYPE_NAME, SEQUENCER) \
|
34 |
|
|
static bit is_registered_with_sequencer = SEQUENCER``::add_typewide_sequence(`"TYPE_NAME`");
|
35 |
|
|
|
36 |
|
|
|
37 |
|
|
// MACRO- `uvm_sequence_utils_begin
|
38 |
|
|
//
|
39 |
|
|
`define uvm_sequence_utils_begin(TYPE_NAME, SEQUENCER) \
|
40 |
|
|
`m_uvm_register_sequence(TYPE_NAME, SEQUENCER) \
|
41 |
|
|
`uvm_declare_p_sequencer(SEQUENCER) \
|
42 |
|
|
`uvm_object_utils_begin(TYPE_NAME)
|
43 |
|
|
|
44 |
|
|
// MACRO- `uvm_sequence_utils_end
|
45 |
|
|
//
|
46 |
|
|
`define uvm_sequence_utils_end \
|
47 |
|
|
`uvm_object_utils_end
|
48 |
|
|
|
49 |
|
|
// MACRO- `uvm_sequence_utils
|
50 |
|
|
//
|
51 |
|
|
// The sequence macros can be used in non-parameterized
|
52 |
|
|
// extensions to pre-register the sequence with a given
|
53 |
|
|
// type.
|
54 |
|
|
//
|
55 |
|
|
// For sequences that do not use any `uvm_field macros:
|
56 |
|
|
//
|
57 |
|
|
//| `uvm_sequence_utils(TYPE_NAME,SQR_TYPE_NAME)
|
58 |
|
|
//
|
59 |
|
|
// For sequences employing with field macros:
|
60 |
|
|
//
|
61 |
|
|
//| `uvm_sequence_utils_begin(TYPE_NAME,SQR_TYPE_NAME)
|
62 |
|
|
//| `uvm_field_* macro invocations here
|
63 |
|
|
//| `uvm_sequence_utils_end
|
64 |
|
|
//
|
65 |
|
|
// The sequence-specific macros perform the same function as the set of
|
66 |
|
|
// `uvm_object_*_utils macros except that they also register the sequence's
|
67 |
|
|
// type, TYPE_NAME, with the given sequencer type, SQR_TYPE_NAME, and define
|
68 |
|
|
// the p_sequencer variable and m_set_p_sequencer method.
|
69 |
|
|
//
|
70 |
|
|
// Use `uvm_sequence_utils[_begin] for non-parameterized classes and
|
71 |
|
|
// `uvm_sequence_param_utils[_begin] for parameterized classes.
|
72 |
|
|
|
73 |
|
|
`define uvm_sequence_utils(TYPE_NAME, SEQUENCER) \
|
74 |
|
|
`uvm_sequence_utils_begin(TYPE_NAME,SEQUENCER) \
|
75 |
|
|
`uvm_sequence_utils_end
|
76 |
|
|
|
77 |
|
|
|
78 |
|
|
//-----------------------------------------------------------------------------
|
79 |
|
|
//
|
80 |
|
|
// *** DEPRECATED ***
|
81 |
|
|
//
|
82 |
|
|
// Group- Sequencer Registration Macros
|
83 |
|
|
//
|
84 |
|
|
// The sequencer-specific macros perform the same function as the set of
|
85 |
|
|
// `uvm_componenent_*utils macros except that they also declare the plumbing
|
86 |
|
|
// necessary for creating the sequencer's sequence library.
|
87 |
|
|
//-----------------------------------------------------------------------------
|
88 |
|
|
|
89 |
|
|
`define uvm_declare_sequence_lib \
|
90 |
|
|
protected bit m_set_sequences_called = 1; \
|
91 |
|
|
static protected string m_static_sequences[$]; \
|
92 |
|
|
static protected string m_static_remove_sequences[$]; \
|
93 |
|
|
\
|
94 |
|
|
static function bit add_typewide_sequence(string type_name); \
|
95 |
|
|
m_static_sequences.push_back(type_name); \
|
96 |
|
|
return 1; \
|
97 |
|
|
endfunction\
|
98 |
|
|
\
|
99 |
|
|
static function bit remove_typewide_sequence(string type_name); \
|
100 |
|
|
m_static_remove_sequences.push_back(type_name); \
|
101 |
|
|
for (int i = 0; i < m_static_sequences.size(); i++) begin \
|
102 |
|
|
if (m_static_sequences[i] == type_name) \
|
103 |
|
|
m_static_sequences.delete(i); \
|
104 |
|
|
end \
|
105 |
|
|
return 1;\
|
106 |
|
|
endfunction\
|
107 |
|
|
\
|
108 |
|
|
function void uvm_update_sequence_lib();\
|
109 |
|
|
if(this.m_set_sequences_called) begin \
|
110 |
|
|
set_sequences_queue(m_static_sequences); \
|
111 |
|
|
this.m_set_sequences_called = 0;\
|
112 |
|
|
end\
|
113 |
|
|
for (int i = 0; i < m_static_remove_sequences.size(); i++) begin \
|
114 |
|
|
remove_sequence(m_static_remove_sequences[i]); \
|
115 |
|
|
end \
|
116 |
|
|
endfunction\
|
117 |
|
|
|
118 |
|
|
|
119 |
|
|
|
120 |
|
|
// MACRO- `uvm_update_sequence_lib
|
121 |
|
|
//
|
122 |
|
|
// This macro populates the instance-specific sequence library for a sequencer.
|
123 |
|
|
// It should be invoked inside the sequencer��s constructor.
|
124 |
|
|
|
125 |
|
|
`define uvm_update_sequence_lib \
|
126 |
|
|
m_add_builtin_seqs(0); \
|
127 |
|
|
uvm_update_sequence_lib();
|
128 |
|
|
|
129 |
|
|
|
130 |
|
|
// MACRO- `uvm_update_sequence_lib_and_item
|
131 |
|
|
//
|
132 |
|
|
// This macro populates the instance specific sequence library for a sequencer,
|
133 |
|
|
// and it registers the given ~USER_ITEM~ as an instance override for the simple
|
134 |
|
|
// sequence's item variable.
|
135 |
|
|
//
|
136 |
|
|
// The macro should be invoked inside the sequencer's constructor.
|
137 |
|
|
|
138 |
|
|
`define uvm_update_sequence_lib_and_item(USER_ITEM) \
|
139 |
|
|
begin uvm_coreservice_t cs = uvm_coreservice_t::get(); uvm_factory factory=cs.get_factory(); \
|
140 |
|
|
factory.set_inst_override_by_type( \
|
141 |
|
|
uvm_sequence_item::get_type(), USER_ITEM::get_type(), \
|
142 |
|
|
{get_full_name(), "*.item"}); end \
|
143 |
|
|
m_add_builtin_seqs(1); \
|
144 |
|
|
uvm_update_sequence_lib();
|
145 |
|
|
|
146 |
|
|
|
147 |
|
|
// MACRO- `uvm_sequencer_utils
|
148 |
|
|
|
149 |
|
|
`define uvm_sequencer_utils(TYPE_NAME) \
|
150 |
|
|
`uvm_sequencer_utils_begin(TYPE_NAME) \
|
151 |
|
|
`uvm_sequencer_utils_end
|
152 |
|
|
|
153 |
|
|
// MACRO- `uvm_sequencer_utils_begin
|
154 |
|
|
|
155 |
|
|
`define uvm_sequencer_utils_begin(TYPE_NAME) \
|
156 |
|
|
`uvm_declare_sequence_lib \
|
157 |
|
|
`uvm_component_utils_begin(TYPE_NAME)
|
158 |
|
|
|
159 |
|
|
// MACRO- `uvm_sequencer_param_utils
|
160 |
|
|
|
161 |
|
|
`define uvm_sequencer_param_utils(TYPE_NAME) \
|
162 |
|
|
`uvm_sequencer_param_utils_begin(TYPE_NAME) \
|
163 |
|
|
`uvm_sequencer_utils_end
|
164 |
|
|
|
165 |
|
|
// MACRO- `uvm_sequencer_param_utils_begin
|
166 |
|
|
|
167 |
|
|
`define uvm_sequencer_param_utils_begin(TYPE_NAME) \
|
168 |
|
|
`uvm_declare_sequence_lib \
|
169 |
|
|
`uvm_component_param_utils_begin(TYPE_NAME)
|
170 |
|
|
|
171 |
|
|
|
172 |
|
|
// MACRO- `uvm_sequencer_utils_end
|
173 |
|
|
//
|
174 |
|
|
// The sequencer macros are used in uvm_sequencer-based class declarations
|
175 |
|
|
// in one of four ways.
|
176 |
|
|
//
|
177 |
|
|
// For simple sequencers, no field macros
|
178 |
|
|
//
|
179 |
|
|
// `uvm_sequencer_utils(SQR_TYPE_NAME)
|
180 |
|
|
//
|
181 |
|
|
// For simple sequencers, with field macros
|
182 |
|
|
//
|
183 |
|
|
// `uvm_sequencer_utils_begin(SQR_TYPE_NAME)
|
184 |
|
|
// `uvm_field_* macros here
|
185 |
|
|
// `uvm_sequencer_utils_end
|
186 |
|
|
//
|
187 |
|
|
// For parameterized sequencers, no field macros
|
188 |
|
|
//
|
189 |
|
|
// `uvm_sequencer_param_utils(SQR_TYPE_NAME)
|
190 |
|
|
//
|
191 |
|
|
// For parameterized sequencers, with field macros
|
192 |
|
|
//
|
193 |
|
|
// `uvm_sequencer_param_utils_begin(SQR_TYPE_NAME)
|
194 |
|
|
// `uvm_field_* macros here
|
195 |
|
|
// `uvm_sequencer_utils_end
|
196 |
|
|
//
|
197 |
|
|
// The sequencer-specific macros perform the same function as the set of
|
198 |
|
|
// `uvm_componenent_*utils macros except that they also declare the plumbing
|
199 |
|
|
// necessary for creating the sequencer's sequence library. This includes:
|
200 |
|
|
//
|
201 |
|
|
// 1. Declaring the type-based static queue of strings registered on the
|
202 |
|
|
// sequencer type.
|
203 |
|
|
//
|
204 |
|
|
// 2. Declaring the static function to add strings to item #1 above.
|
205 |
|
|
//
|
206 |
|
|
// 3. Declaring the static function to remove strings to item #1 above.
|
207 |
|
|
//
|
208 |
|
|
// 4. Declaring the function to populate the instance specific sequence library
|
209 |
|
|
// for a sequencer.
|
210 |
|
|
//
|
211 |
|
|
// Use `uvm_sequencer_utils[_begin] for non-parameterized classes and
|
212 |
|
|
// `uvm_sequencer_param_utils[_begin] for parameterized classes.
|
213 |
|
|
|
214 |
|
|
`define uvm_sequencer_utils_end \
|
215 |
|
|
`uvm_component_utils_end
|
216 |
|
|
|
217 |
|
|
|
218 |
|
|
|
219 |
|
|
//-----------------------------------------------------------------------------
|
220 |
|
|
//
|
221 |
|
|
// MACRO- `uvm_package
|
222 |
|
|
//
|
223 |
|
|
// Use `uvm_package to define the SV package and to create a bogus type to help
|
224 |
|
|
// automate triggering the static initializers of the package.
|
225 |
|
|
// Use uvm_end_package to endpackage.
|
226 |
|
|
//-----------------------------------------------------------------------------
|
227 |
|
|
|
228 |
|
|
`define uvm_package(PKG) \
|
229 |
|
|
package PKG; \
|
230 |
|
|
class uvm_bogus_class extends uvm::uvm_sequence;\
|
231 |
|
|
endclass
|
232 |
|
|
|
233 |
|
|
`define uvm_end_package \
|
234 |
|
|
endpackage
|
235 |
|
|
|
236 |
|
|
|
237 |
|
|
//-----------------------------------------------------------------------------
|
238 |
|
|
//
|
239 |
|
|
// MACRO- `uvm_sequence_library_package
|
240 |
|
|
//
|
241 |
|
|
// This macro is used to trigger static initializers in packages. `uvm_package
|
242 |
|
|
// creates a bogus type which gets referred to by uvm_sequence_library_package
|
243 |
|
|
// to make a package-based variable of the bogus type.
|
244 |
|
|
//-----------------------------------------------------------------------------
|
245 |
|
|
|
246 |
|
|
`define uvm_sequence_library_package(PKG_NAME) \
|
247 |
|
|
import PKG_NAME``::*; \
|
248 |
|
|
PKG_NAME``::uvm_bogus_class M_``PKG_NAME``uvm_bogus_class
|
249 |
|
|
|
250 |
|
|
`endif // UVM_NO_DEPRECATED
|