Skip to content

Commit 7905df1

Browse files
Merge pull request #2935 from verilog-to-routing/temp_format_try3
Yet another update of the code base to be consistent with code formatting rules
2 parents 014cda7 + 859864b commit 7905df1

File tree

102 files changed

+905
-974
lines changed

Some content is hidden

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

102 files changed

+905
-974
lines changed

.clang-format

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ AllowShortIfStatementsOnASingleLine: true
1515
AllowShortLoopsOnASingleLine: false
1616
AlwaysBreakAfterDefinitionReturnType: None
1717
AlwaysBreakAfterReturnType: None
18-
AlwaysBreakBeforeMultilineStrings: true
18+
AlwaysBreakBeforeMultilineStrings: false
1919
AlwaysBreakTemplateDeclarations: true
2020
BinPackArguments: true
2121
BinPackParameters: false
@@ -34,7 +34,7 @@ BraceWrapping:
3434
SplitEmptyFunction: false
3535
SplitEmptyRecord: true
3636
SplitEmptyNamespace: true
37-
BreakBeforeBinaryOperators: All
37+
BreakBeforeBinaryOperators: NonAssignment
3838
BreakBeforeBraces: Custom
3939
BreakBeforeInheritanceComma: false
4040
BreakBeforeTernaryOperators: true

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ jobs:
8989
with:
9090
python-version: 3.10.10
9191
- uses: actions/checkout@v4
92+
with:
93+
submodules: 'true'
9294

9395
- name: Install dependencies
9496
run: ./.github/scripts/install_dependencies.sh

dev/pylint_check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def expand_paths():
132132
"""Build a list of all python files to process by going through 'paths_to_lint'"""
133133

134134
paths = []
135-
for (path, is_recursive) in paths_to_lint:
135+
for path, is_recursive in paths_to_lint:
136136
# Make sure all hard-coded paths point to .py files
137137
if path.is_file():
138138
if path.suffix.lower() != ".py":

dev/submit_slurm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def get_resource_estimates(filepath):
188188
mem_bytes = float(match.groupdict()["mem_bytes"])
189189

190190
time_minutes = time_sec / 60
191-
mem_mb = mem_bytes / (1024 ** 2)
191+
mem_mb = mem_bytes / (1024**2)
192192

193193
return time_minutes, mem_mb
194194

