1 |
16 |
HanySalah |
//----------------------------------------------------------------------
|
2 |
|
|
// Copyright 2010-2011 Mentor Graphics Corporation
|
3 |
|
|
// Copyright 2010 Synopsys, Inc.
|
4 |
|
|
// All Rights Reserved Worldwide
|
5 |
|
|
//
|
6 |
|
|
// Licensed under the Apache License, Version 2.0 (the
|
7 |
|
|
// "License"); you may not use this file except in
|
8 |
|
|
// compliance with the License. You may obtain a copy of
|
9 |
|
|
// the License at
|
10 |
|
|
//
|
11 |
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
12 |
|
|
//
|
13 |
|
|
// Unless required by applicable law or agreed to in
|
14 |
|
|
// writing, software distributed under the License is
|
15 |
|
|
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
16 |
|
|
// CONDITIONS OF ANY KIND, either express or implied. See
|
17 |
|
|
// the License for the specific language governing
|
18 |
|
|
// permissions and limitations under the License.
|
19 |
|
|
//----------------------------------------------------------------------
|
20 |
|
|
|
21 |
|
|
//----------------------------------------------------------------------
|
22 |
|
|
// Title: TLM2 imps (interface implementations)
|
23 |
|
|
//
|
24 |
|
|
// This section defines the implementation classes for connecting TLM2
|
25 |
|
|
// interfaces.
|
26 |
|
|
//
|
27 |
|
|
// TLM imps bind a TLM interface with the object that contains the
|
28 |
|
|
// interface implementation.
|
29 |
|
|
// In addition to the transaction type and the phase type, the imps
|
30 |
|
|
// are parameterized with the type of the object that will provide the
|
31 |
|
|
// implementation. Most often this will be the type of the component
|
32 |
|
|
// where the imp resides. The constructor of the imp takes as an argument
|
33 |
|
|
// an object of type IMP and installs it as the implementation object.
|
34 |
|
|
// Most often the imp constructor argument is "this".
|
35 |
|
|
//----------------------------------------------------------------------
|
36 |
|
|
|
37 |
|
|
//--------------------------
|
38 |
|
|
// Group: IMP binding macros
|
39 |
|
|
//--------------------------
|
40 |
|
|
|
41 |
|
|
// Macro: `UVM_TLM_NB_TRANSPORT_FW_IMP
|
42 |
|
|
//
|
43 |
|
|
// The macro wraps the forward path call function nb_transport_fw()
|
44 |
|
|
//
|
45 |
|
|
// The first call to this method for a transaction marks the initial timing point.
|
46 |
|
|
// Every call to this method may mark a timing point in the execution of the
|
47 |
|
|
// transaction. The timing annotation argument allows the timing points
|
48 |
|
|
// to be offset from the simulation times at which the forward path is used.
|
49 |
|
|
// The final timing point of a transaction may be marked by a call
|
50 |
|
|
// to nb_transport_bw() within <`UVM_TLM_NB_TRANSPORT_BW_IMP> or a return from this
|
51 |
|
|
// or subsequent call to nb_transport_fw().
|
52 |
|
|
//
|
53 |
|
|
// See
|
54 |
|
|
// for more details on the semantics and rules of the nonblocking
|
55 |
|
|
// transport interface.
|
56 |
|
|
|
57 |
|
|
`define UVM_TLM_NB_TRANSPORT_FW_IMP(imp, T, P, t, p, delay) \
|
58 |
|
|
function uvm_tlm_sync_e nb_transport_fw(T t, ref P p, input uvm_tlm_time delay); \
|
59 |
|
|
if (delay == null) begin \
|
60 |
|
|
`uvm_error("UVM/TLM/NULLDELAY", \
|
61 |
|
|
{get_full_name(), \
|
62 |
|
|
".nb_transport_fw() called with 'null' delay"}) \
|
63 |
|
|
return UVM_TLM_COMPLETED; \
|
64 |
|
|
end \
|
65 |
|
|
return imp.nb_transport_fw(t, p, delay); \
|
66 |
|
|
endfunction
|
67 |
|
|
|
68 |
|
|
|
69 |
|
|
// Macro: `UVM_TLM_NB_TRANSPORT_BW_IMP
|
70 |
|
|
//
|
71 |
|
|
//
|
72 |
|
|
// Implementation of the backward path.
|
73 |
|
|
// The macro wraps the function called nb_transport_bw().
|
74 |
|
|
// This function MUST be implemented in the INITIATOR component class.
|
75 |
|
|
//
|
76 |
|
|
// Every call to this method may mark a timing point, including the final
|
77 |
|
|
// timing point, in the execution of the transaction.
|
78 |
|
|
// The timing annotation argument allows the timing point
|
79 |
|
|
// to be offset from the simulation times at which the backward path is used.
|
80 |
|
|
// The final timing point of a transaction may be marked by a call
|
81 |
|
|
// to nb_transport_fw() within <`UVM_TLM_NB_TRANSPORT_FW_IMP> or a return from
|
82 |
|
|
// this or subsequent call to nb_transport_bw().
|
83 |
|
|
//
|
84 |
|
|
// See
|
85 |
|
|
// for more details on the semantics and rules of the nonblocking
|
86 |
|
|
// transport interface.
|
87 |
|
|
//
|
88 |
|
|
// Example:
|
89 |
|
|
//
|
90 |
|
|
//| class master extends uvm_component;
|
91 |
|
|
//| uvm_tlm_nb_initiator_socket
|
92 |
|
|
//| #(trans, uvm_tlm_phase_e, this_t) initiator_socket;
|
93 |
|
|
//|
|
94 |
|
|
//| function void build_phase(uvm_phase phase);
|
95 |
|
|
//| initiator_socket = new("initiator_socket", this, this);
|
96 |
|
|
//| endfunction
|
97 |
|
|
//|
|
98 |
|
|
//| function uvm_tlm_sync_e nb_transport_bw(trans t,
|
99 |
|
|
//| ref uvm_tlm_phase_e p,
|
100 |
|
|
//| input uvm_tlm_time delay);
|
101 |
|
|
//| transaction = t;
|
102 |
|
|
//| state = p;
|
103 |
|
|
//| return UVM_TLM_ACCEPTED;
|
104 |
|
|
//| endfunction
|
105 |
|
|
//|
|
106 |
|
|
//| ...
|
107 |
|
|
//| endclass
|
108 |
|
|
|
109 |
|
|
`define UVM_TLM_NB_TRANSPORT_BW_IMP(imp, T, P, t, p, delay) \
|
110 |
|
|
function uvm_tlm_sync_e nb_transport_bw(T t, ref P p, input uvm_tlm_time delay); \
|
111 |
|
|
if (delay == null) begin \
|
112 |
|
|
`uvm_error("UVM/TLM/NULLDELAY", \
|
113 |
|
|
{get_full_name(), \
|
114 |
|
|
".nb_transport_bw() called with 'null' delay"}) \
|
115 |
|
|
return UVM_TLM_COMPLETED; \
|
116 |
|
|
end \
|
117 |
|
|
return imp.nb_transport_bw(t, p, delay); \
|
118 |
|
|
endfunction
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
// Macro: `UVM_TLM_B_TRANSPORT_IMP
|
122 |
|
|
//
|
123 |
|
|
// The macro wraps the function b_transport()
|
124 |
|
|
// Execute a blocking transaction. Once this method returns,
|
125 |
|
|
// the transaction is assumed to have been executed. Whether
|
126 |
|
|
// that execution is successful or not must be indicated by the
|
127 |
|
|
// transaction itself.
|
128 |
|
|
//
|
129 |
|
|
// The callee may modify or update the transaction object, subject
|
130 |
|
|
// to any constraints imposed by the transaction class. The
|
131 |
|
|
// initiator may re-use a transaction object from one call to
|
132 |
|
|
// the next and across calls to b_transport().
|
133 |
|
|
//
|
134 |
|
|
// The call to b_transport shall mark the first timing point of the
|
135 |
|
|
// transaction. The return from b_transport() shall mark the final
|
136 |
|
|
// timing point of the transaction. The timing annotation argument
|
137 |
|
|
// allows the timing points to be offset from the simulation times
|
138 |
|
|
// at which the task call and return are executed.
|
139 |
|
|
|
140 |
|
|
`define UVM_TLM_B_TRANSPORT_IMP(imp, T, t, delay) \
|
141 |
|
|
task b_transport(T t, uvm_tlm_time delay); \
|
142 |
|
|
if (delay == null) begin \
|
143 |
|
|
`uvm_error("UVM/TLM/NULLDELAY", \
|
144 |
|
|
{get_full_name(), \
|
145 |
|
|
".b_transport() called with 'null' delay"}) \
|
146 |
|
|
return; \
|
147 |
|
|
end \
|
148 |
|
|
imp.b_transport(t, delay); \
|
149 |
|
|
endtask
|
150 |
|
|
|
151 |
|
|
|
152 |
|
|
|
153 |
|
|
//---------------------------
|
154 |
|
|
// Group: IMP binding classes
|
155 |
|
|
//---------------------------
|
156 |
|
|
|
157 |
|
|
//----------------------------------------------------------------------
|
158 |
|
|
// Class: uvm_tlm_b_transport_imp
|
159 |
|
|
//
|
160 |
|
|
// Used like exports, except an additional class parameter specifies
|
161 |
|
|
// the type of the implementation object. When the
|
162 |
|
|
// imp is instantiated the implementation object is bound.
|
163 |
|
|
//----------------------------------------------------------------------
|
164 |
|
|
|
165 |
|
|
class uvm_tlm_b_transport_imp #(type T=uvm_tlm_generic_payload,
|
166 |
|
|
type IMP=int)
|
167 |
|
|
extends uvm_port_base #(uvm_tlm_if #(T));
|
168 |
|
|
`UVM_IMP_COMMON(`UVM_TLM_B_MASK, "uvm_tlm_b_transport_imp", IMP)
|
169 |
|
|
`UVM_TLM_B_TRANSPORT_IMP(m_imp, T, t, delay)
|
170 |
|
|
endclass
|
171 |
|
|
|
172 |
|
|
//----------------------------------------------------------------------
|
173 |
|
|
// Class: uvm_tlm_nb_transport_fw_imp
|
174 |
|
|
//
|
175 |
|
|
// Used like exports, except an additional class parameter specifies
|
176 |
|
|
// the type of the implementation object. When the
|
177 |
|
|
// imp is instantiated the implementation object is bound.
|
178 |
|
|
//----------------------------------------------------------------------
|
179 |
|
|
|
180 |
|
|
class uvm_tlm_nb_transport_fw_imp #(type T=uvm_tlm_generic_payload,
|
181 |
|
|
type P=uvm_tlm_phase_e,
|
182 |
|
|
type IMP=int)
|
183 |
|
|
extends uvm_port_base #(uvm_tlm_if #(T,P));
|
184 |
|
|
`UVM_IMP_COMMON(`UVM_TLM_NB_FW_MASK, "uvm_tlm_nb_transport_fw_imp", IMP)
|
185 |
|
|
`UVM_TLM_NB_TRANSPORT_FW_IMP(m_imp, T, P, t, p, delay)
|
186 |
|
|
endclass
|
187 |
|
|
|
188 |
|
|
//----------------------------------------------------------------------
|
189 |
|
|
// Class: uvm_tlm_nb_transport_bw_imp
|
190 |
|
|
//
|
191 |
|
|
// Used like exports, except an additional class parameter specifies
|
192 |
|
|
// the type of the implementation object. When the
|
193 |
|
|
// imp is instantiated the implementation object is bound.
|
194 |
|
|
//----------------------------------------------------------------------
|
195 |
|
|
|
196 |
|
|
class uvm_tlm_nb_transport_bw_imp #(type T=uvm_tlm_generic_payload,
|
197 |
|
|
type P=uvm_tlm_phase_e,
|
198 |
|
|
type IMP=int)
|
199 |
|
|
extends uvm_port_base #(uvm_tlm_if #(T,P));
|
200 |
|
|
`UVM_IMP_COMMON(`UVM_TLM_NB_BW_MASK, "uvm_tlm_nb_transport_bw_imp", IMP)
|
201 |
|
|
`UVM_TLM_NB_TRANSPORT_BW_IMP(m_imp, T, P, t, p, delay)
|
202 |
|
|
endclass
|