8
8
#include " vpr_error.h"
9
9
#include " vpr_types.h"
10
10
11
+ //
12
+ // Static Function Declarations
13
+ //
14
+
15
+ /* *
16
+ * @brief Populate rr_switch entries for all fanin variants.
17
+ *
18
+ * Iterates over each architecture switch and its fanins, creates the
19
+ * corresponding rr_switch entries, and fills the fanin --> rr_switch mapping.
20
+ */
11
21
static void load_rr_switch_inf (RRGraphBuilder& rr_graph_builder,
12
22
std::vector<std::map<int , int >>& switch_fanin_remap,
13
23
const std::map<int , t_arch_switch_inf>& arch_sw_inf,
14
24
const float R_minW_nmos,
15
25
const float R_minW_pmos,
16
26
const t_arch_switch_fanin& arch_switch_fanins);
17
27
28
+ /* *
29
+ * @brief Allocate rr_switch storage and determine fanin variants.
30
+ *
31
+ * Builds the list of fanins observed for each architecture switch and resizes
32
+ * the rr_switch array accordingly.
33
+ */
18
34
static void alloc_rr_switch_inf (RRGraphBuilder& rr_graph_builder,
19
35
t_arch_switch_fanin& arch_switch_fanins,
20
36
const std::map<int , t_arch_switch_inf>& arch_sw_map);
21
37
22
- /* load the global device_ctx.rr_switch_inf variable. also keep track of, for each arch switch, what
23
- * index of the rr_switch_inf array each version of its fanin has been mapped to (through switch_fanin map) */
38
+ //
39
+ // Static Function Definitions
40
+ //
41
+
24
42
static void load_rr_switch_inf (RRGraphBuilder& rr_graph_builder,
25
43
std::vector<std::map<int , int >>& switch_fanin_remap,
26
44
const std::map<int , t_arch_switch_inf>& arch_sw_inf,
27
45
const float R_minW_nmos,
28
46
const float R_minW_pmos,
29
47
const t_arch_switch_fanin& arch_switch_fanins) {
30
- if (!switch_fanin_remap.empty ()) {
31
- // at this stage, we rebuild the rr_graph (probably in binary search)
32
- // so old device_ctx.switch_fanin_remap is obsolete
33
- switch_fanin_remap.clear ();
34
- }
35
-
48
+ switch_fanin_remap.clear ();
36
49
switch_fanin_remap.resize (arch_sw_inf.size ());
50
+
37
51
for (const int arch_sw_id : arch_sw_inf | std::views::keys) {
38
52
for (auto fanin_rrswitch : arch_switch_fanins[arch_sw_id]) {
39
53
// the fanin value is in it->first, and we'll need to set what index this i_arch_switch/fanin
@@ -56,8 +70,6 @@ static void load_rr_switch_inf(RRGraphBuilder& rr_graph_builder,
56
70
}
57
71
}
58
72
59
- /* Allocates space for the global device_ctx.rr_switch_inf variable and returns the
60
- * number of rr switches that were allocated */
61
73
static void alloc_rr_switch_inf (RRGraphBuilder& rr_graph_builder,
62
74
t_arch_switch_fanin& arch_switch_fanins,
63
75
const std::map<int , t_arch_switch_inf>& arch_sw_map) {
@@ -71,16 +83,18 @@ static void alloc_rr_switch_inf(RRGraphBuilder& rr_graph_builder,
71
83
rr_graph_builder.resize_switches (num_rr_switches);
72
84
}
73
85
74
- // This function is same as create_rr_switch_from_arch_switch() in terms of functionality. It is tuned for clients functions in routing resource graph builder
86
+ //
87
+ // Non-static Function Definitions
88
+ //
89
+
75
90
void load_rr_switch_from_arch_switch (RRGraphBuilder& rr_graph_builder,
76
91
const std::map<int , t_arch_switch_inf>& arch_sw_inf,
77
92
int arch_switch_idx,
78
93
int rr_switch_idx,
79
94
int fanin,
80
95
const float R_minW_nmos,
81
96
const float R_minW_pmos) {
82
- // figure out, by looking at the arch switch's Tdel map, what the delay of the new
83
- // rr switch should be
97
+ // figure out, by looking at the arch switch's Tdel map, what the delay of the new rr switch should be
84
98
double rr_switch_Tdel = arch_sw_inf.at (arch_switch_idx).Tdel (fanin);
85
99
86
100
// copy over the arch switch to rr_switch_inf[rr_switch_idx], but with the changed Tdel value
@@ -92,29 +106,24 @@ void load_rr_switch_from_arch_switch(RRGraphBuilder& rr_graph_builder,
92
106
rr_graph_builder.rr_switch ()[RRSwitchId (rr_switch_idx)].Tdel = rr_switch_Tdel;
93
107
rr_graph_builder.rr_switch ()[RRSwitchId (rr_switch_idx)].mux_trans_size = arch_sw_inf.at (arch_switch_idx).mux_trans_size ;
94
108
if (arch_sw_inf.at (arch_switch_idx).buf_size_type == BufferSize::AUTO) {
95
- // Size based on resistance
109
+ // Size based on resistance
96
110
rr_graph_builder.rr_switch ()[RRSwitchId (rr_switch_idx)].buf_size = trans_per_buf (arch_sw_inf.at (arch_switch_idx).R , R_minW_nmos, R_minW_pmos);
97
111
} else {
98
112
VTR_ASSERT (arch_sw_inf.at (arch_switch_idx).buf_size_type == BufferSize::ABSOLUTE);
99
- // Use the specified size
113
+ // Use the specified size
100
114
rr_graph_builder.rr_switch ()[RRSwitchId (rr_switch_idx)].buf_size = arch_sw_inf.at (arch_switch_idx).buf_size ;
101
115
}
102
116
rr_graph_builder.rr_switch ()[RRSwitchId (rr_switch_idx)].name = arch_sw_inf.at (arch_switch_idx).name ;
103
117
rr_graph_builder.rr_switch ()[RRSwitchId (rr_switch_idx)].power_buffer_type = arch_sw_inf.at (arch_switch_idx).power_buffer_type ;
104
118
rr_graph_builder.rr_switch ()[RRSwitchId (rr_switch_idx)].power_buffer_size = arch_sw_inf.at (arch_switch_idx).power_buffer_size ;
105
119
}
106
120
107
- /* This function creates a routing switch for the usage of routing resource graph, based on a routing switch defined in architecture file.
108
- *
109
- * Since users can specify a routing switch whose buffer size is automatically tuned for routing architecture, the function here sets a definite buffer size, as required by placers and routers.
110
- */
111
121
t_rr_switch_inf create_rr_switch_from_arch_switch (const t_arch_switch_inf& arch_sw_inf,
112
122
const float R_minW_nmos,
113
123
const float R_minW_pmos) {
114
124
t_rr_switch_inf rr_switch_inf;
115
125
116
- // figure out, by looking at the arch switch's Tdel map, what the delay of the new
117
- // rr switch should be
126
+ // figure out, by looking at the arch switch's Tdel map, what the delay of the new rr switch should be
118
127
double rr_switch_Tdel = arch_sw_inf.Tdel (0 );
119
128
120
129
// copy over the arch switch to rr_switch_inf[rr_switch_idx], but with the changed Tdel value
@@ -126,11 +135,11 @@ t_rr_switch_inf create_rr_switch_from_arch_switch(const t_arch_switch_inf& arch_
126
135
rr_switch_inf.Tdel = rr_switch_Tdel;
127
136
rr_switch_inf.mux_trans_size = arch_sw_inf.mux_trans_size ;
128
137
if (arch_sw_inf.buf_size_type == BufferSize::AUTO) {
129
- // Size based on resistance
138
+ // Size based on resistance
130
139
rr_switch_inf.buf_size = trans_per_buf (arch_sw_inf.R , R_minW_nmos, R_minW_pmos);
131
140
} else {
132
141
VTR_ASSERT (arch_sw_inf.buf_size_type == BufferSize::ABSOLUTE);
133
- // Use the specified size
142
+ // Use the specified size
134
143
rr_switch_inf.buf_size = arch_sw_inf.buf_size ;
135
144
}
136
145
rr_switch_inf.name = arch_sw_inf.name ;
@@ -190,10 +199,6 @@ void alloc_and_load_rr_switch_inf(RRGraphBuilder& rr_graph_builder,
190
199
arch_switch_fanins);
191
200
192
201
// next, walk through rr nodes again and remap their switch indices to rr_switch_inf
193
-
194
- /* switch indices of each rr_node original point into the global device_ctx.arch_switch_inf array.
195
- * now we want to remap these indices to point into the global device_ctx.rr_switch_inf array
196
- * which contains switch info at different fan-in values */
197
202
rr_graph_builder.remap_rr_node_switch_indices (arch_switch_fanins);
198
203
199
204
// now we need to set the wire_to_rr_ipin_switch variable which points the detailed routing architecture
@@ -207,11 +212,10 @@ void alloc_and_load_rr_switch_inf(RRGraphBuilder& rr_graph_builder,
207
212
VPR_FATAL_ERROR (VPR_ERROR_ARCH,
208
213
" Not currently allowing an ipin cblock switch to have multiple fan-ins" );
209
214
} else {
210
- // This likely indicates that no connection block has been constructed, indicating significant issues with
211
- // the generated RR graph.
212
- //
213
- // Instead of throwing an error we issue a warning. This means that check_rr_graph() etc. will run to give more information
214
- // and allow graphics to be brought up for users to debug their architectures.
215
+ // This likely indicates that no connection block has been constructed, indicating significant issues with
216
+ // the generated RR graph.
217
+ // Instead of throwing an error we issue a warning. This means that check_rr_graph() etc. will run to give more information
218
+ // and allow graphics to be brought up for users to debug their architectures.
215
219
(*wire_to_rr_ipin_switch) = UNDEFINED;
216
220
VTR_LOG_WARN (" No switch found for the ipin cblock in RR graph. Check if there is an error in arch file, or if no connection blocks are being built in RR graph\n " );
217
221
}
0 commit comments