dev/vtr_gdb_pretty_printers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
88
https://docs.verilogtorouting.org/en/latest/dev/developing#vtr-pretty-printers
99
"""
10+
1011
import re
1112

13+
1214
# VTR related
1315
class VtrStrongIdPrinter:
1416
def __init__(self, val, typename="vtr::StrongId"):

libs/libarchfpga/src/read_fpga_interchange_arch.cpp

Lines changed: 23 additions & 23 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
@@ -1076,7 +1076,7 @@ struct ArchReader {
10761076
continue;
10771077

10781078
// Check for duplicates
1079-
auto is_duplicate = [name](const t_logical_block_type& l)-> bool { return l.name == name; };
1079+
auto is_duplicate = [name](const t_logical_block_type& l) -> bool { return l.name == name; };
10801080
VTR_ASSERT(std::find_if(ltypes_.begin(), ltypes_.end(), is_duplicate) == ltypes_.end());
10811081

10821082
ltype.name = name;

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 & 44 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

@@ -1749,10 +1748,9 @@ static void ProcessInterconnect(vtr::string_internment& strings,
17491748
}
17501749

17511750
mode->interconnect[interconnect_idx].annotations = (t_pin_to_pin_annotation*)vtr::calloc(num_annotations,
1752-
sizeof(t_pin_to_pin_annotation));
1751+
sizeof(t_pin_to_pin_annotation));
17531752
mode->interconnect[interconnect_idx].num_annotations = num_annotations;
17541753

1755-
17561754
int annotation_idx = 0;
17571755
for (auto annot_child_name : {"delay_constant", "delay_matrix", "C_constant", "C_matrix", "pack_pattern"}) {
17581756
pugi::xml_node Cur2 = get_first_child(Cur, annot_child_name, loc_data, ReqOpt::OPTIONAL);
@@ -1770,7 +1768,7 @@ static void ProcessInterconnect(vtr::string_internment& strings,
17701768

17711769
/* Power */
17721770
mode->interconnect[interconnect_idx].interconnect_power = (t_interconnect_power*)vtr::calloc(1,
1773-
sizeof(t_interconnect_power));
1771+
sizeof(t_interconnect_power));
17741772
mode->interconnect[interconnect_idx].interconnect_power->port_info_initialized = false;
17751773

17761774
/* get next iteration */
@@ -3805,63 +3803,61 @@ static std::vector<t_segment_inf> ProcessSegments(pugi::xml_node Parent,
38053803
tmp = get_attribute(SubElem, "name", loc_data, ReqOpt::OPTIONAL).as_string(nullptr);
38063804

38073805
//check if <mux> tag is defined in the architecture, otherwise we should look for <mux_inc> and <mux_dec>
3808-
if(tmp){
3806+
if (tmp) {
38093807
/* Match names */
38103808
int switch_idx = find_switch_by_name(switches, tmp);
38113809
if (switch_idx < 0) {
38123810
archfpga_throw(loc_data.filename_c_str(), loc_data.line(SubElem),
3813-
"'%s' is not a valid mux name.\n", tmp);
3811+
"'%s' is not a valid mux name.\n", tmp);
38143812
}
38153813

38163814
/* Unidir muxes must have the same switch
3817-
* for wire and opin fanin since there is
3818-
* really only the mux in unidir. */
3815+
* for wire and opin fanin since there is
3816+
* really only the mux in unidir. */
38193817
Segs[i].arch_wire_switch = switch_idx;
38203818
Segs[i].arch_opin_switch = switch_idx;
3821-
}
3822-
else { //if a general mux is not defined, we should look for specific mux for each direction in the architecture file
3819+
} else { //if a general mux is not defined, we should look for specific mux for each direction in the architecture file
38233820
SubElem = get_single_child(Node, "mux_inc", loc_data, ReqOpt::OPTIONAL);
38243821
tmp = get_attribute(SubElem, "name", loc_data, ReqOpt::OPTIONAL).as_string(nullptr);
3825-
if(!tmp){
3822+
if (!tmp) {
38263823
archfpga_throw(loc_data.filename_c_str(), loc_data.line(SubElem),
3827-
"if mux is not specified in a wire segment, both mux_inc and mux_dec should be specified");
3828-
} else{
3824+
"if mux is not specified in a wire segment, both mux_inc and mux_dec should be specified");
3825+
} else {
38293826
/* Match names */
38303827
int switch_idx = find_switch_by_name(switches, tmp);
38313828
if (switch_idx < 0) {
38323829
archfpga_throw(loc_data.filename_c_str(), loc_data.line(SubElem),
3833-
"'%s' is not a valid mux name.\n", tmp);
3830+
"'%s' is not a valid mux name.\n", tmp);
38343831
}
38353832

38363833
/* Unidir muxes must have the same switch
3837-
* for wire and opin fanin since there is
3838-
* really only the mux in unidir. */
3834+
* for wire and opin fanin since there is
3835+
* really only the mux in unidir. */
38393836
Segs[i].arch_wire_switch = switch_idx;
38403837
Segs[i].arch_opin_switch = switch_idx;
38413838
}
38423839

38433840
SubElem = get_single_child(Node, "mux_dec", loc_data, ReqOpt::OPTIONAL);
38443841
tmp = get_attribute(SubElem, "name", loc_data, ReqOpt::OPTIONAL).as_string(nullptr);
3845-
if(!tmp){
3842+
if (!tmp) {
38463843
archfpga_throw(loc_data.filename_c_str(), loc_data.line(SubElem),
3847-
"if mux is not specified in a wire segment, both mux_inc and mux_dec should be specified");
3848-
} else{
3844+
"if mux is not specified in a wire segment, both mux_inc and mux_dec should be specified");
3845+
} else {
38493846
/* Match names */
38503847
int switch_idx = find_switch_by_name(switches, tmp);
38513848
if (switch_idx < 0) {
38523849
archfpga_throw(loc_data.filename_c_str(), loc_data.line(SubElem),
3853-
"'%s' is not a valid mux name.\n", tmp);
3850+
"'%s' is not a valid mux name.\n", tmp);
38543851
}
38553852

38563853
/* Unidir muxes must have the same switch
3857-
* for wire and opin fanin since there is
3858-
* really only the mux in unidir. */
3854+
* for wire and opin fanin since there is
3855+
* really only the mux in unidir. */
38593856
Segs[i].arch_wire_switch_dec = switch_idx;
38603857
Segs[i].arch_opin_switch_dec = switch_idx;
38613858
}
38623859
}
3863-
}
3864-
else {
3860+
} else {
38653861
VTR_ASSERT(BI_DIRECTIONAL == Segs[i].directionality);
38663862
SubElem = get_single_child(Node, "wire_switch", loc_data);
38673863
tmp = get_attribute(SubElem, "name", loc_data).value();
@@ -3920,13 +3916,12 @@ static std::vector<t_segment_inf> ProcessSegments(pugi::xml_node Parent,
39203916
return Segs;
39213917
}
39223918

3923-
3924-
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){
3919+
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) {
39253920
auto startx_attr = get_attribute(SubElem, "startx", loc_data, ReqOpt::OPTIONAL);
3926-
auto endx_attr = get_attribute(SubElem, "endx", loc_data, ReqOpt::OPTIONAL);
3921+
auto endx_attr = get_attribute(SubElem, "endx", loc_data, ReqOpt::OPTIONAL);
39273922

39283923
auto starty_attr = get_attribute(SubElem, "starty", loc_data, ReqOpt::OPTIONAL);
3929-
auto endy_attr = get_attribute(SubElem, "endy", loc_data, ReqOpt::OPTIONAL);
3924+
auto endy_attr = get_attribute(SubElem, "endy", loc_data, ReqOpt::OPTIONAL);
39303925

39313926
auto repeatx_attr = get_attribute(SubElem, "repeatx", loc_data, ReqOpt::OPTIONAL);
39323927
auto repeaty_attr = get_attribute(SubElem, "repeaty", loc_data, ReqOpt::OPTIONAL);
@@ -3941,19 +3936,17 @@ static void calculate_custom_SB_locations(const pugiutil::loc_data& loc_data, co
39413936
vars.set_var_value("W", grid_width);
39423937
vars.set_var_value("H", grid_height);
39433938

3944-
39453939
sb.reg_x.start = startx_attr.empty() ? 0 : p.parse_formula(startx_attr.value(), vars);
39463940
sb.reg_y.start = starty_attr.empty() ? 0 : p.parse_formula(starty_attr.value(), vars);
39473941

39483942
sb.reg_x.end = endx_attr.empty() ? (grid_width - 1) : p.parse_formula(endx_attr.value(), vars);
3949-
sb.reg_y.end = endy_attr.empty() ? (grid_height -1) : p.parse_formula(endy_attr.value(), vars);
3943+
sb.reg_y.end = endy_attr.empty() ? (grid_height - 1) : p.parse_formula(endy_attr.value(), vars);
39503944

39513945
sb.reg_x.repeat = repeatx_attr.empty() ? 0 : p.parse_formula(repeatx_attr.value(), vars);
39523946
sb.reg_y.repeat = repeaty_attr.empty() ? 0 : p.parse_formula(repeaty_attr.value(), vars);
39533947

39543948
sb.reg_x.incr = incrx_attr.empty() ? 1 : p.parse_formula(incrx_attr.value(), vars);
39553949
sb.reg_y.incr = incry_attr.empty() ? 1 : p.parse_formula(incry_attr.value(), vars);
3956-
39573950
}
39583951

39593952
/* Processes the switchblocklist section from the xml architecture file.
@@ -3967,10 +3960,10 @@ static void ProcessSwitchblocks(pugi::xml_node Parent, t_arch* arch, const pugiu
39673960
/* get the number of switchblocks */
39683961
int num_switchblocks = count_children(Parent, "switchblock", loc_data);
39693962
arch->switchblocks.reserve(num_switchblocks);
3970-
3963+
39713964
int layout_index = -1;
3972-
for(layout_index = 0; layout_index < (int) arch->grid_layouts.size(); layout_index++){
3973-
if(arch->grid_layouts.at(layout_index).name == arch->device_layout){
3965+
for (layout_index = 0; layout_index < (int)arch->grid_layouts.size(); layout_index++) {
3966+
if (arch->grid_layouts.at(layout_index).name == arch->device_layout) {
39743967
//found the used layout
39753968
break;
39763969
}
@@ -4022,8 +4015,8 @@ static void ProcessSwitchblocks(pugi::xml_node Parent, t_arch* arch, const pugiu
40224015
}
40234016

40244017
/* get the switchblock coordinate only if sb.location is set to E_XY_SPECIFIED*/
4025-
if(sb.location == e_sb_location::E_XY_SPECIFIED){
4026-
if (arch->device_layout == "auto"){
4018+
if (sb.location == e_sb_location::E_XY_SPECIFIED) {
4019+
if (arch->device_layout == "auto") {
40274020
archfpga_throw(loc_data.filename_c_str(), loc_data.line(SubElem), "Specifying SB locations for auto layout devices are not supported yet!\n");
40284021
}
40294022
expect_only_attributes(SubElem,
@@ -4034,25 +4027,24 @@ static void ProcessSwitchblocks(pugi::xml_node Parent, t_arch* arch, const pugiu
40344027

40354028
int grid_width = arch->grid_layouts.at(layout_index).width;
40364029
int grid_height = arch->grid_layouts.at(layout_index).height;
4037-
4030+
40384031
/* Absolute location that this SB must be applied to, -1 if not specified*/
40394032
sb.x = get_attribute(SubElem, "x", loc_data, ReqOpt::OPTIONAL).as_int(-1);
40404033
sb.y = get_attribute(SubElem, "y", loc_data, ReqOpt::OPTIONAL).as_int(-1);
40414034

40424035
//check if the absolute value is within the device grid width and height
4043-
if(sb.x >= grid_width || sb.y >= grid_height) {
4044-
archfpga_throw(loc_data.filename_c_str(), loc_data.line(SubElem), \
4045-
"Location (%d,%d) is not valid within the grid! grid dimensions are: (%d,%d)\n", sb.x, sb.y, grid_width, grid_height);
4036+
if (sb.x >= grid_width || sb.y >= grid_height) {
4037+
archfpga_throw(loc_data.filename_c_str(), loc_data.line(SubElem),
4038+
"Location (%d,%d) is not valid within the grid! grid dimensions are: (%d,%d)\n", sb.x, sb.y, grid_width, grid_height);
40464039
}
4047-
4040+
40484041
/* if the the switchblock exact location is not specified and a region is specified within the architecture file,
40494042
* we have to parse the region specification and apply the SB pattern to all the locations fall into the specified
40504043
* region based on device width and height.
40514044
*/
40524045
if (sb.x == -1 && sb.y == -1) {
40534046
calculate_custom_SB_locations(loc_data, SubElem, grid_width, grid_height, sb);
40544047
}
4055-
40564048
}
40574049

40584050
/* get switchblock permutation functions */

libs/libarchfpga/test/test_read_xml_arch_file.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ TEST_CASE("Verifying mesh topology creation", "[NoC Arch Tests]") {
155155
.end_y = 56.0f,
156156
.start_layer = 0,
157157
.end_layer = 0,
158-
.mesh_size = 0
159-
};
158+
.mesh_size = 0};
160159

161160
SECTION("Check the error where a mesh size was illegal.") {
162161
REQUIRE_THROWS_WITH(generate_noc_mesh(test, test_location, &test_noc, mesh_region), "The NoC mesh size cannot be 0.");

0 commit comments

Comments
 (0)