Skip to content

Commit 430f080

Browse files
make format
1 parent b8a230c commit 430f080

File tree

231 files changed

+2030
-2268
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

231 files changed

+2030
-2268
lines changed

libs/libarchfpga/src/physical_types.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,8 +1248,8 @@ struct t_pin_to_pin_annotation {
12481248
* flat_site_index : Index of this primitive site within its primitive type within this cluster type.
12491249
* Values are in [0...total_primitive_count-1], e.g. if there are 10 ALMs per cluster, 2 FFS
12501250
* and 2 LUTs per ALM, then flat site indices for FFs would run from 0 to 19, and flat site
1251-
indices for LUTs would run from 0 to 19. This member is only used by nodes corresponding
1252-
to primitive sites. It is used when reconstructing clusters from a flat placement file.
1251+
* indices for LUTs would run from 0 to 19. This member is only used by nodes corresponding
1252+
* to primitive sites. It is used when reconstructing clusters from a flat placement file.
12531253
* illegal_modes : vector containing illegal modes that result in conflicts during routing
12541254
*/
12551255
class t_pb_graph_node {
@@ -1303,7 +1303,7 @@ class t_pb_graph_node {
13031303

13041304
int total_pb_pins; /* only valid for top-level */
13051305

1306-
void* temp_scratch_pad; /* temporary data, useful for keeping track of things when traversing data structure */
1306+
void* temp_scratch_pad; /* temporary data, useful for keeping track of things when traversing data structure */
13071307

13081308
int* input_pin_class_size; /* Stores the number of pins that belong to a particular input pin class */
13091309
int num_input_pin_class; /* number of input pin classes that this pb_graph_node has */
@@ -1313,7 +1313,6 @@ class t_pb_graph_node {
13131313
int total_primitive_count; /* total number of this primitive type in the cluster */
13141314
int flat_site_index; /* index of this primitive within sites of its type in this cluster */
13151315

1316-
13171316
/* Interconnect instances for this pb
13181317
* Only used for power
13191318
*/
@@ -1953,7 +1952,7 @@ struct t_switchblock_inf {
19531952
/* We can also define a region to apply this SB to all locations falls into this region using regular expression in the architecture file*/
19541953
t_sb_loc_spec reg_x;
19551954
t_sb_loc_spec reg_y;
1956-
1955+
19571956
t_permutation_map permutation_map; /* map holding the permutation functions attributed to this switchblock */
19581957

19591958
std::vector<t_wireconn_inf> wireconns; /* list of wire types/groups this SB will connect */
@@ -2107,11 +2106,11 @@ struct t_arch {
21072106
std::vector<std::string> ipin_cblock_switch_name;
21082107

21092108
std::vector<t_grid_def> grid_layouts; //Set of potential device layouts
2110-
2109+
21112110
//the layout that is chosen to be used with command line options
21122111
//It is used to generate custom SB for a specific locations within the device
21132112
//If the layout is not specified in the command line options, this variable will be set to "auto"
2114-
std::string device_layout;
2113+
std::string device_layout;
21152114

21162115
t_clock_arch_spec clock_arch; // Clock related data types
21172116

libs/libarchfpga/src/read_fpga_interchange_arch.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@
55

66
#ifdef VTR_ENABLE_CAPNPROTO
77

8-
# include <algorithm>
9-
# include <kj/std/iostream.h>
10-
# include <limits>
11-
# include <map>
12-
# include <regex>
13-
# include <set>
14-
# include <stdlib.h>
15-
# include <string>
16-
# include <string.h>
17-
# include <zlib.h>
18-
# include <sstream>
19-
20-
# include "vtr_assert.h"
21-
# include "vtr_digest.h"
22-
# include "vtr_log.h"
23-
# include "vtr_memory.h"
24-
# include "vtr_util.h"
25-
26-
# include "arch_check.h"
27-
# include "arch_error.h"
28-
# include "arch_util.h"
29-
# include "arch_types.h"
8+
#include <algorithm>
9+
#include <kj/std/iostream.h>
10+
#include <limits>
11+
#include <map>
12+
#include <regex>
13+
#include <set>
14+
#include <stdlib.h>
15+
#include <string>
16+
#include <string.h>
17+
#include <zlib.h>
18+
#include <sstream>
19+
20+
#include "vtr_assert.h"
21+
#include "vtr_digest.h"
22+
#include "vtr_log.h"
23+
#include "vtr_memory.h"
24+
#include "vtr_util.h"
25+
26+
#include "arch_check.h"
27+
#include "arch_error.h"
28+
#include "arch_util.h"
29+
#include "arch_types.h"
3030

3131
/*
3232
* FPGA Interchange Device frontend

libs/libarchfpga/src/read_fpga_interchange_arch.h

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

66
#ifdef VTR_ENABLE_CAPNPROTO
77

8-
# include "DeviceResources.capnp.h"
9-
# include "LogicalNetlist.capnp.h"
10-
# include "capnp/serialize.h"
11-
# include "capnp/serialize-packed.h"
12-
# include <fcntl.h>
13-
# include <unistd.h>
8+
#include "DeviceResources.capnp.h"
9+
#include "LogicalNetlist.capnp.h"
10+
#include "capnp/serialize.h"
11+
#include "capnp/serialize-packed.h"
12+
#include <fcntl.h>
13+
#include <unistd.h>
1414

1515
#endif // VTR_ENABLE_CAPNPROTO
1616

libs/libarchfpga/src/read_xml_arch_file.cpp

Lines changed: 36 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ static void ProcessSubTiles(pugi::xml_node Node,
194194
* string interment storage.
195195
* @param loc_data Points to the location in the architecture file where the parser is reading.
196196
* @param pb_idx Used to assign unique values to index_in_logical_block field in
197-
* t_pb_type for all pb_types under a logical block type.
197+
* t_pb_type for all pb_types under a logical block type.
198198
*/
199199
static void ProcessPb_Type(pugi::xml_node Parent,
200200
t_pb_type* pb_type,
@@ -253,7 +253,7 @@ static void ProcessMode(pugi::xml_node Parent,
253253
* @brief Processes <metadata> tags.
254254
*
255255
* @param strings String internment storage used to store strings used
256-
* as keys and values in <metadata> tags.
256+
* as keys and values in <metadata> tags.
257257
* @param Parent An XML node pointing to the parent tag whose <metadata> children
258258
* are to be parsed.
259259
* @param loc_data Points to the location in the architecture file where the parser is reading.
@@ -358,7 +358,6 @@ static void ProcessPower(pugi::xml_node parent,
358358

359359
static void ProcessClocks(pugi::xml_node Parent, t_clock_arch* clocks, const pugiutil::loc_data& loc_data);
360360

361-
362361
static void ProcessPb_TypePowerEstMethod(pugi::xml_node Parent, t_pb_type* pb_type, const pugiutil::loc_data& loc_data);
363362
static void ProcessPb_TypePort_Power(pugi::xml_node Parent, t_port* port, e_power_estimation_method power_method, const pugiutil::loc_data& loc_data);
364363

@@ -1746,10 +1745,9 @@ static void ProcessInterconnect(vtr::string_internment& strings,
17461745
}
17471746

17481747
mode->interconnect[interconnect_idx].annotations = (t_pin_to_pin_annotation*)vtr::calloc(num_annotations,
1749-
sizeof(t_pin_to_pin_annotation));
1748+
sizeof(t_pin_to_pin_annotation));
17501749
mode->interconnect[interconnect_idx].num_annotations = num_annotations;
17511750

1752-
17531751
int annotation_idx = 0;
17541752
for (auto annot_child_name : {"delay_constant", "delay_matrix", "C_constant", "C_matrix", "pack_pattern"}) {
17551753
pugi::xml_node Cur2 = get_first_child(Cur, annot_child_name, loc_data, ReqOpt::OPTIONAL);
@@ -1767,7 +1765,7 @@ static void ProcessInterconnect(vtr::string_internment& strings,
17671765

17681766
/* Power */
17691767
mode->interconnect[interconnect_idx].interconnect_power = (t_interconnect_power*)vtr::calloc(1,
1770-
sizeof(t_interconnect_power));
1768+
sizeof(t_interconnect_power));
17711769
mode->interconnect[interconnect_idx].interconnect_power->port_info_initialized = false;
17721770

17731771
/* get next iteration */
@@ -2907,7 +2905,6 @@ static void ProcessTiles(pugi::xml_node Node,
29072905
t_arch& arch,
29082906
const pugiutil::loc_data& loc_data,
29092907
const int num_of_avail_layer) {
2910-
29112908
// used to find duplicate tile names
29122909
std::set<std::string> tile_type_descriptors;
29132910

@@ -3805,7 +3802,7 @@ static void ProcessSegments(pugi::xml_node Parent,
38053802
tmp = get_attribute(SubElem, "name", loc_data, ReqOpt::OPTIONAL).as_string(nullptr);
38063803

38073804
//check if <mux> tag is defined in the architecture, otherwise we should look for <mux_inc> and <mux_dec>
3808-
if(tmp){
3805+
if (tmp) {
38093806
/* Match names */
38103807
for (j = 0; j < NumSwitches; ++j) {
38113808
if (0 == strcmp(tmp, Switches[j].name.c_str())) {
@@ -3814,22 +3811,21 @@ static void ProcessSegments(pugi::xml_node Parent,
38143811
}
38153812
if (j >= NumSwitches) {
38163813
archfpga_throw(loc_data.filename_c_str(), loc_data.line(SubElem),
3817-
"'%s' is not a valid mux name.\n", tmp);
3814+
"'%s' is not a valid mux name.\n", tmp);
38183815
}
38193816

38203817
/* Unidir muxes must have the same switch
3821-
* for wire and opin fanin since there is
3822-
* really only the mux in unidir. */
3818+
* for wire and opin fanin since there is
3819+
* really only the mux in unidir. */
38233820
Segs[i].arch_wire_switch = j;
38243821
Segs[i].arch_opin_switch = j;
3825-
}
3826-
else { //if a general mux is not defined, we should look for specific mux for each direction in the architecture file
3822+
} else { //if a general mux is not defined, we should look for specific mux for each direction in the architecture file
38273823
SubElem = get_single_child(Node, "mux_inc", loc_data, ReqOpt::OPTIONAL);
38283824
tmp = get_attribute(SubElem, "name", loc_data, ReqOpt::OPTIONAL).as_string(nullptr);
3829-
if(!tmp){
3825+
if (!tmp) {
38303826
archfpga_throw(loc_data.filename_c_str(), loc_data.line(SubElem),
3831-
"if mux is not specified in a wire segment, both mux_inc and mux_dec should be specified");
3832-
} else{
3827+
"if mux is not specified in a wire segment, both mux_inc and mux_dec should be specified");
3828+
} else {
38333829
/* Match names */
38343830
for (j = 0; j < NumSwitches; ++j) {
38353831
if (0 == strcmp(tmp, Switches[j].name.c_str())) {
@@ -3838,22 +3834,22 @@ static void ProcessSegments(pugi::xml_node Parent,
38383834
}
38393835
if (j >= NumSwitches) {
38403836
archfpga_throw(loc_data.filename_c_str(), loc_data.line(SubElem),
3841-
"'%s' is not a valid mux name.\n", tmp);
3837+
"'%s' is not a valid mux name.\n", tmp);
38423838
}
38433839

38443840
/* Unidir muxes must have the same switch
3845-
* for wire and opin fanin since there is
3846-
* really only the mux in unidir. */
3841+
* for wire and opin fanin since there is
3842+
* really only the mux in unidir. */
38473843
Segs[i].arch_wire_switch = j;
38483844
Segs[i].arch_opin_switch = j;
38493845
}
38503846

38513847
SubElem = get_single_child(Node, "mux_dec", loc_data, ReqOpt::OPTIONAL);
38523848
tmp = get_attribute(SubElem, "name", loc_data, ReqOpt::OPTIONAL).as_string(nullptr);
3853-
if(!tmp){
3849+
if (!tmp) {
38543850
archfpga_throw(loc_data.filename_c_str(), loc_data.line(SubElem),
3855-
"if mux is not specified in a wire segment, both mux_inc and mux_dec should be specified");
3856-
} else{
3851+
"if mux is not specified in a wire segment, both mux_inc and mux_dec should be specified");
3852+
} else {
38573853
/* Match names */
38583854
for (j = 0; j < NumSwitches; ++j) {
38593855
if (0 == strcmp(tmp, Switches[j].name.c_str())) {
@@ -3862,18 +3858,17 @@ static void ProcessSegments(pugi::xml_node Parent,
38623858
}
38633859
if (j >= NumSwitches) {
38643860
archfpga_throw(loc_data.filename_c_str(), loc_data.line(SubElem),
3865-
"'%s' is not a valid mux name.\n", tmp);
3861+
"'%s' is not a valid mux name.\n", tmp);
38663862
}
38673863

38683864
/* Unidir muxes must have the same switch
3869-
* for wire and opin fanin since there is
3870-
* really only the mux in unidir. */
3865+
* for wire and opin fanin since there is
3866+
* really only the mux in unidir. */
38713867
Segs[i].arch_wire_switch_dec = j;
38723868
Segs[i].arch_opin_switch_dec = j;
38733869
}
38743870
}
3875-
}
3876-
else {
3871+
} else {
38773872
VTR_ASSERT(BI_DIRECTIONAL == Segs[i].directionality);
38783873
SubElem = get_single_child(Node, "wire_switch", loc_data);
38793874
tmp = get_attribute(SubElem, "name", loc_data).value();
@@ -3938,13 +3933,12 @@ static void ProcessSegments(pugi::xml_node Parent,
39383933
}
39393934
}
39403935

3941-
3942-
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){
3936+
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) {
39433937
auto startx_attr = get_attribute(SubElem, "startx", loc_data, ReqOpt::OPTIONAL);
3944-
auto endx_attr = get_attribute(SubElem, "endx", loc_data, ReqOpt::OPTIONAL);
3938+
auto endx_attr = get_attribute(SubElem, "endx", loc_data, ReqOpt::OPTIONAL);
39453939

39463940
auto starty_attr = get_attribute(SubElem, "starty", loc_data, ReqOpt::OPTIONAL);
3947-
auto endy_attr = get_attribute(SubElem, "endy", loc_data, ReqOpt::OPTIONAL);
3941+
auto endy_attr = get_attribute(SubElem, "endy", loc_data, ReqOpt::OPTIONAL);
39483942

39493943
auto repeatx_attr = get_attribute(SubElem, "repeatx", loc_data, ReqOpt::OPTIONAL);
39503944
auto repeaty_attr = get_attribute(SubElem, "repeaty", loc_data, ReqOpt::OPTIONAL);
@@ -3959,19 +3953,17 @@ static void calculate_custom_SB_locations(const pugiutil::loc_data& loc_data, co
39593953
vars.set_var_value("W", grid_width);
39603954
vars.set_var_value("H", grid_height);
39613955

3962-
39633956
sb.reg_x.start = startx_attr.empty() ? 0 : p.parse_formula(startx_attr.value(), vars);
39643957
sb.reg_y.start = starty_attr.empty() ? 0 : p.parse_formula(starty_attr.value(), vars);
39653958

39663959
sb.reg_x.end = endx_attr.empty() ? (grid_width - 1) : p.parse_formula(endx_attr.value(), vars);
3967-
sb.reg_y.end = endy_attr.empty() ? (grid_height -1) : p.parse_formula(endy_attr.value(), vars);
3960+
sb.reg_y.end = endy_attr.empty() ? (grid_height - 1) : p.parse_formula(endy_attr.value(), vars);
39683961

39693962
sb.reg_x.repeat = repeatx_attr.empty() ? 0 : p.parse_formula(repeatx_attr.value(), vars);
39703963
sb.reg_y.repeat = repeaty_attr.empty() ? 0 : p.parse_formula(repeaty_attr.value(), vars);
39713964

39723965
sb.reg_x.incr = incrx_attr.empty() ? 1 : p.parse_formula(incrx_attr.value(), vars);
39733966
sb.reg_y.incr = incry_attr.empty() ? 1 : p.parse_formula(incry_attr.value(), vars);
3974-
39753967
}
39763968

39773969
/* Processes the switchblocklist section from the xml architecture file.
@@ -3985,10 +3977,10 @@ static void ProcessSwitchblocks(pugi::xml_node Parent, t_arch* arch, const pugiu
39853977
/* get the number of switchblocks */
39863978
int num_switchblocks = count_children(Parent, "switchblock", loc_data);
39873979
arch->switchblocks.reserve(num_switchblocks);
3988-
3980+
39893981
int layout_index = -1;
3990-
for(layout_index = 0; layout_index < (int) arch->grid_layouts.size(); layout_index++){
3991-
if(arch->grid_layouts.at(layout_index).name == arch->device_layout){
3982+
for (layout_index = 0; layout_index < (int)arch->grid_layouts.size(); layout_index++) {
3983+
if (arch->grid_layouts.at(layout_index).name == arch->device_layout) {
39923984
//found the used layout
39933985
break;
39943986
}
@@ -4040,8 +4032,8 @@ static void ProcessSwitchblocks(pugi::xml_node Parent, t_arch* arch, const pugiu
40404032
}
40414033

40424034
/* get the switchblock coordinate only if sb.location is set to E_XY_SPECIFIED*/
4043-
if(sb.location == e_sb_location::E_XY_SPECIFIED){
4044-
if (arch->device_layout == "auto"){
4035+
if (sb.location == e_sb_location::E_XY_SPECIFIED) {
4036+
if (arch->device_layout == "auto") {
40454037
archfpga_throw(loc_data.filename_c_str(), loc_data.line(SubElem), "Specifying SB locations for auto layout devices are not supported yet!\n");
40464038
}
40474039
expect_only_attributes(SubElem,
@@ -4052,25 +4044,24 @@ static void ProcessSwitchblocks(pugi::xml_node Parent, t_arch* arch, const pugiu
40524044

40534045
int grid_width = arch->grid_layouts.at(layout_index).width;
40544046
int grid_height = arch->grid_layouts.at(layout_index).height;
4055-
4047+
40564048
/* Absolute location that this SB must be applied to, -1 if not specified*/
40574049
sb.x = get_attribute(SubElem, "x", loc_data, ReqOpt::OPTIONAL).as_int(-1);
40584050
sb.y = get_attribute(SubElem, "y", loc_data, ReqOpt::OPTIONAL).as_int(-1);
40594051

40604052
//check if the absolute value is within the device grid width and height
4061-
if(sb.x >= grid_width || sb.y >= grid_height) {
4062-
archfpga_throw(loc_data.filename_c_str(), loc_data.line(SubElem), \
4063-
"Location (%d,%d) is not valid within the grid! grid dimensions are: (%d,%d)\n", sb.x, sb.y, grid_width, grid_height);
4053+
if (sb.x >= grid_width || sb.y >= grid_height) {
4054+
archfpga_throw(loc_data.filename_c_str(), loc_data.line(SubElem),
4055+
"Location (%d,%d) is not valid within the grid! grid dimensions are: (%d,%d)\n", sb.x, sb.y, grid_width, grid_height);
40644056
}
4065-
4057+
40664058
/* if the the switchblock exact location is not specified and a region is specified within the architecture file,
40674059
* we have to parse the region specification and apply the SB pattern to all the locations fall into the specified
40684060
* region based on device width and height.
40694061
*/
40704062
if (sb.x == -1 && sb.y == -1) {
40714063
calculate_custom_SB_locations(loc_data, SubElem, grid_width, grid_height, sb);
40724064
}
4073-
40744065
}
40754066

40764067
/* get switchblock permutation functions */

0 commit comments

Comments
 (0)