-
Notifications
You must be signed in to change notification settings - Fork 414
Add RRGraph
-related API to documentation and clean-up RRSpatialLookup
methods
#1837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
28a572f
[Doc] Add RRGraph-related API to documentation
tangxifan e40e25e
[VPR] Adapt code comments in RRSpatialLookup to be docxgen compatible
tangxifan 471bd84
[VPR] Adapt code comments in rr_graph_builder.h to be docxgen compatible
tangxifan 38672a9
[Doc] Bug fix in calling docxgen for RRGraph APIs
tangxifan e9233aa
[VPR] Update code comments to be identified by Docxgen
tangxifan f330f63
[VPR] Try to see if Docxygen only accepts 1-line member funciton defi…
tangxifan c141f6a
[VPR] Update comments for rr_spatial_lookup member functions to be vi…
tangxifan 9e23361
[Doc] Change doxygen entity to RRSpaitialLookup class instead of file
tangxifan 03525f8
[VPR] Change code comments
tangxifan 8f31581
[Doc] Remain use file in API doc
tangxifan 20ec681
[Doc] Bug fix
tangxifan 6464598
[Doc] Add RRSpatialLookup class to api doc
tangxifan a53ab00
[VPR] format the code
tangxifan 7e3c88f
[VPR] Update comments for RRSpatialLookup
tangxifan e54b700
[VPR] Update code comments in RRGraphBuilder
tangxifan 1cc01db
[Doc] Update doc API to include member functions of RRGraphBuilder an…
tangxifan 0fbc84b
[VPR] Update code comments
tangxifan e7d2255
[VPR] Reworked code comments by fixing typo and remove TODO items fro…
tangxifan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,3 +8,4 @@ VPR API | |
|
||
contexts | ||
netlist | ||
rr_graph |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
====================== | ||
Routing Resource Graph | ||
====================== | ||
|
||
RRGraphView | ||
----------- | ||
|
||
.. doxygenfile:: rr_graph_view.h | ||
:project: vpr | ||
:sections: detaileddescription | ||
|
||
.. doxygenclass:: RRGraphView | ||
:project: vpr | ||
:members: | ||
|
||
RRGraphBuilder | ||
-------------- | ||
|
||
.. doxygenfile:: rr_graph_builder.h | ||
:project: vpr | ||
:sections: detaileddescription | ||
|
||
.. doxygenclass:: RRGraphBuilder | ||
:project: vpr | ||
:members: | ||
|
||
RRSpatialLookup | ||
--------------- | ||
|
||
.. doxygenfile:: rr_spatial_lookup.h | ||
:project: vpr | ||
:sections: detaileddescription | ||
|
||
.. doxygenclass:: RRSpatialLookup | ||
:project: vpr | ||
:members: | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,24 @@ | ||
#ifndef RR_SPATIAL_LOOKUP_H | ||
#define RR_SPATIAL_LOOKUP_H | ||
|
||
#include "vtr_geometry.h" | ||
#include "vtr_vector.h" | ||
#include "vpr_types.h" | ||
|
||
/******************************************************************** | ||
/** | ||
* @file | ||
* @brief This RRSpatialLookup class encapsulates | ||
* the node-lookup for a routing resource graph | ||
* | ||
* A data structure built to find the id of an routing resource node | ||
* (rr_node) given information about its physical position and type. | ||
* The data structure is mostly needed during rr_graph building | ||
* The data structure is mostly needed during building a routing resource graph | ||
* | ||
* The data structure allows users to | ||
* - Update the look-up with new nodes | ||
* - Find the id of a node with given information, e.g., x, y, type etc. | ||
********************************************************************/ | ||
* | ||
* - Update the look-up with new nodes | ||
* - Find the id of a node with given information, e.g., x, y, type etc. | ||
*/ | ||
#include "vtr_geometry.h" | ||
#include "vtr_vector.h" | ||
#include "vpr_types.h" | ||
|
||
class RRSpatialLookup { | ||
/* -- Constructors -- */ | ||
public: | ||
|
@@ -32,26 +37,28 @@ class RRSpatialLookup { | |
/* -- Accessors -- */ | ||
public: | ||
/** | ||
* Returns the index of the specified routing resource node. | ||
* - (x, y) are the grid location within the FPGA | ||
* - rr_type specifies the type of resource, | ||
* - ptc gives a unique number of resources of that type (e.g. CHANX) at that (x,y). | ||
* All ptcs start at 0 and are positive. | ||
* Depending on what type of resource this is, ptc can be | ||
* - the class number of a common SINK/SOURCE node of grid, | ||
* starting at 0 and go up to class_inf size - 1 of SOURCEs + SINKs in a grid | ||
* - pin number of an input/output pin of a grid. They would normally start at 0 | ||
* and go to the number of pins on a block at that (x, y) location | ||
* - track number of a routing wire in a channel. They would normally go from 0 | ||
* to channel_width - 1 at that (x,y) | ||
* @brief Returns the index of the specified routing resource node. | ||
* | ||
* @param (x, y) are the grid location within the FPGA | ||
* @param rr_type specifies the type of resource, | ||
* @param ptc gives a unique number of resources of that type (e.g. CHANX) at that (x,y). | ||
* | ||
* An invalid id will be returned if the node does not exist | ||
* @note All ptcs start at 0 and are positive. | ||
* Depending on what type of resource this is, ptc can be | ||
* - the class number of a common SINK/SOURCE node of grid, | ||
* starting at 0 and go up to class_inf size - 1 of SOURCEs + SINKs in a grid | ||
* - pin number of an input/output pin of a grid. They would normally start at 0 | ||
* and go to the number of pins on a block at that (x, y) location | ||
* - track number of a routing wire in a channel. They would normally go from 0 | ||
* to channel_width - 1 at that (x,y) | ||
* | ||
* Note that for segments (CHANX and CHANY) of length > 1, the segment is | ||
* @note An invalid id will be returned if the node does not exist | ||
* | ||
* @note For segments (CHANX and CHANY) of length > 1, the segment is | ||
* given an rr_index based on the (x,y) location at which it starts (i.e. | ||
* lowest (x,y) location at which this segment exists). | ||
* | ||
* The 'side' argument only applies to IPIN/OPIN types, and specifies which | ||
* @note The 'side' argument only applies to IPIN/OPIN types, and specifies which | ||
* side of the grid tile the node should be located on. The value is ignored | ||
* for non-IPIN/OPIN types | ||
* | ||
|
@@ -65,12 +72,12 @@ class RRSpatialLookup { | |
e_side side = NUM_SIDES) const; | ||
|
||
/** | ||
* Returns the indices of the specified routing resource nodes, | ||
* representing routing tracks in a channel. | ||
* - (x, y) are the coordinate of the routing channel within the FPGA | ||
* - rr_type specifies the type of routing channel, either x-direction or y-direction | ||
* @brief Returns the indices of the specified routing resource nodes, representing routing tracks in a channel. | ||
* | ||
* @param (x, y) are the coordinate of the routing channel within the FPGA | ||
* @param rr_type specifies the type of routing channel, either x-direction or y-direction | ||
* | ||
* Note: | ||
* @note | ||
* - Return an empty list if there are no routing channel at the given (x, y) location | ||
* - The node list returned only contain valid ids | ||
* For example, if the 2nd routing track does not exist in a routing channel at (x, y) location, | ||
|
@@ -83,7 +90,8 @@ class RRSpatialLookup { | |
t_rr_type type) const; | ||
|
||
/** | ||
* Like find_node() but returns all matching nodes on all the sides. | ||
* @brief Like find_node() but returns all matching nodes on all the sides. | ||
* | ||
* This is particularly useful for getting all instances | ||
* of a specific IPIN/OPIN at a specific grid tile (x,y) location. | ||
*/ | ||
|
@@ -93,7 +101,8 @@ class RRSpatialLookup { | |
int ptc) const; | ||
|
||
/** | ||
* Returns all matching nodes on all the sides at a specific grid tile (x,y) location. | ||
* @brief Returns all matching nodes on all the sides at a specific grid tile (x,y) location. | ||
* | ||
* As this is applicable to grid pins, the type of nodes are limited to SOURCE/SINK/IPIN/OPIN | ||
*/ | ||
std::vector<RRNodeId> find_grid_nodes_at_all_sides(int x, | ||
|
@@ -102,29 +111,30 @@ class RRSpatialLookup { | |
|
||
/* -- Mutators -- */ | ||
public: | ||
/** | ||
* Reserve the memory for a list of nodes at (x, y) location with given type and side | ||
*/ | ||
/** @brief Reserve the memory for a list of nodes at (x, y) location with given type and side */ | ||
void reserve_nodes(int x, | ||
int y, | ||
t_rr_type type, | ||
int num_nodes, | ||
e_side side = SIDES[0]); | ||
|
||
/** | ||
* Register a node in the fast look-up | ||
* - You must have a valid node id to register the node in the lookup | ||
* - (x, y) are the coordinate of the node to be indexable in the fast look-up | ||
* - type is the type of a node | ||
* - ptc is a feature number of a node, which can be | ||
* - the class number of a common SINK/SOURCE node of grid, | ||
* - pin index in a tile when type is OPIN/IPIN | ||
* - track index in a routing channel when type is CHANX/CHANY | ||
* - side is the side of node on the tile, applicable to OPIN/IPIN | ||
* | ||
* Note that a node added with this call will not create a node in the rr_graph_storage node list | ||
* You MUST add the node in the rr_graph_storage so that the node is valid | ||
* @brief Register a node in the fast look-up | ||
* | ||
* @note You must have a valid node id to register the node in the lookup | ||
* | ||
* @param (x, y) are the coordinate of the node to be indexable in the fast look-up | ||
* @param type is the type of a node | ||
* @param ptc is a feature number of a node, which can be | ||
* - the class number of a common SINK/SOURCE node of grid, | ||
* - pin index in a tile when type is OPIN/IPIN | ||
* - track index in a routing channel when type is CHANX/CHANY | ||
* @param side is the side of node on the tile, applicable to OPIN/IPIN | ||
* | ||
* @note a node added with this call will not create a node in the rr_graph_storage node list | ||
* You MUST add the node in the rr_graph_storage so that the node is valid | ||
*/ | ||
/* | ||
* TODO: Consider to try to return a reference to *this so that we can do chain calls | ||
* - .add_node(...) | ||
* - .add_node(...) | ||
|
@@ -139,14 +149,17 @@ class RRSpatialLookup { | |
e_side side = SIDES[0]); | ||
|
||
/** | ||
* Mirror the last dimension of a look-up, i.e., a list of nodes, from a source coordinate to | ||
* @brief Mirror the last dimension of a look-up, i.e., a list of nodes, from a source coordinate to | ||
* a destination coordinate. | ||
* | ||
* This function is mostly need by SOURCE and SINK nodes which are indexable in multiple locations. | ||
* Considering a bounding box (x, y)->(x + width, y + height) of a multi-height and multi-width grid, | ||
* SOURCE and SINK nodes are indexable in any location inside the boundry. | ||
* | ||
* An example of usage: | ||
* | ||
* | ||
* | ||
* ``` | ||
* // Create a empty lookup | ||
* RRSpatialLookup rr_lookup; | ||
* // Adding other nodes ... | ||
|
@@ -155,14 +168,21 @@ class RRSpatialLookup { | |
* vtr::Point<int>(1, 2), | ||
* SOURCE, | ||
* TOP); | ||
* ``` | ||
* | ||
* Note: currently this function only accepts SOURCE/SINK nodes. May unlock for the other types | ||
* @note currently this function only accepts SOURCE/SINK nodes. May unlock for the other types | ||
* depending on needs | ||
* | ||
*/ | ||
/* | ||
* TODO: Consider to make a high-level API to duplicate the nodes for large blocks. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe the TODO comment should be outside the doxygen comments so it is a note to developers rather than API users? |
||
* Then this API can become a private one | ||
* For example, | ||
* | ||
* | ||
* ``` | ||
* expand_nodes(source_coordinate, bounding_box_coordinate, type, side); | ||
* ``` | ||
* | ||
* Alternatively, we can rework the ``find_node()`` API so that we always search the lowest (x,y) | ||
* corner when dealing with large blocks. But this may require the data structure to be dependent | ||
* on DeviceGrid information (it needs to identify if a grid has height > 1 as well as width > 1) | ||
|
@@ -173,11 +193,13 @@ class RRSpatialLookup { | |
e_side side); | ||
|
||
/** | ||
* Resize the given 3 dimensions (x, y, side) of the RRSpatialLookup data structure for the given type | ||
* This function will keep any existing data | ||
* @brief Resize the given 3 dimensions (x, y, side) of the RRSpatialLookup data structure for the given type | ||
* | ||
* Strongly recommend to use when the sizes of dimensions are deterministic | ||
* This function will keep any existing data | ||
* | ||
* @note Strongly recommend to use when the sizes of dimensions are deterministic | ||
*/ | ||
/* | ||
* TODO: should have a reserve function but vtd::ndmatrix does not have such API | ||
* as a result, resize can be an internal one while reserve function is a public mutator | ||
*/ | ||
|
@@ -186,10 +208,10 @@ class RRSpatialLookup { | |
t_rr_type type, | ||
e_side side); | ||
|
||
/* Reorder the internal look up to be more memory efficient */ | ||
/** @brief Reorder the internal look up to be more memory efficient */ | ||
void reorder(const vtr::vector<RRNodeId, RRNodeId> dest_order); | ||
|
||
/* Clear all the data inside */ | ||
/** @brief Clear all the data inside */ | ||
void clear(); | ||
|
||
/* -- Internal data queries -- */ | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the TODO comment should be outside the doxygen commenting (put as just a regular comment) so it doesn't show up in the API comment?