bridge.hh (3349:fec4a86fa212) | bridge.hh (4432:5e55857abb01) |
---|---|
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 bool fixPartialWrite; 70 |
|
69 class PacketBuffer : public Packet::SenderState { 70 71 public: 72 Tick ready; 73 PacketPtr pkt; 74 Packet::SenderState *origSenderState; 75 short origSrc; 76 bool expectResponse; 77 | 71 class PacketBuffer : public Packet::SenderState { 72 73 public: 74 Tick ready; 75 PacketPtr pkt; 76 Packet::SenderState *origSenderState; 77 short origSrc; 78 bool expectResponse; 79 |
80 bool partialWriteFixed; 81 PacketPtr oldPkt; 82 |
|
78 PacketBuffer(PacketPtr _pkt, Tick t) 79 : ready(t), pkt(_pkt), 80 origSenderState(_pkt->senderState), origSrc(_pkt->getSrc()), | 83 PacketBuffer(PacketPtr _pkt, Tick t) 84 : ready(t), pkt(_pkt), 85 origSenderState(_pkt->senderState), origSrc(_pkt->getSrc()), |
81 expectResponse(_pkt->needsResponse()) | 86 expectResponse(_pkt->needsResponse()), partialWriteFixed(false) |
82 { 83 if (!pkt->isResponse()) 84 pkt->senderState = this; 85 } 86 87 void fixResponse(PacketPtr pkt) 88 { 89 assert(pkt->senderState == this); 90 pkt->setDest(origSrc); 91 pkt->senderState = origSenderState; | 87 { 88 if (!pkt->isResponse()) 89 pkt->senderState = this; 90 } 91 92 void fixResponse(PacketPtr pkt) 93 { 94 assert(pkt->senderState == this); 95 pkt->setDest(origSrc); 96 pkt->senderState = origSenderState; |
97 if (partialWriteFixed) 98 delete oldPkt; |
|
92 } | 99 } |
100 101 void partialWriteFix(Port *port) 102 { 103 assert(!partialWriteFixed); 104 assert(expectResponse); 105 106 int pbs = port->peerBlockSize(); 107 partialWriteFixed = true; 108 PacketDataPtr data; 109 110 data = new uint8_t[pbs]; 111 PacketPtr funcPkt = new Packet(pkt->req, MemCmd::ReadReq, 112 Packet::Broadcast, pbs); 113 114 funcPkt->dataStatic(data); 115 port->sendFunctional(funcPkt); 116 assert(funcPkt->result == Packet::Success); 117 delete funcPkt; 118 119 oldPkt = pkt; 120 memcpy(data + oldPkt->getOffset(pbs), pkt->getPtr<uint8_t>(), 121 pkt->getSize()); 122 pkt = new Packet(oldPkt->req, MemCmd::WriteInvalidateReq, 123 Packet::Broadcast, pbs); 124 pkt->dataDynamicArray(data); 125 pkt->senderState = oldPkt->senderState; 126 } 127 128 void undoPartialWriteFix() 129 { 130 if (!partialWriteFixed) 131 return; 132 delete pkt; 133 pkt = oldPkt; 134 partialWriteFixed = false; 135 } 136 |
|
93 }; 94 95 /** 96 * Outbound packet queue. Packets are held in this queue for a 97 * specified delay to model the processing delay of the 98 * bridge. 99 */ 100 std::list<PacketBuffer*> sendQueue; --- 34 unchanged lines hidden (view full) --- 135 136 SendEvent sendEvent; 137 138 public: 139 140 /** Constructor for the BusPort.*/ 141 BridgePort(const std::string &_name, 142 Bridge *_bridge, BridgePort *_otherPort, | 137 }; 138 139 /** 140 * Outbound packet queue. Packets are held in this queue for a 141 * specified delay to model the processing delay of the 142 * bridge. 143 */ 144 std::list<PacketBuffer*> sendQueue; --- 34 unchanged lines hidden (view full) --- 179 180 SendEvent sendEvent; 181 182 public: 183 184 /** Constructor for the BusPort.*/ 185 BridgePort(const std::string &_name, 186 Bridge *_bridge, BridgePort *_otherPort, |
143 int _delay, int _queueLimit); | 187 int _delay, int _queueLimit, bool fix_partial_write); |
144 145 protected: 146 147 /** When receiving a timing request from the peer port, 148 pass it to the bridge. */ 149 virtual bool recvTiming(PacketPtr pkt); 150 151 /** When receiving a retry request from the peer port, --- 25 unchanged lines hidden (view full) --- 177 178 public: 179 180 /** A function used to return the port associated with this bus object. */ 181 virtual Port *getPort(const std::string &if_name, int idx = -1); 182 183 virtual void init(); 184 | 188 189 protected: 190 191 /** When receiving a timing request from the peer port, 192 pass it to the bridge. */ 193 virtual bool recvTiming(PacketPtr pkt); 194 195 /** When receiving a retry request from the peer port, --- 25 unchanged lines hidden (view full) --- 221 222 public: 223 224 /** A function used to return the port associated with this bus object. */ 225 virtual Port *getPort(const std::string &if_name, int idx = -1); 226 227 virtual void init(); 228 |
185 Bridge(const std::string &n, int qsa, int qsb, Tick _delay, int write_ack); | 229 Bridge(const std::string &n, int qsa, int qsb, Tick _delay, int write_ack, 230 bool fix_partial_write_a, bool fix_partial_write_b); |
186}; 187 188#endif //__MEM_BUS_HH__ | 231}; 232 233#endif //__MEM_BUS_HH__ |