1 |
2 |
acastong |
//ResponsePacket.h
|
2 |
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
3 |
|
|
* Version: MPL 1.1
|
4 |
|
|
*
|
5 |
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
6 |
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
7 |
|
|
* the License. You may obtain a copy of the License at
|
8 |
|
|
* http://www.mozilla.org/MPL/
|
9 |
|
|
*
|
10 |
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
11 |
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
12 |
|
|
* for the specific language governing rights and limitations under the
|
13 |
|
|
* License.
|
14 |
|
|
*
|
15 |
|
|
* The Original Code is HyperTransport Tunnel IP Core.
|
16 |
|
|
*
|
17 |
|
|
* The Initial Developer of the Original Code is
|
18 |
|
|
* Ecole Polytechnique de Montreal.
|
19 |
|
|
* Portions created by the Initial Developer are Copyright (C) 2005
|
20 |
|
|
* the Initial Developer. All Rights Reserved.
|
21 |
|
|
*
|
22 |
|
|
* Contributor(s):
|
23 |
|
|
* Ami Castonguay <acastong@grm.polymtl.ca>
|
24 |
|
|
*
|
25 |
|
|
* Alternatively, the contents of this file may be used under the terms
|
26 |
|
|
* of the Polytechnique HyperTransport Tunnel IP Core Source Code License
|
27 |
|
|
* (the "PHTICSCL License", see the file PHTICSCL.txt), in which case the
|
28 |
|
|
* provisions of PHTICSCL License are applicable instead of those
|
29 |
|
|
* above. If you wish to allow use of your version of this file only
|
30 |
|
|
* under the terms of the PHTICSCL License and not to allow others to use
|
31 |
|
|
* your version of this file under the MPL, indicate your decision by
|
32 |
|
|
* deleting the provisions above and replace them with the notice and
|
33 |
|
|
* other provisions required by the PHTICSCL License. If you do not delete
|
34 |
|
|
* the provisions above, a recipient may use your version of this file
|
35 |
|
|
* under either the MPL or the PHTICSCL License."
|
36 |
|
|
*
|
37 |
|
|
* ***** END LICENSE BLOCK ***** */
|
38 |
|
|
|
39 |
|
|
#ifndef ResponsePacket_H
|
40 |
|
|
#define ResponsePacket_H
|
41 |
|
|
|
42 |
|
|
#ifndef SC_USER_DEFINED_MAX_NUMBER_OF_PROCESSES
|
43 |
|
|
#define SC_USER_DEFINED_MAX_NUMBER_OF_PROCESSES
|
44 |
|
|
#define SC_VC6_MAX_NUMBER_OF_PROCESSES 20
|
45 |
|
|
#endif
|
46 |
|
|
#include <systemc.h>
|
47 |
|
|
|
48 |
|
|
#include "ControlPacket.h"
|
49 |
|
|
|
50 |
|
|
///Response packets
|
51 |
|
|
/**
|
52 |
|
|
A packet of type response is issued to respond to a request packet
|
53 |
|
|
*/
|
54 |
|
|
class ResponsePacket: public ControlPacket{
|
55 |
|
|
|
56 |
|
|
public:
|
57 |
|
|
|
58 |
|
|
///Constructor with a 32 bit vector
|
59 |
|
|
/**
|
60 |
|
|
@param dWord The least significant 32 bits that represents packet
|
61 |
|
|
*/
|
62 |
|
|
ResponsePacket(const sc_bv<32> &dWord) : ControlPacket(dWord){}
|
63 |
|
|
|
64 |
|
|
///Constructor with a 64 bit vector
|
65 |
|
|
/**
|
66 |
|
|
@param qWord The 64 bits that represents packet
|
67 |
|
|
*/
|
68 |
|
|
ResponsePacket(const sc_bv<64> &qWord) : ControlPacket(qWord){}
|
69 |
|
|
|
70 |
|
|
///Constructor with specific parameters for responses
|
71 |
|
|
/**
|
72 |
|
|
This allows to construct a packet with parameters that are generic
|
73 |
|
|
to all response packets
|
74 |
|
|
|
75 |
|
|
@param command The command of the packet, defines the exact type of the
|
76 |
|
|
packet.
|
77 |
|
|
@param unitID unitID of the device that sent the response
|
78 |
|
|
@param srcTag srcTag allows to track non-posted packets. When a non-posted packet
|
79 |
|
|
is sent with a srcTag, another non-posted packet with that same
|
80 |
|
|
srcTag cannot be sent before a response is received for the original
|
81 |
|
|
request. This is the srcTag of the request paquet that this
|
82 |
|
|
response packet is responding to
|
83 |
|
|
@param rqUID When bridge == 0, this is the last two bits of the unitID of the device
|
84 |
|
|
that sent the request this response is responding to
|
85 |
|
|
@param bridge If this packet comes from the host or a bridge
|
86 |
|
|
@param error Error returned in the packet
|
87 |
|
|
@param passPW If this packet can pass posted writes (increased priority)
|
88 |
|
|
@param isoc This bit either represents if the packet travels in isoc channels
|
89 |
|
|
(increased priority)
|
90 |
|
|
*/
|
91 |
|
|
ResponsePacket(const sc_bv<6> &command,
|
92 |
|
|
const sc_bv<5> &unitID,
|
93 |
|
|
const sc_bv<5> &srcTag,
|
94 |
|
|
const sc_bv<2> &rqUID,
|
95 |
|
|
bool bridge,
|
96 |
|
|
ResponseError error = RE_NORMAL,
|
97 |
|
|
bool passPW = 0,
|
98 |
|
|
bool isoc = 0);
|
99 |
|
|
|
100 |
|
|
///If the packet type is 32 bits
|
101 |
|
|
/**
|
102 |
|
|
All response packets are 32 bits
|
103 |
|
|
|
104 |
|
|
@return true
|
105 |
|
|
*/
|
106 |
|
|
virtual bool isDwordPacket() const {return true;}
|
107 |
|
|
|
108 |
|
|
/**
|
109 |
|
|
@return unitID of the device that sent the response
|
110 |
|
|
*/
|
111 |
|
|
sc_bv<5> getUnitID() const;
|
112 |
|
|
|
113 |
|
|
virtual bool hasDataAssociated() const;
|
114 |
|
|
|
115 |
|
|
///If packet part of chain
|
116 |
|
|
/**
|
117 |
|
|
@return false
|
118 |
|
|
*/
|
119 |
|
|
virtual bool isChain() const {return false;}
|
120 |
|
|
|
121 |
9 |
acastong |
///Get the SrcTag of the response
|
122 |
|
|
/**
|
123 |
|
|
@return SrcTag of the response
|
124 |
|
|
*/
|
125 |
|
|
virtual sc_uint<5> getSrcTag() const {return (sc_bv<5>)bv.range(20,16);}
|
126 |
|
|
|
127 |
2 |
acastong |
///Get the <code>VirtualChannel</code> of the packet
|
128 |
|
|
/**
|
129 |
|
|
To get the virtual channel of this packet
|
130 |
|
|
Packet can travel in different channels depending on their function
|
131 |
|
|
and of their attributes. Responses always travel in the Response
|
132 |
|
|
virtual channel
|
133 |
|
|
|
134 |
|
|
@return The VirtualChannel VC_RESPONSE
|
135 |
|
|
*/
|
136 |
|
|
virtual VirtualChannel getVirtualChannel() const {return VC_RESPONSE;}
|
137 |
|
|
|
138 |
|
|
///Get the type of this packet
|
139 |
|
|
/**
|
140 |
|
|
@return The RESPONSE PacketType
|
141 |
|
|
*/
|
142 |
|
|
virtual PacketType getPacketType() const {return RESPONSE;}
|
143 |
|
|
|
144 |
|
|
virtual PacketCommand getPacketCommand() const = 0;
|
145 |
|
|
|
146 |
|
|
virtual sc_uint<4> getDataLengthm1() const;
|
147 |
|
|
|
148 |
|
|
virtual ControlPacket* getCopy() const = 0;
|
149 |
|
|
|
150 |
|
|
virtual bool getPassPW() const;
|
151 |
|
|
|
152 |
|
|
/**
|
153 |
|
|
@return The error contained in the packet
|
154 |
|
|
*/
|
155 |
|
|
ResponseError getResponseError() const;
|
156 |
|
|
};
|
157 |
|
|
|
158 |
|
|
|
159 |
|
|
///ReadResponse response packet
|
160 |
|
|
/**
|
161 |
|
|
The ReadResponsePacket is sent in response to a read request.
|
162 |
|
|
*/
|
163 |
|
|
class ReadResponsePacket: public ResponsePacket{
|
164 |
|
|
|
165 |
|
|
public:
|
166 |
|
|
|
167 |
|
|
///Constructor with a 32 bit vector
|
168 |
|
|
/**
|
169 |
|
|
@param dWord The least significant 32 bits that represents packet
|
170 |
|
|
*/
|
171 |
|
|
ReadResponsePacket(const sc_bv<32> &dWord) : ResponsePacket(dWord){}
|
172 |
|
|
|
173 |
|
|
///Constructor with a 64 bit vector
|
174 |
|
|
/**
|
175 |
|
|
@param qWord The 64 bits that represents packet
|
176 |
|
|
*/
|
177 |
|
|
ReadResponsePacket(const sc_bv<64> &qWord) : ResponsePacket(qWord){}
|
178 |
|
|
|
179 |
|
|
///Constructor with specific parameters for responses
|
180 |
|
|
/**
|
181 |
|
|
This allows to construct a packet with parameters that are generic
|
182 |
|
|
to all response packets
|
183 |
|
|
|
184 |
|
|
@param unitID unitID of the device that sent the response
|
185 |
|
|
@param srcTag srcTag allows to track non-posted packets. When a non-posted packet
|
186 |
|
|
is sent with a srcTag, another non-posted packet with that same
|
187 |
|
|
srcTag cannot be sent before a response is received for the original
|
188 |
|
|
request. This is the srcTag of the request paquet that this
|
189 |
|
|
response packet is responding to
|
190 |
|
|
@param rqUID When bridge == 0, this is the last two bits of the unitID of the device
|
191 |
|
|
that sent the request this response is responding to
|
192 |
|
|
@param count The count of dwords being sent in the data packet associated to this
|
193 |
|
|
ReadResponsePacket
|
194 |
|
|
@param bridge If this packet comes from the host or a bridge
|
195 |
|
|
@param error Error returned in the packet
|
196 |
|
|
@param passPW If this packet can pass posted writes (increased priority)
|
197 |
|
|
@param isoc This bit either represents if the packet travels in isoc channels
|
198 |
|
|
(increased priority)
|
199 |
|
|
*/
|
200 |
|
|
ReadResponsePacket(const sc_bv<5> &unitID,
|
201 |
|
|
const sc_bv<5> &srcTag,
|
202 |
|
|
const sc_bv<2> &rqUID,
|
203 |
|
|
const sc_bv<4> &count,
|
204 |
|
|
bool bridge,
|
205 |
|
|
ResponseError error = RE_NORMAL,
|
206 |
|
|
bool passPW = 0,
|
207 |
|
|
bool isoc = 0) :
|
208 |
|
|
ResponsePacket(sc_bv<6>("110000"),
|
209 |
|
|
unitID,
|
210 |
|
|
srcTag,
|
211 |
|
|
rqUID,
|
212 |
|
|
bridge,
|
213 |
|
|
error,
|
214 |
|
|
passPW,
|
215 |
|
|
isoc)
|
216 |
|
|
{
|
217 |
|
|
bv.range(25,22) = count;
|
218 |
|
|
}
|
219 |
|
|
|
220 |
|
|
///To get the command of the packet
|
221 |
|
|
/**
|
222 |
|
|
@return RD_RESPONSE
|
223 |
|
|
*/
|
224 |
|
|
virtual PacketCommand getPacketCommand() const{return RD_RESPONSE;}
|
225 |
|
|
|
226 |
|
|
ControlPacket* getCopy() const{
|
227 |
|
|
return new ReadResponsePacket(bv);
|
228 |
|
|
}
|
229 |
|
|
|
230 |
|
|
};
|
231 |
|
|
|
232 |
|
|
///TargetDone response packet
|
233 |
|
|
/**
|
234 |
|
|
TargetDonePacket is sent to say that something has been completed.
|
235 |
|
|
For example it can be a non-posted write or a flush request.
|
236 |
|
|
*/
|
237 |
|
|
class TargetDonePacket: public ResponsePacket{
|
238 |
|
|
|
239 |
|
|
public:
|
240 |
|
|
|
241 |
|
|
///Constructor with a 32 bit vector
|
242 |
|
|
/**
|
243 |
|
|
@param dWord The least significant 32 bits that represents packet
|
244 |
|
|
*/
|
245 |
|
|
TargetDonePacket(const sc_bv<32> &dWord) : ResponsePacket(dWord){}
|
246 |
|
|
|
247 |
|
|
///Constructor with a 64 bit vector
|
248 |
|
|
/**
|
249 |
|
|
@param qWord The 64 bits that represents packet
|
250 |
|
|
*/
|
251 |
|
|
TargetDonePacket(const sc_bv<64> &qWord) : ResponsePacket(qWord){}
|
252 |
|
|
|
253 |
|
|
///Constructor with specific parameters for responses
|
254 |
|
|
/**
|
255 |
|
|
This allows to construct a packet with parameters that are generic
|
256 |
|
|
to all response packets
|
257 |
|
|
|
258 |
|
|
@param unitID unitID of the device that sent the response
|
259 |
|
|
@param srcTag srcTag allows to track non-posted packets. When a non-posted packet
|
260 |
|
|
is sent with a srcTag, another non-posted packet with that same
|
261 |
|
|
srcTag cannot be sent before a response is received for the original
|
262 |
|
|
request. This is the srcTag of the request paquet that this
|
263 |
|
|
response packet is responding to
|
264 |
|
|
@param rqUID When bridge == 0, this is the last two bits of the unitID of the device
|
265 |
|
|
that sent the request this response is responding to
|
266 |
|
|
@param bridge If this packet comes from the host or a bridge
|
267 |
|
|
@param error Error returned in the packet
|
268 |
|
|
@param passPW If this packet can pass posted writes (increased priority)
|
269 |
|
|
@param isoc This bit either represents if the packet travels in isoc channels
|
270 |
|
|
(increased priority)
|
271 |
|
|
*/
|
272 |
|
|
TargetDonePacket(const sc_bv<5> &unitID,
|
273 |
|
|
const sc_bv<5> &srcTag,
|
274 |
|
|
const sc_bv<2> &rqUID,
|
275 |
|
|
bool bridge,
|
276 |
|
|
ResponseError error = RE_NORMAL,
|
277 |
|
|
bool passPW = 0,
|
278 |
|
|
bool isoc = 0) :
|
279 |
|
|
ResponsePacket(sc_bv<6>("110011"),
|
280 |
|
|
unitID,
|
281 |
|
|
srcTag,
|
282 |
|
|
rqUID,
|
283 |
|
|
bridge,
|
284 |
|
|
error,
|
285 |
|
|
passPW,
|
286 |
|
|
isoc)
|
287 |
|
|
{
|
288 |
|
|
}
|
289 |
|
|
|
290 |
|
|
///To get the command of the packet
|
291 |
|
|
/**
|
292 |
|
|
@return TGTDONE
|
293 |
|
|
*/
|
294 |
|
|
virtual PacketCommand getPacketCommand() const{return TGTDONE;}
|
295 |
|
|
|
296 |
|
|
ControlPacket* getCopy() const{
|
297 |
|
|
return new TargetDonePacket(bv);
|
298 |
|
|
}
|
299 |
|
|
|
300 |
|
|
|
301 |
|
|
};
|
302 |
|
|
|
303 |
|
|
#endif
|
304 |
|
|
|