summaryrefslogtreecommitdiff
path: root/src/mem/ruby/network/Network.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem/ruby/network/Network.hh')
-rw-r--r--src/mem/ruby/network/Network.hh39
1 files changed, 38 insertions, 1 deletions
diff --git a/src/mem/ruby/network/Network.hh b/src/mem/ruby/network/Network.hh
index 4c0d4edfc..7f5ed2aae 100644
--- a/src/mem/ruby/network/Network.hh
+++ b/src/mem/ruby/network/Network.hh
@@ -1,4 +1,16 @@
/*
+ * Copyright (c) 2017 ARM Limited
+ * All rights reserved.
+ *
+ * The license below extends only to copyright in the software and shall
+ * not be construed as granting a license to any other intellectual
+ * property including but not limited to intellectual property relating
+ * to a hardware implementation of the functionality of the software
+ * licensed hereunder. You may use the software subject to the license
+ * terms below provided that you ensure that this notice is replicated
+ * unmodified and in its entirety in all distributions of the software,
+ * modified or unmodified, in source code or in binary form.
+ *
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
* All rights reserved.
*
@@ -42,13 +54,17 @@
#include <iostream>
#include <string>
+#include <unordered_map>
#include <vector>
+#include "base/addr_range.hh"
+#include "base/types.hh"
+#include "mem/packet.hh"
#include "mem/protocol/LinkDirection.hh"
#include "mem/protocol/MessageSizeType.hh"
+#include "mem/ruby/common/MachineID.hh"
#include "mem/ruby/common/TypeDefines.hh"
#include "mem/ruby/network/Topology.hh"
-#include "mem/packet.hh"
#include "params/RubyNetwork.hh"
#include "sim/clocked_object.hh"
@@ -102,6 +118,20 @@ class Network : public ClockedObject
virtual uint32_t functionalWrite(Packet *pkt)
{ fatal("Functional write not implemented.\n"); }
+ /**
+ * Map an address to the correct NodeID
+ *
+ * This function traverses the global address map to find the
+ * NodeID that corresponds to the given address and the type of
+ * the destination. For example for a request to a directory this
+ * function will return the NodeID of the right directory.
+ *
+ * @param the destination address
+ * @param the type of the destination
+ * @return the NodeID of the destination
+ */
+ NodeID addressToNodeID(Addr addr, MachineType mtype);
+
protected:
// Private copy constructor and assignment operator
Network(const Network& obj);
@@ -137,6 +167,13 @@ class Network : public ClockedObject
void process() {ctr->collateStats();}
};
+
+ // Global address map
+ struct AddrMapNode {
+ NodeID id;
+ AddrRangeList ranges;
+ };
+ std::unordered_multimap<MachineType, AddrMapNode> addrMap;
};
inline std::ostream&