Skip to content

Noc traffic flows parser final #2083

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 129 commits into from
Jul 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
129 commits
Select commit Hold shift + click to select a range
ad67564
adding support to be able to process architecture descriptions that i…
Srivat97 Nov 1, 2021
66b81f1
changed function prototypes to improve readibility
Srivat97 Nov 12, 2021
97861ba
fixed a vector initialization bug, a bug related to parsing an attrib…
Srivat97 Nov 20, 2021
e66973c
added support to verify a provided noc topology within the architectu…
Srivat97 Nov 23, 2021
4c6e038
added unit tests to the libarchfpga build condifuration
Srivat97 Nov 23, 2021
ae3fc05
added functionality to the architecture file format to support standa…
Srivat97 Dec 7, 2021
aaa4687
added unit tests to verify the new features that support nocs in the …
Srivat97 Dec 7, 2021
5b088b6
added new context variable to represent the NoC
Srivat97 Dec 15, 2021
6fcb368
added a new step in the vpr flow to setup noc model if provided as an…
Srivat97 Dec 15, 2021
7a80043
removed unnecessary code used to test some data structures
Srivat97 Dec 16, 2021
b966d70
created a noc router object
Srivat97 Jan 7, 2022
db4c1f3
added a noc link object
Srivat97 Jan 7, 2022
d57ad16
changed link and router objects to noc_link and noc_router. Also adde…
Srivat97 Jan 11, 2022
790e660
Created a datastructure to represent the entire NoC
Srivat97 Jan 21, 2022
1401585
added functionality to the NoC datastructure to map the user provided…
Srivat97 Jan 21, 2022
e3a0400
added messages to assertions
Srivat97 Jan 21, 2022
dfa7742
ensured that the the NoC datastructure cannot be copied
Srivat97 Jan 21, 2022
dd51424
Added a check box in the graphics to control the display of the NoC
Srivat97 Jan 31, 2022
887af99
verified that connections in the NoC were not included more than once…
Srivat97 Feb 2, 2022
0577a29
added support to fully build the NoC model from the arch file descrip…
Srivat97 Feb 2, 2022
076b091
removed unnecessary destructors and added a function to the NocStorag…
Srivat97 Feb 2, 2022
37e11ef
added a check to catch the case where no physical router tiles exist …
Srivat97 Feb 2, 2022
6f4beae
modified function that adds routers to noc model so that the algorith…
Srivat97 Feb 8, 2022
1e55e3d
adding router test
Srivat97 Dec 21, 2021
cfa3969
removed older representation of a noc router
Srivat97 Feb 8, 2022
dbb09c4
changed router positions provided by the user to double format for hi…
Srivat97 Feb 10, 2022
3ca57f1
modified the mesh creation function to reduce the number of router po…
Srivat97 Feb 15, 2022
3b2a565
improved accuracy of float comparison
Srivat97 Feb 15, 2022
12afbd6
re-added a step in the add_router function to include the mapping bet…
Srivat97 Feb 15, 2022
52f0598
changed the use of a hashmap to keep of track of router assignments …
Srivat97 Feb 15, 2022
d8bf75a
added unit tests to verify a portion of the noc storage class
Srivat97 Feb 16, 2022
5eec09e
fixing compiling issue
Srivat97 Feb 19, 2022
f3e12a6
added unit tests to verfiy the noc datastructure in vtr
Srivat97 Feb 19, 2022
cf0f135
updated error message associated with the <mesh> tag
Srivat97 Mar 12, 2022
fb41204
added a unit tests for functions regarding the noc model setup
Srivat97 Mar 12, 2022
0de01cc
fixed issue with how the centroid points were being calculated for ea…
Srivat97 Mar 12, 2022
df88ab7
added getters to the noc storage class to retrieve the fulle list of …
Srivat97 Mar 13, 2022
ad39612
modified the noc router creator function to pass the noc information …
Srivat97 Mar 13, 2022
c3dbe68
added unit tests to verify functions associated with setting up the NoC
Srivat97 Mar 16, 2022
7786b8f
improved error messages in setup_noc() and also fixed a few bugs
Srivat97 Mar 16, 2022
1b291e8
added new command line options for the NoC
Srivat97 Mar 18, 2022
fcb9bfb
added a new set of options for the NoC in vpr setup
Srivat97 Mar 18, 2022
cc40fd6
added another attribute of the noc, which is the name used to describ…
Srivat97 Mar 23, 2022
df6651c
updated the command line parser to include a new set of options for t…
Srivat97 Mar 23, 2022
5129422
ensured that all the helper functions in setup noc are limited to be …
Srivat97 Mar 23, 2022
8f226c3
added an echo file for the NoC and a function that dumps the contents…
Srivat97 Mar 24, 2022
6321cc5
Changed the precision of the noc constraints (noc link bandwidth, lin…
Srivat97 Mar 24, 2022
2e461f1
added a function to log the options used when the NoC is enabled
Srivat97 Mar 24, 2022
b9d3f67
added a check to make sure that we dont read a nullptr when a noc top…
Srivat97 Mar 29, 2022
066e57a
the display_noc radio button only appears when the user supplied the …
Srivat97 Mar 29, 2022
11c88fa
added functions to draw the NoC on the FPGA when the display noc radi…
Srivat97 Mar 29, 2022
bde20d4
added a new feature that displays a heat map of the usage of all the …
Srivat97 Mar 30, 2022
774e10f
created a combo box that allows users to have the option to just disp…
Srivat97 Mar 31, 2022
fc66cc9
added a utility function that finds a parralel link of any link in th…
Srivat97 Apr 5, 2022
ba26e7c
made sure the new utility to find a parallel link in the noc did not …
Srivat97 Apr 6, 2022
0038cc0
When displaying the NoC, the noc links are drawn so that any parallel…
Srivat97 Apr 6, 2022
bd6ca3f
Since the links don't overlap anymore, ensured that each link as a un…
Srivat97 Apr 7, 2022
ee0c344
Improved code documentation (added comments)
Srivat97 Apr 12, 2022
e6332d9
Revert "added a function to log the options used when the NoC is enab…
Srivat97 Apr 12, 2022
a142d1b
redefined static functions that were previously tested in test_vpr so…
Srivat97 Apr 12, 2022
3c31e04
added directives to the draw noc related code so that there is no bui…
Srivat97 Apr 12, 2022
76342be
fixed an issue with the NocStorage class unit test that caused a fail…
Srivat97 Apr 12, 2022
3711019
fixed compiler issue when including catch test framework header
Srivat97 Apr 13, 2022
7b96833
modified the build procedure for libarchfpga so that the main.cpp fil…
Srivat97 Apr 13, 2022
22b4071
created a new datastructure to represent a noc traffic flow. Then add…
Srivat97 Apr 14, 2022
89232af
Modified the noc traffic flows datastructure to add some new features
Srivat97 Apr 21, 2022
72b4f96
added a new strong id to index noc traffic flows
Srivat97 Apr 21, 2022
e73fece
Added a new variable to keep track of all the 'noc router' cluster bl…
Srivat97 Apr 22, 2022
9571c5c
added definitions for the NocTrafficFlows class functions
Srivat97 Apr 22, 2022
3bd8100
added a new function to determine the number of unique noc router fou…
Srivat97 Apr 29, 2022
c6b7b24
adding unit tests for the NocTrafficFlows class
Srivat97 Apr 29, 2022
5a77e6b
added the parser for the noc traffic flows description file
Srivat97 Apr 29, 2022
b487e33
changed the error logging to use vpr_throw instead of VPR_FATAL_ERROR…
Srivat97 May 12, 2022
d14f6bb
in the command line added the option to provide a noc traffic flows file
Srivat97 May 13, 2022
ca1304b
added the noc .flows file parser within the vpr flow
Srivat97 May 13, 2022
b30a1f6
converted strings to characters before logging errors
Srivat97 May 16, 2022
4175d51
modified help message for noc traffic flows file argument
Srivat97 May 16, 2022
91daab2
added functions to the clustered netlist and netlist classes that are…
Srivat97 May 23, 2022
9873d39
created a unit test to verify the functionality of the function that …
Srivat97 May 23, 2022
76016e1
made the find_block_with_matching_name function public instead of pri…
Srivat97 May 24, 2022
80c35ec
added some additiontal tests to verify the find_block_with_matching_n…
Srivat97 May 24, 2022
279f89d
fixed unit tests for the find_block_with_matching_name function and v…
Srivat97 May 24, 2022
7422117
changed the find_block_with_matching_name to a constant
Srivat97 May 27, 2022
f180c93
changed functions to static and modified the get_router_module_cluste…
Srivat97 May 27, 2022
8d8af65
added a unit test to verify the verify_traffic_flow_router_modules
Srivat97 May 27, 2022
32125ff
changed a call of VPR_ERROR() to vpr_throw()
Srivat97 Jun 8, 2022
4837211
added unit tests to verify functions: verify_traffic_flow_properties,…
Srivat97 Jun 8, 2022
f4e3ee4
changed the check_that_all_router_blocks_have_an_associated_traffic_f…
Srivat97 Jun 13, 2022
76f9f49
added a unit test to verify the check_that_all_router_blocks_have_an_…
Srivat97 Jun 13, 2022
72926e5
added a new function to catch duplicate traffic flows (source and sin…
Srivat97 Jun 14, 2022
a153da5
Modified comments to doxygen style and improved them
Srivat97 Jun 17, 2022
d018f1b
Bringing in the changes made to support the noc traffic flows file
Srivat97 Jun 27, 2022
1f3a951
fixed issues that arose during the merge. Redeclaration of functions …
Srivat97 Jun 28, 2022
3ad6112
added comments to help explain the need for error checking for comman…
Srivat97 Jun 28, 2022
caee85f
added an echo function to dump out all the internal datastructure inf…
Srivat97 Jun 29, 2022
af61c84
Made it so now after parsing the traffic flows file the NocTrafficFlo…
Srivat97 Jun 29, 2022
70de39a
fixed an issue within the check_for_diplicate_traffic_flows function,…
Srivat97 Jun 30, 2022
496c9a4
fixed in an issue in the echo function whereall the printed traffic f…
Srivat97 Jun 30, 2022
0c8d04d
Moved from using the string comparison function to directly comparing…
Srivat97 Jun 30, 2022
9b8cbf2
Updated tests to check for previously changed error messages in read_…
Srivat97 Jun 30, 2022
9491ffe
Removed the use of the word 'list' when naming vectors or referencing…
Srivat97 Jun 30, 2022
2addace
formatting changes.
Srivat97 Jun 30, 2022
9578626
adding benchmark designs that were used to verify the noc traffic flo…
Srivat97 Jun 30, 2022
55c8ae4
Grouped all NoC related files together within the noc folder inside .…
Srivat97 Jun 30, 2022
abc735b
Added a function to clear the global clustered netlist. This function…
Srivat97 Jul 4, 2022
5001d14
Added a function clear the global device datastructure. This function…
Srivat97 Jul 4, 2022
b6aaa9a
removed unneccessary files generated from running unit tests that we…
Srivat97 Jul 4, 2022
ae2734f
removed a global datastructure within the clustered netlist class tha…
Srivat97 Jul 19, 2022
5372ba6
Created a new function that searches the clustered netlist and stores…
Srivat97 Jul 19, 2022
96539ac
renamed the 'find_block_with_match_name' function to 'find_block_by_n…
Srivat97 Jul 20, 2022
8b6b860
removed a function that checked for duplicate traffic flows. Initiall…
Srivat97 Jul 20, 2022
8033563
Changed the NocTrafficFlows class to keep track of associated traffic…
Srivat97 Jul 21, 2022
77d24b1
removed a datastructure inside the NocTrafficFlows class that kept tr…
Srivat97 Jul 21, 2022
a78c867
created a new status variable that indicates whether the NocTrafficFl…
Srivat97 Jul 21, 2022
b32fba0
removed a datastructure within the NocTrafficFlows class that kep tra…
Srivat97 Jul 22, 2022
c9e568c
updating comments
Srivat97 Jul 22, 2022
57bfd96
cleaned up some code and improved fixed/improved comments for the Noc…
Srivat97 Jul 22, 2022
6551f65
Added comments to clarify why certain parameters were passed in to fu…
Srivat97 Jul 22, 2022
5137869
Changed example noc traffic flows file to use more realistic constrai…
Srivat97 Jul 23, 2022
5eba6ac
removed header declaration for a function that was previously removed
Srivat97 Jul 25, 2022
682522c
cleaned up code commenting and fixed formatting
Srivat97 Jul 25, 2022
d16c5db
cleaned up the check_if_cluster_block_has_traffic_flows function with…
Srivat97 Jul 25, 2022
ad0bebf
broke down an error that reported when the src and destination router…
Srivat97 Jul 26, 2022
f11ed2d
added an assertion to check if the NoC has any physical routers, this…
Srivat97 Jul 26, 2022
9cbcf33
Changed the get_cluster_blocks_compatible_with_noc_router_tiles funct…
Srivat97 Jul 26, 2022
9f6ca9f
changed the string parameter name within the find_block_by_name_fragm…
Srivat97 Jul 26, 2022
7776f03
improved commenting that describes the purpose of the --noc command l…
Srivat97 Jul 26, 2022
6869f55
formatting changes
Srivat97 Jul 26, 2022
b1f1477
Changed one of the section names in the NocTrafficFlows ojects echo f…
Srivat97 Jul 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libs/libarchfpga/src/read_xml_arch_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4672,7 +4672,7 @@ static void processTopology(pugi::xml_node topology_tag, const pugiutil::loc_dat
/**
* Stores router information that includes the number of connections a router has within a given topology and also the number of times a router was declared in the arch file using the <router> tag.
* In the datastructure below, the router id is the key and the stored data is a pair, where the first element describes the number of router declarations and the second element describes the number of router connections.
* This is used only for erro checking.
* This is used only for error checking.
*/
std::map<int, std::pair<int, int>> routers_in_arch_info;

Expand Down
1 change: 1 addition & 0 deletions vpr/src/base/SetupVPR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ static void SetupPowerOpts(const t_options& Options, t_power_opts* power_opts, t
static void SetupNocOpts(const t_options& Options, t_noc_opts* NocOpts) {
// assign the noc specific options from the command line
NocOpts->noc = Options.noc;
NocOpts->noc_flows_file = Options.noc_flows_file;

return;
}
Expand Down
11 changes: 11 additions & 0 deletions vpr/src/base/ShowSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ static void ShowPlacerOpts(const t_placer_opts& PlacerOpts,
const t_annealing_sched& AnnealSched);
static void ShowRouterOpts(const t_router_opts& RouterOpts);
static void ShowAnalysisOpts(const t_analysis_opts& AnalysisOpts);
static void ShowNocOpts(const t_noc_opts& NocOpts);

static void ShowAnnealSched(const t_annealing_sched& AnnealSched);

Expand Down Expand Up @@ -61,6 +62,9 @@ void ShowSetup(const t_vpr_setup& vpr_setup) {
if (vpr_setup.AnalysisOpts.doAnalysis) {
ShowAnalysisOpts(vpr_setup.AnalysisOpts);
}
if (vpr_setup.NocOpts.noc) {
ShowNocOpts(vpr_setup.NocOpts);
}
}

void ClusteredNetlistStats::writeHuman(std::ostream& output) const {
Expand Down Expand Up @@ -764,3 +768,10 @@ static void ShowPackerOpts(const t_packer_opts& PackerOpts) {
VTR_LOG("\n");
VTR_LOG("\n");
}

static void ShowNocOpts(const t_noc_opts& NocOpts) {
VTR_LOG("NocOpts.noc_flows_file: %s\n", NocOpts.noc_flows_file.c_str());
VTR_LOG("\n");

// add future options here (routing algorithm etc...)
}
14 changes: 14 additions & 0 deletions vpr/src/base/clustered_netlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,3 +306,17 @@ bool ClusteredNetlist::validate_net_sizes_impl(size_t num_nets) const {
}
return true;
}

ClusterBlockId ClusteredNetlist::find_block_by_name_fragment(const std::string& name_pattern, const std::vector<ClusterBlockId>& cluster_block_candidates) const {
ClusterBlockId blk_id = ClusterBlockId::INVALID();
std::regex name_to_match(name_pattern);

for (auto compatible_block_id = cluster_block_candidates.begin(); compatible_block_id != cluster_block_candidates.end(); compatible_block_id++) {
if (std::regex_match(Netlist::block_name(*compatible_block_id), name_to_match)) {
blk_id = *compatible_block_id;
break;
}
}

return blk_id;
}
71 changes: 71 additions & 0 deletions vpr/src/base/clustered_netlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,77 @@ class ClusteredNetlist : public Netlist<ClusterBlockId, ClusterPortId, ClusterPi
///@brief Sets the flag in net_is_global_ = state
void set_net_is_global(ClusterNetId net_id, bool state);

/**
* @brief Given a name of a block and vector of possible cluster blocks
* that are candidates to match the block name, go through
* the vector of cluster blocks and return the id of the block
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return first?
What is none matches (return Invalid?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also seems like the comment is half-repeated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

* where the block name matches the provided name.
*
* Given a string pattern representing a block name and a vector of
* poissble cluster blocks that are candidates to match to the block
* name pattern, go through the vector of cluster blocks and return
* the id of the block where the block name matches to the provided
* input pattern.
*
*/

/**
* @brief The intented use is to find the block id of a
* hard block without knowing its name in the netlist. Instead
* a pattern can be created that we know the block's name will
* match to. Generally, we expect the pattern to be constructed
* using the block's module name in the HDL design, since we can
* expect the netlist name of the block to include the module
* name within it.
*
* For example, suppose a RAM block was named in the netlist as
* "top|alu|test_ram|out". The user instantiated the ram module
* in the HDL design as "test_ram". So instead of going through
* the netlist and finding the ram block's full name, this
* function can be used by just providing the string pattern as
* ".*test_ram.*". We know that the module name should be somewhere
* within the string, so the pattern we provide says that the netlist
* name of the block contains arbritary characters then the module
* name and then some other arbritary characters after.
* This pattern will then be used to match to the block in the
* netlist. The matched cluster block id is returned, and if no
* block matched to the input string then an invalid block id
* is returned.
*
* The function
* here additionally requires a vector of possible cluster blocks
* that can match to the input pattern. This vector can be the
* entire netlist or a subset. For example, if the intended use
* is to find hard blocks, it is quite inefficient
* to go through all the blocks to find a matching one. Instead, a
* a filtered vector can be passed that is a subset of the entire
* netlist and can only contain blocks of a certain logical block
* type (blocks that can be placed on a specific hard block).
* The idea here is that the filtered vector should be
* considereably smaller that a vector of every block in the netlist
* and this should help improve run time.
*
* This function runs in linear time (O(N)) as it goes over the
* vector of 'cluster_block_candidates'. 'cluster_block_candidates'
* could be the whole netlist or a subset as explained above.
* Additionally, if there are multiple
* blocks that match to the provided input pattern, then the
* first block found is returned.
*
*
* @param name_pattern A regex string pattern that can be used to match to
* a clustered block name within the netlist.
* @param cluster_block_candidates A vector of clustered block ids that
* represent a subset of the clustered
* netlist. The blocks in this vector
* will be used to compare and match
* to the input string pattern.
* @return A cluster block id representing a unique cluster block that
* matched to the input string pattern.
*
*/
ClusterBlockId find_block_by_name_fragment(const std::string& name_pattern, const std::vector<ClusterBlockId>& cluster_block_candidates) const;

private: //Private Members
/*
* Netlist compression/optimization
Expand Down
1 change: 1 addition & 0 deletions vpr/src/base/echo_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ void alloc_and_load_echo_file_info() {

//NoC
setEchoFileName(E_ECHO_NOC_MODEL, "noc_model.echo");
setEchoFileName(E_ECHO_NOC_TRAFFIC_FLOWS, "noc_traffic_flows.echo");
}

void free_echo_file_info() {
Expand Down
1 change: 1 addition & 0 deletions vpr/src/base/echo_files.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ enum e_echo_files {

//NoC
E_ECHO_NOC_MODEL,
E_ECHO_NOC_TRAFFIC_FLOWS,

E_ECHO_END_TOKEN
};
Expand Down
37 changes: 37 additions & 0 deletions vpr/src/base/netlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,43 @@ class Netlist {
*/
BlockId find_block(const std::string& name) const;

/**
* @brief Finds a block where the block's name contains the
* provided input name as a substring.
* The intented use is to find the block id of a
* hard block without knowing its name in the netlist. Instead
* the block's module name in the HDL design can be used as it will
* be a substring within its full name in the netlist.
*
* For example, suppose a RAM block was named in the netlist as
* "top|alu|test_ram|out". The user instantiated the ram module
* in the HDL design as "test_ram". So instead of going through
* the netlist and finding the ram block's full name, this
* function can be used by just providing the module name "test_ram"
* and using this substring to match the blocks name in the netlist
* and retrieving its block id. If no blocks matched to input pattern
* then an invalid block id is returned.
*
* This function runs in linear time (O(N)) as it goes over all the
* cluster blocks in the netlist. Additionally, if there are multiple
* blocks that contain the provided input as a substring, then the
* first block found is returned.
*
* NOTE: This function tries to find blocks by checking for
* substrings.
* The clustered netlist class defines another version of this
* function that find blocks by checking for a pattern match,
* meaning that the input is a pattern string and the pattern
* is looked for ine each block name.
*
* @param name_substring A substring of a block name for which an ID needs
* to be found.
* @return A cluster block id representing a unique cluster block that
* matched to the input string pattern.
*
*/
BlockId find_block_by_name_fragment(const std::string& name_substring) const;

/**
* @brief Returns the PortId of the specifed port if it exists or PortId::INVALID() if not
*
Expand Down
18 changes: 18 additions & 0 deletions vpr/src/base/netlist.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,24 @@ BlockId Netlist<BlockId, PortId, PinId, NetId>::find_block(const std::string& na
}
}

template<typename BlockId, typename PortId, typename PinId, typename NetId>
BlockId Netlist<BlockId, PortId, PinId, NetId>::find_block_by_name_fragment(const std::string& name_substring) const {
BlockId matching_blk_id = BlockId::INVALID();
const std::string blk_name;

// go through all the blocks in the netlist
for (auto blk_id = block_ids_.begin(); blk_id != block_ids_.end(); blk_id++) {
// get the corresponding block name
blk_name = &strings_[block_names_[*blk_id]];
// check whether the current block name contains the input string within it
if (blk_name.find(name_substring) != std::string::npos) {
matching_blk_id = blk_id;
break;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Return first match; not guaranteeing it the only match.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to the comment

}
}
return matching_blk_id;
}

template<typename BlockId, typename PortId, typename PinId, typename NetId>
PortId Netlist<BlockId, PortId, PinId, NetId>::find_port(const BlockId blk_id, const std::string& name) const {
VTR_ASSERT_SAFE(valid_block_id(blk_id));
Expand Down
23 changes: 22 additions & 1 deletion vpr/src/base/read_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2622,6 +2622,13 @@ argparse::ArgumentParser create_arg_parser(std::string prog_name, t_options& arg
.default_value("off")
.show_in(argparse::ShowIn::HELP_ONLY);

noc_grp.add_argument<std::string>(args.noc_flows_file, "--noc_flows_file")
.help(
"XML file containing the list of traffic flows within the NoC (communication between routers)."
"This is required if the --noc option is turned on.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"turned on" --> "on"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or just if --noc is on

.default_value("")
.show_in(argparse::ShowIn::HELP_ONLY);

return parser;
}

Expand Down Expand Up @@ -2803,7 +2810,7 @@ void set_conditional_defaults(t_options& args) {

bool verify_args(const t_options& args) {
/*
* Check for conflicting paramaters
* Check for conflicting paramaters or dependencies where one parameter set requires another parameter to be included
*/
if (args.read_rr_graph_file.provenance() == Provenance::SPECIFIED
&& args.RouteChanWidth.provenance() != Provenance::SPECIFIED) {
Expand All @@ -2826,5 +2833,19 @@ bool verify_args(const t_options& args) {
args.router_lookahead_type.argument_name().c_str());
}

/**
* @brief If the user provided the "--noc" command line option, then there
* must be a NoC in the FPGA and the netlist must include NoC routers.
* Therefore, the user must also provide a noc traffic flows file to
* describe the communication within the NoC. We ensure that a noc traffic
* flows file is provided when the "--noc" option is used. If it is not
* provided, we throw an error.
*
*/
if (args.noc.provenance() == Provenance::SPECIFIED && args.noc_flows_file.provenance() != Provenance::SPECIFIED) {
VPR_FATAL_ERROR(VPR_ERROR_OTHER,
"--noc_flows_file option must be specified if --noc is turned on.\n");
}

return true;
}
1 change: 1 addition & 0 deletions vpr/src/base/read_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ struct t_options {

/*NoC Options*/
argparse::ArgValue<bool> noc;
argparse::ArgValue<std::string> noc_flows_file;

/* Timing-driven placement options only */
argparse::ArgValue<float> PlaceTimingTradeoff;
Expand Down
1 change: 0 additions & 1 deletion vpr/src/base/setup_noc.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

#include <climits>
#include <cmath>

Expand Down
7 changes: 0 additions & 7 deletions vpr/src/base/setup_noc.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
#ifndef SETUP_NOC
#define SETUP_NOC

/*
* THis file contains functions and datatypes that help setup the NoC model datastructure from the user NoC description in the arch file.
*
* During VPR setup, the functions here should be used to setup the NoC.
*
*/

/**
* @file
* @brief This is the setup_noc header file. The main purpose of
Expand Down
5 changes: 4 additions & 1 deletion vpr/src/base/vpr_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "SetupGrid.h"
#include "setup_clocks.h"
#include "setup_noc.h"
#include "read_xml_noc_traffic_flows_file.h"
#include "stats.h"
#include "read_options.h"
#include "echo_files.h"
Expand Down Expand Up @@ -515,9 +516,11 @@ void vpr_setup_clock_networks(t_vpr_setup& vpr_setup, const t_arch& Arch) {
*/
void vpr_setup_noc(const t_vpr_setup& vpr_setup, const t_arch& arch) {
// check if the user provided the option to model the noc
if (vpr_setup.NocOpts.noc == true) {
if (vpr_setup.NocOpts.noc) {
// create the NoC model based on the user description from the arch file
setup_noc(arch);
// read and store the noc traffic flow information
read_xml_noc_traffic_flows_file(vpr_setup.NocOpts.noc_flows_file.c_str());

#ifndef NO_GRAPHICS
// setup the graphics
Expand Down
11 changes: 11 additions & 0 deletions vpr/src/base/vpr_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "metadata_storage.h"
#include "vpr_constraints.h"
#include "noc_storage.h"
#include "noc_traffic_flows.h"

/**
* @brief A Context is collection of state relating to a particular part of VPR
Expand Down Expand Up @@ -427,6 +428,16 @@ struct NocContext : public Context {
* The NoC model is created once from the architecture file description.
*/
NocStorage noc_model;

/**
* @brief Stores all the communication happening between routers in the NoC
*
* Contains all of the traffic flows that ddescribe which pairs of logical routers are communicating and also some metrics and constraints on the data transfer between the two routers.
*
*
* This is created from a user supplied .flows file.
*/
NocTrafficFlows noc_traffic_flows_storage;
};

/**
Expand Down
3 changes: 2 additions & 1 deletion vpr/src/base/vpr_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1271,7 +1271,8 @@ struct t_analysis_opts {

// used to store NoC specific options, when supplied as an input by the user
struct t_noc_opts {
bool noc; ///<options to model the noc within the FPGA device
bool noc; ///<options to turn on hard NoC modeling & optimization
std::string noc_flows_file; ///<name of the file that contains all the traffic flow information in the NoC
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
#include "vtr_strong_id.h"

// data types used to index the routers and links within the noc

struct noc_router_id_tag;
struct noc_link_id_tag;

typedef vtr::StrongId<noc_router_id_tag, int> NocRouterId;
typedef vtr::StrongId<noc_link_id_tag, int> NocLinkId;

// data type to index traffic flows within the noc
struct noc_traffic_flow_id_tag;

typedef vtr::StrongId<noc_traffic_flow_id_tag, int> NocTrafficFlowId;

#endif
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading