summaryrefslogtreecommitdiff
path: root/src/base
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/base
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/base')
-rw-r--r--src/base/types.hh6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/base/types.hh b/src/base/types.hh
index 5ce778572..3105059ed 100644
--- a/src/base/types.hh
+++ b/src/base/types.hh
@@ -97,6 +97,12 @@ const Addr MaxAddr = (Addr)-1;
typedef int16_t ThreadID;
const ThreadID InvalidThreadID = (ThreadID)-1;
+/**
+ * Port index/ID type, and a symbolic name for an invalid port id.
+ */
+typedef int16_t PortID;
+const PortID InvalidPortID = (PortID)-1;
+
class FaultBase;
template <class T> class RefCountingPtr;
typedef RefCountingPtr<FaultBase> Fault;