/
GlobalRoutingTable.h
71 lines (51 loc) · 1.6 KB
/
GlobalRoutingTable.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* Noxim - the NoC Simulator
*
* (C) 2005-2018 by the University of Catania
* For the complete list of authors refer to file ../doc/AUTHORS.txt
* For the license applied to these sources refer to file ../doc/LICENSE.txt
*
*/
#ifndef __NOXIMGLOBALROUTINGTABLE_H__
#define __NOXIMGLOBALROUTINGTABLE_H__
#define COLUMN_AOC 22
#include <vector>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <fstream>
#include "DataStructs.h"
using namespace std;
// Pair of source, destination node
typedef pair < int, int >LinkId;
// Routing table
typedef set < LinkId > AdmissibleOutputs;
// Map a destination to a set of admissible outputs
typedef map < int, AdmissibleOutputs > RoutingTableLink;
// Map an input link to its routing table
typedef map < LinkId, RoutingTableLink > RoutingTableNode;
// Map a node of the network to its routing table
typedef map < int, RoutingTableNode > RoutingTableNoC;
// Converts an input direction to a link
LinkId direction2ILinkId(const int node_id, const int dir);
// Converts an input direction to a link
int oLinkId2Direction(const LinkId & out_link);
// Converts a set of output links to a set of directions
vector <
int >admissibleOutputsSet2Vector(const AdmissibleOutputs & ao);
class GlobalRoutingTable {
public:
GlobalRoutingTable();
// Load routing table from file. Returns true if ok, false otherwise
bool load(const char *fname);
RoutingTableNode getNodeRoutingTable(const int node_id);
bool isValid() {
return valid;
} private:
RoutingTableNoC rt_noc;
bool valid;
};
#endif