-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRouterBase.py
executable file
·145 lines (119 loc) · 5.26 KB
/
RouterBase.py
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# This file is part of GenMap and released under the MIT License, see LICENSE.
# Author: Takuya Kojima
from abc import ABCMeta, abstractmethod
import networkx as nx
class RouterBase(metaclass=ABCMeta):
@staticmethod
@abstractmethod
def set_default_weights(CGRA):
"""Set default weight to network model.
Args:
CGRA (PEArrayModel) : A model of the CGRA to be initialized
Returns: None
"""
pass
@staticmethod
@abstractmethod
def comp_routing(CGRA, comp_DFG, mapping, routed_graph, **info):
"""Routes a computation DFG on the PE array.
Args:
CGRA (PEArrayModel): A model of the CGRA
comp_DFG (networkx DiGraph): A graph to be routed
mapping (dict): mapping of the DFG
keys (str): operation label of DFG
values (tuple): PE coordinates
routed_graph (networkx DiGraph): PE array graph
Returns:
int: routing cost
Notes:
This method will add following attributes to routed_graph's edges
1. operand: to fix order of operands for an ALU
Also, this method will add following attributes to routed_graph's nodes
1. route: to specifiy routing ALU
"""
pass
@staticmethod
@abstractmethod
def const_routing(CGRA, const_DFG, mapping, routed_graph, **info):
"""Routes a computation DFG on the PE array.
Args:
CGRA (PEArrayModel): A model of the CGRA
const_DFG (networkx DiGraph): A graph to be routed
mapping (dict): mapping of the DFG
keys (str): operation label of DFG
values (tuple): PE coordinates
routed_graph (networkx DiGraph): PE array graph
Returns:
int: routing cost
Notes:
This method will add following attributes to routed_graph's edges
1. operand: to fix order of operands for an ALU
Also, this method will add following attributes to routed_graph's nodes
1. value: constant value which is assigned to an const reg
2. route: to specifiy routing ALU
"""
pass
@staticmethod
@abstractmethod
def input_routing(CGRA, in_DFG, mapping, routed_graph, **info):
"""Routes a computation DFG on the PE array.
Args:
CGRA (PEArrayModel): A model of the CGRA
input_DFG (networkx DiGraph): A graph to be routed
mapping (dict): mapping of the DFG
keys (str): operation label of DFG
values (tuple): PE coordinates
routed_graph (networkx DiGraph): PE array graph
Returns:
int: routing cost
Notes:
This method will add following attributes to routed_graph's edges
1. operand: to fix order of operands for an ALU
Also, this method will add following attributes to routed_graph's nodes
1. map: input data which is mapped to an input port
2. route: to specifiy routing ALU
"""
pass
@staticmethod
@abstractmethod
def output_routing(CGRA, out_DFG, mapping, routed_graph, **info):
"""Routes a computation DFG on the PE array.
Args:
CGRA (PEArrayModel): A model of the CGRA
out_DFG (networkx DiGraph): A graph to be routed
mapping (dict): mapping of the DFG
keys (str): node names of DFG
values (tuple): PE coordinates
routed_graph (networkx DiGraph): PE array graph
Optional:
preg_conf: Pipeline configuration if the PE Array is pipelined.
If it is not None, pipeline latency is adjusted
by extending output data path.
Returns:
int: routing cost
Notes:
This method will add following attributes to routed_graph's nodes
1. map: output data which is mapped to a output port
2. route: to specifiy routing ALU
"""
pass
@staticmethod
@abstractmethod
def inout_routing(CGRA, in_DFG, out_DFG, mapping, routed_graph, **info):
"""Routes a computation DFG on the PE array.
Args:
CGRA (PEArrayModel): A model of the CGRA
in_DFG (networkx DiGraph): An input data graph to be routed
out_DFG (networkx DiGraph): An output data graph to be routed
mapping (dict): mapping of the DFG
keys (str): node names of DFG
values (tuple): PE coordinates
routed_graph (networkx DiGraph): PE array graph
Returns:
int: routing cost
Notes:
This method will add following attributes to routed_graph's nodes
1. map: output data which is mapped to a inout port
2. route: to specifiy routing ALU
"""
pass