@@ -33,7 +33,10 @@ static void count_unidir_routing_transistors(std::vector<t_segment_inf>& segment
33
33
const float trans_sram_bit,
34
34
bool is_flat);
35
35
36
- static float get_cblock_trans (int * num_inputs_to_cblock, int wire_to_ipin_switch, int max_inputs_to_cblock, float trans_sram_bit);
36
+ static float get_cblock_trans (vtr::vector<RRNodeId, int >& num_inputs_to_cblock,
37
+ int wire_to_ipin_switch,
38
+ int max_inputs_to_cblock,
39
+ float trans_sram_bit);
37
40
38
41
static float * alloc_and_load_unsharable_switch_trans (int num_switch,
39
42
float trans_sram_bit,
@@ -108,9 +111,9 @@ void count_bidir_routing_transistors(int num_switch, int wire_to_ipin_switch, fl
108
111
auto & device_ctx = g_vpr_ctx.device ();
109
112
const auto & rr_graph = device_ctx.rr_graph ;
110
113
111
- int * num_inputs_to_cblock; /* [0..device_ctx.rr_nodes.size()-1], but all entries not */
114
+ vtr::vector<RRNodeId, int > num_inputs_to_cblock (rr_graph.num_nodes (), 0 ); // entries not corresponding to IPINs will be 0
115
+
112
116
113
- /* corresponding to IPINs will be 0. */
114
117
115
118
bool * cblock_counted; /* [0..max(device_ctx.grid.width(),device_ctx.grid.height())] -- 0th element unused. */
116
119
float * shared_buffer_trans; /* [0..max(device_ctx.grid.width(),device_ctx.grid.height())] */
@@ -145,16 +148,11 @@ void count_bidir_routing_transistors(int num_switch, int wire_to_ipin_switch, fl
145
148
* wiring C plus the fanout. */
146
149
147
150
if (INCLUDE_TRACK_BUFFERS) {
148
- trans_track_to_cblock_buf = trans_per_buf (R_minW_nmos / 4 ., R_minW_nmos,
149
- R_minW_pmos);
151
+ trans_track_to_cblock_buf = trans_per_buf (R_minW_nmos / 4 ., R_minW_nmos, R_minW_pmos);
150
152
} else {
151
153
trans_track_to_cblock_buf = 0 ;
152
154
}
153
155
154
- num_inputs_to_cblock = new int [rr_graph.num_nodes ()];
155
- for (size_t cb = 0 ; cb < rr_graph.num_nodes (); cb++)
156
- num_inputs_to_cblock[cb] = 0 ;
157
-
158
156
maxlen = std::max (device_ctx.grid .width (), device_ctx.grid .height ());
159
157
cblock_counted = new bool [maxlen];
160
158
shared_buffer_trans = new float [maxlen];
@@ -169,7 +167,7 @@ void count_bidir_routing_transistors(int num_switch, int wire_to_ipin_switch, fl
169
167
sharable_switch_trans = alloc_and_load_sharable_switch_trans (num_switch,
170
168
R_minW_nmos, R_minW_pmos);
171
169
172
- for (const RRNodeId& from_rr_node : device_ctx.rr_graph .nodes ()) {
170
+ for (const RRNodeId from_rr_node : device_ctx.rr_graph .nodes ()) {
173
171
size_t from_node = (size_t )from_rr_node;
174
172
from_rr_type = rr_graph.node_type (from_rr_node);
175
173
@@ -210,9 +208,8 @@ void count_bidir_routing_transistors(int num_switch, int wire_to_ipin_switch, fl
210
208
break ;
211
209
212
210
case e_rr_type::IPIN:
213
- num_inputs_to_cblock[size_t (to_node)]++;
214
- max_inputs_to_cblock = std::max (max_inputs_to_cblock,
215
- num_inputs_to_cblock[size_t (to_node)]);
211
+ num_inputs_to_cblock[to_node]++;
212
+ max_inputs_to_cblock = std::max (max_inputs_to_cblock, num_inputs_to_cblock[to_node]);
216
213
217
214
iseg = seg_index_of_cblock (rr_graph, from_rr_type, size_t (to_node));
218
215
@@ -293,8 +290,6 @@ void count_bidir_routing_transistors(int num_switch, int wire_to_ipin_switch, fl
293
290
input_cblock_trans = get_cblock_trans (num_inputs_to_cblock, wire_to_ipin_switch,
294
291
max_inputs_to_cblock, trans_sram_bit);
295
292
296
- delete[] num_inputs_to_cblock;
297
-
298
293
ntrans_sharing += input_cblock_trans;
299
294
ntrans_no_sharing += input_cblock_trans;
300
295
@@ -317,17 +312,14 @@ void count_unidir_routing_transistors(std::vector<t_segment_inf>& /*segment_inf*
317
312
const auto & rr_graph = device_ctx.rr_graph ;
318
313
319
314
bool * cblock_counted; /* [0..max(device_ctx.grid.width(),device_ctx.grid.height())] -- 0th element unused. */
320
- int * num_inputs_to_cblock; /* [0..device_ctx.rr_nodes.size()-1], but all entries not */
321
-
322
- /* corresponding to IPINs will be 0. */
315
+ vtr::vector<RRNodeId, int > num_inputs_to_cblock (rr_graph.num_nodes (), 0 ); // entries not corresponding to IPINs will be 0
323
316
324
317
e_rr_type from_rr_type, to_rr_type;
325
318
int i, j, iseg, iedge, num_edges, maxlen;
326
319
int max_inputs_to_cblock;
327
320
float input_cblock_trans;
328
321
329
- /* August 2014:
330
- * In a unidirectional architecture all the fanin to a wire segment comes from
322
+ /* In a unidirectional architecture all the fanin to a wire segment comes from
331
323
* a single mux. We should count this mux only once as we look at the outgoing
332
324
* switches of all rr nodes. Thus we keep track of which muxes we have already
333
325
* counted via the variable below. */
@@ -361,17 +353,13 @@ void count_unidir_routing_transistors(std::vector<t_segment_inf>& /*segment_inf*
361
353
trans_track_to_cblock_buf = 0 ;
362
354
}
363
355
364
- num_inputs_to_cblock = new int [rr_graph.num_nodes ()];
365
- for (size_t c = 0 ; c < rr_graph.num_nodes (); c++)
366
- num_inputs_to_cblock[c] = 0 ;
367
-
368
356
maxlen = std::max (device_ctx.grid .width (), device_ctx.grid .height ());
369
357
cblock_counted = new bool [maxlen];
370
358
for (auto k = 0 ; k < maxlen; k++)
371
359
cblock_counted[k] = 0 ;
372
360
373
361
ntrans = 0 ;
374
- for (const RRNodeId& from_rr_node : device_ctx.rr_graph .nodes ()) {
362
+ for (const RRNodeId from_rr_node : device_ctx.rr_graph .nodes ()) {
375
363
size_t from_node = size_t (from_rr_node);
376
364
from_rr_type = rr_graph.node_type (from_rr_node);
377
365
@@ -395,7 +383,7 @@ void count_unidir_routing_transistors(std::vector<t_segment_inf>& /*segment_inf*
395
383
case e_rr_type::CHANY:
396
384
if (!chan_node_switch_done[size_t (to_node)]) {
397
385
int switch_index = rr_graph.edge_switch (RRNodeId (from_node), iedge);
398
- auto switch_type = rr_graph.rr_switch_inf (RRSwitchId (switch_index)).type ();
386
+ SwitchType switch_type = rr_graph.rr_switch_inf (RRSwitchId (switch_index)).type ();
399
387
400
388
int fan_in = rr_graph.node_fan_in (to_node);
401
389
@@ -411,7 +399,7 @@ void count_unidir_routing_transistors(std::vector<t_segment_inf>& /*segment_inf*
411
399
* the rr switches were created from the arch switches */
412
400
ntrans += rr_graph.rr_switch_inf (RRSwitchId (switch_index)).buf_size ;
413
401
} else if (switch_type == SwitchType::SHORT) {
414
- ntrans += 0 .; // Electrical shorts contribute no transisitor area
402
+ ntrans += 0 .; // Electrical shorts contribute no transistor area
415
403
} else if (switch_type == SwitchType::BUFFER) {
416
404
if (fan_in != 1 ) {
417
405
std::string msg = vtr::string_fmt (
@@ -434,9 +422,8 @@ void count_unidir_routing_transistors(std::vector<t_segment_inf>& /*segment_inf*
434
422
break ;
435
423
436
424
case e_rr_type::IPIN:
437
- num_inputs_to_cblock[size_t (to_node)]++;
438
- max_inputs_to_cblock = std::max (max_inputs_to_cblock,
439
- num_inputs_to_cblock[size_t (to_node)]);
425
+ num_inputs_to_cblock[to_node]++;
426
+ max_inputs_to_cblock = std::max (max_inputs_to_cblock, num_inputs_to_cblock[to_node]);
440
427
iseg = seg_index_of_cblock (rr_graph, from_rr_type, size_t (to_node));
441
428
442
429
if (cblock_counted[iseg] == false ) {
@@ -448,6 +435,10 @@ void count_unidir_routing_transistors(std::vector<t_segment_inf>& /*segment_inf*
448
435
case e_rr_type::SINK:
449
436
break ; // ignore virtual sinks
450
437
438
+ case e_rr_type::CHANZ:
439
+ // TODO: handle chanz
440
+ break ;
441
+
451
442
default :
452
443
VPR_ERROR (VPR_ERROR_ROUTE,
453
444
" in count_routing_transistors:\n "
@@ -470,9 +461,14 @@ void count_unidir_routing_transistors(std::vector<t_segment_inf>& /*segment_inf*
470
461
cblock_counted[j] = false ;
471
462
}
472
463
break ;
464
+
473
465
case e_rr_type::OPIN:
474
466
break ;
475
467
468
+ case e_rr_type::CHANZ:
469
+ // TODO: handle chanz
470
+ break ;
471
+
476
472
default :
477
473
break ;
478
474
@@ -485,7 +481,6 @@ void count_unidir_routing_transistors(std::vector<t_segment_inf>& /*segment_inf*
485
481
max_inputs_to_cblock, trans_sram_bit);
486
482
487
483
delete[] cblock_counted;
488
- delete[] num_inputs_to_cblock;
489
484
490
485
ntrans += input_cblock_trans;
491
486
@@ -494,7 +489,10 @@ void count_unidir_routing_transistors(std::vector<t_segment_inf>& /*segment_inf*
494
489
VTR_LOG (" \t Total routing area: %#g, per logic tile: %#g\n " , ntrans, ntrans / (float )(device_ctx.grid .get_num_layers () * device_ctx.grid .width () * device_ctx.grid .height ()));
495
490
}
496
491
497
- static float get_cblock_trans (int * num_inputs_to_cblock, int wire_to_ipin_switch, int max_inputs_to_cblock, float trans_sram_bit) {
492
+ static float get_cblock_trans (vtr::vector<RRNodeId, int >& num_inputs_to_cblock,
493
+ int wire_to_ipin_switch,
494
+ int max_inputs_to_cblock,
495
+ float trans_sram_bit) {
498
496
/* Computes the transistors in the input connection block multiplexers and *
499
497
* the buffers from connection block outputs to the logic block input pins. *
500
498
* For speed, I precompute the number of transistors in the multiplexers of *
@@ -522,8 +520,8 @@ static float get_cblock_trans(int* num_inputs_to_cblock, int wire_to_ipin_switch
522
520
523
521
trans_count = 0 .;
524
522
525
- for (const RRNodeId& rr_id : device_ctx.rr_graph .nodes ()) {
526
- num_inputs = num_inputs_to_cblock[( size_t ) rr_id];
523
+ for (const RRNodeId rr_id : device_ctx.rr_graph .nodes ()) {
524
+ num_inputs = num_inputs_to_cblock[rr_id];
527
525
trans_count += trans_per_cblock[num_inputs];
528
526
}
529
527
0 commit comments