summaryrefslogtreecommitdiff
path: root/src/mem/port.hh
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2012-05-30 05:29:42 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2012-05-30 05:29:42 -0400
commitcad802761a876c6dcd00d58e09c8984886c987f6 (patch)
treefcb327a8923631de61133c6ad14aeaffcc44761c /src/mem/port.hh
parent6a54f7fc5ff1c33bc9f222014dc08c33248b0299 (diff)
downloadgem5-cad802761a876c6dcd00d58e09c8984886c987f6.tar.xz
Packet: Unify the use of PortID in packet and port
This patch removes the Packet::NodeID typedef and unifies it with the Port::PortId. The src and dest fields in the packet are used to hold a port id (e.g. in the bus), and thus the two should actually be the same. The typedef PortID is now global (in base/types.hh) and aligned with the ThreadID in terms of capitalisation and naming of the InvalidPortID constant. Before this patch, two flags were used for valid destination and source, rather than relying on a named value (InvalidPortID), and this is now redundant, as the src and dest field themselves are sufficient to tell whether the current value is a valid port identifier or not. Consequently, the VALID_SRC and VALID_DST are removed. As part of the cleaning up, a number of int parameters and local variables are updated to use PortID. Note that Ruby still has its own NodeID typedef. Furthermore, the MemObject getMaster/SlavePort still has an int idx parameter with a default value of -1 which should eventually change to PortID idx = InvalidPortID.
Diffstat (limited to 'src/mem/port.hh')
-rw-r--r--src/mem/port.hh20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/mem/port.hh b/src/mem/port.hh
index 840952354..c70733bf6 100644
--- a/src/mem/port.hh
+++ b/src/mem/port.hh
@@ -78,14 +78,6 @@ class MemObject;
class Port
{
- public:
-
- /** A type name for the port identifier. */
- typedef int PortId;
-
- /** A symbolic name for the absence of a port id. */
- static const PortId INVALID_PORT_ID = -1;
-
private:
/** Descriptive name (for DPRINTF output) */
@@ -95,9 +87,9 @@ class Port
/**
* A numeric identifier to distinguish ports in a vector, and set
- * to INVALID_PORT_ID in case this port is not part of a vector.
+ * to InvalidPortID in case this port is not part of a vector.
*/
- const PortId id;
+ const PortID id;
/** A pointer to the peer port. */
Port* peer;
@@ -112,7 +104,7 @@ class Port
* @param _owner The MemObject that is the structural owner of this port
* @param _id A port identifier for vector ports
*/
- Port(const std::string& _name, MemObject& _owner, PortId _id);
+ Port(const std::string& _name, MemObject& _owner, PortID _id);
/**
* Virtual destructor due to inheritance.
@@ -125,7 +117,7 @@ class Port
const std::string name() const { return portName; }
/** Get the port id. */
- PortId getId() const { return id; }
+ PortID getId() const { return id; }
protected:
@@ -167,7 +159,7 @@ class MasterPort : public Port
public:
MasterPort(const std::string& name, MemObject* owner,
- PortId id = INVALID_PORT_ID);
+ PortID id = InvalidPortID);
virtual ~MasterPort();
void bind(SlavePort& slave_port);
@@ -305,7 +297,7 @@ class SlavePort : public Port
public:
SlavePort(const std::string& name, MemObject* owner,
- PortId id = INVALID_PORT_ID);
+ PortID id = InvalidPortID);
virtual ~SlavePort();
void bind(MasterPort& master_port);