Skip to content

Commit b7b04f4

Browse files
committed
make format
1 parent 31b67f2 commit b7b04f4

29 files changed

+385
-450
lines changed

libs/libarchfpga/src/physical_types.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2147,8 +2147,6 @@ struct t_noc_inf {
21472147
std::string noc_router_tile_name;
21482148
};
21492149

2150-
2151-
21522150
/* Detailed routing architecture */
21532151
struct t_arch {
21542152
/** Stores unique strings used as key and values in <metadata> tags,

libs/libarchfpga/src/read_xml_arch_file.cpp

Lines changed: 27 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,6 @@ static void ProcessVibBlockTypeLocs(t_vib_grid_def& grid_def,
316316
pugi::xml_node layout_block_type_tag,
317317
const pugiutil::loc_data& loc_data);
318318

319-
320319
static t_grid_def ProcessGridLayout(vtr::string_internment& strings, pugi::xml_node layout_type_tag, const pugiutil::loc_data& loc_data, t_arch* arch, int& num_of_avail_layer);
321320
static void ProcessBlockTypeLocs(t_grid_def& grid_def, int die_number, vtr::string_internment& strings, pugi::xml_node layout_block_type_tag, const pugiutil::loc_data& loc_data);
322321

@@ -4193,23 +4192,23 @@ static void ProcessBend(pugi::xml_node Node, std::vector<int>& list, std::vector
41934192

41944193
int tmp_len = 1;
41954194
int sum_len = 0;
4196-
for(size_t i_len = 0; i_len < list.size(); i_len++){
4195+
for (size_t i_len = 0; i_len < list.size(); i_len++) {
41974196
if (list[i_len] == 0) {
41984197
tmp_len++;
41994198
} else if (list[i_len] != 0) {
4200-
VTR_ASSERT(tmp_len < (int) list.size()+1);
4199+
VTR_ASSERT(tmp_len < (int)list.size() + 1);
42014200
part_len.push_back(tmp_len);
42024201
sum_len += tmp_len;
42034202
tmp_len = 1;
42044203
}
42054204
}
42064205

42074206
// add the last clip of segment
4208-
if (sum_len < (int) list.size()+1)
4207+
if (sum_len < (int)list.size() + 1)
42094208
part_len.push_back(list.size() + 1 - sum_len);
42104209
}
42114210

4212-
static void calculate_custom_SB_locations(const pugiutil::loc_data& loc_data, const pugi::xml_node& SubElem, const int grid_width, const int grid_height, t_switchblock_inf& sb){
4211+
static void calculate_custom_SB_locations(const pugiutil::loc_data& loc_data, const pugi::xml_node& SubElem, const int grid_width, const int grid_height, t_switchblock_inf& sb) {
42134212
auto startx_attr = get_attribute(SubElem, "startx", loc_data, ReqOpt::OPTIONAL);
42144213
auto endx_attr = get_attribute(SubElem, "endx", loc_data, ReqOpt::OPTIONAL);
42154214

@@ -5127,7 +5126,7 @@ static T* get_type_by_name(std::string_view type_name, std::vector<T>& types) {
51275126
// // 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
51285127
// /*
51295128
// * For example:
5130-
// * - 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
5129+
// * - 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
51315130
// *
51325131
// * start end
51335132
// *** *** *** ***
@@ -5261,11 +5260,11 @@ static T* get_type_by_name(std::string_view type_name, std::vector<T>& types) {
52615260
// }
52625261

52635262
// /* Each router needs a sperate <router> tag in the architecture description
5264-
// * to declare it. The number of declarations for each router in the
5263+
// * to declare it. The number of declarations for each router in the
52655264
// * architecture file is updated here.
52665265
// *
52675266
// * Additionally, for any given topology, a router can connect to other routers.
5268-
// * THe number of connections for each router is also updated here.
5267+
// * THe number of connections for each router is also updated here.
52695268
// *
52705269
// */
52715270
// 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) {
@@ -5296,7 +5295,7 @@ static T* get_type_by_name(std::string_view type_name, std::vector<T>& types) {
52965295
// * Verify each router in the noc by checking whether they satisfy the following conditions:
52975296
// * - The router has only one declaration in the arch file
52985297
// * - The router has atleast one connection to another router
5299-
// * If any of the conditions above are not met, then an error is thrown.
5298+
// * If any of the conditions above are not met, then an error is thrown.
53005299
// */
53015300
// static void verify_noc_topology(std::map<int, std::pair<int, int>>& routers_in_arch_info) {
53025301
// for (auto router_info = routers_in_arch_info.begin(); router_info != routers_in_arch_info.end(); router_info++) {
@@ -5329,7 +5328,7 @@ static void ProcessVibArch(pugi::xml_node Parent, std::vector<t_physical_tile_ty
53295328
int num_vibs = count_children(Parent, "vib", loc_data);
53305329
arch->vib_infs.reserve(num_vibs);
53315330
Node = get_first_child(Parent, "vib", loc_data);
5332-
5331+
53335332
for (int i_vib = 0; i_vib < num_vibs; i_vib++) {
53345333
ProcessVib(Node, PhysicalTileTypes, arch, loc_data);
53355334
Node = Node.next_sibling(Node.name());
@@ -5349,25 +5348,23 @@ static void ProcessVib(pugi::xml_node Vib_node, std::vector<t_physical_tile_type
53495348
tmp = get_attribute(Vib_node, "name", loc_data).as_string(nullptr);
53505349
if (tmp) {
53515350
vib.set_name(tmp);
5352-
}
5353-
else {
5351+
} else {
53545352
archfpga_throw(loc_data.filename_c_str(), loc_data.line(Vib_node),
53555353
"No name specified for the vib!\n");
53565354
}
53575355

53585356
tmp = get_attribute(Vib_node, "pbtype_name", loc_data).as_string(nullptr);
53595357
if (tmp) {
53605358
vib.set_pbtype_name(tmp);
5361-
}
5362-
else {
5359+
} else {
53635360
archfpga_throw(loc_data.filename_c_str(), loc_data.line(Vib_node),
53645361
"No pbtype_name specified for the vib!\n");
53655362
}
53665363

53675364
vib.set_seg_group_num(get_attribute(Vib_node, "vib_seg_group", loc_data).as_int(1));
53685365

53695366
tmp = get_attribute(Vib_node, "arch_vib_switch", loc_data).as_string(nullptr);
5370-
5367+
53715368
if (tmp) {
53725369
std::string str_tmp;
53735370
str_tmp = tmp;
@@ -5378,8 +5375,7 @@ static void ProcessVib(pugi::xml_node Vib_node, std::vector<t_physical_tile_type
53785375
// break;
53795376
// }
53805377
// }
5381-
}
5382-
else {
5378+
} else {
53835379
archfpga_throw(loc_data.filename_c_str(), loc_data.line(Vib_node),
53845380
"No switch specified for the vib!\n");
53855381
}
@@ -5394,7 +5390,7 @@ static void ProcessVib(pugi::xml_node Vib_node, std::vector<t_physical_tile_type
53945390
t_seg_group seg_group;
53955391

53965392
tmp = get_attribute(Node, "name", loc_data).as_string(nullptr);
5397-
5393+
53985394
if (tmp) {
53995395
seg_group.name = tmp;
54005396
// for (int i_seg = 0; i_seg < (int)segments.size(); i_seg++) {
@@ -5403,8 +5399,7 @@ static void ProcessVib(pugi::xml_node Vib_node, std::vector<t_physical_tile_type
54035399
// break;
54045400
// }
54055401
// }
5406-
}
5407-
else {
5402+
} else {
54085403
archfpga_throw(loc_data.filename_c_str(), loc_data.line(Node),
54095404
"No name specified for the vib seg group!\n");
54105405
}
@@ -5425,8 +5420,7 @@ static void ProcessVib(pugi::xml_node Vib_node, std::vector<t_physical_tile_type
54255420
itmp = get_attribute(Node, "track_nums", loc_data).as_int();
54265421
if (itmp) {
54275422
seg_group.track_num = itmp;
5428-
}
5429-
else {
5423+
} else {
54305424
archfpga_throw(loc_data.filename_c_str(), loc_data.line(Node),
54315425
"No track_num specified for the vib seg group!\n");
54325426
}
@@ -5447,7 +5441,6 @@ static void ProcessVib(pugi::xml_node Vib_node, std::vector<t_physical_tile_type
54475441
for (auto first_stage : first_stages) {
54485442
vib.push_first_stage(first_stage);
54495443
}
5450-
54515444
}
54525445

54535446
SubElem = get_single_child(Node, "second_stage", loc_data);
@@ -5458,7 +5451,6 @@ static void ProcessVib(pugi::xml_node Vib_node, std::vector<t_physical_tile_type
54585451
for (auto second_stage : second_stages) {
54595452
vib.push_second_stage(second_stage);
54605453
}
5461-
54625454
}
54635455

54645456
arch->vib_infs.push_back(vib);
@@ -5522,7 +5514,7 @@ static void ProcessSecondStage(pugi::xml_node Stage_node, std::vector<t_physical
55225514
// //VTR_ASSERT(to.from_type == SEGMENT || to.from_type == PB);
55235515
// second_stage_mux.to.push_back(to);
55245516
// }
5525-
5517+
55265518
SubElem = get_first_child(Node, "from", loc_data);
55275519
int from_num = count_children(Node, "from", loc_data);
55285520
for (int i_from = 0; i_from < from_num; i_from++) {
@@ -5562,7 +5554,7 @@ static void ProcessSecondStage(pugi::xml_node Stage_node, std::vector<t_physical
55625554
// pb_type_name = new char[strlen(Token_char)];
55635555
// port_name = new char[strlen(Token_char)];
55645556
// parse_pin_name((char*)Token_char, &start_pin_index, &end_pin_index, pb_type_name, port_name);
5565-
5557+
55665558
// std::vector<int> all_sub_tile_to_tile_pin_indices;
55675559
// for (auto& sub_tile : PhysicalTileTypes[i_phy_type].sub_tiles) {
55685560
// int sub_tile_capacity = sub_tile.capacity.total();
@@ -5608,14 +5600,14 @@ static void ProcessSecondStage(pugi::xml_node Stage_node, std::vector<t_physical
56085600
// from_inf.phy_pin_index = all_sub_tile_to_tile_pin_indices[i];
56095601
// froms.push_back(from_inf);
56105602
// }
5611-
5603+
56125604
// // for (auto& sub_tile : PhysicalTileTypes[i_phy_type].sub_tiles) {
56135605
// // //int sub_tile_index = sub_tile.index;
56145606
// // int sub_tile_capacity = sub_tile.capacity.total();
56155607

56165608
// // int i_port = 0;
56175609
// // for (; i_port < (int)sub_tile.ports.size(); ++i_port) {
5618-
5610+
56195611
// // if (!strcmp(sub_tile.ports[i_port].name, port_name)) {
56205612
// // if (start_pin_index == end_pin_index && start_pin_index < 0) {
56215613
// // start_pin_index = 0;
@@ -5645,7 +5637,7 @@ static void ProcessSecondStage(pugi::xml_node Stage_node, std::vector<t_physical
56455637
// // }
56465638
// // }
56475639
// // }
5648-
5640+
56495641
// }
56505642
// }
56515643
// for (int i_seg_type = 0; i_seg_type < (int)segments.size(); i_seg_type++) {
@@ -5665,12 +5657,12 @@ static void ProcessSecondStage(pugi::xml_node Stage_node, std::vector<t_physical
56655657
// from_inf.seg_index = seg_index;
56665658
// froms.push_back(from_inf);
56675659
// }
5668-
5660+
56695661
// break;
56705662
// }
56715663
// }
56725664
// VTR_ASSERT(from_type == PB || from_type == SEGMENT);
5673-
5665+
56745666
// }
56755667
// else {
56765668
// std::string msg = vtr::string_fmt("Failed to parse vib mux from information '%s'", Token.c_str());
@@ -5694,9 +5686,8 @@ void parse_pin_name(char* src_string, int* start_pin_index, int* end_pin_index,
56945686
/* Format "pb_type_name.port_name" */
56955687
*start_pin_index = *end_pin_index = -1;
56965688

5697-
56985689
strcpy(source_string, src_string);
5699-
5690+
57005691
for (ichar = 0; ichar < (int)(strlen(source_string)); ichar++) {
57015692
if (source_string[ichar] == '.')
57025693
source_string[ichar] = ' ';
@@ -5738,7 +5729,7 @@ void parse_pin_name(char* src_string, int* start_pin_index, int* end_pin_index,
57385729
"The end_pin_index and start_pin_index can be the same.\n",
57395730
src_string);
57405731
exit(1);
5741-
}
5732+
}
57425733
}
57435734
if (*end_pin_index < 0 || *start_pin_index < 0) {
57445735
VTR_LOG_ERROR(
@@ -5796,7 +5787,6 @@ static void ProcessVibLayout(pugi::xml_node vib_layout_tag, t_arch* arch, const
57965787

57975788
arch->vib_grid_layouts.emplace_back(std::move(grid_def));
57985789
}
5799-
58005790
}
58015791

58025792
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) {
@@ -5811,13 +5801,13 @@ static t_vib_grid_def ProcessVibGridLayout(vtr::string_internment& strings, pugi
58115801
grid_def.grid_type = VibGridDefType::VIB_AUTO;
58125802
grid_def.name = "auto";
58135803

5814-
for (size_t i = 0;i < arch->grid_layouts.size(); i++) {
5804+
for (size_t i = 0; i < arch->grid_layouts.size(); i++) {
58155805
if (arch->grid_layouts[i].name == grid_def.name) {
58165806
grid_def.aspect_ratio = arch->grid_layouts[i].aspect_ratio;
58175807
}
58185808
}
58195809
//grid_def.aspect_ratio = get_attribute(layout_type_tag, "aspect_ratio", loc_data, ReqOpt::OPTIONAL).as_float(1.);
5820-
5810+
58215811
} else if (layout_type_tag.name() == std::string("fixed_layout")) {
58225812
expect_only_attributes(layout_type_tag, {"name"}, loc_data);
58235813

@@ -6111,4 +6101,3 @@ static void ProcessVibBlockTypeLocs(t_vib_grid_def& grid_def,
61116101
}
61126102
}
61136103
}
6114-

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)