Skip to content

Commit e7058da

Browse files
update noc options in read_options.cpp
1 parent 2181194 commit e7058da

File tree

4 files changed

+30
-27
lines changed

4 files changed

+30
-27
lines changed

libs/EXTERNAL/libargparse/src/argparse.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#include <algorithm>
2-
#include <array>
32
#include <list>
43
#include <cassert>
54
#include <string>
65
#include <set>
76
#include <limits>
7+
#include <utility>
88

99
#include "argparse.hpp"
1010
#include "argparse_util.hpp"
@@ -16,16 +16,16 @@ namespace argparse {
1616
* ArgumentParser
1717
*/
1818

19-
ArgumentParser::ArgumentParser(std::string prog_name, std::string description_str, std::ostream& os)
20-
: description_(description_str)
19+
ArgumentParser::ArgumentParser(const std::string& prog_name, std::string description_str, std::ostream& os)
20+
: description_(std::move(description_str))
2121
, formatter_(new DefaultFormatter())
2222
, os_(os)
2323
{
2424
prog(prog_name);
2525
argument_groups_.push_back(ArgumentGroup("arguments"));
2626
}
2727

28-
ArgumentParser& ArgumentParser::prog(std::string prog_name, bool basename_only) {
28+
ArgumentParser& ArgumentParser::prog(const std::string& prog_name, bool basename_only) {
2929
if (basename_only) {
3030
prog_ = basename(prog_name);
3131
} else {
@@ -35,17 +35,17 @@ namespace argparse {
3535
}
3636

3737
ArgumentParser& ArgumentParser::version(std::string version_str) {
38-
version_ = version_str;
38+
version_ = std::move(version_str);
3939
return *this;
4040
}
4141

4242
ArgumentParser& ArgumentParser::epilog(std::string epilog_str) {
43-
epilog_ = epilog_str;
43+
epilog_ = std::move(epilog_str);
4444
return *this;
4545
}
4646

4747
ArgumentGroup& ArgumentParser::add_argument_group(std::string description_str) {
48-
argument_groups_.push_back(ArgumentGroup(description_str));
48+
argument_groups_.push_back(ArgumentGroup(std::move(description_str)));
4949
return argument_groups_[argument_groups_.size() - 1];
5050
}
5151

@@ -72,7 +72,7 @@ namespace argparse {
7272
void ArgumentParser::parse_args_throw(int argc, const char* const* argv) {
7373
std::vector<std::string> arg_strs;
7474
for (int i = 1; i < argc; ++i) {
75-
arg_strs.push_back(argv[i]);
75+
arg_strs.emplace_back(argv[i]);
7676
}
7777

7878
parse_args_throw(arg_strs);
@@ -241,7 +241,7 @@ namespace argparse {
241241
} else if (arg->nargs() == '+' || arg->nargs() == '*') {
242242
if (arg->nargs() == '+') {
243243
assert(nargs_read >= 1);
244-
assert(values.size() >= 1);
244+
assert(!values.empty());
245245
}
246246

247247
for (const auto& value : values) {
@@ -410,11 +410,11 @@ namespace argparse {
410410
* ArgumentGroup
411411
*/
412412
ArgumentGroup::ArgumentGroup(std::string name_str)
413-
: name_(name_str)
413+
: name_(std::move(name_str))
414414
{}
415415

416416
ArgumentGroup& ArgumentGroup::epilog(std::string str) {
417-
epilog_ = str;
417+
epilog_ = std::move(str);
418418
return *this;
419419
}
420420
std::string ArgumentGroup::name() const { return name_; }
@@ -425,10 +425,10 @@ namespace argparse {
425425
* Argument
426426
*/
427427
Argument::Argument(std::string long_opt, std::string short_opt)
428-
: long_opt_(long_opt)
429-
, short_opt_(short_opt) {
428+
: long_opt_(std::move(long_opt))
429+
, short_opt_(std::move(short_opt)) {
430430

431-
if (long_opt_.size() < 1) {
431+
if (long_opt_.empty()) {
432432
throw ArgParseError("Argument must be at least one character long");
433433
}
434434

@@ -445,7 +445,7 @@ namespace argparse {
445445
}
446446

447447
Argument& Argument::help(std::string help_str) {
448-
help_ = help_str;
448+
help_ = std::move(help_str);
449449
return *this;
450450
}
451451

@@ -476,12 +476,12 @@ namespace argparse {
476476
}
477477

478478
Argument& Argument::metavar(std::string metavar_str) {
479-
metavar_ = metavar_str;
479+
metavar_ = std::move(metavar_str);
480480
return *this;
481481
}
482482

483483
Argument& Argument::choices(std::vector<std::string> choice_values) {
484-
choices_ = choice_values;
484+
choices_ = std::move(choice_values);
485485
return *this;
486486
}
487487

@@ -536,7 +536,7 @@ namespace argparse {
536536
}
537537

538538
Argument& Argument::group_name(std::string grp) {
539-
group_name_ = grp;
539+
group_name_ = std::move(grp);
540540
return *this;
541541
}
542542

libs/EXTERNAL/libargparse/src/argparse.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ namespace argparse {
3434
class ArgumentParser {
3535
public:
3636
//Initializes an argument parser
37-
ArgumentParser(std::string prog_name, std::string description_str=std::string(), std::ostream& os=std::cout);
37+
ArgumentParser(const std::string& prog_name, std::string description_str=std::string(), std::ostream& os=std::cout);
3838

3939
//Overrides the program name
40-
ArgumentParser& prog(std::string prog, bool basename_only=true);
40+
ArgumentParser& prog(const std::string& prog, bool basename_only=true);
4141

4242
//Sets the program version
4343
ArgumentParser& version(std::string version);

vpr/src/base/read_options.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#include "argparse.hpp"
77

8-
#include "vtr_memory.h"
98
#include "vtr_log.h"
109
#include "vtr_util.h"
1110
#include "vtr_path.h"
@@ -14,7 +13,7 @@
1413
using argparse::ConvertedValue;
1514
using argparse::Provenance;
1615

17-
///@brief Read and process VPR's command-line aruments
16+
///@brief Read and process VPR's command-line arguments
1817
t_options read_options(int argc, const char** argv) {
1918
t_options args = t_options(); //Explicitly initialize for zero initialization
2019

@@ -1259,7 +1258,7 @@ struct ParsePostSynthNetlistUnconnOutputHandling {
12591258
}
12601259
};
12611260

1262-
argparse::ArgumentParser create_arg_parser(std::string prog_name, t_options& args) {
1261+
argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_options& args) {
12631262
std::string description =
12641263
"Implements the specified circuit onto the target FPGA architecture"
12651264
" by performing packing/placement/routing, and analyzes the result.\n"
@@ -2807,8 +2806,12 @@ argparse::ArgumentParser create_arg_parser(std::string prog_name, t_options& arg
28072806
.help(
28082807
"Controls the algorithm used by the NoC to route packets.\n"
28092808
"* xy_routing: Uses the direction oriented routing algorithm. This is recommended to be used with mesh NoC topologies.\n"
2810-
"* bfs_routing: Uses the breadth first search algorithm. The objective is to find a route that uses a minimum number of links.\n"
2811-
"This can be used with any NoC topology\n")
2809+
"* bfs_routing: Uses the breadth first search algorithm. The objective is to find a route that uses a minimum number of links."
2810+
" This algorithm is not guaranteed to generate deadlock-free traffic flow routes, but can be used with any NoC topology\n"
2811+
"* west_first_routing: Uses the west-first routing algorithm. This is recommended to be used with mesh NoC topologies.\n"
2812+
"* north_last_routing: Uses the north-last routing algorithm. This is recommended to be used with mesh NoC topologies.\n"
2813+
"* negative_first_routing: Uses the negative-first routing algorithm. This is recommended to be used with mesh NoC topologies.\n"
2814+
"* odd_even_routing: Uses the odd-even routing algorithm. This is recommended to be used with mesh NoC topologies.\n")
28122815
.default_value("bfs_routing")
28132816
.choices({"xy_routing", "bfs_routing", "west_first_routing", "north_last_routing", "negative_first_routing",
28142817
"odd_even_routing"})
@@ -2860,7 +2863,7 @@ argparse::ArgumentParser create_arg_parser(std::string prog_name, t_options& arg
28602863
"Other positive numbers specify the importance of minimizing congestion to other NoC-related cost terms.\n"
28612864
"Weighting factors for NoC-related cost terms are normalized internally. Therefore, their absolute values are not important, and"
28622865
"only their relative ratios determine the importance of each cost term.")
2863-
.default_value("0.00")
2866+
.default_value("0.25")
28642867
.show_in(argparse::ShowIn::HELP_ONLY);
28652868

28662869
noc_grp.add_argument<double>(args.noc_swap_percentage, "--noc_swap_percentage")

vpr/src/base/read_options.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ struct t_options {
242242
argparse::ArgValue<std::string> write_timing_summary;
243243
};
244244

245-
argparse::ArgumentParser create_arg_parser(std::string prog_name, t_options& args);
245+
argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_options& args);
246246
t_options read_options(int argc, const char** argv);
247247
void set_conditional_defaults(t_options& args);
248248
bool verify_args(const t_options& args);

0 commit comments

Comments
 (0)