1 |
2 |
acastong |
//RequestPacket.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 RequestPacket_H
|
40 |
|
|
#define RequestPacket_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 |
|
|
//enum VirtualChannel;
|
51 |
|
|
|
52 |
|
|
///Base class for all request packets
|
53 |
|
|
/**
|
54 |
|
|
A request packet is a packet that is used to send request to the chain.
|
55 |
|
|
The most used types of RequestPacket are read and write packets.
|
56 |
|
|
*/
|
57 |
|
|
class RequestPacket: public ControlPacket{
|
58 |
|
|
|
59 |
|
|
public:
|
60 |
|
|
|
61 |
|
|
///Constructor with a 32 bit vector
|
62 |
|
|
/**
|
63 |
|
|
@param dWord The least significant 32 bits that represents packet
|
64 |
|
|
*/
|
65 |
|
|
RequestPacket(const sc_bv<32> &dWord) : ControlPacket(dWord){}
|
66 |
|
|
|
67 |
|
|
///Constructor with a 64 bit vector
|
68 |
|
|
/**
|
69 |
|
|
@param qWord The 64 bits that represents packet
|
70 |
|
|
*/
|
71 |
|
|
RequestPacket(const sc_bv<64> &qWord) : ControlPacket(qWord){}
|
72 |
|
|
|
73 |
|
|
///Constructor with specific parameters
|
74 |
|
|
/**
|
75 |
|
|
This allows to construct a packet with parameters that are generic
|
76 |
|
|
to all request packets
|
77 |
|
|
|
78 |
|
|
@param command The command of the packet, defines the exact type of the
|
79 |
|
|
packet.
|
80 |
|
|
@param seqID The sequence ID of the packet. Packets which have the same
|
81 |
|
|
sequenceID and the same unitID are garantied to stay ordered
|
82 |
|
|
@param unitID unitID of the device that sent the request
|
83 |
|
|
@param passPW If this packet can pass posted writes (increased priority)
|
84 |
|
|
@param isocOrCompat Depending on the packet type, this bit either represents if
|
85 |
|
|
the packet travels in isoc channels (increased priority) or if
|
86 |
|
|
the packet has to be read by the substractive decode device
|
87 |
|
|
@param srcTag srcTag allows to track non-posted packets. When a non-posted packet
|
88 |
|
|
is sent with a srcTag, another non-posted packet with that same
|
89 |
|
|
srcTag cannot be sent before a response is received for the original
|
90 |
|
|
request. When a request is posted, bit 4 represents DataError and bit
|
91 |
|
|
3 Chain if the request is part of a Chain.
|
92 |
|
|
@param count The count of data for packets that send Dword data packets, a mask for
|
93 |
|
|
packets sending Byte data packets and reserved for other packets
|
94 |
|
|
@param address The destination addresse of this packet
|
95 |
|
|
*/
|
96 |
|
|
RequestPacket(const sc_bv<6> &command,
|
97 |
|
|
const sc_bv<4> &seqID,
|
98 |
|
|
const sc_bv<5> &unitID,
|
99 |
|
|
bool passPW = false,
|
100 |
|
|
bool isocOrCompat = false,
|
101 |
|
|
sc_bv<5> srcTag = sc_bv<5>(),
|
102 |
|
|
sc_bv<4> count = sc_bv<4>(),
|
103 |
|
|
sc_bv<38> address = sc_bv<38>());
|
104 |
|
|
|
105 |
|
|
///If the packet type is 32 bits
|
106 |
|
|
/**
|
107 |
|
|
To know if the packet type is 32 bits.
|
108 |
|
|
|
109 |
|
|
@return True if the packet is of a type that is 32 bits (dword)
|
110 |
|
|
or false otherwise.
|
111 |
|
|
*/
|
112 |
|
|
virtual bool isDwordPacket() const;
|
113 |
|
|
|
114 |
|
|
///Packet has data associated
|
115 |
|
|
/**
|
116 |
|
|
To know if there is a data packet associated with this control
|
117 |
|
|
packet
|
118 |
|
|
|
119 |
|
|
@return If the packet has data associated
|
120 |
|
|
*/
|
121 |
|
|
virtual bool hasDataAssociated() const;
|
122 |
|
|
|
123 |
|
|
///Get the <code>VirtualChannel</code> of the packet
|
124 |
|
|
/**
|
125 |
|
|
To get the virtual channel of this packet
|
126 |
|
|
Packet can travel in different channels depending on their function
|
127 |
|
|
and of their attributes.
|
128 |
|
|
|
129 |
|
|
@return The VirtualChannel associated to the command
|
130 |
|
|
*/
|
131 |
|
|
virtual VirtualChannel getVirtualChannel() const;
|
132 |
|
|
|
133 |
|
|
///Get the type of this packet
|
134 |
|
|
/**
|
135 |
|
|
RequestPacket objects are always of type REQUEST
|
136 |
|
|
|
137 |
|
|
@return The REQUEST PacketType
|
138 |
|
|
*/
|
139 |
|
|
virtual PacketType getPacketType() const {return REQUEST;}
|
140 |
|
|
|
141 |
|
|
/**
|
142 |
|
|
To know if the this packet is in this range of addresses
|
143 |
|
|
|
144 |
|
|
@param low Character string that can be converted to a 40 bits vector
|
145 |
|
|
that represents the low value of the address range
|
146 |
|
|
@param high Character string that can be converted to a 40 bits vector
|
147 |
|
|
that represents the high value of the address range
|
148 |
|
|
@return If the address of the packet is between high and low
|
149 |
|
|
*/
|
150 |
|
|
bool isInAddressRange(const char * low,const char * high) const;
|
151 |
|
|
|
152 |
|
|
/**
|
153 |
|
|
To know if the this packet is in this range of addresses
|
154 |
|
|
|
155 |
|
|
@param low 40 bits vector that represents the low value of the address range
|
156 |
|
|
@param high 40 bits vector that represents the high value of the address range
|
157 |
|
|
@return If the address of the packet is between high and low
|
158 |
|
|
*/
|
159 |
|
|
bool isInAddressRange(const sc_bv<40> &low,const sc_bv<40> &high) const;
|
160 |
|
|
|
161 |
|
|
/**
|
162 |
|
|
To know if the this packet is in this range of addresses
|
163 |
|
|
|
164 |
|
|
@param low 40 bits vector that represents the low value of the address range
|
165 |
|
|
@param high 40 bits vector that represents the high value of the address range
|
166 |
|
|
@return If the address of the packet is between high and low
|
167 |
|
|
*/
|
168 |
|
|
bool isInAddressRange(const sc_uint<40> &low,const sc_uint<40> &high) const;
|
169 |
|
|
|
170 |
|
|
/**
|
171 |
|
|
@return The adress of the destination of the packet
|
172 |
|
|
Will return an address of 0 if the packet does not have
|
173 |
|
|
an address (is a Dword packet)
|
174 |
|
|
*/
|
175 |
|
|
sc_uint<40> getRequestAddr() const;
|
176 |
|
|
|
177 |
|
|
///Get the length-1 of the data associated
|
178 |
|
|
/**
|
179 |
|
|
Gets the number of doublewords of data associated with this ctl packet
|
180 |
|
|
minus 1. So a returned number of 0 represents 1 doubleWord.
|
181 |
|
|
If there is no data associated, the result is undefined.
|
182 |
|
|
The number returned also includes the doubleword mask in a byte write
|
183 |
|
|
|
184 |
|
|
@return Length-1 of data associated with the packet, or undefined
|
185 |
|
|
if the packet has no data associated
|
186 |
|
|
*/
|
187 |
|
|
sc_uint<4> getDataLengthm1() const;
|
188 |
|
|
|
189 |
|
|
///Get a copy of this object
|
190 |
|
|
/**
|
191 |
|
|
To get a new object which is identical to this packet
|
192 |
|
|
|
193 |
|
|
@return A packet of the same derived type with the same
|
194 |
|
|
internal vector
|
195 |
|
|
*/
|
196 |
|
|
virtual ControlPacket* getCopy() const = 0;
|
197 |
|
|
|
198 |
|
|
/**
|
199 |
|
|
@return The sequence ID of the packet. Packets which have the same
|
200 |
|
|
sequenceID and the same unitID are garantied to stay ordered
|
201 |
|
|
*/
|
202 |
|
|
sc_bv<4> getSeqID() const;
|
203 |
|
|
|
204 |
|
|
/**
|
205 |
|
|
@return If this packet can pass posted writes (increased priority)
|
206 |
|
|
*/
|
207 |
|
|
virtual bool getPassPW() const;
|
208 |
|
|
|
209 |
|
|
/**
|
210 |
|
|
@return unitID of the device that sent the request
|
211 |
|
|
*/
|
212 |
|
|
sc_bv<5> getUnitID() const;
|
213 |
|
|
|
214 |
|
|
/**
|
215 |
|
|
srcTag allows to track non-posted packets. When a non-posted packet
|
216 |
|
|
is sent with a srcTag, another non-posted packet with that same
|
217 |
|
|
srcTag cannot be sent before a response is received for the original
|
218 |
|
|
request. When a request is posted, bit 4 represents DataError and bit
|
219 |
|
|
3 Chain if the request is part of a Chain.
|
220 |
|
|
|
221 |
|
|
@return The srcTag of this packet
|
222 |
|
|
*/
|
223 |
|
|
sc_bv<5> getSrcTag() const;
|
224 |
|
|
|
225 |
|
|
/**
|
226 |
|
|
@return Depending on the packet type, this bit either represents if
|
227 |
|
|
the packet travels in isoc channels (increased priority) or if
|
228 |
|
|
the packet has to be read by the substractive decode device
|
229 |
|
|
*/
|
230 |
|
|
bool getCompatOrIsoc() const;
|
231 |
|
|
|
232 |
|
|
/**
|
233 |
|
|
@return If this packet is part of a Chain
|
234 |
|
|
*/
|
235 |
|
|
virtual bool isChain() const;
|
236 |
|
|
|
237 |
|
|
};
|
238 |
|
|
|
239 |
|
|
|
240 |
|
|
|
241 |
|
|
///Flush request packet
|
242 |
|
|
/**
|
243 |
|
|
Since a flush packet has passPW false and is posted, it cannot pass other packets.
|
244 |
|
|
When it reaches the host (or it's destination in DirecRoute), it surely
|
245 |
|
|
means that all other posted packets that was sent prior to the flush has also
|
246 |
|
|
reached destination. A response is then sent by the destination.
|
247 |
|
|
|
248 |
|
|
It is a way to assure that all packets sent have reached it's first
|
249 |
|
|
destination. In the case of a host reflected destination, the flush only
|
250 |
|
|
garanties that all the packets have reached the host.
|
251 |
|
|
*/
|
252 |
|
|
class FlushPacket: public RequestPacket{
|
253 |
|
|
|
254 |
|
|
public :
|
255 |
|
|
|
256 |
|
|
///Constructor with a 32 bit vector
|
257 |
|
|
/**
|
258 |
|
|
@param dWord The least significant 32 bits that represents packet
|
259 |
|
|
*/
|
260 |
|
|
FlushPacket(const sc_bv<32> &dWord) : RequestPacket(dWord){}
|
261 |
|
|
|
262 |
|
|
///Constructor with a 64 bit vector
|
263 |
|
|
/**
|
264 |
|
|
@param qWord The 64 bits that represents packet
|
265 |
|
|
*/
|
266 |
|
|
FlushPacket(const sc_bv<64> &qWord) : RequestPacket(qWord){}
|
267 |
|
|
|
268 |
|
|
///Constructor with specific parameters
|
269 |
|
|
/**
|
270 |
|
|
This allows to construct a packet with parameters that are specific to the
|
271 |
|
|
Flush packet
|
272 |
|
|
|
273 |
|
|
@param seqID The sequence ID of the packet. Packets which have the same
|
274 |
|
|
sequenceID and the same unitID are garantied to stay ordered
|
275 |
|
|
@param unitID unitID of the device that sent the request
|
276 |
|
|
@param passPW If this packet can pass posted writes (increased priority)
|
277 |
|
|
@param isoc If the packet should travel in isochronous channels
|
278 |
|
|
@param srcTag srcTag allows to track non-posted packets. Another non-posted
|
279 |
|
|
packet with that same srcTag cannot be sent before a response is
|
280 |
|
|
received for the original request.
|
281 |
|
|
*/
|
282 |
|
|
FlushPacket(const sc_bv<4> &seqID,
|
283 |
|
|
const sc_bv<5> &unitID,
|
284 |
|
|
bool passPW = false,
|
285 |
|
|
bool isoc = false,
|
286 |
|
|
sc_bv<5> srcTag = sc_bv<5>()) :
|
287 |
|
|
RequestPacket(sc_bv<6>("000010"),
|
288 |
|
|
seqID,
|
289 |
|
|
unitID,
|
290 |
|
|
passPW,
|
291 |
|
|
isoc,
|
292 |
|
|
srcTag){};
|
293 |
|
|
|
294 |
|
|
virtual PacketCommand getPacketCommand() const{return FLUSH;}
|
295 |
|
|
|
296 |
|
|
virtual ControlPacket* getCopy() const{
|
297 |
|
|
return new FlushPacket(bv);
|
298 |
|
|
}
|
299 |
|
|
};
|
300 |
|
|
|
301 |
|
|
|
302 |
|
|
///Fence request packet
|
303 |
|
|
/**
|
304 |
|
|
A Fence packet is a way to make a barrier between two groups of
|
305 |
|
|
posted packets that have passPW clear. Normally, two posted packets
|
306 |
|
|
from the same source with passPW clear can not pass each other. But
|
307 |
|
|
if two posted packets with passPW clear are from different sources,
|
308 |
|
|
nothing garanties that they will stay ordered.
|
309 |
|
|
|
310 |
|
|
The only way to make sure that posted packets with passPW clrea from
|
311 |
|
|
different sources stay ordered is with a Fence packet since no posted
|
312 |
|
|
packet with passPW clear can pass it.
|
313 |
|
|
*/
|
314 |
|
|
class FencePacket: public RequestPacket{
|
315 |
|
|
|
316 |
|
|
public :
|
317 |
|
|
|
318 |
|
|
///Constructor with a 32 bit vector
|
319 |
|
|
/**
|
320 |
|
|
@param dWord The least significant 32 bits that represents packet
|
321 |
|
|
*/
|
322 |
|
|
FencePacket(const sc_bv<32> &dWord) : RequestPacket(dWord){}
|
323 |
|
|
|
324 |
|
|
///Constructor with a 64 bit vector
|
325 |
|
|
/**
|
326 |
|
|
@param qWord The 64 bits that represents packet
|
327 |
|
|
*/
|
328 |
|
|
FencePacket(const sc_bv<64> &qWord) : RequestPacket(qWord){}
|
329 |
|
|
|
330 |
|
|
|
331 |
|
|
///Constructor with specific parameters
|
332 |
|
|
/**
|
333 |
|
|
This allows to construct a packet with parameters that are specific to the
|
334 |
|
|
Fence packet
|
335 |
|
|
|
336 |
|
|
@param seqID The sequence ID of the packet. Packets which have the same
|
337 |
|
|
sequenceID and the same unitID are garantied to stay ordered
|
338 |
|
|
@param unitID unitID of the device that sent the request
|
339 |
|
|
@param passPW If this packet can pass posted writes (increased priority)
|
340 |
|
|
@param isoc If the packet should travel in isochronous channels
|
341 |
|
|
*/
|
342 |
|
|
FencePacket( const sc_bv<4> &seqID,
|
343 |
|
|
const sc_bv<5> &unitID,
|
344 |
|
|
bool passPW = false,
|
345 |
|
|
bool isoc = false) :
|
346 |
|
|
RequestPacket(sc_bv<6>("111100"),
|
347 |
|
|
seqID,
|
348 |
|
|
unitID,
|
349 |
|
|
passPW,
|
350 |
|
|
isoc){}
|
351 |
|
|
|
352 |
|
|
virtual PacketCommand getPacketCommand() const{return FENCE;}
|
353 |
|
|
|
354 |
|
|
virtual ControlPacket* getCopy() const{
|
355 |
|
|
return new FencePacket(bv);
|
356 |
|
|
}
|
357 |
|
|
};
|
358 |
|
|
|
359 |
|
|
///Read request packet
|
360 |
|
|
/**
|
361 |
|
|
A ReadPacket is a request to read data. A responsePacket that contains
|
362 |
|
|
the data that is at the requested address will be issued upon reception
|
363 |
|
|
of the read packet by the destination, unless an error occurs.
|
364 |
|
|
*/
|
365 |
|
|
class ReadPacket: public RequestPacket{
|
366 |
|
|
|
367 |
|
|
public :
|
368 |
|
|
|
369 |
|
|
///Constructor with a 32 bit vector
|
370 |
|
|
/**
|
371 |
|
|
@param dWord The least significant 32 bits that represents packet
|
372 |
|
|
*/
|
373 |
|
|
ReadPacket(const sc_bv<32> &dWord) : RequestPacket(dWord){}
|
374 |
|
|
|
375 |
|
|
///Constructor with a 64 bit vector
|
376 |
|
|
/**
|
377 |
|
|
@param qWord The 64 bits that represents packet
|
378 |
|
|
*/
|
379 |
|
|
ReadPacket(const sc_bv<64> &qWord) : RequestPacket(qWord){}
|
380 |
|
|
|
381 |
|
|
///Constructor with specific parameters
|
382 |
|
|
/**
|
383 |
|
|
This allows to construct a packet with parameters that are specific to
|
384 |
|
|
Read packets
|
385 |
|
|
|
386 |
|
|
@param seqID The sequence ID of the packet. Packets which have the same
|
387 |
|
|
sequenceID and the same unitID are garantied to stay ordered
|
388 |
|
|
@param unitID unitID of the device that sent the request
|
389 |
|
|
@param passPW If this packet can pass posted writes (increased priority)
|
390 |
|
|
@param srcTag srcTag allows to track non-posted packets. When a non-posted packet
|
391 |
|
|
is sent with a srcTag, another non-posted packet with that same
|
392 |
|
|
srcTag cannot be sent before a response is received for the original
|
393 |
|
|
request.
|
394 |
|
|
@param maskCount The count of data for packets that send Dword data packets, a mask for
|
395 |
|
|
packets sending Byte data packets
|
396 |
|
|
@param address The destination addresse of this packet
|
397 |
|
|
@param doubleWordDataLength True if it is a dword read of false if it is a Byte read
|
398 |
|
|
@param responsePassPW If the response to this request should have passPW=1
|
399 |
|
|
@param memoryCoherent Indicates whether access requires host cache coherence (reserved and
|
400 |
|
|
set if access is not to host memory)
|
401 |
|
|
@param compat If the packet should be received by the compatibility decoder
|
402 |
|
|
@param isoc If the packet should travel in isochronous channels
|
403 |
|
|
*/
|
404 |
|
|
ReadPacket( const sc_bv<4> &seqID,
|
405 |
|
|
const sc_bv<5> &unitID,
|
406 |
|
|
const sc_bv<5> srcTag,
|
407 |
|
|
const sc_bv<4> maskCount,
|
408 |
|
|
const sc_bv<38> address,
|
409 |
|
|
bool doubleWordDataLength,
|
410 |
|
|
bool passPW = false,
|
411 |
|
|
bool responsePassPW = false,
|
412 |
|
|
bool memoryCoherent = true,
|
413 |
|
|
bool compat = false,
|
414 |
|
|
bool isoc = false) :
|
415 |
|
|
RequestPacket(sc_bv<6>("010000"),
|
416 |
|
|
seqID,
|
417 |
|
|
unitID,
|
418 |
|
|
passPW,
|
419 |
|
|
compat,
|
420 |
|
|
srcTag,
|
421 |
|
|
maskCount,
|
422 |
|
|
address)
|
423 |
|
|
{
|
424 |
|
|
bv[0] = memoryCoherent;
|
425 |
|
|
bv[1] = isoc;
|
426 |
|
|
bv[2] = doubleWordDataLength;
|
427 |
|
|
bv[3] = responsePassPW;
|
428 |
|
|
}
|
429 |
|
|
|
430 |
|
|
virtual PacketCommand getPacketCommand() const{return READ;}
|
431 |
|
|
|
432 |
|
|
virtual ControlPacket* getCopy() const{
|
433 |
|
|
return new ReadPacket(bv);
|
434 |
|
|
}
|
435 |
|
|
|
436 |
|
|
inline bool isDoubleWordDataLength() const{
|
437 |
|
|
return (sc_bit)(bv[2]);
|
438 |
|
|
}
|
439 |
|
|
|
440 |
|
|
inline bool isIsoc() const{
|
441 |
|
|
return (sc_bit)(bv[1]);
|
442 |
|
|
}
|
443 |
|
|
|
444 |
|
|
};
|
445 |
|
|
|
446 |
|
|
|
447 |
|
|
///Write request packet
|
448 |
|
|
/**
|
449 |
|
|
A WritePacket enable to send a request with data to write
|
450 |
|
|
at a specific address. It can either be posted or non-posted.
|
451 |
|
|
In the non-posted case, a TargetDone response will be issued by
|
452 |
|
|
the destination of the packet once the write has been done.
|
453 |
|
|
*/
|
454 |
|
|
class WritePacket: public RequestPacket{
|
455 |
|
|
|
456 |
|
|
public :
|
457 |
|
|
|
458 |
|
|
///Constructor with a 32 bit vector
|
459 |
|
|
/**
|
460 |
|
|
@param dWord The least significant 32 bits that represents packet
|
461 |
|
|
*/
|
462 |
|
|
WritePacket(const sc_bv<32> &dWord) : RequestPacket(dWord){}
|
463 |
|
|
|
464 |
|
|
///Constructor with a 64 bit vector
|
465 |
|
|
/**
|
466 |
|
|
@param qWord The 64 bits that represents packet
|
467 |
|
|
*/
|
468 |
|
|
WritePacket(const sc_bv<64> &qWord) : RequestPacket(qWord){}
|
469 |
|
|
|
470 |
|
|
|
471 |
|
|
///Constructor with specific parameters for posted writes
|
472 |
|
|
/**
|
473 |
|
|
This allows to construct a packet with parameters that are specific to
|
474 |
|
|
posted Write packets
|
475 |
|
|
|
476 |
|
|
@param seqID The sequence ID of the packet. Packets which have the same
|
477 |
|
|
sequenceID and the same unitID are garantied to stay ordered
|
478 |
|
|
@param unitID unitID of the device that sent the request
|
479 |
|
|
@param passPW If this packet can pass posted writes (increased priority)
|
480 |
|
|
@param count The count of data for packets, including the byte mask in the case
|
481 |
|
|
of a byte write.
|
482 |
|
|
@param address The destination addresse of this packet
|
483 |
|
|
@param doubleWordDataLength True if it is a dword read of false if it is a Byte read.
|
484 |
|
|
<br><i>Special note</i> : This is an int instead of a bool because there is no implicit
|
485 |
|
|
cast from const char * to an int, while there is one for a bool. If someone
|
486 |
|
|
was to create a WritePacket with data from strings instead of sc_bv, the
|
487 |
|
|
compiler can end up using the wrong constructor. Using the int prevents this.
|
488 |
|
|
@param memoryCoherent Indicates whether access requires host cache coherence (reserved and
|
489 |
|
|
set if acces is not to host memory)
|
490 |
|
|
@param compat If the packet should be received by the compatibility decoder
|
491 |
|
|
@param isoc If the packet should travel in isochronous channels
|
492 |
|
|
@param dataError If a data error occured while forwarding the request
|
493 |
|
|
@param chain If the packet is par of a chain
|
494 |
|
|
*/
|
495 |
|
|
WritePacket( const sc_bv<4> &seqID,
|
496 |
|
|
const sc_bv<5> &unitID,
|
497 |
|
|
const sc_bv<4> &count,
|
498 |
|
|
const sc_bv<38> &address,
|
499 |
|
|
bool doubleWordDataLength,
|
500 |
|
|
bool passPW = false,
|
501 |
|
|
bool dataError = false,
|
502 |
|
|
bool chain = false,
|
503 |
|
|
bool memoryCoherent = true,
|
504 |
|
|
bool compat = false,
|
505 |
|
|
bool isoc = false) :
|
506 |
|
|
RequestPacket(sc_bv<6>("101000"),
|
507 |
|
|
seqID,
|
508 |
|
|
unitID,
|
509 |
|
|
passPW,
|
510 |
|
|
compat,
|
511 |
|
|
sc_bv<5>(),
|
512 |
|
|
count,
|
513 |
|
|
address)
|
514 |
|
|
{
|
515 |
|
|
bv[0] = memoryCoherent;
|
516 |
|
|
bv[1] = isoc;
|
517 |
|
|
bv[2] = doubleWordDataLength;
|
518 |
|
|
bv[20] = dataError;
|
519 |
|
|
bv[19] = chain;
|
520 |
|
|
}
|
521 |
|
|
|
522 |
|
|
|
523 |
|
|
///Constructor with specific parameters for non-posted writes
|
524 |
|
|
/**
|
525 |
|
|
This allows to construct a packet with parameters that are specific to
|
526 |
|
|
posted Write packets
|
527 |
|
|
|
528 |
|
|
@param seqID The sequence ID of the packet. Packets which have the same
|
529 |
|
|
sequenceID and the same unitID are garantied to stay ordered
|
530 |
|
|
@param unitID unitID of the device that sent the request
|
531 |
|
|
@param srcTag srcTag allows to track non-posted packets. When a non-posted packet
|
532 |
|
|
is sent with a srcTag, another non-posted packet with that same
|
533 |
|
|
srcTag cannot be sent before a response is received for the original
|
534 |
|
|
request.
|
535 |
|
|
@param passPW If this packet can pass posted writes (increased priority)
|
536 |
|
|
@param count The count of data for packets, including the byte mask in the case
|
537 |
|
|
of a byte write.
|
538 |
|
|
@param address The destination addresse of this packet
|
539 |
|
|
@param doubleWordDataLength True if it is a dword read of false if it is a Byte read.
|
540 |
|
|
<br><i>Special note</i> : This is an int instead of a bool because there is no implicit
|
541 |
|
|
cast from const char * to an int, while there is one for a bool. If someone
|
542 |
|
|
was to create a WritePacket with data from strings instead of sc_bv, the
|
543 |
|
|
compiler can end up using the wrong constructor. Using the int prevents this.
|
544 |
|
|
@param memoryCoherent Indicates whether access requires host cache coherence (reserved and
|
545 |
|
|
set if acces is not to host memory)
|
546 |
|
|
@param compat If the packet should be received by the compatibility decoder
|
547 |
|
|
@param isoc If the packet should travel in isochronous channels
|
548 |
|
|
*/
|
549 |
|
|
WritePacket( const sc_bv<4> &seqID,
|
550 |
|
|
const sc_bv<5> &unitID,
|
551 |
|
|
const sc_bv<5> &srcTag,
|
552 |
|
|
const sc_bv<4> &count,
|
553 |
|
|
const sc_bv<38> &address,
|
554 |
|
|
bool doubleWordDataLength,
|
555 |
|
|
bool passPW = false,
|
556 |
|
|
bool memoryCoherent = true,
|
557 |
|
|
bool compat = false,
|
558 |
|
|
bool isoc = false) :
|
559 |
|
|
RequestPacket(sc_bv<6>("001000"),
|
560 |
|
|
seqID,
|
561 |
|
|
unitID,
|
562 |
|
|
passPW,
|
563 |
|
|
compat,
|
564 |
|
|
srcTag,
|
565 |
|
|
count,
|
566 |
|
|
address)
|
567 |
|
|
{
|
568 |
|
|
bv[0] = memoryCoherent;
|
569 |
|
|
bv[1] = isoc;
|
570 |
|
|
bv[2] = doubleWordDataLength;
|
571 |
|
|
}
|
572 |
|
|
|
573 |
|
|
virtual PacketCommand getPacketCommand() const{return WRITE;}
|
574 |
|
|
|
575 |
|
|
///To get if the packet had an error while being forwared
|
576 |
|
|
/**
|
577 |
|
|
@return The data error bit in posted writes. If the write
|
578 |
|
|
packet is non-posted, false is returned
|
579 |
|
|
*/
|
580 |
|
|
bool getDataError() const {
|
581 |
|
|
if(bv[5] == true) return sc_bit(bv[20]);
|
582 |
|
|
return false;
|
583 |
|
|
}
|
584 |
|
|
|
585 |
|
|
virtual ControlPacket* getCopy() const{
|
586 |
|
|
return new WritePacket(bv);
|
587 |
|
|
}
|
588 |
|
|
|
589 |
|
|
inline bool isIsoc() const{
|
590 |
|
|
return (sc_bit)(bv[1]);
|
591 |
|
|
}
|
592 |
|
|
};
|
593 |
|
|
|
594 |
|
|
///Broadcast request packet
|
595 |
|
|
/**
|
596 |
|
|
A BroadcastPacket is accepted by all devices on the chain. It contains
|
597 |
|
|
an address field but it's use is application specific.
|
598 |
|
|
*/
|
599 |
|
|
class BroadcastPacket: public RequestPacket{
|
600 |
|
|
|
601 |
|
|
public :
|
602 |
|
|
|
603 |
|
|
///Constructor with a 32 bit vector
|
604 |
|
|
/**
|
605 |
|
|
@param dWord The least significant 32 bits that represents packet
|
606 |
|
|
*/
|
607 |
|
|
BroadcastPacket(const sc_bv<32> &dWord) : RequestPacket(dWord){}
|
608 |
|
|
|
609 |
|
|
///Constructor with a 64 bit vector
|
610 |
|
|
/**
|
611 |
|
|
@param qWord The 64 bits that represents packet
|
612 |
|
|
*/
|
613 |
|
|
BroadcastPacket(const sc_bv<64> &qWord) : RequestPacket(qWord){}
|
614 |
|
|
|
615 |
|
|
///Constructor with specific parameters for broadcast packets
|
616 |
|
|
/**
|
617 |
|
|
This allows to construct a packet with parameters that are specific to
|
618 |
|
|
Broadcast packets
|
619 |
|
|
|
620 |
|
|
@param seqID The sequence ID of the packet. Packets which have the same
|
621 |
|
|
sequenceID and the same unitID are garantied to stay ordered
|
622 |
|
|
@param unitID unitID of the device that sent the request
|
623 |
|
|
@param passPW If this packet can pass posted writes (increased priority)
|
624 |
|
|
@param address The destination addresse of this packet
|
625 |
|
|
*/
|
626 |
|
|
BroadcastPacket(const sc_bv<4> &seqID,
|
627 |
|
|
const sc_bv<5> &unitID,
|
628 |
|
|
bool passPW = false,
|
629 |
|
|
sc_bv<38> address = sc_bv<38>()) :
|
630 |
|
|
RequestPacket(sc_bv<6>("111010"),
|
631 |
|
|
seqID,
|
632 |
|
|
unitID,
|
633 |
|
|
passPW,
|
634 |
|
|
false,
|
635 |
|
|
sc_bv<5>(),
|
636 |
|
|
sc_bv<4>(),
|
637 |
|
|
address){};
|
638 |
|
|
|
639 |
|
|
virtual PacketCommand getPacketCommand() const{return BROADCAST;}
|
640 |
|
|
|
641 |
|
|
virtual ControlPacket* getCopy() const{
|
642 |
|
|
return new BroadcastPacket(bv);
|
643 |
|
|
}
|
644 |
|
|
};
|
645 |
|
|
|
646 |
|
|
///Atomic request packet
|
647 |
|
|
/**
|
648 |
|
|
An AtomicPacket combines the use of write requests and read requests
|
649 |
|
|
at the same time. It is an atomic Read-Modify-Write (RMW) request. It
|
650 |
|
|
has two types of operation which is dictated by the amount of data that
|
651 |
|
|
is associated with the packet :
|
652 |
|
|
|
653 |
|
|
- Fetch and add
|
654 |
|
|
- Compare and swap
|
655 |
|
|
*/
|
656 |
|
|
class AtomicPacket: public RequestPacket{
|
657 |
|
|
|
658 |
|
|
public :
|
659 |
|
|
|
660 |
|
|
///Constructor with a 32 bit vector
|
661 |
|
|
/**
|
662 |
|
|
@param dWord The least significant 32 bits that represents packet
|
663 |
|
|
*/
|
664 |
|
|
AtomicPacket(const sc_bv<32> &dWord) : RequestPacket(dWord){}
|
665 |
|
|
|
666 |
|
|
///Constructor with a 64 bit vector
|
667 |
|
|
/**
|
668 |
|
|
@param qWord The 64 bits that represents packet
|
669 |
|
|
*/
|
670 |
|
|
AtomicPacket(const sc_bv<64> &qWord) : RequestPacket(qWord){}
|
671 |
|
|
|
672 |
|
|
///Constructor with specific parameters for atomics read-modify-write
|
673 |
|
|
/**
|
674 |
|
|
This allows to construct a packet with parameters that are specific to
|
675 |
|
|
posted Write packest
|
676 |
|
|
|
677 |
|
|
@param seqID The sequence ID of the packet. Packets which have the same
|
678 |
|
|
sequenceID and the same unitID are garantied to stay ordered
|
679 |
|
|
@param unitID unitID of the device that sent the request
|
680 |
|
|
@param srcTag srcTag allows to track non-posted packets. When a non-posted packet
|
681 |
|
|
is sent with a srcTag, another non-posted packet with that same
|
682 |
|
|
srcTag cannot be sent before a response is received for the original
|
683 |
|
|
request.
|
684 |
|
|
@param passPW If this packet can pass posted writes (increased priority)
|
685 |
|
|
@param count The count of data for packets that send Dword data packets, a mask for
|
686 |
|
|
packets sendinf Byte data packets and reserved for other packets
|
687 |
|
|
@param address The destination addresse of this packet
|
688 |
|
|
@param compat If the packet should be received by the compatibility decoder
|
689 |
|
|
*/
|
690 |
|
|
AtomicPacket( const sc_bv<4> &seqID,
|
691 |
|
|
const sc_bv<5> &unitID,
|
692 |
|
|
const sc_bv<5> srcTag,
|
693 |
|
|
const sc_bv<4> count,
|
694 |
|
|
const sc_bv<37> address,
|
695 |
|
|
bool passPW = false,
|
696 |
|
|
bool compat = false) :
|
697 |
|
|
RequestPacket(sc_bv<6>("111101"),
|
698 |
|
|
seqID,
|
699 |
|
|
unitID,
|
700 |
|
|
passPW,
|
701 |
|
|
compat,
|
702 |
|
|
srcTag,
|
703 |
|
|
count,
|
704 |
|
|
address << 1)
|
705 |
|
|
{
|
706 |
|
|
}
|
707 |
|
|
|
708 |
|
|
virtual PacketCommand getPacketCommand() const{return ATOMIC;}
|
709 |
|
|
|
710 |
|
|
virtual ControlPacket* getCopy() const{
|
711 |
|
|
return new AtomicPacket(bv);
|
712 |
|
|
}
|
713 |
|
|
};
|
714 |
|
|
|
715 |
|
|
///Address extension packet
|
716 |
|
|
/**
|
717 |
|
|
An address extension packet is like a normal request packet, but
|
718 |
|
|
it contains an extra 32 bits of address extension
|
719 |
|
|
*/
|
720 |
|
|
class AddressExtensionPacket: public RequestPacket{
|
721 |
|
|
|
722 |
|
|
sc_bv<32> addrExtension;
|
723 |
|
|
|
724 |
|
|
public :
|
725 |
|
|
|
726 |
|
|
///Constructor with a 32 bit vector
|
727 |
|
|
/**
|
728 |
|
|
@param dWord The least significant 32 bits that represents packet
|
729 |
|
|
*/
|
730 |
|
|
AddressExtensionPacket(const sc_bv<32> &dWord) : RequestPacket(dWord){
|
731 |
|
|
addrExtension.range(5,0) = "111110";
|
732 |
|
|
}
|
733 |
|
|
|
734 |
|
|
///Constructor with a 64 bit vector
|
735 |
|
|
/**
|
736 |
|
|
@param qWord The 64 bits that represents packet
|
737 |
|
|
*/
|
738 |
|
|
AddressExtensionPacket(const sc_bv<64> &qWord) : RequestPacket(qWord){
|
739 |
|
|
addrExtension.range(5,0) = "111110";
|
740 |
|
|
}
|
741 |
|
|
|
742 |
|
|
///Constructor with specific extended address
|
743 |
|
|
/**
|
744 |
|
|
@param addrExt The 24-bit address extension
|
745 |
|
|
@param dWord The lower 32 bits that represents packet
|
746 |
|
|
*/
|
747 |
|
|
AddressExtensionPacket(const sc_bv<24> &addrExt,const sc_bv<32> &dWord)
|
748 |
|
|
: RequestPacket(dWord),addrExtension()
|
749 |
|
|
{
|
750 |
|
|
addrExtension.range(5,0) = "111110";
|
751 |
|
|
addrExtension.range(31,8) = addrExtension;
|
752 |
|
|
}
|
753 |
|
|
|
754 |
|
|
///Constructor with specific extended address
|
755 |
|
|
/**
|
756 |
|
|
@param qWord The 64 bits that represents packet
|
757 |
|
|
@param addrExt The 32-bit address extension
|
758 |
|
|
*/
|
759 |
|
|
AddressExtensionPacket(const sc_bv<32> &addrExt,const sc_bv<64> &qWord)
|
760 |
|
|
: RequestPacket(qWord),addrExtension()
|
761 |
|
|
{
|
762 |
|
|
addrExtension.range(5,0) = "111110";
|
763 |
|
|
addrExtension.range(31,8) = addrExtension;
|
764 |
|
|
}
|
765 |
|
|
|
766 |
|
|
virtual PacketCommand getPacketCommand() const{return ADDR_EXT;}
|
767 |
|
|
|
768 |
|
|
virtual PacketCommand getInternalPacketCommand() const{
|
769 |
|
|
return ControlPacket::getPacketCommand(bv.range(5,0));
|
770 |
|
|
}
|
771 |
|
|
|
772 |
|
|
virtual PacketType getPacketType() const{return ADDR_EXT_TYPE;}
|
773 |
|
|
|
774 |
|
|
virtual PacketType getInternalPacketType() const{
|
775 |
|
|
return ControlPacket::getPacketType(bv.range(5,0));
|
776 |
|
|
}
|
777 |
|
|
|
778 |
|
|
sc_bv<32> getAddressExtension(){ return addrExtension; }
|
779 |
|
|
|
780 |
|
|
virtual ControlPacket* getCopy() const{
|
781 |
|
|
return new AddressExtensionPacket(addrExtension,bv);
|
782 |
|
|
}
|
783 |
|
|
};
|
784 |
|
|
|
785 |
|
|
|
786 |
|
|
#endif
|