3#include <bits/stdc++.h>
9#include <unordered_map>
12#define NUMBER_NODES 32
13#define NUMBER_RINGS 12
16using FENRegMap = std::unordered_map<std::string, uint32_t>;
17using TopologyMap = std::unordered_map<uint32_t, std::unordered_map<uint32_t, std::shared_ptr<FrontEndBase>>>;
30using TopologyList = std::vector<FrontEndEntry>;
31using NodesList = std::map<int, FrontEndEntry>;
52 const FENRegMap&
getAddrMap(
int ring,
int node);
58 TopologyList topology;
60 size_t mapped_topology[NUMBER_RINGS][NUMBER_NODES]{};
61 uint8_t active_nodes[NUMBER_RINGS]{};
62 std::mutex topology_mutex;
Base class for frontend devices, providing common functionality.
Definition FrontEndBase.h:17
const std::vector< int > getActiveRings()
Returns which rings have populated nodes.
Definition Topology.cpp:83
const TopologyList & getAllEntries() const
Retrieve all entries in the topology.
Definition Topology.h:47
void fillNodesArray(uint8_t *rings, size_t size=NUMBER_RINGS)
Fills the number of nodes per ring in an array.
Definition Topology.cpp:63
const NodesList getNodesForRing(int ring)
Retrieves all nodes associated with a specific ring.
Definition Topology.cpp:33
Topology()
Constructor for the Topology class.
Definition Topology.cpp:8
const uint8_t getNumberOfNodesInRing(int ring)
Retrieves the number of nodes in a specific ring.
Definition Topology.cpp:52
const FrontEndBase * getFEN(int ring, int node)
gets the FrontEnd in given ring and node. Returns NULL if not found.
Definition Topology.cpp:99
const FENRegMap & getAddrMap(int ring, int node)
Returns the register map for a given ring-node pair.
Definition Topology.cpp:75
void addEntry(const FrontEndEntry &entry)
Adds a front-end entry to the topology map.
Definition Topology.cpp:15
Struct to hold the information about a registered frontend device.
Definition Topology.h:23
std::shared_ptr< FrontEndBase > instance
Shared pointer to the frontend instance.
Definition Topology.h:25
int node
The node ID within the ring.
Definition Topology.h:27
std::string name
Name of the frontend device.
Definition Topology.h:24
int ring
The ring ID where the frontend device is located.
Definition Topology.h:26