-
Notifications
You must be signed in to change notification settings - Fork 415
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
Changes from 117 commits
ad67564
66b81f1
97861ba
e66973c
4c6e038
ae3fc05
aaa4687
5b088b6
6fcb368
7a80043
b966d70
db4c1f3
d57ad16
790e660
1401585
e3a0400
dfa7742
dd51424
887af99
0577a29
076b091
37e11ef
6f4beae
1e55e3d
cfa3969
dbb09c4
3ca57f1
3b2a565
12afbd6
52f0598
d8bf75a
5eec09e
f3e12a6
cf0f135
fb41204
0de01cc
df88ab7
ad39612
c3dbe68
7786b8f
1b291e8
fcb9bfb
cc40fd6
df6651c
5129422
8f226c3
6321cc5
2e461f1
b9d3f67
066e57a
11c88fa
bde20d4
774e10f
fc66cc9
ba26e7c
0038cc0
bd6ca3f
ee0c344
e6332d9
a142d1b
3c31e04
76342be
3711019
7b96833
22b4071
89232af
72b4f96
e73fece
9571c5c
3bd8100
c6b7b24
5a77e6b
b487e33
d14f6bb
ca1304b
b30a1f6
4175d51
91daab2
9873d39
76016e1
80c35ec
279f89d
7422117
f180c93
8d8af65
32125ff
4837211
f4e3ee4
76f9f49
72926e5
a153da5
d018f1b
1f3a951
3ad6112
caee85f
af61c84
70de39a
496c9a4
0c8d04d
9b8cbf2
9491ffe
2addace
9578626
55c8ae4
abc735b
5001d14
b6aaa9a
ae2734f
5372ba6
96539ac
8b6b860
8033563
77d24b1
a78c867
b32fba0
c9e568c
57bfd96
6551f65
5137869
5eba6ac
682522c
d16c5db
ad0bebf
f11ed2d
9cbcf33
9f6ca9f
7776f03
6869f55
b1f1477
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -306,3 +306,56 @@ bool ClusteredNetlist::validate_net_sizes_impl(size_t num_nets) const { | |
} | ||
return true; | ||
} | ||
|
||
/** | ||
* @brief Finds a block where the block's name matches to the provided | ||
* input string pattern. | ||
* 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. | ||
* | ||
* 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 match to the provided input pattern, then the | ||
* first block found is returned. | ||
* | ||
* There is a similiar function in the Netlist Class. This function | ||
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. Delete this paragraph. No data structure stored anymore. 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. Done |
||
* additionally requires the logical type of the block as well. Since | ||
* the inteded use is to find hard blocks, it is quite inefficient to | ||
* to go through all the blocks to find a matching one. Instead, an | ||
* additional datastructure is created that groups clusters by their | ||
* logical type. This function filters the clusters and only searches | ||
* for the matching block within a list of blocks that are the same | ||
* logical type. The idea here is that the filtered list should be | ||
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. Can just make this routine take a pass in vector of blocks to search if you want to keep it efficient (can compute that vector once in the calling routine); if someone didn't know the vector of blocks they could pass in a vector of the whole netlist 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. Removed this new data-structure from the clustered netlist, |
||
* considereably smaller that a list of every block in the netlist | ||
* and this should help improve run time. | ||
* | ||
*/ | ||
ClusterBlockId ClusteredNetlist::find_block_by_name_fragment(const std::string& name, const std::vector<ClusterBlockId>& cluster_block_candidates) const { | ||
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. suggest changing name to name_pattern 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. Done |
||
ClusterBlockId blk_id = ClusterBlockId::INVALID(); | ||
std::regex name_to_match(name); | ||
|
||
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; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -228,6 +228,21 @@ 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 | ||
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. Return first? 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. Also seems like the comment is half-repeated? 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. 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. | ||
* | ||
*/ | ||
ClusterBlockId find_block_by_name_fragment(const std::string& name, const std::vector<ClusterBlockId>& cluster_block_candidates) const; | ||
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. Add @param to describe the inputs. 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. Then can shorten description some (@param gives the input details). 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. @return for return value 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. Done |
||
|
||
private: //Private Members | ||
/* | ||
* Netlist compression/optimization | ||
|
@@ -242,6 +257,9 @@ class ClusteredNetlist : public Netlist<ClusterBlockId, ClusterPortId, ClusterPi | |
///@brief Shrinks internal data structures to required size to reduce memory consumption | ||
void shrink_to_fit_impl() override; | ||
|
||
///@brief Group the block to its corresponding logical type | ||
void add_block_to_logical_type(ClusterBlockId blk_id, t_logical_block_type_ptr type); | ||
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. Delete this one. 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. Removed 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. Still in .h file --> please remove. Also check for any other dangling definitions in .h files. 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. Removed and went through all other header files, did not see any other dangling function definitions. |
||
|
||
/* | ||
* Component removal | ||
*/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,6 +65,7 @@ enum e_echo_files { | |
|
||
//NoC | ||
E_ECHO_NOC_MODEL, | ||
E_ECHO_NOC_TRAFFIC_FLOWS, | ||
|
||
E_ECHO_END_TOKEN | ||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -458,6 +458,52 @@ BlockId Netlist<BlockId, PortId, PinId, NetId>::find_block(const std::string& na | |
} | ||
} | ||
|
||
/** | ||
* @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. | ||
* | ||
* 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. | ||
* | ||
*/ | ||
template<typename BlockId, typename PortId, typename PinId, typename NetId> | ||
BlockId Netlist<BlockId, PortId, PinId, NetId>::find_block_by_name_fragment(const std::string& name) 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) != std::string::npos) { | ||
matching_blk_id = blk_id; | ||
break; | ||
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. Return first match; not guaranteeing it the only match. 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. 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)); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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.") | ||
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. "turned on" --> "on" 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. or just if --noc is on |
||
.default_value("") | ||
.show_in(argparse::ShowIn::HELP_ONLY); | ||
|
||
return parser; | ||
} | ||
|
||
|
@@ -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) { | ||
|
@@ -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; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
#include <climits> | ||
#include <cmath> | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 model the noc within the FPGA device | ||
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. Turns on hard NoC modeling & optimization 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. Done |
||
std::string noc_flows_file; ///<name of the file that contains all the traffic flow information in the NoC | ||
}; | ||
|
||
/** | ||
|
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.
Update this to say you go through the cluster_block_candidates, and are O(N) in that. The cluster_block_candidates could be the whole netlist, or a subset of the correct type, or anything else.
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.
(Unless this is redudant with the .h, in which case just shorten/ensure it's accurate).
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.
Done