bridge.hh (4762:c94e103c83ad) bridge.hh (4870:fcc39d001154)
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;

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

40#include <string>
41#include <list>
42#include <inttypes.h>
43#include <queue>
44
45#include "mem/mem_object.hh"
46#include "mem/packet.hh"
47#include "mem/port.hh"
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;

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

40#include <string>
41#include <list>
42#include <inttypes.h>
43#include <queue>
44
45#include "mem/mem_object.hh"
46#include "mem/packet.hh"
47#include "mem/port.hh"
48#include "params/Bridge.hh"
49#include "sim/eventq.hh"
50
51class Bridge : public MemObject
52{
53 protected:
54 /** Declaration of the buses port type, one will be instantiated for each
55 of the interfaces connecting to the bus. */
56 class BridgePort : public Port

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

82 bool expectResponse;
83
84 PacketBuffer(PacketPtr _pkt, Tick t, bool nack = false)
85 : ready(t), pkt(_pkt),
86 origSenderState(_pkt->senderState), origSrc(_pkt->getSrc()),
87 expectResponse(_pkt->needsResponse() && !nack)
88
89 {
48#include "sim/eventq.hh"
49
50class Bridge : public MemObject
51{
52 protected:
53 /** Declaration of the buses port type, one will be instantiated for each
54 of the interfaces connecting to the bus. */
55 class BridgePort : public Port

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

81 bool expectResponse;
82
83 PacketBuffer(PacketPtr _pkt, Tick t, bool nack = false)
84 : ready(t), pkt(_pkt),
85 origSenderState(_pkt->senderState), origSrc(_pkt->getSrc()),
86 expectResponse(_pkt->needsResponse() && !nack)
87
88 {
90 if (!pkt->isResponse() && !nack && pkt->result != Packet::Nacked)
89 if (!pkt->isResponse() && !nack && !pkt->wasNacked())
91 pkt->senderState = this;
92 }
93
94 void fixResponse(PacketPtr pkt)
95 {
96 assert(pkt->senderState == this);
97 pkt->setDest(origSrc);
98 pkt->senderState = origSenderState;

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

187 };
188
189 BridgePort portA, portB;
190
191 /** If this bridge should acknowledge writes. */
192 bool ackWrites;
193
194 public:
90 pkt->senderState = this;
91 }
92
93 void fixResponse(PacketPtr pkt)
94 {
95 assert(pkt->senderState == this);
96 pkt->setDest(origSrc);
97 pkt->senderState = origSenderState;

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

186 };
187
188 BridgePort portA, portB;
189
190 /** If this bridge should acknowledge writes. */
191 bool ackWrites;
192
193 public:
195 typedef BridgeParams Params;
194 struct Params
195 {
196 std::string name;
197 int req_size_a;
198 int req_size_b;
199 int resp_size_a;
200 int resp_size_b;
201 Tick delay;
202 Tick nack_delay;
203 bool write_ack;
204 bool fix_partial_write_a;
205 bool fix_partial_write_b;
206 };
196
197 protected:
198 Params *_params;
199
200 public:
201 const Params *params() const { return _params; }
202
203 /** A function used to return the port associated with this bus object. */
204 virtual Port *getPort(const std::string &if_name, int idx = -1);
205
206 virtual void init();
207
208 Bridge(Params *p);
209};
210
211#endif //__MEM_BUS_HH__
207
208 protected:
209 Params *_params;
210
211 public:
212 const Params *params() const { return _params; }
213
214 /** A function used to return the port associated with this bus object. */
215 virtual Port *getPort(const std::string &if_name, int idx = -1);
216
217 virtual void init();
218
219 Bridge(Params *p);
220};
221
222#endif //__MEM_BUS_HH__