Skip to content

Commit b0d7458

Browse files
authored
Merge branch 'master' into stable_sort
2 parents 903ec07 + 164b453 commit b0d7458

File tree

17 files changed

+97
-100
lines changed

17 files changed

+97
-100
lines changed

.github/scripts/install_dependencies.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ sudo apt install -y \
2929
libncurses5-dev \
3030
libx11-dev \
3131
libxft-dev \
32+
libxml2-utils \
3233
libxml++2.6-dev \
3334
libreadline-dev \
3435
tcllib \

CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -418,11 +418,13 @@ if(${WITH_PARMYS}) # define cmake params to compile Yosys
418418
set(MAKE_PROGRAM "make")
419419
endif()
420420

421-
if(NOT DEFINED "${CMAKE_BUILD_PARALLEL_LEVEL}")
422-
set(CUSTOM_BUILD_PARALLEL_LEVEL 16)
423-
else()
424-
set(CUSTOM_BUILD_PARALLEL_LEVEL "${CMAKE_BUILD_PARALLEL_LEVEL}")
425-
endif()
421+
# Commented out since a make file should not call another make command with
422+
# threads. It should pass this information from the parent automatically.
423+
# if(NOT DEFINED "${CMAKE_BUILD_PARALLEL_LEVEL}")
424+
# set(CUSTOM_BUILD_PARALLEL_LEVEL 16)
425+
# else()
426+
# set(CUSTOM_BUILD_PARALLEL_LEVEL "${CMAKE_BUILD_PARALLEL_LEVEL}")
427+
# endif()
426428
add_subdirectory(yosys)
427429
endif()
428430

blifexplorer/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16)
22

33
project("blifexplorer")
44

5-
set(CMAKE_CXX_STANDARD 14)
5+
set(CMAKE_CXX_STANDARD 17)
66
set(CMAKE_CXX_STANDARD_REQUIRED ON)
77
set(CMAKE_CXX_EXTENSIONS OFF)
88

doc/src/vtr/benchmarks.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ These designs use many precisions including binary, different fixed point types
102102
proxy Proxy/synthetic benchmarks
103103
================= ======================================
104104

105-
The VTR benchmarks are provided as Verilog (enabling full flexibility to modify and change how the designs are implemented) under: ::
105+
The Koios benchmarks are provided as Verilog (enabling full flexibility to modify and change how the designs are implemented) under: ::
106106

107107
$VTR_ROOT/vtr_flow/benchmarks/verilog/koios
108108

@@ -207,4 +207,4 @@ real application domains. On the other hand, MLP benchmarks include modules that
207207
and move data. Pre-synthesized netlists for the synthetic benchmarks are added to VTR project, but MLP netlists should
208208
be downloaded separately.
209209

210-
.. note:: The NoC MLP benchmarks are not included with the VTR release (due to their size). However they can be downloaded and extracted by running ``make get_noc_mlp_benchmarks`` from the root of the VTR tree. They can also be `downloaded manually <https://www.eecg.utoronto.ca/~vaughn/titan/>`_.
210+
.. note:: The NoC MLP benchmarks are not included with the VTR release (due to their size). However they can be downloaded and extracted by running ``make get_noc_mlp_benchmarks`` from the root of the VTR tree. They can also be `downloaded manually <https://www.eecg.utoronto.ca/~vaughn/titan/>`_.

libs/EXTERNAL/libcatch2

Submodule libcatch2 updated 110 files

