bridge.hh (4433:4722c6787f69) bridge.hh (4435:7da241055348)
1/*
2 * Copyright (c) 2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 52 unchanged lines hidden (view full) ---

61 * Pointer to the port on the other side of the bridge
62 * (connected to the other bus).
63 */
64 BridgePort *otherPort;
65
66 /** Minimum delay though this bridge. */
67 Tick delay;
68
1/*
2 * Copyright (c) 2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 52 unchanged lines hidden (view full) ---

61 * Pointer to the port on the other side of the bridge
62 * (connected to the other bus).
63 */
64 BridgePort *otherPort;
65
66 /** Minimum delay though this bridge. */
67 Tick delay;
68
69 /** Min delay to respond to a nack. */
70 Tick nackDelay;
71
69 bool fixPartialWrite;
70
71 class PacketBuffer : public Packet::SenderState {
72
73 public:
74 Tick ready;
75 PacketPtr pkt;
76 Packet::SenderState *origSenderState;

--- 67 unchanged lines hidden (view full) ---

144 * specified delay to model the processing delay of the
145 * bridge.
146 */
147 std::list<PacketBuffer*> sendQueue;
148
149 int outstandingResponses;
150 int queuedRequests;
151
72 bool fixPartialWrite;
73
74 class PacketBuffer : public Packet::SenderState {
75
76 public:
77 Tick ready;
78 PacketPtr pkt;
79 Packet::SenderState *origSenderState;

--- 67 unchanged lines hidden (view full) ---

147 * specified delay to model the processing delay of the
148 * bridge.
149 */
150 std::list<PacketBuffer*> sendQueue;
151
152 int outstandingResponses;
153 int queuedRequests;
154
155 /** If we're waiting for a retry to happen.*/
156 bool inRetry;
157
152 /** Max queue size for outbound packets */
158 /** Max queue size for outbound packets */
153 int queueLimit;
159 int reqQueueLimit;
154
160
161 /** Max queue size for reserved responses. */
162 int respQueueLimit;
163
155 /**
156 * Is this side blocked from accepting outbound packets?
157 */
164 /**
165 * Is this side blocked from accepting outbound packets?
166 */
158 bool queueFull();
167 bool respQueueFull();
168 bool reqQueueFull();
159
160 void queueForSendTiming(PacketPtr pkt);
161
162 void finishSend(PacketBuffer *buf);
163
164 void nackRequest(PacketPtr pkt);
165
166 /**

--- 14 unchanged lines hidden (view full) ---

181 virtual void process() { port->trySend(); }
182
183 virtual const char *description() { return "bridge send event"; }
184 };
185
186 SendEvent sendEvent;
187
188 public:
169
170 void queueForSendTiming(PacketPtr pkt);
171
172 void finishSend(PacketBuffer *buf);
173
174 void nackRequest(PacketPtr pkt);
175
176 /**

--- 14 unchanged lines hidden (view full) ---

191 virtual void process() { port->trySend(); }
192
193 virtual const char *description() { return "bridge send event"; }
194 };
195
196 SendEvent sendEvent;
197
198 public:
189
190 /** Constructor for the BusPort.*/
199 /** Constructor for the BusPort.*/
191 BridgePort(const std::string &_name,
192 Bridge *_bridge, BridgePort *_otherPort,
193 int _delay, int _queueLimit, bool fix_partial_write);
200 BridgePort(const std::string &_name, Bridge *_bridge,
201 BridgePort *_otherPort, int _delay, int _nack_delay,
202 int _req_limit, int _resp_limit, bool fix_partial_write);
194
195 protected:
196
197 /** When receiving a timing request from the peer port,
198 pass it to the bridge. */
199 virtual bool recvTiming(PacketPtr pkt);
200
201 /** When receiving a retry request from the peer port,

--- 19 unchanged lines hidden (view full) ---

221 };
222
223 BridgePort portA, portB;
224
225 /** If this bridge should acknowledge writes. */
226 bool ackWrites;
227
228 public:
203
204 protected:
205
206 /** When receiving a timing request from the peer port,
207 pass it to the bridge. */
208 virtual bool recvTiming(PacketPtr pkt);
209
210 /** When receiving a retry request from the peer port,

--- 19 unchanged lines hidden (view full) ---

230 };
231
232 BridgePort portA, portB;
233
234 /** If this bridge should acknowledge writes. */
235 bool ackWrites;
236
237 public:
238 struct Params
239 {
240 std::string name;
241 int req_size_a;
242 int req_size_b;
243 int resp_size_a;
244 int resp_size_b;
245 Tick delay;
246 Tick nack_delay;
247 bool write_ack;
248 bool fix_partial_write_a;
249 bool fix_partial_write_b;
250 };
229
251
252 protected:
253 Params *_params;
254
255 public:
256 const Params *params() const { return _params; }
257
230 /** A function used to return the port associated with this bus object. */
231 virtual Port *getPort(const std::string &if_name, int idx = -1);
232
233 virtual void init();
234
258 /** A function used to return the port associated with this bus object. */
259 virtual Port *getPort(const std::string &if_name, int idx = -1);
260
261 virtual void init();
262
235 Bridge(const std::string &n, int qsa, int qsb, Tick _delay, int write_ack,
236 bool fix_partial_write_a, bool fix_partial_write_b);
263 Bridge(Params *p);
237};
238
239#endif //__MEM_BUS_HH__
264};
265
266#endif //__MEM_BUS_HH__