-
Notifications
You must be signed in to change notification settings - Fork 422
Subtile Pin Location #3129
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
Subtile Pin Location #3129
Conversation
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.
This looks good to me other than some minor comments. I am not as familiar with this code, but I gave some general comments.
Can you please add some documentation for this new feature to the architecture docs? I think you can just directly copy the docs from OpenFPGA.
auto token = tokens[token_index]; | ||
|
||
if (token.type != TOKEN_STRING || 0 != strcmp(token.data, type->name.c_str())) { | ||
archfpga_throw(loc_data.filename_c_str(), loc_data.line(Locations), |
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.
Although it is not "required", I think freeTokens
should be called before all of the throw statements in the function for cleanliness. I have run into issues in the past where throws fail due to memory not being deallocated properly.
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.
Interesting! I added a helper function throw_xml_arch_error that takes the tokens and frees them before throwing an error. I replaced all archfpga_throw calls with this helper function (it took me a while :) )
static void throw_xml_arch_error(const char* filename,
int line,
const std::string& err_msg,
t_token* tokens,
int num_tokens);
@@ -123,6 +123,11 @@ static std::pair<int, int> ProcessPinString(pugi::xml_node Locations, | |||
T type, | |||
const char* pin_loc_string, | |||
const pugiutil::loc_data& loc_data); | |||
template<typename T> | |||
static std::pair<int, int> ProcessInstanceString(pugi::xml_node Locations, |
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.
Most function names in this file are camel case, but the rest of code base uses snake case. We should gradually change this. NoC-realted function names are snake case. I think new functions should use snake case too.
Why is this a template function? It is only called once with T=t_sub_tile*
. I also suggest we pass it by const reference instead of pointer.
Add doxygen comment for this function
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.
I changed the name of all functions in this file from camel case to snake case.
@@ -703,10 +708,15 @@ static void LoadPinLoc(pugi::xml_node Locations, | |||
&sub_tile, | |||
token.c_str(), | |||
loc_data); | |||
|
|||
/* Get the offset in the capacity range */ | |||
auto capacity_range = ProcessInstanceString<t_sub_tile*>(Locations, |
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.
You can use auto
to unpack the pair and give each of its members a name. For example:
auto [capacity_range_low, capacity_range_high] = ...
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.
Look who’s suddenly in favor of using auto :)) (just kidding)
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.
Thanks for this new feature.
I think it should be also documented in the architecture reference.
…rilog-to-routing into subtile_pin_loc
@soheilshahrouz @AlexandreSinger: Thanks for reviewing this PR. I’ve applied your comments. Please let me know if you have any further suggestions. |
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.
LGTM. The throw function freeing memory makes sense, but its a bit unclear to someone using the code that they need to do that; however I know that Soheil is working on cleaning up the token code to prevent this so it does not matter.
I still think it would be good to document this change!
I added the following Doxygen comment for throw_xml_arch_error :
Also, inside of the function I added the following comment:
|
@AlexandreSinger: Added the following to architecture documentation:
|
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.
LGTM thanks for adding the documentation!
@amin1377 Thanks for all these changes! As discussed yesterday, I created a class to avoid using raw pointers in |
@soheilshahrouz: Sure. I'll revert the commit. |
…rilog-to-routing into subtile_pin_loc
In the architecture file, when a sub-tile has a capacity bigger than one, it is assumed that the pin location of all sub-tiles should be assigned together:
In the above case, the first half of the IO pins for both sub-tiles will be placed on the left side of the device.
In this PR, a feature from OpenFPGA is added where one can define different locations for each sub-tile capacity if necessary: