@@ -87,11 +87,13 @@ struct RR_Graph_Builder {
87
87
RR_Graph_Builder (Device::Reader& arch_reader,
88
88
const DeviceGrid& grid,
89
89
DeviceContext& device_ctx,
90
- const std::vector<t_physical_tile_type>& physical_tile_types ,
90
+ t_rr_graph_storage& rr_nodes ,
91
91
const vtr::vector<RRSegmentId, t_segment_inf>& segment_inf,
92
+ const std::vector<t_physical_tile_type>& physical_tile_types,
92
93
const enum e_base_cost_type base_cost_type)
93
94
: ar_(arch_reader)
94
95
, device_ctx_(device_ctx)
96
+ , rr_nodes_(rr_nodes)
95
97
, segment_inf_(segment_inf)
96
98
, grid_(grid)
97
99
, base_cost_type_(base_cost_type) {
@@ -137,6 +139,7 @@ struct RR_Graph_Builder {
137
139
private:
138
140
Device::Reader& ar_;
139
141
DeviceContext& device_ctx_;
142
+ t_rr_graph_storage& rr_nodes_;
140
143
const vtr::vector<RRSegmentId, t_segment_inf>& segment_inf_;
141
144
const DeviceGrid& grid_;
142
145
const enum e_base_cost_type base_cost_type_;
@@ -288,7 +291,7 @@ struct RR_Graph_Builder {
288
291
289
292
int it = 0 ;
290
293
291
- for (auto const & switch_id : device_ctx_.rr_switch_inf ) {
294
+ for (auto const & switch_id : device_ctx_.rr_graph . rr_switch () ) {
292
295
VTR_LOG (" Switch: %d Name:%s\n " , it++, switch_id.name );
293
296
}
294
297
@@ -361,13 +364,20 @@ struct RR_Graph_Builder {
361
364
std::set<std::tuple<int /* timing*/ , bool /* buffered*/ >> seen;
362
365
pip_types (seen, ar_);
363
366
364
- device_ctx_.rr_switch_inf .resize (seen.size () + 2 );
367
+ std::vector<t_rr_switch_inf> switches;
368
+ switches.resize (seen.size () + 2 );
365
369
366
370
std::vector<std::tuple<std::tuple<int , bool >, int >> temp_;
367
- process_switches_array<t_rr_switch_inf*, int >(ar_, seen, device_ctx_.rr_switch_inf .data (), temp_);
368
- for (auto i : temp_) {
371
+ process_switches_array<std::vector<t_rr_switch_inf>&, int >(ar_, seen, switches, temp_);
372
+
373
+ auto & rr_switches = device_ctx_.rr_graph_builder .rr_switch ();
374
+ rr_switches.resize (seen.size () + 2 );
375
+
376
+ for (int i = 0 ; i < (int )switches.size (); i++)
377
+ rr_switches[RRSwitchId (i)] = switches[i];
378
+
379
+ for (auto i : temp_)
369
380
pips_models_[std::get<0 >(i)] = std::get<1 >(i);
370
- }
371
381
}
372
382
373
383
/*
@@ -1327,9 +1337,9 @@ struct RR_Graph_Builder {
1327
1337
chan_loc_map_[std::make_tuple (track_loc, track_type)][track_idx] = std::make_tuple (track_seg, track_R, track_C, end);
1328
1338
}
1329
1339
1330
- device_ctx_. rr_nodes .make_room_for_node (RRNodeId (rr_idx));
1340
+ rr_nodes_ .make_room_for_node (RRNodeId (rr_idx));
1331
1341
loc_type_idx_to_rr_idx_[std::make_tuple (loc, pin, j)] = rr_idx;
1332
- auto node = device_ctx_. rr_nodes [rr_idx];
1342
+ auto node = rr_nodes_ [rr_idx];
1333
1343
RRNodeId node_id = node.id ();
1334
1344
device_ctx_.rr_graph_builder .set_node_type (node_id, pin);
1335
1345
device_ctx_.rr_graph_builder .set_node_capacity (node_id, 1 );
@@ -1351,9 +1361,9 @@ struct RR_Graph_Builder {
1351
1361
continue ;
1352
1362
e_rr_type pin = input ? e_rr_type::IPIN : e_rr_type::OPIN;
1353
1363
1354
- device_ctx_. rr_nodes .make_room_for_node (RRNodeId (rr_idx));
1364
+ rr_nodes_ .make_room_for_node (RRNodeId (rr_idx));
1355
1365
loc_type_idx_to_rr_idx_[std::make_tuple (loc, pin, j)] = rr_idx;
1356
- auto node = device_ctx_. rr_nodes [rr_idx];
1366
+ auto node = rr_nodes_ [rr_idx];
1357
1367
RRNodeId node_id = node.id ();
1358
1368
device_ctx_.rr_graph_builder .set_node_type (node_id, pin);
1359
1369
device_ctx_.rr_graph_builder .set_node_capacity (node_id, 1 );
@@ -1387,9 +1397,9 @@ struct RR_Graph_Builder {
1387
1397
std::tie (seg, R, C, end) = track.second ;
1388
1398
std::tie (x1, y1 ) = end;
1389
1399
1390
- device_ctx_. rr_nodes .make_room_for_node (RRNodeId (rr_idx));
1400
+ rr_nodes_ .make_room_for_node (RRNodeId (rr_idx));
1391
1401
loc_type_idx_to_rr_idx_[std::make_tuple (loc, type, track.first )] = rr_idx;
1392
- auto node = device_ctx_. rr_nodes [rr_idx];
1402
+ auto node = rr_nodes_ [rr_idx];
1393
1403
RRNodeId node_id = node.id ();
1394
1404
1395
1405
device_ctx_.rr_graph_builder .set_node_type (node_id, type);
@@ -1413,11 +1423,11 @@ struct RR_Graph_Builder {
1413
1423
}
1414
1424
1415
1425
void pack_rr_nodes () {
1416
- device_ctx_. rr_nodes .clear ();
1426
+ rr_nodes_ .clear ();
1417
1427
seg_index_.resize (CHANX_COST_INDEX_START + 2 * segment_inf_.size (), -1 );
1418
1428
pack_tiles ();
1419
1429
pack_chans ();
1420
- device_ctx_. rr_nodes .shrink_to_fit ();
1430
+ rr_nodes_ .shrink_to_fit ();
1421
1431
}
1422
1432
1423
1433
void pack_tiles_edges () {
@@ -1553,8 +1563,8 @@ struct RR_Graph_Builder {
1553
1563
device_ctx_.rr_graph_builder .node_lookup ().resize_nodes (grid_.width (), grid_.height (), rr_type, NUM_SIDES);
1554
1564
}
1555
1565
}
1556
- for (size_t node = 0 ; node < device_ctx_. rr_nodes .size (); node++) {
1557
- auto rr_node = device_ctx_. rr_nodes [node];
1566
+ for (size_t node = 0 ; node < rr_nodes_ .size (); node++) {
1567
+ auto rr_node = rr_nodes_ [node];
1558
1568
device_ctx_.rr_graph_builder .add_node_to_all_locs (rr_node.id ());
1559
1569
}
1560
1570
@@ -1595,9 +1605,11 @@ void build_rr_graph_fpga_interchange(const t_graph_type graph_type,
1595
1605
1596
1606
auto & device_ctx = g_vpr_ctx.mutable_device ();
1597
1607
size_t num_segments = segment_inf.size ();
1598
- device_ctx.rr_segments .reserve (num_segments);
1608
+
1609
+ auto & rr_segments = device_ctx.rr_graph_builder .rr_segments ();
1610
+ rr_segments.reserve (num_segments);
1599
1611
for (long unsigned int iseg = 0 ; iseg < num_segments; ++iseg) {
1600
- device_ctx. rr_segments .push_back (segment_inf[(iseg)]);
1612
+ rr_segments.push_back (segment_inf[(iseg)]);
1601
1613
}
1602
1614
1603
1615
// Decompress GZipped capnproto device file
@@ -1636,7 +1648,14 @@ void build_rr_graph_fpga_interchange(const t_graph_type graph_type,
1636
1648
1637
1649
auto device_reader = message_reader.getRoot <DeviceResources::Device>();
1638
1650
1639
- RR_Graph_Builder builder (device_reader, grid, device_ctx, device_ctx.physical_tile_types , device_ctx.rr_segments , base_cost_type);
1651
+ RR_Graph_Builder builder (
1652
+ device_reader,
1653
+ grid,
1654
+ device_ctx,
1655
+ device_ctx.rr_graph_builder .rr_nodes (),
1656
+ device_ctx.rr_graph .rr_segments (),
1657
+ device_ctx.physical_tile_types ,
1658
+ base_cost_type);
1640
1659
builder.build_rr_graph ();
1641
1660
*wire_to_rr_ipin_switch = 0 ;
1642
1661
device_ctx.read_rr_graph_filename .assign (get_arch_file_name ());
0 commit comments