OpenCores
URL https://opencores.org/ocsvn/ht_tunnel/ht_tunnel/trunk

Subversion Repositories ht_tunnel

[/] [ht_tunnel/] [tags/] [START/] [bench/] [core/] [ResponsePacket.h] - Blame information for rev 21

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
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
        ///Get the <code>VirtualChannel</code> of the packet
122
        /**
123
                To get the virtual channel of this packet
124
                Packet can travel in different channels depending on their function
125
                and of their attributes.  Responses always travel in the Response
126
                virtual channel
127
 
128
                @return The VirtualChannel VC_RESPONSE
129
        */
130
        virtual VirtualChannel getVirtualChannel() const {return VC_RESPONSE;}
131
 
132
        ///Get the type of this packet
133
        /**
134
                @return The RESPONSE PacketType
135
        */
136
        virtual PacketType getPacketType() const {return RESPONSE;}
137
 
138
        virtual PacketCommand getPacketCommand() const = 0;
139
 
140
        virtual sc_uint<4> getDataLengthm1() const;
141
 
142
        virtual ControlPacket* getCopy() const = 0;
143
 
144
        virtual bool getPassPW() const;
145
 
146
        /**
147
                @return The error contained in the packet
148
        */
149
        ResponseError getResponseError() const;
150
};
151
 
152
 
153
///ReadResponse response packet 
154
/**
155
        The ReadResponsePacket is sent in response to a read request.
156
*/
157
class ReadResponsePacket: public ResponsePacket{
158
 
159
public:
160
 
161
        ///Constructor with a 32 bit vector
162
        /**
163
                @param dWord The least significant 32 bits that represents packet
164
        */
165
        ReadResponsePacket(const sc_bv<32> &dWord) : ResponsePacket(dWord){}
166
 
167
        ///Constructor with a 64 bit vector
168
        /**
169
                @param qWord The 64 bits that represents packet
170
        */
171
        ReadResponsePacket(const sc_bv<64> &qWord) : ResponsePacket(qWord){}
172
 
173
        ///Constructor with specific parameters for responses
174
        /**
175
                This allows to construct a packet with parameters that are generic
176
                to all response packets
177
 
178
                @param unitID   unitID of the device that sent the response
179
                @param srcTag   srcTag allows to track non-posted packets.  When a non-posted packet
180
                                                is sent with a srcTag, another non-posted packet with that same
181
                                                srcTag cannot be sent before a response is received for the original
182
                                                request.  This is the srcTag of the request paquet that this
183
                                                response packet is responding to
184
                @param rqUID    When bridge == 0, this is the last two bits of the unitID of the device
185
                                                that sent the request this response is responding to
186
                @param count    The count of dwords being sent in the data packet associated to this
187
                                                ReadResponsePacket
188
                @param bridge   If this packet comes from the host or a bridge
189
                @param error    Error returned in the packet
190
                @param passPW   If this packet can pass posted writes (increased priority)
191
                @param isoc             This bit either represents if the packet travels in isoc channels
192
                                                (increased priority)
193
        */
194
        ReadResponsePacket(const sc_bv<5> &unitID,
195
                                                 const sc_bv<5> &srcTag,
196
                                                 const sc_bv<2> &rqUID,
197
                                                 const sc_bv<4> &count,
198
                                                 bool bridge,
199
                                                 ResponseError error = RE_NORMAL,
200
                                                 bool passPW = 0,
201
                                                 bool isoc = 0) :
202
                ResponsePacket(sc_bv<6>("110000"),
203
                                                  unitID,
204
                                                  srcTag,
205
                                                  rqUID,
206
                                                  bridge,
207
                                                  error,
208
                                                  passPW,
209
                                                  isoc)
210
        {
211
                bv.range(25,22) = count;
212
        }
213
 
214
        ///To get the command of the packet
215
        /**
216
                @return RD_RESPONSE
217
        */
218
        virtual PacketCommand getPacketCommand() const{return RD_RESPONSE;}
219
 
220
        ControlPacket* getCopy() const{
221
                return new ReadResponsePacket(bv);
222
        }
223
 
224
};
225
 
226
///TargetDone response packet 
227
/**
228
        TargetDonePacket is sent to say that something has been completed.
229
        For example it can be a non-posted write or a flush request.
230
*/
231
class TargetDonePacket: public ResponsePacket{
232
 
233
public:
234
 
235
        ///Constructor with a 32 bit vector
236
        /**
237
                @param dWord The least significant 32 bits that represents packet
238
        */
239
        TargetDonePacket(const sc_bv<32> &dWord) : ResponsePacket(dWord){}
240
 
241
        ///Constructor with a 64 bit vector
242
        /**
243
                @param qWord The 64 bits that represents packet
244
        */
245
        TargetDonePacket(const sc_bv<64> &qWord) : ResponsePacket(qWord){}
246
 
247
        ///Constructor with specific parameters for responses
248
        /**
249
                This allows to construct a packet with parameters that are generic
250
                to all response packets
251
 
252
                @param unitID   unitID of the device that sent the response
253
                @param srcTag   srcTag allows to track non-posted packets.  When a non-posted packet
254
                                                is sent with a srcTag, another non-posted packet with that same
255
                                                srcTag cannot be sent before a response is received for the original
256
                                                request.  This is the srcTag of the request paquet that this
257
                                                response packet is responding to
258
                @param rqUID    When bridge == 0, this is the last two bits of the unitID of the device
259
                                                that sent the request this response is responding to
260
                @param bridge   If this packet comes from the host or a bridge
261
                @param error    Error returned in the packet
262
                @param passPW   If this packet can pass posted writes (increased priority)
263
                @param isoc             This bit either represents if the packet travels in isoc channels
264
                                                (increased priority)
265
        */
266
        TargetDonePacket(const sc_bv<5> &unitID,
267
                                                 const sc_bv<5> &srcTag,
268
                                                 const sc_bv<2> &rqUID,
269
                                                 bool bridge,
270
                                                 ResponseError error = RE_NORMAL,
271
                                                 bool passPW = 0,
272
                                                 bool isoc = 0) :
273
                ResponsePacket(sc_bv<6>("110011"),
274
                                                  unitID,
275
                                                  srcTag,
276
                                                  rqUID,
277
                                                  bridge,
278
                                                  error,
279
                                                  passPW,
280
                                                  isoc)
281
        {
282
        }
283
 
284
        ///To get the command of the packet
285
        /**
286
                @return TGTDONE
287
        */
288
        virtual PacketCommand getPacketCommand() const{return TGTDONE;}
289
 
290
        ControlPacket* getCopy() const{
291
                return new TargetDonePacket(bv);
292
        }
293
 
294
 
295
};
296
 
297
#endif
298
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.