libs/libvtrutil/src/vtr_util.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ static int cont; /* line continued? (used by strtok)*/
2626
*
2727
* The split strings (excluding the delimiters) are returned
2828
*/
29-
std::vector<std::string> split(const char* text, const std::string& delims) {
29+
std::vector<std::string> split(const char* text, std::string_view delims) {
3030
if (text) {
3131
std::string text_str(text);
3232
return split(text_str, delims);
@@ -39,13 +39,13 @@ std::vector<std::string> split(const char* text, const std::string& delims) {
3939
*
4040
* The split strings (excluding the delimiters) are returned
4141
*/
42-
std::vector<std::string> split(const std::string& text, const std::string& delims) {
42+
std::vector<std::string> split(std::string_view text, std::string_view delims) {
4343
std::vector<std::string> tokens;
4444

4545
std::string curr_tok;
4646
for (char c : text) {
4747
if (delims.find(c) != std::string::npos) {
48-
//Delimeter character
48+
//Delimiter character
4949
if (!curr_tok.empty()) {
5050
//At the end of the token
5151

@@ -58,7 +58,7 @@ std::vector<std::string> split(const std::string& text, const std::string& delim
5858
//Pass
5959
}
6060
} else {
61-
//Non-delimeter append to token
61+
//Non-delimiter append to token
6262
curr_tok += c;
6363
}
6464
}
@@ -72,18 +72,18 @@ std::vector<std::string> split(const std::string& text, const std::string& delim
7272
}
7373

7474
///@brief Returns 'input' with the first instance of 'search' replaced with 'replace'
75-
std::string replace_first(const std::string& input, const std::string& search, const std::string& replace) {
75+
std::string replace_first(std::string_view input, std::string_view search, std::string_view replace) {
7676
auto pos = input.find(search);
7777

7878
std::string output(input, 0, pos);
7979
output += replace;
80-
output += std::string(input, pos + search.size());
80+
output += input.substr(pos + search.size());
8181

8282
return output;
8383
}
8484

8585
///@brief Returns 'input' with all instances of 'search' replaced with 'replace'
86-
std::string replace_all(const std::string& input, const std::string& search, const std::string& replace) {
86+
std::string replace_all(std::string_view input, std::string_view search, std::string_view replace) {
8787
std::string output;
8888

8989
size_t last = 0;
@@ -101,8 +101,8 @@ std::string replace_all(const std::string& input, const std::string& search, con
101101
return output;
102102
}
103103

104-
///@brief Retruns true if str starts with prefix
105-
bool starts_with(const std::string& str, const std::string& prefix) {
104+
///@brief Returns true if str starts with prefix
105+
bool starts_with(const std::string& str, std::string_view prefix) {
106106
return str.find(prefix) == 0;
107107
}
108108

@@ -195,7 +195,7 @@ char* strdup(const char* str) {
195195
* and/or correct 'unexpected' behaviour of the standard c-functions
196196
*/
197197
template<class T>
198-
T atoT(const std::string& value, const std::string& type_name) {
198+
T atoT(const std::string& value, std::string_view type_name) {
199199
//The c version of atof doesn't catch errors.
200200
//
201201
//This version uses stringstream to detect conversion errors
@@ -461,8 +461,8 @@ bool file_exists(const char* filename) {
461461
*
462462
* Returns true if the extension is correct, and false otherwise.
463463
*/
464-
bool check_file_name_extension(const std::string& file_name,
465-
const std::string& file_extension) {
464+
bool check_file_name_extension(std::string_view file_name,
465+
std::string_view file_extension) {
466466
auto ext = std::filesystem::path(file_name).extension();
467467
return ext == file_extension;
468468
}

libs/libvtrutil/src/vtr_util.h

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <algorithm>
55
#include <vector>
66
#include <string>
7+
#include <string_view>
78
#include <cstdarg>
89
#include <array>
910

@@ -14,17 +15,17 @@ namespace vtr {
1415
*
1516
* The split strings (excluding the delimiters) are returned
1617
*/
17-
std::vector<std::string> split(const char* text, const std::string& delims = " \t\n");
18-
std::vector<std::string> split(const std::string& text, const std::string& delims = " \t\n");
18+
std::vector<std::string> split(const char* text, std::string_view string_view = " \t\n");
19+
std::vector<std::string> split(std::string_view text, std::string_view delims = " \t\n");
1920

2021
///@brief Returns 'input' with the first instance of 'search' replaced with 'replace'
21-
std::string replace_first(const std::string& input, const std::string& search, const std::string& replace);
22+
std::string replace_first(std::string_view input, std::string_view search, std::string_view replace);
2223

2324
///@brief Returns 'input' with all instances of 'search' replaced with 'replace'
24-
std::string replace_all(const std::string& input, const std::string& search, const std::string& replace);
25+
std::string replace_all(std::string_view input, std::string_view search, std::string_view replace);
2526

2627
///@brief Retruns true if str starts with prefix
27-
bool starts_with(const std::string& str, const std::string& prefix);
28+
bool starts_with(const std::string& str, std::string_view prefix);
2829

2930
///@brief Returns a std::string formatted using a printf-style format string
3031
std::string string_fmt(const char* fmt, ...);
@@ -39,13 +40,13 @@ std::string vstring_fmt(const char* fmt, va_list args);
3940
* would return "home/user/my_files/test.blif"
4041
*/
4142
template<typename Iter>
42-
std::string join(Iter begin, Iter end, std::string delim);
43+
std::string join(Iter begin, Iter end, std::string_view delim);
4344

4445
template<typename Container>
45-
std::string join(Container container, std::string delim);
46+
std::string join(Container container, std::string_view delim);
4647

4748
template<typename T>
48-
std::string join(std::initializer_list<T> list, std::string delim);
49+
std::string join(std::initializer_list<T> list, std::string_view delim);
4950

5051
template<typename Container>
5152
void uniquify(Container container);
@@ -69,7 +70,7 @@ double atod(const std::string& value);
6970
*/
7071
int get_file_line_number_of_last_opened_file();
7172
bool file_exists(const char* filename);
72-
bool check_file_name_extension(const std::string& file_name, const std::string& file_extension);
73+
bool check_file_name_extension(std::string_view file_name, std::string_view file_extension);
7374

7475
extern std::string out_file_prefix;
7576

@@ -82,7 +83,7 @@ std::vector<std::string> ReadLineTokens(FILE* InFile, int* LineNum);
8283
* @brief Template join function implementation
8384
*/
8485
template<typename Iter>
85-
std::string join(Iter begin, Iter end, std::string delim) {
86+
std::string join(Iter begin, Iter end, std::string_view delim) {
8687
std::string joined_str;
8788
for (auto iter = begin; iter != end; ++iter) {
8889
joined_str += *iter;
@@ -94,12 +95,12 @@ std::string join(Iter begin, Iter end, std::string delim) {
9495
}
9596

9697
template<typename Container>
97-
std::string join(Container container, std::string delim) {
98+
std::string join(Container container, std::string_view delim) {
9899
return join(std::begin(container), std::end(container), delim);
99100
}
100101

101102
template<typename T>
102-
std::string join(std::initializer_list<T> list, std::string delim) {
103+
std::string join(std::initializer_list<T> list, std::string_view delim) {
103104
return join(list.begin(), list.end(), delim);
104105
}
105106

utils/fasm/src/fasm.cpp

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,20 @@
11
#include "fasm.h"
22

33
#include <algorithm>
4-
#include <fstream>
5-
#include <iomanip>
64
#include <iostream>
7-
#include <iterator>
85
#include <set>
96
#include <sstream>
107
#include <string>
11-
#include <unordered_map>
128

139
#include "globals.h"
1410

1511
#include "rr_metadata.h"
1612

1713
#include "vtr_assert.h"
1814
#include "vtr_logic.h"
19-
#include "vtr_version.h"
2015
#include "vpr_error.h"
2116

2217
#include "atom_netlist_utils.h"
23-
#include "netlist_writer.h"
24-
#include "vpr_utils.h"
2518

2619
#include "fasm_utils.h"
2720

@@ -77,7 +70,7 @@ void FasmWriterVisitor::visit_clb_impl(ClusterBlockId blk_id, const t_pb* clb) {
7770
std::vector<std::string> tag_defs = vtr::split(value->front().as_string().get(strings_), "\n");
7871
for (auto& tag_def: tag_defs) {
7972
auto parts = split_fasm_entry(tag_def, "=:", "\t ");
80-
if (parts.size() == 0) {
73+
if (parts.empty()) {
8174
continue;
8275
}
8376

@@ -86,7 +79,7 @@ void FasmWriterVisitor::visit_clb_impl(ClusterBlockId blk_id, const t_pb* clb) {
8679
VTR_ASSERT(tags_.count(parts.at(0)) == 0);
8780

8881
// When the value is "NULL" then substitute empty string
89-
if (!parts.at(1).compare("NULL")) {
82+
if (parts.at(1) == "NULL") {
9083
tags_[parts.at(0)] = "";
9184
}
9285
else {
@@ -179,7 +172,7 @@ std::string FasmWriterVisitor::handle_fasm_prefix(const t_metadata_dict *meta,
179172
}
180173

181174
std::string FasmWriterVisitor::build_clb_prefix(const t_pb *pb, const t_pb_graph_node* pb_graph_node, bool* is_parent_pb_null) const {
182-
std::string clb_prefix = "";
175+
std::string clb_prefix;
183176

184177
const t_pb *pb_for_graph_node = nullptr;
185178

@@ -272,7 +265,7 @@ void FasmWriterVisitor::visit_all_impl(const t_pb_routes &pb_routes, const t_pb*
272265
std::string clb_prefix = build_clb_prefix(pb, pb_graph_node, &is_parent_pb_null);
273266
clb_prefix_map_.insert(std::make_pair(pb_graph_node, clb_prefix));
274267
clb_prefix_ = clb_prefix;
275-
if (is_parent_pb_null == true) {
268+
if (is_parent_pb_null) {
276269
return;
277270
}
278271

@@ -365,7 +358,7 @@ static LogicVec lut_outputs(const t_pb* atom_pb, size_t num_inputs, const t_pb_r
365358
if(truth_table.size() == 1) {
366359
VTR_ASSERT(truth_table[0].size() == 1);
367360
lut.SetConstant(truth_table[0][0]);
368-
} else if(truth_table.size() == 0) {
361+
} else if(truth_table.empty()) {
369362
lut.SetConstant(vtr::LogicValue::FALSE);
370363
} else {
371364
vpr_throw(VPR_ERROR_OTHER, __FILE__, __LINE__, "LUT truth table unexpected size is %d", truth_table.size());
@@ -420,7 +413,7 @@ static LogicVec lut_outputs(const t_pb* atom_pb, size_t num_inputs, const t_pb_r
420413
return lut.table();
421414
}
422415

423-
const t_metadata_dict *FasmWriterVisitor::get_fasm_type(const t_pb_graph_node* pb_graph_node, std::string target_type) const {
416+
const t_metadata_dict *FasmWriterVisitor::get_fasm_type(const t_pb_graph_node* pb_graph_node, std::string_view target_type) const {
424417
if(pb_graph_node == nullptr) {
425418
return nullptr;
426419
}
@@ -470,9 +463,8 @@ const LutOutputDefinition* FasmWriterVisitor::find_lut(const t_pb_graph_node* pb
470463
VTR_ASSERT(value != nullptr);
471464

472465
std::vector<std::pair<std::string, LutOutputDefinition>> luts;
473-
luts.push_back(std::make_pair(
474-
vtr::string_fmt("%s[0]", pb_graph_node->pb_type->name),
475-
LutOutputDefinition(value->as_string().get(strings_))));
466+
luts.emplace_back(vtr::string_fmt("%s[0]", pb_graph_node->pb_type->name),
467+
LutOutputDefinition(value->as_string().get(strings_)));
476468

477469
auto insert_result = lut_definitions_.insert(
478470
std::make_pair(pb_graph_node->pb_type, luts));
@@ -505,8 +497,7 @@ const LutOutputDefinition* FasmWriterVisitor::find_lut(const t_pb_graph_node* pb
505497
fasm_lut_str.c_str());
506498
}
507499

508-
luts.push_back(std::make_pair(
509-
parts[1], LutOutputDefinition(parts[0])));
500+
luts.emplace_back(parts[1], LutOutputDefinition(parts[0]));
510501
}
511502

512503
auto insert_result = lut_definitions_.insert(
@@ -569,9 +560,9 @@ void FasmWriterVisitor::check_for_param(const t_pb *atom) {
569560
VTR_ASSERT(value != nullptr);
570561

571562
std::string fasm_params_str = value->as_string().get(strings_);
572-
for(const auto param : vtr::split(fasm_params_str, "\n")) {
563+
for(const auto& param : vtr::split(fasm_params_str, "\n")) {
573564
auto param_parts = split_fasm_entry(param, "=", "\t ");
574-
if(param_parts.size() == 0) {
565+
if(param_parts.empty()) {
575566
continue;
576567
}
577568
VTR_ASSERT(param_parts.size() == 2);
@@ -589,10 +580,10 @@ void FasmWriterVisitor::check_for_param(const t_pb *atom) {
589580

590581
auto &params = iter->second;
591582

592-
for(auto param : atom_ctx.nlist.block_params(atom_blk_id)) {
583+
for(const auto& param : atom_ctx.nlist.block_params(atom_blk_id)) {
593584
auto feature = params.EmitFasmFeature(param.first, param.second);
594585

595-
if(feature.size() > 0) {
586+
if(!feature.empty()) {
596587
output_fasm_features(feature);
597588
}
598589
}
@@ -668,7 +659,7 @@ void FasmWriterVisitor::find_clb_prefix(const t_pb_graph_node *node,
668659
}
669660
}
670661

671-
void FasmWriterVisitor::output_fasm_mux(std::string fasm_mux_str,
662+
void FasmWriterVisitor::output_fasm_mux(std::string_view fasm_mux_str,
672663
t_interconnect *interconnect,
673664
const t_pb_graph_pin *mux_input_pin) {
674665
auto *pb_name = mux_input_pin->parent_node->pb_type->name;
@@ -697,7 +688,7 @@ void FasmWriterVisitor::output_fasm_mux(std::string fasm_mux_str,
697688
for(const auto &mux_input : mux_inputs) {
698689
auto mux_parts = split_fasm_entry(mux_input, "=:", "\t ");
699690

700-
if(mux_parts.size() == 0) {
691+
if(mux_parts.empty()) {
701692
// Swallow whitespace.
702693
continue;
703694
}
@@ -750,15 +741,15 @@ void FasmWriterVisitor::output_fasm_mux(std::string fasm_mux_str,
750741

751742
vpr_throw(VPR_ERROR_OTHER, __FILE__, __LINE__,
752743
"fasm_mux %s[%d].%s[%d] found no matches in:\n%s\n",
753-
pb_name, pb_index, port_name, pin_index, fasm_mux_str.c_str());
744+
pb_name, pb_index, port_name, pin_index, fasm_mux_str.data());
754745
}
755746

756-
void FasmWriterVisitor::output_fasm_features(const std::string features) const {
747+
void FasmWriterVisitor::output_fasm_features(const std::string& features) const {
757748
output_fasm_features(features, clb_prefix_, blk_prefix_);
758749
}
759750

760-
void FasmWriterVisitor::output_fasm_features(const std::string features, const std::string clb_prefix, const std::string blk_prefix) const {
761-
std::stringstream os(features);
751+
void FasmWriterVisitor::output_fasm_features(const std::string& features, std::string_view clb_prefix, std::string_view blk_prefix) const {
752+
std::istringstream os(features);
762753

763754
while(os) {
764755
std::string feature;

0 commit comments

Comments
 (0)