25
25
* - This avoids massive changes for each client on using the APIs
26
26
* as each frame view provides adhoc APIs for each client
27
27
*
28
- * TODO: more compact frame views will be created, e.g.,
28
+ * TODO: more compact frame views will be created, e.g.,
29
29
* - a mini frame view: contains only node and edges, representing the connectivity of the graph
30
- * - a geometry frame view: an extended mini frame view with node-level attributes,
30
+ * - a geometry frame view: an extended mini frame view with node-level attributes,
31
31
* in particular geometry information (type, x, y etc).
32
32
*
33
33
*/
@@ -45,29 +45,29 @@ class RRGraphView {
45
45
const vtr::vector<RRSwitchId, t_rr_switch_inf>& rr_switch_inf);
46
46
47
47
/* Disable copy constructors and copy assignment operator
48
- * This is to avoid accidental copy because it could be an expensive operation considering that the
48
+ * This is to avoid accidental copy because it could be an expensive operation considering that the
49
49
* memory footprint of the data structure could ~ Gb
50
- * Using the following syntax, we prohibit accidental 'pass-by-value' which can be immediately caught
50
+ * Using the following syntax, we prohibit accidental 'pass-by-value' which can be immediately caught
51
51
* by compiler
52
52
*/
53
53
RRGraphView (const RRGraphView&) = delete ;
54
54
void operator =(const RRGraphView&) = delete ;
55
55
56
56
/* -- Accessors -- */
57
- /* TODO: The accessors may be turned into private later if they are replacable by 'questionin'
57
+ /* TODO: The accessors may be turned into private later if they are replacable by 'questionin'
58
58
* kind of accessors
59
59
*/
60
60
public:
61
61
/* Aggregates: create range-based loops for nodes
62
- * To iterate over the nodes in a RRGraph,
63
- * using a range-based loop is suggested.
64
- * -----------------------------------------------------------------
65
- * Example: iterate over all the nodes
66
- * // Strongly suggest to use a read-only rr_graph object
67
- * const RRGraph& rr_graph;
68
- * for (const RRNodeId& node : rr_graph.nodes()) {
69
- * // Do something with each node
70
- * }
62
+ * To iterate over the nodes in a RRGraph,
63
+ * using a range-based loop is suggested.
64
+ * -----------------------------------------------------------------
65
+ * Example: iterate over all the nodes
66
+ * // Strongly suggest to use a read-only rr_graph object
67
+ * const RRGraph& rr_graph;
68
+ * for (const RRNodeId& node : rr_graph.nodes()) {
69
+ * // Do something with each node
70
+ * }
71
71
*/
72
72
inline vtr::StrongIdRange<RRNodeId> nodes () const {
73
73
return vtr::StrongIdRange<RRNodeId>(RRNodeId (0 ), RRNodeId (num_nodes ()));
@@ -188,7 +188,7 @@ class RRGraphView {
188
188
&& (node_xhigh (node) == -1 ) && (node_yhigh (node) == -1 ));
189
189
}
190
190
191
- /* * @brief Check if two routing resource nodes are adjacent (must be a CHANX and a CHANY).
191
+ /* * @brief Check if two routing resource nodes are adjacent (must be a CHANX and a CHANY).
192
192
* This function is used for error checking; it checks if two nodes are physically adjacent (could be connected) based on their geometry.
193
193
* It does not check the routing edges to see if they are, in fact, possible to connect in the current routing graph.
194
194
* This function is inlined for runtime optimization. */
@@ -203,7 +203,7 @@ class RRGraphView {
203
203
return true ;
204
204
}
205
205
206
- /* * @brief Check if node is within bounding box.
206
+ /* * @brief Check if node is within bounding box.
207
207
* To return true, the RRNode must be completely contained within the specified bounding box, with the edges of the bounding box being inclusive.
208
208
*This function is inlined for runtime optimization. */
209
209
inline bool node_is_inside_bounding_box (RRNodeId node, vtr::Rect<int > bounding_box) const {
@@ -307,6 +307,13 @@ class RRGraphView {
307
307
return node_storage_.edge_sink_node (id, iedge);
308
308
}
309
309
310
+ /* * @brief Get the source node for the iedge'th edge from specified RRNodeId.
311
+ * This method should generally not be used, and instead first_edge and
312
+ * last_edge should be used.*/
313
+ inline RRNodeId edge_source_node (RRNodeId id, t_edge_size iedge) const {
314
+ return node_storage_.edge_source_node (id, iedge);
315
+ }
316
+
310
317
/* * @brief Detect if the edge is a configurable edge (controlled by a programmable routing multipler or a tri-state switch). */
311
318
inline bool edge_is_configurable (RRNodeId id, t_edge_size iedge) const {
312
319
return node_storage_.edge_is_configurable (id, iedge, rr_switch_inf_);
@@ -322,16 +329,16 @@ class RRGraphView {
322
329
return node_storage_.num_non_configurable_edges (node, rr_switch_inf_);
323
330
}
324
331
325
- /* * @brief A configurable edge represents a programmable switch between routing resources, which could be
332
+ /* * @brief A configurable edge represents a programmable switch between routing resources, which could be
326
333
* a multiplexer
327
334
* a tri-state buffer
328
- * a pass gate
335
+ * a pass gate
329
336
* This API gets ID range for configurable edges. This function is inlined for runtime optimization. */
330
337
inline edge_idx_range configurable_edges (RRNodeId node) const {
331
338
return vtr::make_range (edge_idx_iterator (0 ), edge_idx_iterator (node_storage_.num_edges (node) - num_non_configurable_edges (node)));
332
339
}
333
340
334
- /* * @brief A non-configurable edge represents a hard-wired connection between routing resources, which could be
341
+ /* * @brief A non-configurable edge represents a hard-wired connection between routing resources, which could be
335
342
* a non-configurable buffer that can not be turned off
336
343
* a short metal connection that can not be turned off
337
344
* This API gets ID range for non-configurable edges. This function is inlined for runtime optimization. */
@@ -357,26 +364,26 @@ class RRGraphView {
357
364
return node_storage_.num_edges (node);
358
365
}
359
366
360
- /* * @brief The ptc_num carries different meanings for different node types
361
- * (true in VPR RRG that is currently supported, may not be true in customized RRG)
362
- * CHANX or CHANY: the track id in routing channels
363
- * OPIN or IPIN: the index of pins in the logic block data structure
364
- * SOURCE and SINK: the class id of a pin (indicating logic equivalence of pins) in the logic block data structure
365
- * @note
366
- * This API is very powerful and developers should not use it unless it is necessary,
367
- * e.g the node type is unknown. If the node type is known, the more specific routines, `node_pin_num()`,
367
+ /* * @brief The ptc_num carries different meanings for different node types
368
+ * (true in VPR RRG that is currently supported, may not be true in customized RRG)
369
+ * CHANX or CHANY: the track id in routing channels
370
+ * OPIN or IPIN: the index of pins in the logic block data structure
371
+ * SOURCE and SINK: the class id of a pin (indicating logic equivalence of pins) in the logic block data structure
372
+ * @note
373
+ * This API is very powerful and developers should not use it unless it is necessary,
374
+ * e.g the node type is unknown. If the node type is known, the more specific routines, `node_pin_num()`,
368
375
* `node_track_num()`and `node_class_num()`, for different types of nodes should be used.*/
369
376
inline short node_ptc_num (RRNodeId node) const {
370
377
return node_storage_.node_ptc_num (node);
371
378
}
372
379
373
- /* * @brief Get the pin num of a routing resource node. This is designed for logic blocks,
380
+ /* * @brief Get the pin num of a routing resource node. This is designed for logic blocks,
374
381
* which are IPIN and OPIN nodes. This function is inlined for runtime optimization. */
375
382
inline short node_pin_num (RRNodeId node) const {
376
383
return node_storage_.node_pin_num (node);
377
384
}
378
385
379
- /* * @brief Get the track num of a routing resource node. This is designed for routing tracks,
386
+ /* * @brief Get the track num of a routing resource node. This is designed for routing tracks,
380
387
* which are CHANX and CHANY nodes. This function is inlined for runtime optimization. */
381
388
inline short node_track_num (RRNodeId node) const {
382
389
return node_storage_.node_track_num (node);
@@ -498,7 +505,7 @@ class RRGraphView {
498
505
/* rr_indexed_data_ and rr_segments_ are needed to lookup the segment information in node_coordinate_to_string() */
499
506
const vtr::vector<RRIndexedDataId, t_rr_indexed_data>& rr_indexed_data_;
500
507
501
- /* RC data for nodes. This is a flyweight data */
508
+ /* RC data for nodes. This is a flyweight data */
502
509
const std::vector<t_rr_rc_data>& rr_rc_data_;
503
510
504
511
/* Segment info for rr nodes */
0 commit comments