port.hh (5476:758c2413765a) | port.hh (5489:94a7bb476fca) |
---|---|
1/* 2 * Copyright (c) 2002-2005 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; --- 73 unchanged lines hidden (view full) --- 82 memory objects. */ 83 Port *peer; 84 85 /** A pointer to the MemObject that owns this port. This may not be set. */ 86 MemObject *owner; 87 88 public: 89 | 1/* 2 * Copyright (c) 2002-2005 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; --- 73 unchanged lines hidden (view full) --- 82 memory objects. */ 83 Port *peer; 84 85 /** A pointer to the MemObject that owns this port. This may not be set. */ 86 MemObject *owner; 87 88 public: 89 |
90 Port(); 91 | |
92 /** 93 * Constructor. 94 * 95 * @param _name Port name for DPRINTF output. Should include name 96 * of memory system object to which the port belongs. 97 * @param _owner Pointer to the MemObject that owns this port. | 90 /** 91 * Constructor. 92 * 93 * @param _name Port name for DPRINTF output. Should include name 94 * of memory system object to which the port belongs. 95 * @param _owner Pointer to the MemObject that owns this port. |
98 * Will not necessarily be set. | |
99 */ | 96 */ |
100 Port(const std::string &_name, MemObject *_owner = NULL); | 97 Port(const std::string &_name, MemObject *_owner, Port *_peer = NULL); |
101 102 /** Return port name (for DPRINTF). */ 103 const std::string &name() const { return portName; } 104 105 virtual ~Port(); 106 107 // mey be better to use subclasses & RTTI? 108 /** Holds the ports status. Currently just that a range recomputation needs 109 * to be done. */ 110 enum Status { 111 RangeChange 112 }; 113 | 98 99 /** Return port name (for DPRINTF). */ 100 const std::string &name() const { return portName; } 101 102 virtual ~Port(); 103 104 // mey be better to use subclasses & RTTI? 105 /** Holds the ports status. Currently just that a range recomputation needs 106 * to be done. */ 107 enum Status { 108 RangeChange 109 }; 110 |
114 void setName(const std::string &name) 115 { portName = name; } 116 | |
117 /** Function to set the pointer for the peer port. */ 118 virtual void setPeer(Port *port); 119 120 /** Function to get the pointer to the peer port. */ 121 Port *getPeer() { return peer; } 122 | 111 /** Function to set the pointer for the peer port. */ 112 virtual void setPeer(Port *port); 113 114 /** Function to get the pointer to the peer port. */ 115 Port *getPeer() { return peer; } 116 |
123 /** Function to set the owner of this port. */ 124 void setOwner(MemObject *_owner) { owner = _owner; } 125 | |
126 /** Function to return the owner of this port. */ 127 MemObject *getOwner() { return owner; } 128 | 117 /** Function to return the owner of this port. */ 118 MemObject *getOwner() { return owner; } 119 |
129 /** Inform the peer port to delete itself and notify it's owner about it's 130 * demise. */ 131 void removeConn(); | 120 /** Notify my peer port that I'm disconnecting (by calling its 121 * disconnect() method) so it can clean up. */ 122 void disconnectFromPeer(); |
132 133 virtual bool isDefaultPort() const { return false; } 134 135 bool isConnected() { return peer && !peer->isDefaultPort(); } 136 137 protected: 138 139 /** These functions are protected because they should only be --- 109 unchanged lines hidden (view full) --- 249 */ 250 void printAddr(Addr a); 251 252 private: 253 254 /** Internal helper function for read/writeBlob(). 255 */ 256 void blobHelper(Addr addr, uint8_t *p, int size, MemCmd cmd); | 123 124 virtual bool isDefaultPort() const { return false; } 125 126 bool isConnected() { return peer && !peer->isDefaultPort(); } 127 128 protected: 129 130 /** These functions are protected because they should only be --- 109 unchanged lines hidden (view full) --- 240 */ 241 void printAddr(Addr a); 242 243 private: 244 245 /** Internal helper function for read/writeBlob(). 246 */ 247 void blobHelper(Addr addr, uint8_t *p, int size, MemCmd cmd); |
248 249 /** Receive notification that my peer is disconnecting and clean 250 * up (potentially deleting myself in the process). Should be 251 * called only from peer's disconnectFromPeer(). */ 252 void disconnect(); |
|
257}; 258 259/** A simple functional port that is only meant for one way communication to 260 * physical memory. It is only meant to be used to load data into memory before 261 * the simulation begins. 262 */ 263 264class FunctionalPort : public Port --- 39 unchanged lines hidden --- | 253}; 254 255/** A simple functional port that is only meant for one way communication to 256 * physical memory. It is only meant to be used to load data into memory before 257 * the simulation begins. 258 */ 259 260class FunctionalPort : public Port --- 39 unchanged lines hidden --- |