@@ -36,16 +36,21 @@ class RRGraphBuilder {
36
36
public:
37
37
/* * @brief Return a writable object for rr_nodes */
38
38
t_rr_graph_storage& rr_nodes ();
39
+
39
40
/* * @brief Return a writable object for update the fast look-up of rr_node */
40
41
RRSpatialLookup& node_lookup ();
42
+
41
43
/* * @warning The Metadata should stay as an independent data structure from the rest of the internal data,
42
44
* e.g., node_lookup! */
43
45
/* * @brief Return a writable object for the meta data on the nodes */
44
46
MetadataStorage<int >& rr_node_metadata ();
47
+
45
48
/* * @brief Return a writable object for the meta data on the edge */
46
49
MetadataStorage<std::tuple<int , int , short >>& rr_edge_metadata ();
50
+
47
51
/* * @brief Return a writable object fo the incoming edge storage */
48
52
vtr::vector<RRNodeId, std::vector<RREdgeId>>& node_in_edge_storage ();
53
+
49
54
/* * @brief Return a writable object of the node ptc storage (for tileable routing resource graph) */
50
55
vtr::vector<RRNodeId, std::vector<short >>& node_ptc_storage ();
51
56
@@ -241,9 +246,16 @@ class RRGraphBuilder {
241
246
node_storage_.set_node_track_num (id, new_track_num);
242
247
}
243
248
249
+ // ** The following functions are only used for tileable routing resource graph generator **
250
+
244
251
/* * @brief Add a track id for a given node base on the offset in coordinate, applicable only to CHANX and CHANY nodes.
245
252
* This API is used by tileable routing resource graph generator, which requires each routing track has a different
246
253
* track id depending their location in FPGA fabric.
254
+ *
255
+ * @param node The node to add the track id to.
256
+ * @param node_offset Location of the portion of the node being considered. It is used
257
+ * to calculate the relative location from the beginning of the node.
258
+ * @param track_id The track id to add to the node.
247
259
*/
248
260
void add_node_track_num (RRNodeId node, vtr::Point<size_t > node_offset, short track_id);
249
261
@@ -256,17 +268,17 @@ class RRGraphBuilder {
256
268
}
257
269
258
270
/* * @brief set_node_mux_num() is designed for routing mux nodes */
259
- inline void set_node_mux_num (RRNodeId id, int new_class_num ) {
260
- node_storage_.set_node_mux_num (id, new_class_num );
271
+ inline void set_node_mux_num (RRNodeId id, int new_mux_num ) {
272
+ node_storage_.set_node_mux_num (id, new_mux_num );
261
273
}
262
274
263
- /* * @brief Add a list of ptc number in string (split by comma) to a given node. This function is used by rr graph reader only. Not suggested for internal builder!!! */
275
+ /* * @brief Add a list of ptc number in string (split by comma) to a given node. This function is used by rr graph reader only. */
264
276
void set_node_ptc_nums (RRNodeId node, const std::string& ptc_str);
265
277
266
- /* * @brief With a given node, output ptc numbers into a string (use comma as delima). This function is used by rr graph writer only. Not suggested for internal builder!!! */
278
+ /* * @brief With a given node, output ptc numbers into a string (use comma as delima). This function is used by rr graph writer only. */
267
279
std::string node_ptc_nums_to_string (RRNodeId node) const ;
268
280
269
- /* * @brief Identify if a node contains multiple ptc numbers. Mainly used by I/O reader only. Not suggest for internal builder */
281
+ /* * @brief Identify if a node contains multiple ptc numbers. It is used for tileable RR Graph and mainly used by I/O reader only. */
270
282
bool node_contain_multiple_ptc (RRNodeId node) const ;
271
283
272
284
/* * @brief Set the node direction; The node direction is only available of routing channel nodes, such as x-direction routing tracks (CHANX) and y-direction routing tracks (CHANY). For other nodes types, this value is not meaningful and should be set to NONE. */
@@ -275,8 +287,8 @@ class RRGraphBuilder {
275
287
}
276
288
277
289
/* * @brief Add a new edge to the cache of edges to be built
278
- * .. note:: This will not add an edge to storage! You need to call build_edges() after all the edges are cached! */
279
- void create_edge (RRNodeId src, RRNodeId dest, RRSwitchId edge_switch, bool remapped);
290
+ * @ note This will not add an edge to storage. You need to call build_edges() after all the edges are cached. */
291
+ void create_edge_in_cache (RRNodeId src, RRNodeId dest, RRSwitchId edge_switch, bool remapped);
280
292
281
293
/* * @brief Allocate and build actual edges in storage.
282
294
* Once called, the cached edges will be uniquified and added to routing resource nodes,
@@ -295,6 +307,8 @@ class RRGraphBuilder {
295
307
*/
296
308
std::vector<RREdgeId> node_in_edges (RRNodeId node) const ;
297
309
310
+ // ** End of functions for tileable routing resource graph generator **
311
+
298
312
/* * @brief Set the node id for clock network virtual sink */
299
313
inline void set_virtual_clock_network_root_idx (RRNodeId virtual_clock_network_root_idx) {
300
314
node_storage_.set_virtual_clock_network_root_idx (virtual_clock_network_root_idx);
@@ -370,11 +384,6 @@ class RRGraphBuilder {
370
384
return node_storage_.count_rr_switches (arch_switch_inf, arch_switch_fanins);
371
385
}
372
386
373
- /* *
374
- * @brief Unlock storage; required to modify an routing resource graph after edge is read
375
- */
376
- inline void unlock_storage () { node_storage_.edges_read_ = false ; node_storage_.partitioned_ = false ; node_storage_.clear_node_first_edge ();}
377
-
378
387
/* * @brief Reserve the lists of nodes, edges, switches etc. to be memory efficient.
379
388
* This function is mainly used to reserve memory space inside RRGraph,
380
389
* when adding a large number of nodes/edge/switches/segments,
@@ -393,9 +402,9 @@ class RRGraphBuilder {
393
402
inline void resize_nodes (size_t size) {
394
403
node_storage_.resize (size);
395
404
}
396
- /* * @brief This function resize node ptc nums. Only used by RR graph I/O reader and writers. Do not use for internal builder */
405
+ /* * @brief This function resize node ptc nums. Only used by RR graph I/O reader and writers. */
397
406
inline void resize_node_ptc_nums (size_t size) {
398
- node_ptc_nums_ .resize (size);
407
+ node_tilable_track_nums_ .resize (size);
399
408
}
400
409
401
410
@@ -404,7 +413,8 @@ class RRGraphBuilder {
404
413
rr_switch_inf_.resize (size);
405
414
}
406
415
407
- /* * @brief Validate that edge data is partitioned correctly. Also there are no edges left to be built!
416
+ /* * @brief Validate that edge data is partitioned correctly. This function should be called
417
+ * when all edges in cache are added.
408
418
* @note This function is used to validate the correctness of the routing resource graph in terms
409
419
* of graph attributes. Strongly recommend to call it when you finish the building a routing resource
410
420
* graph. If you need more advance checks, which are related to architecture features, you should
@@ -459,8 +469,13 @@ class RRGraphBuilder {
459
469
460
470
/* *
461
471
* @brief A cache for edge-related information, required to build edges for routing resource nodes.
462
- * @note It is used when building a routing resource graph by considering memory efficiency.
463
- * It will be clear up after calling build_edges().
472
+ * @note It is used when building a routing resource graph. It is a set of edges that have not yet been
473
+ * added to the main rr-graph edge storage to avoid an expensive edge-by-edge reallocation or re-shuffling
474
+ * of edges in the main rr-graph edge storage.
475
+ *
476
+ * @note It will be cleared after calling build_edges().
477
+ *
478
+ * @note This data structure is only used for tileable routing resource graph generator.
464
479
*
465
480
* @warning This is a temporary data which is used to collect edges to be built for nodes
466
481
*/
@@ -490,15 +505,16 @@ class RRGraphBuilder {
490
505
/* *
491
506
* @brief A list of incoming edges for each routing resource node.
492
507
* @note This can be built optionally, as required by applications.
493
- * By default, it is empty! Call build_in_edges() to construct it!!!
508
+ * By default, it is empty! Call build_in_edges() to construct it.
494
509
*/
495
510
vtr::vector<RRNodeId, std::vector<RREdgeId>> node_in_edges_;
496
511
497
512
/* *
498
513
* @brief Extra ptc number for each routing resource node.
499
- * @note This is required by tileable routing resource graph.
514
+ * @note This is required by tileable routing resource graphs. The first index is the node id, and
515
+ * the second index is is the relative distance from the starting point of the node.
500
516
* @details
501
- * In a tileable routing architecture, routing tracks, e.g., CHANX and CHANY, follows a staggered organization.
517
+ * In a tileable routing architecture, routing tracks, e.g., CHANX and CHANY, follow a staggered organization.
502
518
* Hence, a routing track may appear in different routing channels, representing different ptc/track id.
503
519
* Here is an illustrative example of a X-direction routing track (CHANX) in INC direction, which is organized in staggered way.
504
520
*
@@ -514,7 +530,7 @@ class RRGraphBuilder {
514
530
* | |
515
531
* starting point ending point
516
532
*/
517
- vtr::vector<RRNodeId, std::vector<short >> node_ptc_nums_ ;
533
+ vtr::vector<RRNodeId, std::vector<short >> node_tilable_track_nums_ ;
518
534
519
535
/* * @warning The Metadata should stay as an independent data structure from the rest of the internal data,
520
536
* e.g., node_lookup! */
@@ -542,8 +558,15 @@ class RRGraphBuilder {
542
558
*/
543
559
MetadataStorage<std::tuple<int , int , short >> rr_edge_metadata_;
544
560
545
- /* * @brief a flag to mark the status of edge storage
546
- * dirty means that the edge storage is not complete, should call related APIs to build */
561
+ /* *
562
+ * @brief This flag indicates if all the edges in cache are added to the main rr-graph edge storage.
563
+ * To add all edges in cache to the main rr-graph edge storage, call build_edges().
564
+ */
547
565
bool is_edge_dirty_;
566
+
567
+ /* *
568
+ * @brief This flag indicates whether node_in_edges_ is updated with
569
+ * edges in the main rr-graph edge storage.
570
+ */
548
571
bool is_incoming_edge_dirty_;
549
572
};
0 commit comments