port.hh (8965:1ebd7c856abc) | port.hh (8975:7f36d4436074) |
---|---|
1/* 2 * Copyright (c) 2011-2012 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 59 unchanged lines hidden (view full) --- 68class MemObject; 69 70/** 71 * Ports are used to interface memory objects to each other. A port is 72 * either a master or a slave and the connected peer is always of the 73 * opposite role. 74 * 75 * Each port has a name and an owner, and enables three basic types of | 1/* 2 * Copyright (c) 2011-2012 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 59 unchanged lines hidden (view full) --- 68class MemObject; 69 70/** 71 * Ports are used to interface memory objects to each other. A port is 72 * either a master or a slave and the connected peer is always of the 73 * opposite role. 74 * 75 * Each port has a name and an owner, and enables three basic types of |
76 * accesses to the peer port: sendFunctional, sendAtomic and 77 * sendTiming. | 76 * accesses to the peer port: functional, atomic and timing. |
78 */ 79class Port 80{ 81 82 public: 83 84 /** A type name for the port identifier. */ 85 typedef int PortId; --- 39 unchanged lines hidden (view full) --- 125 /** Return port name (for DPRINTF). */ 126 const std::string name() const { return portName; } 127 128 /** Get the port id. */ 129 PortId getId() const { return id; } 130 131 protected: 132 | 77 */ 78class Port 79{ 80 81 public: 82 83 /** A type name for the port identifier. */ 84 typedef int PortId; --- 39 unchanged lines hidden (view full) --- 124 /** Return port name (for DPRINTF). */ 125 const std::string name() const { return portName; } 126 127 /** Get the port id. */ 128 PortId getId() const { return id; } 129 130 protected: 131 |
133 /** These functions are protected because they should only be 134 * called by a peer port, never directly by any outside object. */ 135 | |
136 /** | 132 /** |
137 * Receive a timing request or response packet from the peer port. | 133 * Called by a peer port if sendTimingReq, sendTimingResp or 134 * sendTimingSnoopResp was unsuccesful, and had to wait. |
138 */ | 135 */ |
139 virtual bool recvTiming(PacketPtr pkt) = 0; 140 141 /** 142 * Receive a timing snoop request or snoop response packet from 143 * the peer port. 144 */ 145 virtual bool recvTimingSnoop(PacketPtr pkt) 146 { 147 panic("%s was not expecting a timing snoop\n", name()); 148 return false; 149 } 150 151 /** 152 * Called by a peer port if sendTiming or sendTimingSnoop was 153 * unsuccesful, and had to wait. 154 */ | |
155 virtual void recvRetry() = 0; 156 157 public: 158 159 /** | 136 virtual void recvRetry() = 0; 137 138 public: 139 140 /** |
160 * Attempt to send a timing request or response packet to the peer 161 * port by calling its receive function. If the send does not 162 * succeed, as indicated by the return value, then the sender must 163 * wait for a recvRetry at which point it can re-issue a 164 * sendTiming. 165 * 166 * @param pkt Packet to send. 167 * 168 * @return If the send was succesful or not. 169 */ 170 bool sendTiming(PacketPtr pkt) { return peer->recvTiming(pkt); } 171 172 /** 173 * Attempt to send a timing snoop request or snoop response packet 174 * to the peer port by calling its receive function. If the send 175 * does not succeed, as indicated by the return value, then the 176 * sender must wait for a recvRetry at which point it can re-issue 177 * a sendTimingSnoop. 178 * 179 * @param pkt Packet to send. 180 * 181 * @return If the send was succesful or not. 182 */ 183 bool sendTimingSnoop(PacketPtr pkt) { return peer->recvTimingSnoop(pkt); } 184 185 /** | |
186 * Send a retry to a peer port that previously attempted a | 141 * Send a retry to a peer port that previously attempted a |
187 * sendTiming or sendTimingSnoop which was unsuccessful. | 142 * sendTimingReq, sendTimingResp or sendTimingSnoopResp which was 143 * unsuccessful. |
188 */ 189 void sendRetry() { return peer->recvRetry(); } 190 191}; 192 193/** Forward declaration */ 194class SlavePort; 195 196/** 197 * A MasterPort is a specialisation of a port. In addition to the 198 * basic functionality of sending packets to its slave peer, it also 199 * has functions specific to a master, e.g. to receive range changes 200 * or determine if the port is snooping or not. 201 */ 202class MasterPort : public Port 203{ 204 | 144 */ 145 void sendRetry() { return peer->recvRetry(); } 146 147}; 148 149/** Forward declaration */ 150class SlavePort; 151 152/** 153 * A MasterPort is a specialisation of a port. In addition to the 154 * basic functionality of sending packets to its slave peer, it also 155 * has functions specific to a master, e.g. to receive range changes 156 * or determine if the port is snooping or not. 157 */ 158class MasterPort : public Port 159{ 160 |
161 friend class SlavePort; 162 |
|
205 private: 206 207 SlavePort* _slavePort; 208 209 public: 210 211 MasterPort(const std::string& name, MemObject* owner, 212 PortId id = INVALID_PORT_ID); --- 19 unchanged lines hidden (view full) --- 232 * updated everywhere in the memory system, without affecting the 233 * current state of any block or moving the block. 234 * 235 * @param pkt Packet to send. 236 */ 237 void sendFunctional(PacketPtr pkt); 238 239 /** | 163 private: 164 165 SlavePort* _slavePort; 166 167 public: 168 169 MasterPort(const std::string& name, MemObject* owner, 170 PortId id = INVALID_PORT_ID); --- 19 unchanged lines hidden (view full) --- 190 * updated everywhere in the memory system, without affecting the 191 * current state of any block or moving the block. 192 * 193 * @param pkt Packet to send. 194 */ 195 void sendFunctional(PacketPtr pkt); 196 197 /** |
240 * Receive an atomic snoop request packet from the slave port. 241 */ 242 virtual Tick recvAtomicSnoop(PacketPtr pkt) 243 { 244 panic("%s was not expecting an atomic snoop\n", name()); 245 return 0; 246 } | 198 * Attempt to send a timing request to the slave port by calling 199 * its corresponding receive function. If the send does not 200 * succeed, as indicated by the return value, then the sender must 201 * wait for a recvRetry at which point it can re-issue a 202 * sendTimingReq. 203 * 204 * @param pkt Packet to send. 205 * 206 * @return If the send was succesful or not. 207 */ 208 bool sendTimingReq(PacketPtr pkt); |
247 248 /** | 209 210 /** |
249 * Receive a functional snoop request packet from the slave port. | 211 * Attempt to send a timing snoop response packet to the slave 212 * port by calling its corresponding receive function. If the send 213 * does not succeed, as indicated by the return value, then the 214 * sender must wait for a recvRetry at which point it can re-issue 215 * a sendTimingSnoopResp. 216 * 217 * @param pkt Packet to send. |
250 */ | 218 */ |
251 virtual void recvFunctionalSnoop(PacketPtr pkt) 252 { 253 panic("%s was not expecting a functional snoop\n", name()); 254 } | 219 bool sendTimingSnoopResp(PacketPtr pkt); |
255 256 /** | 220 221 /** |
257 * Called to receive an address range change from the peer slave 258 * port. the default implementation ignored the change and does 259 * nothing. Override this function in a derived class if the owner 260 * needs to be aware of he laesddress ranges, e.g. in an 261 * interconnect component like a bus. 262 */ 263 virtual void recvRangeChange() { } 264 265 /** | |
266 * Determine if this master port is snooping or not. The default 267 * implementation returns false and thus tells the neighbour we 268 * are not snooping. Any master port that wants to receive snoop 269 * requests (e.g. a cache connected to a bus) has to override this 270 * function. 271 * 272 * @return true if the port should be considered a snooper 273 */ --- 9 unchanged lines hidden (view full) --- 283 of the device on attached to the peer port. 284 */ 285 unsigned peerBlockSize() const; 286 287 /** Inject a PrintReq for the given address to print the state of 288 * that address throughout the memory system. For debugging. 289 */ 290 void printAddr(Addr a); | 222 * Determine if this master port is snooping or not. The default 223 * implementation returns false and thus tells the neighbour we 224 * are not snooping. Any master port that wants to receive snoop 225 * requests (e.g. a cache connected to a bus) has to override this 226 * function. 227 * 228 * @return true if the port should be considered a snooper 229 */ --- 9 unchanged lines hidden (view full) --- 239 of the device on attached to the peer port. 240 */ 241 unsigned peerBlockSize() const; 242 243 /** Inject a PrintReq for the given address to print the state of 244 * that address throughout the memory system. For debugging. 245 */ 246 void printAddr(Addr a); |
247 248 protected: 249 250 /** 251 * Receive an atomic snoop request packet from the slave port. 252 */ 253 virtual Tick recvAtomicSnoop(PacketPtr pkt) 254 { 255 panic("%s was not expecting an atomic snoop request\n", name()); 256 return 0; 257 } 258 259 /** 260 * Receive a functional snoop request packet from the slave port. 261 */ 262 virtual void recvFunctionalSnoop(PacketPtr pkt) 263 { 264 panic("%s was not expecting a functional snoop request\n", name()); 265 } 266 267 /** 268 * Receive a timing response from the slave port. 269 */ 270 virtual bool recvTimingResp(PacketPtr pkt) = 0; 271 272 /** 273 * Receive a timing snoop request from the slave port. 274 */ 275 virtual void recvTimingSnoopReq(PacketPtr pkt) 276 { 277 panic("%s was not expecting a timing snoop request\n", name()); 278 } 279 280 /** 281 * Called to receive an address range change from the peer slave 282 * port. the default implementation ignored the change and does 283 * nothing. Override this function in a derived class if the owner 284 * needs to be aware of he laesddress ranges, e.g. in an 285 * interconnect component like a bus. 286 */ 287 virtual void recvRangeChange() { } |
|
291}; 292 293/** 294 * A SlavePort is a specialisation of a port. In addition to the 295 * basic functionality of sending packets to its master peer, it also 296 * has functions specific to a slave, e.g. to send range changes 297 * and get the address ranges that the port responds to. 298 */ 299class SlavePort : public Port 300{ 301 | 288}; 289 290/** 291 * A SlavePort is a specialisation of a port. In addition to the 292 * basic functionality of sending packets to its master peer, it also 293 * has functions specific to a slave, e.g. to send range changes 294 * and get the address ranges that the port responds to. 295 */ 296class SlavePort : public Port 297{ 298 |
299 friend class MasterPort; 300 |
|
302 private: 303 304 MasterPort* _masterPort; 305 306 public: 307 308 SlavePort(const std::string& name, MemObject* owner, 309 PortId id = INVALID_PORT_ID); --- 19 unchanged lines hidden (view full) --- 329 * instantly updated everywhere in the memory system, without 330 * affecting the current state of any block or moving the block. 331 * 332 * @param pkt Snoop packet to send. 333 */ 334 void sendFunctionalSnoop(PacketPtr pkt); 335 336 /** | 301 private: 302 303 MasterPort* _masterPort; 304 305 public: 306 307 SlavePort(const std::string& name, MemObject* owner, 308 PortId id = INVALID_PORT_ID); --- 19 unchanged lines hidden (view full) --- 328 * instantly updated everywhere in the memory system, without 329 * affecting the current state of any block or moving the block. 330 * 331 * @param pkt Snoop packet to send. 332 */ 333 void sendFunctionalSnoop(PacketPtr pkt); 334 335 /** |
337 * Receive an atomic request packet from the master port. 338 */ 339 virtual Tick recvAtomic(PacketPtr pkt) = 0; | 336 * Attempt to send a timing response to the master port by calling 337 * its corresponding receive function. If the send does not 338 * succeed, as indicated by the return value, then the sender must 339 * wait for a recvRetry at which point it can re-issue a 340 * sendTimingResp. 341 * 342 * @param pkt Packet to send. 343 * 344 * @return If the send was succesful or not. 345 */ 346 bool sendTimingResp(PacketPtr pkt); |
340 341 /** | 347 348 /** |
342 * Receive a functional request packet from the master port. | 349 * Attempt to send a timing snoop request packet to the master port 350 * by calling its corresponding receive function. Snoop requests 351 * always succeed and hence no return value is needed. 352 * 353 * @param pkt Packet to send. |
343 */ | 354 */ |
344 virtual void recvFunctional(PacketPtr pkt) = 0; | 355 void sendTimingSnoopReq(PacketPtr pkt); |
345 346 /** 347 * Called by a peer port in order to determine the block size of 348 * the owner of this port. 349 */ 350 virtual unsigned deviceBlockSize() const { return 0; } 351 352 /** Called by the associated device if it wishes to find out the blocksize --- 9 unchanged lines hidden (view full) --- 362 /** 363 * Get a list of the non-overlapping address ranges the owner is 364 * responsible for. All slave ports must override this function 365 * and return a populated list with at least one item. 366 * 367 * @return a list of ranges responded to 368 */ 369 virtual AddrRangeList getAddrRanges() = 0; | 356 357 /** 358 * Called by a peer port in order to determine the block size of 359 * the owner of this port. 360 */ 361 virtual unsigned deviceBlockSize() const { return 0; } 362 363 /** Called by the associated device if it wishes to find out the blocksize --- 9 unchanged lines hidden (view full) --- 373 /** 374 * Get a list of the non-overlapping address ranges the owner is 375 * responsible for. All slave ports must override this function 376 * and return a populated list with at least one item. 377 * 378 * @return a list of ranges responded to 379 */ 380 virtual AddrRangeList getAddrRanges() = 0; |
381 382 protected: 383 384 /** 385 * Receive an atomic request packet from the master port. 386 */ 387 virtual Tick recvAtomic(PacketPtr pkt) = 0; 388 389 /** 390 * Receive a functional request packet from the master port. 391 */ 392 virtual void recvFunctional(PacketPtr pkt) = 0; 393 394 /** 395 * Receive a timing request from the master port. 396 */ 397 virtual bool recvTimingReq(PacketPtr pkt) = 0; 398 399 /** 400 * Receive a timing snoop response from the master port. 401 */ 402 virtual bool recvTimingSnoopResp(PacketPtr pkt) 403 { 404 panic("%s was not expecting a timing snoop response\n", name()); 405 } 406 |
|
370}; 371 372#endif //__MEM_PORT_HH__ | 407}; 408 409#endif //__MEM_PORT_HH__ |