Skip to content

Commit 0a779ae

Browse files
committed
make format
1 parent 8203e9a commit 0a779ae

35 files changed

+494
-560
lines changed

libs/libarchfpga/src/physical_types.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2135,8 +2135,6 @@ struct t_noc_inf {
21352135
std::string noc_router_tile_name;
21362136
};
21372137

2138-
2139-
21402138
/* Detailed routing architecture */
21412139
struct t_arch {
21422140
/** Stores unique strings used as key and values in <metadata> tags,
@@ -2221,7 +2219,7 @@ struct t_arch {
22212219
//It is used to generate custom SB for a specific locations within the device
22222220
//If the layout is not specified in the command line options, this variable will be set to "auto"
22232221
std::string device_layout;
2224-
2222+
22252223
std::vector<t_vib_grid_def> vib_grid_layouts;
22262224

22272225
t_clock_arch_spec clock_arch; // Clock related data types

libs/libarchfpga/src/read_xml_arch_file.cpp

Lines changed: 26 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4207,19 +4207,19 @@ static void ProcessBend(pugi::xml_node Node, std::vector<int>& list, std::vector
42074207

42084208
int tmp_len = 1;
42094209
int sum_len = 0;
4210-
for(size_t i_len = 0; i_len < list.size(); i_len++){
4210+
for (size_t i_len = 0; i_len < list.size(); i_len++) {
42114211
if (list[i_len] == 0) {
42124212
tmp_len++;
42134213
} else if (list[i_len] != 0) {
4214-
VTR_ASSERT(tmp_len < (int) list.size()+1);
4214+
VTR_ASSERT(tmp_len < (int)list.size() + 1);
42154215
part_len.push_back(tmp_len);
42164216
sum_len += tmp_len;
42174217
tmp_len = 1;
42184218
}
42194219
}
42204220

42214221
// add the last clip of segment
4222-
if (sum_len < (int) list.size()+1)
4222+
if (sum_len < (int)list.size() + 1)
42234223
part_len.push_back(list.size() + 1 - sum_len);
42244224
}
42254225

@@ -5108,7 +5108,7 @@ static T* get_type_by_name(std::string_view type_name, std::vector<T>& types) {
51085108
// // we decrease the mesh size by 1 when calculating the spacing so that the first and last routers of each row or column are positioned on the mesh boundary
51095109
// /*
51105110
// * For example:
5111-
// * - If we had a mesh size of 3, then using 3 would result in a spacing that would result in one router positions being placed in either the start of the reigion or end of the region. This is because the distance calculation resulted in having 3 spaces between the ends of the region
5111+
// * - If we had a mesh size of 3, then using 3 would result in a spacing that would result in one router positions being placed in either the start of the reigion or end of the region. This is because the distance calculation resulted in having 3 spaces between the ends of the region
51125112
// *
51135113
// * start end
51145114
// *** *** *** ***
@@ -5242,11 +5242,11 @@ static T* get_type_by_name(std::string_view type_name, std::vector<T>& types) {
52425242
// }
52435243

52445244
// /* Each router needs a sperate <router> tag in the architecture description
5245-
// * to declare it. The number of declarations for each router in the
5245+
// * to declare it. The number of declarations for each router in the
52465246
// * architecture file is updated here.
52475247
// *
52485248
// * Additionally, for any given topology, a router can connect to other routers.
5249-
// * THe number of connections for each router is also updated here.
5249+
// * THe number of connections for each router is also updated here.
52505250
// *
52515251
// */
52525252
// static void update_router_info_in_arch(int router_id, bool router_updated_as_a_connection, std::map<int, std::pair<int, int>>& routers_in_arch_info) {
@@ -5277,7 +5277,7 @@ static T* get_type_by_name(std::string_view type_name, std::vector<T>& types) {
52775277
// * Verify each router in the noc by checking whether they satisfy the following conditions:
52785278
// * - The router has only one declaration in the arch file
52795279
// * - The router has atleast one connection to another router
5280-
// * If any of the conditions above are not met, then an error is thrown.
5280+
// * If any of the conditions above are not met, then an error is thrown.
52815281
// */
52825282
// static void verify_noc_topology(std::map<int, std::pair<int, int>>& routers_in_arch_info) {
52835283
// for (auto router_info = routers_in_arch_info.begin(); router_info != routers_in_arch_info.end(); router_info++) {
@@ -5310,7 +5310,7 @@ static void ProcessVibArch(pugi::xml_node Parent, std::vector<t_physical_tile_ty
53105310
int num_vibs = count_children(Parent, "vib", loc_data);
53115311
arch->vib_infs.reserve(num_vibs);
53125312
Node = get_first_child(Parent, "vib", loc_data);
5313-
5313+
53145314
for (int i_vib = 0; i_vib < num_vibs; i_vib++) {
53155315
ProcessVib(Node, PhysicalTileTypes, arch, loc_data);
53165316
Node = Node.next_sibling(Node.name());
@@ -5330,25 +5330,23 @@ static void ProcessVib(pugi::xml_node Vib_node, std::vector<t_physical_tile_type
53305330
tmp = get_attribute(Vib_node, "name", loc_data).as_string(nullptr);
53315331
if (tmp) {
53325332
vib.set_name(tmp);
5333-
}
5334-
else {
5333+
} else {
53355334
archfpga_throw(loc_data.filename_c_str(), loc_data.line(Vib_node),
53365335
"No name specified for the vib!\n");
53375336
}
53385337

53395338
tmp = get_attribute(Vib_node, "pbtype_name", loc_data).as_string(nullptr);
53405339
if (tmp) {
53415340
vib.set_pbtype_name(tmp);
5342-
}
5343-
else {
5341+
} else {
53445342
archfpga_throw(loc_data.filename_c_str(), loc_data.line(Vib_node),
53455343
"No pbtype_name specified for the vib!\n");
53465344
}
53475345

53485346
vib.set_seg_group_num(get_attribute(Vib_node, "vib_seg_group", loc_data).as_int(1));
53495347

53505348
tmp = get_attribute(Vib_node, "arch_vib_switch", loc_data).as_string(nullptr);
5351-
5349+
53525350
if (tmp) {
53535351
std::string str_tmp;
53545352
str_tmp = tmp;
@@ -5359,8 +5357,7 @@ static void ProcessVib(pugi::xml_node Vib_node, std::vector<t_physical_tile_type
53595357
// break;
53605358
// }
53615359
// }
5362-
}
5363-
else {
5360+
} else {
53645361
archfpga_throw(loc_data.filename_c_str(), loc_data.line(Vib_node),
53655362
"No switch specified for the vib!\n");
53665363
}
@@ -5375,7 +5372,7 @@ static void ProcessVib(pugi::xml_node Vib_node, std::vector<t_physical_tile_type
53755372
t_seg_group seg_group;
53765373

53775374
tmp = get_attribute(Node, "name", loc_data).as_string(nullptr);
5378-
5375+
53795376
if (tmp) {
53805377
seg_group.name = tmp;
53815378
// for (int i_seg = 0; i_seg < (int)segments.size(); i_seg++) {
@@ -5384,8 +5381,7 @@ static void ProcessVib(pugi::xml_node Vib_node, std::vector<t_physical_tile_type
53845381
// break;
53855382
// }
53865383
// }
5387-
}
5388-
else {
5384+
} else {
53895385
archfpga_throw(loc_data.filename_c_str(), loc_data.line(Node),
53905386
"No name specified for the vib seg group!\n");
53915387
}
@@ -5406,8 +5402,7 @@ static void ProcessVib(pugi::xml_node Vib_node, std::vector<t_physical_tile_type
54065402
itmp = get_attribute(Node, "track_nums", loc_data).as_int();
54075403
if (itmp) {
54085404
seg_group.track_num = itmp;
5409-
}
5410-
else {
5405+
} else {
54115406
archfpga_throw(loc_data.filename_c_str(), loc_data.line(Node),
54125407
"No track_num specified for the vib seg group!\n");
54135408
}
@@ -5428,7 +5423,6 @@ static void ProcessVib(pugi::xml_node Vib_node, std::vector<t_physical_tile_type
54285423
for (auto first_stage : first_stages) {
54295424
vib.push_first_stage(first_stage);
54305425
}
5431-
54325426
}
54335427

54345428
SubElem = get_single_child(Node, "second_stage", loc_data);
@@ -5439,7 +5433,6 @@ static void ProcessVib(pugi::xml_node Vib_node, std::vector<t_physical_tile_type
54395433
for (auto second_stage : second_stages) {
54405434
vib.push_second_stage(second_stage);
54415435
}
5442-
54435436
}
54445437

54455438
arch->vib_infs.push_back(vib);
@@ -5503,7 +5496,7 @@ static void ProcessSecondStage(pugi::xml_node Stage_node, std::vector<t_physical
55035496
// //VTR_ASSERT(to.from_type == SEGMENT || to.from_type == PB);
55045497
// second_stage_mux.to.push_back(to);
55055498
// }
5506-
5499+
55075500
SubElem = get_first_child(Node, "from", loc_data);
55085501
int from_num = count_children(Node, "from", loc_data);
55095502
for (int i_from = 0; i_from < from_num; i_from++) {
@@ -5543,7 +5536,7 @@ static void ProcessSecondStage(pugi::xml_node Stage_node, std::vector<t_physical
55435536
// pb_type_name = new char[strlen(Token_char)];
55445537
// port_name = new char[strlen(Token_char)];
55455538
// parse_pin_name((char*)Token_char, &start_pin_index, &end_pin_index, pb_type_name, port_name);
5546-
5539+
55475540
// std::vector<int> all_sub_tile_to_tile_pin_indices;
55485541
// for (auto& sub_tile : PhysicalTileTypes[i_phy_type].sub_tiles) {
55495542
// int sub_tile_capacity = sub_tile.capacity.total();
@@ -5589,14 +5582,14 @@ static void ProcessSecondStage(pugi::xml_node Stage_node, std::vector<t_physical
55895582
// from_inf.phy_pin_index = all_sub_tile_to_tile_pin_indices[i];
55905583
// froms.push_back(from_inf);
55915584
// }
5592-
5585+
55935586
// // for (auto& sub_tile : PhysicalTileTypes[i_phy_type].sub_tiles) {
55945587
// // //int sub_tile_index = sub_tile.index;
55955588
// // int sub_tile_capacity = sub_tile.capacity.total();
55965589

55975590
// // int i_port = 0;
55985591
// // for (; i_port < (int)sub_tile.ports.size(); ++i_port) {
5599-
5592+
56005593
// // if (!strcmp(sub_tile.ports[i_port].name, port_name)) {
56015594
// // if (start_pin_index == end_pin_index && start_pin_index < 0) {
56025595
// // start_pin_index = 0;
@@ -5626,7 +5619,7 @@ static void ProcessSecondStage(pugi::xml_node Stage_node, std::vector<t_physical
56265619
// // }
56275620
// // }
56285621
// // }
5629-
5622+
56305623
// }
56315624
// }
56325625
// for (int i_seg_type = 0; i_seg_type < (int)segments.size(); i_seg_type++) {
@@ -5646,12 +5639,12 @@ static void ProcessSecondStage(pugi::xml_node Stage_node, std::vector<t_physical
56465639
// from_inf.seg_index = seg_index;
56475640
// froms.push_back(from_inf);
56485641
// }
5649-
5642+
56505643
// break;
56515644
// }
56525645
// }
56535646
// VTR_ASSERT(from_type == PB || from_type == SEGMENT);
5654-
5647+
56555648
// }
56565649
// else {
56575650
// std::string msg = vtr::string_fmt("Failed to parse vib mux from information '%s'", Token.c_str());
@@ -5675,9 +5668,8 @@ void parse_pin_name(char* src_string, int* start_pin_index, int* end_pin_index,
56755668
/* Format "pb_type_name.port_name" */
56765669
*start_pin_index = *end_pin_index = -1;
56775670

5678-
56795671
strcpy(source_string, src_string);
5680-
5672+
56815673
for (ichar = 0; ichar < (int)(strlen(source_string)); ichar++) {
56825674
if (source_string[ichar] == '.')
56835675
source_string[ichar] = ' ';
@@ -5719,7 +5711,7 @@ void parse_pin_name(char* src_string, int* start_pin_index, int* end_pin_index,
57195711
"The end_pin_index and start_pin_index can be the same.\n",
57205712
src_string);
57215713
exit(1);
5722-
}
5714+
}
57235715
}
57245716
if (*end_pin_index < 0 || *start_pin_index < 0) {
57255717
VTR_LOG_ERROR(
@@ -5777,7 +5769,6 @@ static void ProcessVibLayout(pugi::xml_node vib_layout_tag, t_arch* arch, const
57775769

57785770
arch->vib_grid_layouts.emplace_back(std::move(grid_def));
57795771
}
5780-
57815772
}
57825773

57835774
static t_vib_grid_def ProcessVibGridLayout(vtr::string_internment& strings, pugi::xml_node layout_type_tag, const pugiutil::loc_data& loc_data, t_arch* arch, int& num_of_avail_layer) {
@@ -5792,13 +5783,13 @@ static t_vib_grid_def ProcessVibGridLayout(vtr::string_internment& strings, pugi
57925783
grid_def.grid_type = VibGridDefType::VIB_AUTO;
57935784
grid_def.name = "auto";
57945785

5795-
for (size_t i = 0;i < arch->grid_layouts.size(); i++) {
5786+
for (size_t i = 0; i < arch->grid_layouts.size(); i++) {
57965787
if (arch->grid_layouts[i].name == grid_def.name) {
57975788
grid_def.aspect_ratio = arch->grid_layouts[i].aspect_ratio;
57985789
}
57995790
}
58005791
//grid_def.aspect_ratio = get_attribute(layout_type_tag, "aspect_ratio", loc_data, ReqOpt::OPTIONAL).as_float(1.);
5801-
5792+
58025793
} else if (layout_type_tag.name() == std::string("fixed_layout")) {
58035794
expect_only_attributes(layout_type_tag, {"name"}, loc_data);
58045795

libs/libarchfpga/src/vib_inf.cpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void VibInf::set_switch_name(const std::string switch_name) {
4343
void VibInf::set_seg_groups(const std::vector<t_seg_group> seg_groups) {
4444
VTR_ASSERT(!seg_groups.empty());
4545
seg_groups_.clear();
46-
for(auto seg_group : seg_groups) {
46+
for (auto seg_group : seg_groups) {
4747
seg_groups_.push_back(seg_group);
4848
}
4949
}
@@ -56,7 +56,7 @@ void VibInf::push_seg_group(const t_seg_group seg_group) {
5656
void VibInf::set_first_stages(const std::vector<t_first_stage_mux_inf> first_stages) {
5757
VTR_ASSERT(!first_stages.empty());
5858
first_stages_.clear();
59-
for(auto first_stage : first_stages) {
59+
for (auto first_stage : first_stages) {
6060
first_stages_.push_back(first_stage);
6161
}
6262
}
@@ -69,7 +69,7 @@ void VibInf::push_first_stage(const t_first_stage_mux_inf first_stage) {
6969
void VibInf::set_second_stages(const std::vector<t_second_stage_mux_inf> second_stages) {
7070
VTR_ASSERT(!second_stages.empty());
7171
second_stages_.clear();
72-
for(auto second_stage : second_stages) {
72+
for (auto second_stage : second_stages) {
7373
second_stages_.push_back(second_stage);
7474
}
7575
}
@@ -79,47 +79,47 @@ void VibInf::push_second_stage(const t_second_stage_mux_inf second_stage) {
7979
second_stages_.push_back(second_stage);
8080
}
8181

82-
std::string VibInf::get_name() const{
82+
std::string VibInf::get_name() const {
8383
VTR_ASSERT(!name_.empty());
8484
return name_;
8585
}
8686

87-
std::string VibInf::get_pbtype_name() const{
87+
std::string VibInf::get_pbtype_name() const {
8888
VTR_ASSERT(!pbtype_name_.empty());
8989
return pbtype_name_;
9090
}
9191

92-
int VibInf::get_seg_group_num() const{
92+
int VibInf::get_seg_group_num() const {
9393
VTR_ASSERT(seg_group_num_ >= 0);
9494
return seg_group_num_;
9595
}
9696

97-
int VibInf::get_switch_idx() const{
97+
int VibInf::get_switch_idx() const {
9898
VTR_ASSERT(switch_idx_ != -1);
9999
return switch_idx_;
100100
}
101101

102-
std::string VibInf::get_switch_name() const{
102+
std::string VibInf::get_switch_name() const {
103103
VTR_ASSERT(!switch_name_.empty());
104104
return switch_name_;
105105
}
106106

107-
std::vector<t_seg_group> VibInf::get_seg_groups() const{
107+
std::vector<t_seg_group> VibInf::get_seg_groups() const {
108108
VTR_ASSERT(!seg_groups_.empty());
109109
return seg_groups_;
110110
}
111111

112-
std::vector<t_first_stage_mux_inf> VibInf::get_first_stages() const{
112+
std::vector<t_first_stage_mux_inf> VibInf::get_first_stages() const {
113113
VTR_ASSERT(!first_stages_.empty());
114114
return first_stages_;
115115
}
116116

117-
std::vector<t_second_stage_mux_inf> VibInf::get_second_stages() const{
117+
std::vector<t_second_stage_mux_inf> VibInf::get_second_stages() const {
118118
VTR_ASSERT(!second_stages_.empty());
119119
return second_stages_;
120120
}
121121

122-
size_t VibInf::medium_mux_index_by_name(const std::string& name) const{
122+
size_t VibInf::medium_mux_index_by_name(const std::string& name) const {
123123
for (size_t i_medium = 0; i_medium < first_stages_.size(); ++i_medium) {
124124
if (name == first_stages_[i_medium].mux_name) {
125125
return i_medium;
@@ -128,9 +128,7 @@ size_t VibInf::medium_mux_index_by_name(const std::string& name) const{
128128
VTR_LOG_ERROR("No medium mux named %s!", name.c_str());
129129
}
130130

131-
132131
VibDeviceGrid::VibDeviceGrid(std::string grid_name, vtr::NdMatrix<const VibInf*, 3> vib_grid)
133132
: name_(std::move(grid_name))
134133
, vib_grid_(std::move(vib_grid)) {
135-
136134
}

0 commit comments

Comments
 (0)