Skip to content

Commit ac5e489

Browse files
committed
make format
1 parent 5eedb46 commit ac5e489

File tree

3 files changed

+44
-44
lines changed

3 files changed

+44
-44
lines changed

vpr/src/base/read_options.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3316,7 +3316,7 @@ argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_optio
33163316
.help("Whether the generated CRR should remove CHANX and CHANY nodes that have no fan-in")
33173317
.default_value("off")
33183318
.show_in(argparse::ShowIn::HELP_ONLY);
3319-
3319+
33203320
crr_grp.add_argument(args.sb_count_dir, "--sb_count_dir")
33213321
.help("Directory to store csv files showing how many times each switch specified in the switch block templates is used")
33223322
.default_value("")

vpr/src/base/stats.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -42,35 +42,35 @@ struct SBKeyParts {
4242
// Parse the key to extract filename, row, and column
4343
static SBKeyParts parse_sb_key(const std::string& key) {
4444
SBKeyParts parts;
45-
45+
4646
// Find the last two underscores
4747
size_t last_underscore = key.rfind('_');
4848
size_t second_last_underscore = key.rfind('_', last_underscore - 1);
49-
49+
5050
parts.filename = key.substr(0, second_last_underscore);
5151
parts.row = std::stoi(key.substr(second_last_underscore + 1, last_underscore - second_last_underscore - 1));
5252
parts.col = std::stoi(key.substr(last_underscore + 1));
53-
53+
5454
return parts;
5555
}
5656

5757
// Read CSV file and keep first NUM_EMPTY_ROWS rows completely and first NUM_EMPTY_COLS columns of all other rows
5858
static std::vector<std::vector<std::string>> read_and_trim_csv(const std::string& filepath) {
5959
std::vector<std::vector<std::string>> data;
6060
std::ifstream file(filepath);
61-
61+
6262
if (!file.is_open()) {
6363
return data;
6464
}
65-
65+
6666
std::string line;
6767
int row_count = 0;
6868
while (std::getline(file, line)) {
6969
std::vector<std::string> row;
7070
std::stringstream ss(line);
7171
std::string cell;
7272
int col_count = 0;
73-
73+
7474
if (row_count < crrgenerator::NUM_EMPTY_ROWS) {
7575
// Keep entire row for first NUM_EMPTY_ROWS rows
7676
while (std::getline(ss, cell, ',')) {
@@ -83,19 +83,19 @@ static std::vector<std::vector<std::string>> read_and_trim_csv(const std::string
8383
col_count++;
8484
}
8585
}
86-
86+
8787
data.push_back(row);
8888
row_count++;
8989
}
90-
90+
9191
file.close();
9292
return data;
9393
}
9494

9595
// Write 2D vector to CSV file
9696
static void write_csv(const std::string& filepath, const std::vector<std::vector<std::string>>& data) {
9797
std::ofstream file(filepath);
98-
98+
9999
for (size_t i = 0; i < data.size(); ++i) {
100100
for (size_t j = 0; j < data[i].size(); ++j) {
101101
file << data[i][j];
@@ -105,7 +105,7 @@ static void write_csv(const std::string& filepath, const std::vector<std::vector
105105
}
106106
file << "\n";
107107
}
108-
108+
109109
file.close();
110110
}
111111

@@ -252,22 +252,22 @@ void write_sb_count_stats(const Netlist<>& net_list,
252252
// Write the sb_count to a file
253253
// First, read all CSV files from directory and trim them
254254
std::unordered_map<std::string, std::vector<std::vector<std::string>>> csv_data;
255-
255+
256256
for (const auto& entry : fs::directory_iterator(sb_map_dir)) {
257257
if (entry.is_regular_file() && entry.path().extension() == ".csv") {
258258
std::string filename = entry.path().filename().string();
259259
csv_data[filename] = read_and_trim_csv(entry.path().string());
260260
}
261261
}
262-
262+
263263
// Group sb_count entries by filename
264264
std::unordered_map<std::string, std::vector<std::pair<int, std::pair<int, int>>>> file_groups;
265-
265+
266266
for (const auto& [sb_id, count] : sb_count) {
267267
SBKeyParts parts = parse_sb_key(sb_id);
268268
file_groups[parts.filename].push_back({parts.row, {parts.col, count}});
269269
}
270-
270+
271271
// Process each file
272272
for (auto& [filename, data] : csv_data) {
273273
// Check if this file has updates from sb_count
@@ -278,35 +278,35 @@ void write_sb_count_stats(const Netlist<>& net_list,
278278
VTR_LOG("Written trimmed CSV: %s\n", filename.c_str());
279279
continue;
280280
}
281-
281+
282282
const auto& entries = file_groups[filename];
283-
283+
284284
// Find maximum row and column needed
285285
int max_row = 0, max_col = 0;
286286
for (const auto& entry : entries) {
287287
max_row = std::max(max_row, entry.first);
288288
max_col = std::max(max_col, entry.second.first);
289289
}
290-
290+
291291
// Expand data structure if needed
292292
while (data.size() <= static_cast<size_t>(max_row)) {
293293
data.push_back(std::vector<std::string>());
294294
}
295-
295+
296296
for (auto& row : data) {
297297
while (row.size() <= static_cast<size_t>(max_col)) {
298298
row.push_back("");
299299
}
300300
}
301-
301+
302302
// Update values from sb_count
303303
for (const auto& entry : entries) {
304304
int row = entry.first;
305305
int col = entry.second.first;
306306
int count = entry.second.second;
307307
data[row][col] = std::to_string(count);
308308
}
309-
309+
310310
// Write updated file
311311
std::string output_path = sb_count_dir + "/" + filename;
312312
write_csv(output_path, data);

vpr/src/route/rr_graph_generation/tileable_rr_graph/crr_generator/crr_common.h

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -149,31 +149,31 @@ struct Sizing {
149149
* It is used to store the connection information and to compare connections.
150150
*/
151151
class Connection {
152-
public:
153-
Connection(RRNodeId sink_node, RRNodeId src_node, int delay_ps, std::string crr_id) noexcept
154-
: sink_node_(sink_node)
155-
, src_node_(src_node)
156-
, delay_ps_(delay_ps)
157-
, crr_id_(std::move(crr_id)) {}
158-
159-
RRNodeId sink_node() const { return sink_node_; }
160-
RRNodeId src_node() const { return src_node_; }
161-
int delay_ps() const { return delay_ps_; }
162-
std::string crr_id() const { return crr_id_; }
163-
164-
bool operator<(const Connection& other) const {
165-
return std::tie(sink_node_, src_node_, delay_ps_) < std::tie(other.sink_node_, other.src_node_, other.delay_ps_);
166-
}
152+
public:
153+
Connection(RRNodeId sink_node, RRNodeId src_node, int delay_ps, std::string crr_id) noexcept
154+
: sink_node_(sink_node)
155+
, src_node_(src_node)
156+
, delay_ps_(delay_ps)
157+
, crr_id_(std::move(crr_id)) {}
158+
159+
RRNodeId sink_node() const { return sink_node_; }
160+
RRNodeId src_node() const { return src_node_; }
161+
int delay_ps() const { return delay_ps_; }
162+
std::string crr_id() const { return crr_id_; }
163+
164+
bool operator<(const Connection& other) const {
165+
return std::tie(sink_node_, src_node_, delay_ps_) < std::tie(other.sink_node_, other.src_node_, other.delay_ps_);
166+
}
167167

168-
bool operator==(const Connection& other) const {
169-
return sink_node_ == other.sink_node_ && src_node_ == other.src_node_ && delay_ps_ == other.delay_ps_;
170-
}
168+
bool operator==(const Connection& other) const {
169+
return sink_node_ == other.sink_node_ && src_node_ == other.src_node_ && delay_ps_ == other.delay_ps_;
170+
}
171171

172-
private:
173-
RRNodeId sink_node_;
174-
RRNodeId src_node_;
175-
int delay_ps_;
176-
std::string crr_id_;
172+
private:
173+
RRNodeId sink_node_;
174+
RRNodeId src_node_;
175+
int delay_ps_;
176+
std::string crr_id_;
177177
};
178178

179179
// Node hash type for lookups

0 commit comments

Comments
 (0)