1 |
16 |
HanySalah |
//
|
2 |
|
|
//------------------------------------------------------------------------------
|
3 |
|
|
// Copyright 2007-2011 Mentor Graphics Corporation
|
4 |
|
|
// Copyright 2007-2010 Cadence Design Systems, Inc.
|
5 |
|
|
// Copyright 2010 Synopsys, Inc.
|
6 |
|
|
// Copyright 2013-2014 NVIDIA Corporation
|
7 |
|
|
// All Rights Reserved Worldwide
|
8 |
|
|
//
|
9 |
|
|
// Licensed under the Apache License, Version 2.0 (the
|
10 |
|
|
// "License"); you may not use this file except in
|
11 |
|
|
// compliance with the License. You may obtain a copy of
|
12 |
|
|
// the License at
|
13 |
|
|
//
|
14 |
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
15 |
|
|
//
|
16 |
|
|
// Unless required by applicable law or agreed to in
|
17 |
|
|
// writing, software distributed under the License is
|
18 |
|
|
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
19 |
|
|
// CONDITIONS OF ANY KIND, either express or implied. See
|
20 |
|
|
// the License for the specific language governing
|
21 |
|
|
// permissions and limitations under the License.
|
22 |
|
|
//------------------------------------------------------------------------------
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
`define UVM_SEQ_ITEM_TASK_ERROR "Sequencer interface task not implemented"
|
26 |
|
|
`define UVM_SEQ_ITEM_FUNCTION_ERROR "Sequencer interface function not implemented"
|
27 |
|
|
|
28 |
|
|
//------------------------------------------------------------------------------
|
29 |
|
|
//
|
30 |
|
|
// CLASS: uvm_sqr_if_base #(REQ,RSP)
|
31 |
|
|
//
|
32 |
|
|
// This class defines an interface for sequence drivers to communicate with
|
33 |
|
|
// sequencers. The driver requires the interface via a port, and the sequencer
|
34 |
|
|
// implements it and provides it via an export.
|
35 |
|
|
//
|
36 |
|
|
//------------------------------------------------------------------------------
|
37 |
|
|
|
38 |
|
|
virtual class uvm_sqr_if_base #(type T1=uvm_object, T2=T1);
|
39 |
|
|
|
40 |
|
|
// Task: get_next_item
|
41 |
|
|
//
|
42 |
|
|
// Retrieves the next available item from a sequence. The call will block
|
43 |
|
|
// until an item is available. The following steps occur on this call:
|
44 |
|
|
//
|
45 |
|
|
// 1 - Arbitrate among requesting, unlocked, relevant sequences - choose the
|
46 |
|
|
// highest priority sequence based on the current sequencer arbitration
|
47 |
|
|
// mode. If no sequence is available, wait for a requesting unlocked
|
48 |
|
|
// relevant sequence, then re-arbitrate.
|
49 |
|
|
// 2 - The chosen sequence will return from wait_for_grant
|
50 |
|
|
// 3 - The chosen sequence is called
|
51 |
|
|
// 4 - The chosen sequence item is randomized
|
52 |
|
|
// 5 - The chosen sequence is called
|
53 |
|
|
// 6 - Return with a reference to the item
|
54 |
|
|
//
|
55 |
|
|
// Once is called, must be called to indicate the
|
56 |
|
|
// completion of the request to the sequencer. This will remove the request
|
57 |
|
|
// item from the sequencer FIFO.
|
58 |
|
|
|
59 |
|
|
virtual task get_next_item(output T1 t);
|
60 |
|
|
uvm_report_error("get_next_item", `UVM_SEQ_ITEM_TASK_ERROR, UVM_NONE);
|
61 |
|
|
endtask
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
// Task: try_next_item
|
65 |
|
|
//
|
66 |
|
|
// Retrieves the next available item from a sequence if one is available.
|
67 |
|
|
// Otherwise, the function returns immediately with request set to ~null~.
|
68 |
|
|
// The following steps occur on this call:
|
69 |
|
|
//
|
70 |
|
|
// 1 - Arbitrate among requesting, unlocked, relevant sequences - choose the
|
71 |
|
|
// highest priority sequence based on the current sequencer arbitration
|
72 |
|
|
// mode. If no sequence is available, return ~null~.
|
73 |
|
|
// 2 - The chosen sequence will return from wait_for_grant
|
74 |
|
|
// 3 - The chosen sequence is called
|
75 |
|
|
// 4 - The chosen sequence item is randomized
|
76 |
|
|
// 5 - The chosen sequence is called
|
77 |
|
|
// 6 - Return with a reference to the item
|
78 |
|
|
//
|
79 |
|
|
// Once is called, must be called to indicate the
|
80 |
|
|
// completion of the request to the sequencer. This will remove the request
|
81 |
|
|
// item from the sequencer FIFO.
|
82 |
|
|
|
83 |
|
|
virtual task try_next_item(output T1 t);
|
84 |
|
|
uvm_report_error("try_next_item", `UVM_SEQ_ITEM_TASK_ERROR, UVM_NONE);
|
85 |
|
|
endtask
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
// Function: item_done
|
89 |
|
|
//
|
90 |
|
|
// Indicates that the request is completed to the sequencer. Any
|
91 |
|
|
//
|
92 |
|
|
// calls made by a sequence for this item will return.
|
93 |
|
|
//
|
94 |
|
|
// The current item is removed from the sequencer FIFO.
|
95 |
|
|
//
|
96 |
|
|
// If a response item is provided, then it will be sent back to the requesting
|
97 |
|
|
// sequence. The response item must have its sequence ID and transaction ID
|
98 |
|
|
// set correctly, using the method:
|
99 |
|
|
//
|
100 |
|
|
//| rsp.set_id_info(req);
|
101 |
|
|
//
|
102 |
|
|
// Before is called, any calls to peek will retrieve the current
|
103 |
|
|
// item that was obtained by . After is called, peek
|
104 |
|
|
// will cause the sequencer to arbitrate for a new item.
|
105 |
|
|
|
106 |
|
|
virtual function void item_done(input T2 t = null);
|
107 |
|
|
uvm_report_error("item_done", `UVM_SEQ_ITEM_FUNCTION_ERROR, UVM_NONE);
|
108 |
|
|
endfunction
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
// Task: wait_for_sequences
|
112 |
|
|
//
|
113 |
|
|
// Waits for a sequence to have a new item available. The default
|
114 |
|
|
// implementation in the sequencer calls
|
115 |
|
|
// .
|
116 |
|
|
// User-derived sequencers
|
117 |
|
|
// may override its implementation to perform some other
|
118 |
|
|
// application-specific implementation.
|
119 |
|
|
|
120 |
|
|
virtual task wait_for_sequences();
|
121 |
|
|
uvm_report_error("wait_for_sequences", `UVM_SEQ_ITEM_TASK_ERROR, UVM_NONE);
|
122 |
|
|
endtask
|
123 |
|
|
|
124 |
|
|
|
125 |
|
|
// Function: has_do_available
|
126 |
|
|
//
|
127 |
|
|
// Indicates whether a sequence item is available for immediate processing.
|
128 |
|
|
// Implementations should return 1 if an item is available, 0 otherwise.
|
129 |
|
|
|
130 |
|
|
virtual function bit has_do_available();
|
131 |
|
|
uvm_report_error("has_do_available", `UVM_SEQ_ITEM_FUNCTION_ERROR, UVM_NONE);
|
132 |
|
|
return 0;
|
133 |
|
|
endfunction
|
134 |
|
|
|
135 |
|
|
|
136 |
|
|
//-----------------------
|
137 |
|
|
// uvm_tlm_blocking_slave_if
|
138 |
|
|
//-----------------------
|
139 |
|
|
|
140 |
|
|
// Task: get
|
141 |
|
|
//
|
142 |
|
|
// Retrieves the next available item from a sequence. The call blocks until
|
143 |
|
|
// an item is available. The following steps occur on this call:
|
144 |
|
|
//
|
145 |
|
|
// 1 - Arbitrate among requesting, unlocked, relevant sequences - choose the
|
146 |
|
|
// highest priority sequence based on the current sequencer arbitration
|
147 |
|
|
// mode. If no sequence is available, wait for a requesting unlocked
|
148 |
|
|
// relevant sequence, then re-arbitrate.
|
149 |
|
|
// 2 - The chosen sequence will return from
|
150 |
|
|
// 3 - The chosen sequence is called
|
151 |
|
|
// 4 - The chosen sequence item is randomized
|
152 |
|
|
// 5 - The chosen sequence is called
|
153 |
|
|
// 6 - Indicate to the sequencer
|
154 |
|
|
// 7 - Return with a reference to the item
|
155 |
|
|
//
|
156 |
|
|
// When get is called, may not be called. A new item can be
|
157 |
|
|
// obtained by calling get again, or a response may be sent using either
|
158 |
|
|
// , or uvm_driver::rsp_port.write().
|
159 |
|
|
|
160 |
|
|
virtual task get(output T1 t);
|
161 |
|
|
uvm_report_error("get", `UVM_SEQ_ITEM_TASK_ERROR, UVM_NONE);
|
162 |
|
|
endtask
|
163 |
|
|
|
164 |
|
|
// Task: peek
|
165 |
|
|
//
|
166 |
|
|
// Returns the current request item if one is in the sequencer FIFO. If no
|
167 |
|
|
// item is in the FIFO, then the call will block until the sequencer has a new
|
168 |
|
|
// request. The following steps will occur if the sequencer FIFO is empty:
|
169 |
|
|
//
|
170 |
|
|
// 1 - Arbitrate among requesting, unlocked, relevant sequences - choose the
|
171 |
|
|
// highest priority sequence based on the current sequencer arbitration mode.
|
172 |
|
|
// If no sequence is available, wait for a requesting unlocked relevant
|
173 |
|
|
// sequence, then re-arbitrate.
|
174 |
|
|
//
|
175 |
|
|
// 2 - The chosen sequence will return from
|
176 |
|
|
// 3 - The chosen sequence is called
|
177 |
|
|
// 4 - The chosen sequence item is randomized
|
178 |
|
|
// 5 - The chosen sequence is called
|
179 |
|
|
//
|
180 |
|
|
// Once a request item has been retrieved and is in the sequencer FIFO,
|
181 |
|
|
// subsequent calls to peek will return the same item. The item will stay in
|
182 |
|
|
// the FIFO until either get or is called.
|
183 |
|
|
|
184 |
|
|
virtual task peek(output T1 t);
|
185 |
|
|
uvm_report_error("peek", `UVM_SEQ_ITEM_TASK_ERROR, UVM_NONE);
|
186 |
|
|
endtask
|
187 |
|
|
|
188 |
|
|
|
189 |
|
|
// Task: put
|
190 |
|
|
//
|
191 |
|
|
// Sends a response back to the sequence that issued the request. Before the
|
192 |
|
|
// response is put, it must have its sequence ID and transaction ID set to
|
193 |
|
|
// match the request. This can be done using the
|
194 |
|
|
// call:
|
195 |
|
|
//
|
196 |
|
|
// rsp.set_id_info(req);
|
197 |
|
|
//
|
198 |
|
|
// While this is a task, it will not consume time (including delta cycles).
|
199 |
|
|
// The response will be put into the
|
200 |
|
|
// sequence response queue or it will be sent to the
|
201 |
|
|
// sequence response handler.
|
202 |
|
|
//
|
203 |
|
|
|
204 |
|
|
|
205 |
|
|
virtual task put(input T2 t);
|
206 |
|
|
uvm_report_error("put", `UVM_SEQ_ITEM_TASK_ERROR, UVM_NONE);
|
207 |
|
|
endtask
|
208 |
|
|
|
209 |
|
|
|
210 |
|
|
// Function: put_response
|
211 |
|
|
//
|
212 |
|
|
// Sends a response back to the sequence that issued the request. Before the
|
213 |
|
|
// response is put, it must have its sequence ID and transaction ID set to
|
214 |
|
|
// match the request. This can be done using the
|
215 |
|
|
// call:
|
216 |
|
|
//
|
217 |
|
|
// rsp.set_id_info(req);
|
218 |
|
|
//
|
219 |
|
|
|
220 |
|
|
virtual function void put_response(input T2 t);
|
221 |
|
|
uvm_report_error("put_response", `UVM_SEQ_ITEM_FUNCTION_ERROR, UVM_NONE);
|
222 |
|
|
endfunction
|
223 |
|
|
|
224 |
|
|
// Function: disable_auto_item_recording
|
225 |
|
|
//
|
226 |
|
|
// By default, item recording is performed automatically when
|
227 |
|
|
// get_next_item() and item_done() are called.
|
228 |
|
|
// However, this works only for simple, in-order, blocking transaction
|
229 |
|
|
// execution. For pipelined and out-of-order transaction execution, the
|
230 |
|
|
// driver must turn off this automatic recording and call
|
231 |
|
|
// ,
|
232 |
|
|
// and explicitly at appropriate points in time.
|
233 |
|
|
//
|
234 |
|
|
// This methods be called at the beginning of the driver's ~run_phase()~ method.
|
235 |
|
|
// Once disabled, automatic recording cannot be re-enabled.
|
236 |
|
|
//
|
237 |
|
|
// For backward-compatibility, automatic item recording can be globally
|
238 |
|
|
// turned off at compile time by defining UVM_DISABLE_AUTO_ITEM_RECORDING
|
239 |
|
|
|
240 |
|
|
virtual function void disable_auto_item_recording();
|
241 |
|
|
uvm_report_error("disable_auto_item_recording", `UVM_SEQ_ITEM_FUNCTION_ERROR, UVM_NONE);
|
242 |
|
|
endfunction
|
243 |
|
|
|
244 |
|
|
// Function: is_auto_item_recording_enabled
|
245 |
|
|
//
|
246 |
|
|
// Return TRUE if automatic item recording is enabled for this port instance.
|
247 |
|
|
|
248 |
|
|
virtual function bit is_auto_item_recording_enabled();
|
249 |
|
|
uvm_report_error("is_auto_item_recording_enabled", `UVM_SEQ_ITEM_FUNCTION_ERROR, UVM_NONE);
|
250 |
|
|
return 0;
|
251 |
|
|
endfunction
|
252 |
|
|
endclass
|