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 |
|
|
// File: TLM2 Types
|
22 |
|
|
|
23 |
|
|
// Enum: uvm_tlm_phase_e
|
24 |
|
|
//
|
25 |
|
|
// Nonblocking transport synchronization state values between
|
26 |
|
|
// an initiator and a target.
|
27 |
|
|
//
|
28 |
|
|
// UNINITIALIZED_PHASE - Defaults for constructor
|
29 |
|
|
// BEGIN_REQ - Beginning of request phase
|
30 |
|
|
// END_REQ - End of request phase
|
31 |
|
|
// BEGIN_RESP - Beginning of response phase
|
32 |
|
|
// END_RESP - End of response phase
|
33 |
|
|
|
34 |
|
|
typedef enum
|
35 |
|
|
{
|
36 |
|
|
UNINITIALIZED_PHASE,
|
37 |
|
|
BEGIN_REQ,
|
38 |
|
|
END_REQ,
|
39 |
|
|
BEGIN_RESP,
|
40 |
|
|
END_RESP
|
41 |
|
|
} uvm_tlm_phase_e;
|
42 |
|
|
|
43 |
|
|
// Enum: uvm_tlm_sync_e
|
44 |
|
|
//
|
45 |
|
|
// Pre-defined phase state values for the nonblocking transport
|
46 |
|
|
// Base Protocol between an initiator and a target.
|
47 |
|
|
//
|
48 |
|
|
// UVM_TLM_ACCEPTED - Transaction has been accepted
|
49 |
|
|
// UVM_TLM_UPDATED - Transaction has been modified
|
50 |
|
|
// UVM_TLM_COMPLETED - Execution of transaction is complete
|
51 |
|
|
|
52 |
|
|
typedef enum
|
53 |
|
|
{
|
54 |
|
|
UVM_TLM_ACCEPTED,
|
55 |
|
|
UVM_TLM_UPDATED,
|
56 |
|
|
UVM_TLM_COMPLETED
|
57 |
|
|
} uvm_tlm_sync_e;
|
58 |
|
|
|
59 |
|
|
// MACRO: `UVM_TLM_TASK_ERROR
|
60 |
|
|
//
|
61 |
|
|
// Defines Not-Yet-Implemented TLM tasks
|
62 |
|
|
`define UVM_TLM_TASK_ERROR "TLM-2 interface task not implemented"
|
63 |
|
|
|
64 |
|
|
// MACRO: `UVM_TLM_FUNCTION_ERROR
|
65 |
|
|
//
|
66 |
|
|
// Defines Not-Yet-Implemented TLM functions
|
67 |
|
|
`define UVM_TLM_FUNCTION_ERROR "TLM-2 interface function not implemented"
|
68 |
|
|
|
69 |
|
|
//
|
70 |
|
|
// Class: uvm_tlm_if
|
71 |
|
|
//
|
72 |
|
|
// Base class type to define the transport functions.
|
73 |
|
|
//
|
74 |
|
|
// -
|
75 |
|
|
//
|
76 |
|
|
// -
|
77 |
|
|
//
|
78 |
|
|
// -
|
79 |
|
|
//
|
80 |
|
|
|
81 |
|
|
class uvm_tlm_if #(type T=uvm_tlm_generic_payload,
|
82 |
|
|
type P=uvm_tlm_phase_e);
|
83 |
|
|
//----------------------------------------------------------------------
|
84 |
|
|
// Group: tlm transport methods
|
85 |
|
|
//
|
86 |
|
|
// Each of the interface methods take a handle to the transaction to be
|
87 |
|
|
// transported and a reference argument for the delay. In addition, the
|
88 |
|
|
// nonblocking interfaces take a reference argument for the phase.
|
89 |
|
|
//
|
90 |
|
|
|
91 |
|
|
//----------------------------------------------------------------------
|
92 |
|
|
// Function: nb_transport_fw
|
93 |
|
|
//
|
94 |
|
|
// Forward path call.
|
95 |
|
|
// The first call to this method for a transaction marks the initial timing point.
|
96 |
|
|
// Every call to this method may mark a timing point in the execution of the
|
97 |
|
|
// transaction. The timing annotation argument allows the timing points
|
98 |
|
|
// to be offset from the simulation times at which the forward path is used.
|
99 |
|
|
// The final timing point of a transaction may be marked by a call
|
100 |
|
|
// to or a return from this or subsequent call to
|
101 |
|
|
// nb_transport_fw.
|
102 |
|
|
//
|
103 |
|
|
// See
|
104 |
|
|
// for more details on the semantics and rules of the nonblocking
|
105 |
|
|
// transport interface.
|
106 |
|
|
|
107 |
|
|
virtual function uvm_tlm_sync_e nb_transport_fw(T t, ref P p, input uvm_tlm_time delay);
|
108 |
|
|
`uvm_error("nb_transport_fw", `UVM_TLM_FUNCTION_ERROR)
|
109 |
|
|
return UVM_TLM_ACCEPTED;
|
110 |
|
|
endfunction
|
111 |
|
|
|
112 |
|
|
// Function: nb_transport_bw
|
113 |
|
|
//
|
114 |
|
|
// Implementation of the backward path.
|
115 |
|
|
// This function MUST be implemented in the INITIATOR component class.
|
116 |
|
|
//
|
117 |
|
|
// Every call to this method may mark a timing point, including the final
|
118 |
|
|
// timing point, in the execution of the transaction.
|
119 |
|
|
// The timing annotation argument allows the timing point
|
120 |
|
|
// to be offset from the simulation times at which the backward path is used.
|
121 |
|
|
// The final timing point of a transaction may be marked by a call
|
122 |
|
|
// to or a return from this or subsequent call to
|
123 |
|
|
// nb_transport_bw.
|
124 |
|
|
//
|
125 |
|
|
// See
|
126 |
|
|
// for more details on the semantics and rules of the nonblocking
|
127 |
|
|
// transport interface.
|
128 |
|
|
//
|
129 |
|
|
// Example:
|
130 |
|
|
//
|
131 |
|
|
//| class master extends uvm_component;
|
132 |
|
|
// uvm_tlm_nb_initiator_socket #(trans, uvm_tlm_phase_e, this_t) initiator_socket;
|
133 |
|
|
//| ...
|
134 |
|
|
//| function void build_phase(uvm_phase phase);
|
135 |
|
|
// initiator_socket = new("initiator_socket", this, this);
|
136 |
|
|
//| endfunction
|
137 |
|
|
//|
|
138 |
|
|
//| function uvm_tlm_sync_e nb_transport_bw(ref trans t,
|
139 |
|
|
//| ref uvm_tlm_phase_e p,
|
140 |
|
|
//| input uvm_tlm_time delay);
|
141 |
|
|
//| transaction = t;
|
142 |
|
|
//| state = p;
|
143 |
|
|
//| return UVM_TLM_ACCEPTED;
|
144 |
|
|
//| endfunction
|
145 |
|
|
//|
|
146 |
|
|
//| ...
|
147 |
|
|
//| endclass
|
148 |
|
|
|
149 |
|
|
virtual function uvm_tlm_sync_e nb_transport_bw(T t, ref P p, input uvm_tlm_time delay);
|
150 |
|
|
`uvm_error("nb_transport_bw", `UVM_TLM_FUNCTION_ERROR)
|
151 |
|
|
return UVM_TLM_ACCEPTED;
|
152 |
|
|
endfunction
|
153 |
|
|
|
154 |
|
|
// Function: b_transport
|
155 |
|
|
//
|
156 |
|
|
// Execute a blocking transaction. Once this method returns,
|
157 |
|
|
// the transaction is assumed to have been executed. Whether
|
158 |
|
|
// that execution is successful or not must be indicated by the
|
159 |
|
|
// transaction itself.
|
160 |
|
|
//
|
161 |
|
|
// The callee may modify or update the transaction object, subject
|
162 |
|
|
// to any constraints imposed by the transaction class. The
|
163 |
|
|
// initiator may re-use a transaction object from one call to
|
164 |
|
|
// the next and across calls to b_transport().
|
165 |
|
|
//
|
166 |
|
|
// The call to b_transport shall mark the first timing point of the
|
167 |
|
|
// transaction. The return from b_transport shall mark the final
|
168 |
|
|
// timing point of the transaction. The timing annotation argument
|
169 |
|
|
// allows the timing points to be offset from the simulation times
|
170 |
|
|
// at which the task call and return are executed.
|
171 |
|
|
|
172 |
|
|
virtual task b_transport(T t, uvm_tlm_time delay);
|
173 |
|
|
`uvm_error("b_transport", `UVM_TLM_TASK_ERROR)
|
174 |
|
|
endtask
|
175 |
|
|
|
176 |
|
|
endclass
|
177 |
|
|
|