Skip to content

Commit 2b069a0

Browse files
rename SB_Side_Connection to SBSideConnection
1 parent ff700ca commit 2b069a0

File tree

5 files changed

+31
-33
lines changed

5 files changed

+31
-33
lines changed

libs/libarchfpga/src/parse_switchblocks.cpp

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static t_wireconn_inf parse_wireconn_multinode(pugi::xml_node node,
8282
const std::vector<t_arch_switch_inf>& switches);
8383

8484
//Process a <from> or <to> sub-node of a multinode wireconn
85-
t_wire_switchpoints parse_wireconn_from_to_node(pugi::xml_node node, const pugiutil::loc_data& loc_data);
85+
static t_wire_switchpoints parse_wireconn_from_to_node(pugi::xml_node node, const pugiutil::loc_data& loc_data);
8686

8787
/* parses the wire types specified in the comma-separated 'ch' char array into the vector wire_points_vec.
8888
* Spaces are trimmed off */
@@ -95,13 +95,13 @@ static void parse_comma_separated_wire_points(const char* ch, std::vector<t_wire
9595
static void parse_num_conns(std::string num_conns, t_wireconn_inf& wireconn);
9696

9797
/* Set connection from_side and to_side for custom switch block pattern*/
98-
static void set_switch_func_type(SB_Side_Connection& conn, const char* func_type);
98+
static void set_switch_func_type(SBSideConnection& conn, const char* func_type);
9999

100100
/* parse switch_override in wireconn */
101101
static void parse_switch_override(const char* switch_override, t_wireconn_inf& wireconn, const std::vector<t_arch_switch_inf>& switches);
102102

103103
/* checks for correctness of a unidir switchblock. */
104-
static void check_unidir_switchblock(const t_switchblock_inf* sb);
104+
static void check_unidir_switchblock(const t_switchblock_inf& sb);
105105

106106
/* checks for correctness of a bidir switchblock. */
107107
static void check_bidir_switchblock(const t_permutation_map* permutation_map);
@@ -235,7 +235,7 @@ static t_wireconn_inf parse_wireconn_multinode(pugi::xml_node node,
235235
}
236236
}
237237

238-
t_wire_switchpoints parse_wireconn_from_to_node(pugi::xml_node node, const pugiutil::loc_data& loc_data) {
238+
static t_wire_switchpoints parse_wireconn_from_to_node(pugi::xml_node node, const pugiutil::loc_data& loc_data) {
239239
expect_only_attributes(node, {"type", "switchpoint"}, loc_data);
240240

241241
size_t attribute_count = count_attributes(node, loc_data);
@@ -277,13 +277,13 @@ static void parse_switchpoint_order(const char* order, SwitchPointOrder& switchp
277277
/* parses the wire types specified in the comma-separated 'ch' char array into the vector wire_points_vec.
278278
* Spaces are trimmed off */
279279
static void parse_comma_separated_wire_types(const char* ch, std::vector<t_wire_switchpoints>& wire_switchpoints) {
280-
auto types = vtr::split(ch, ",");
280+
std::vector<std::string> types = vtr::split(ch, ",");
281281

282282
if (types.empty()) {
283283
archfpga_throw(__FILE__, __LINE__, "parse_comma_separated_wire_types: found empty wireconn wire type entry\n");
284284
}
285285

286-
for (const auto& type : types) {
286+
for (const std::string& type : types) {
287287
t_wire_switchpoints wsp;
288288
wsp.segment_name = type;
289289

@@ -293,15 +293,15 @@ static void parse_comma_separated_wire_types(const char* ch, std::vector<t_wire_
293293

294294
/* parses the wirepoints specified in the comma-separated 'ch' char array into the vector wire_points_vec */
295295
static void parse_comma_separated_wire_points(const char* ch, std::vector<t_wire_switchpoints>& wire_switchpoints) {
296-
auto points = vtr::split(ch, ",");
296+
std::vector<std::string> points = vtr::split(ch, ",");
297297
if (points.empty()) {
298298
archfpga_throw(__FILE__, __LINE__, "parse_comma_separated_wire_points: found empty wireconn wire point entry\n");
299299
}
300300

301-
for (const auto& point_str : points) {
301+
for (const std::string& point_str : points) {
302302
int point = vtr::atoi(point_str);
303303

304-
for (auto& wire_switchpoint : wire_switchpoints) {
304+
for (t_wire_switchpoints& wire_switchpoint : wire_switchpoints) {
305305
wire_switchpoint.switchpoints.push_back(point);
306306
}
307307
}
@@ -313,7 +313,7 @@ static void parse_num_conns(std::string num_conns, t_wireconn_inf& wireconn) {
313313
}
314314

315315
//set sides for a specific conn for custom switch block pattern
316-
static void set_switch_func_type(SB_Side_Connection& conn, const char* func_type) {
316+
static void set_switch_func_type(SBSideConnection& conn, const char* func_type) {
317317
if (0 == strcmp(func_type, "lt")) {
318318
conn.set_sides(LEFT, TOP);
319319
} else if (0 == strcmp(func_type, "lr")) {
@@ -399,7 +399,7 @@ void read_sb_switchfuncs(pugi::xml_node node, t_switchblock_inf& sb, const pugiu
399399
const char* func_formula = get_attribute(SubElem, "formula", loc_data).as_string(nullptr);
400400

401401
// Used to index into permutation map of switchblock
402-
SB_Side_Connection conn;
402+
SBSideConnection conn;
403403

404404
// go through all the possible cases of func_type
405405
set_switch_func_type(conn, func_type);
@@ -431,20 +431,20 @@ static void parse_switch_override(const char* switch_override, t_wireconn_inf& w
431431
}
432432

433433
/* checks for correctness of switch block read-in from the XML architecture file */
434-
void check_switchblock(const t_switchblock_inf* sb, const t_arch* arch) {
434+
void check_switchblock(const t_switchblock_inf& sb, const t_arch* arch) {
435435
/* get directionality */
436-
enum e_directionality directionality = sb->directionality;
436+
enum e_directionality directionality = sb.directionality;
437437

438438
/* Check for errors in the switchblock descriptions */
439439
if (UNI_DIRECTIONAL == directionality) {
440440
check_unidir_switchblock(sb);
441441
} else {
442442
VTR_ASSERT(BI_DIRECTIONAL == directionality);
443-
check_bidir_switchblock(&(sb->permutation_map));
443+
check_bidir_switchblock(&(sb.permutation_map));
444444
}
445445

446446
/* check that specified wires exist */
447-
for (const auto& wireconn : sb->wireconns) {
447+
for (const t_wireconn_inf& wireconn : sb.wireconns) {
448448
check_wireconn(arch, wireconn);
449449
}
450450

@@ -456,9 +456,9 @@ void check_switchblock(const t_switchblock_inf* sb, const t_arch* arch) {
456456
}
457457

458458
/* checks for correctness of a unidirectional switchblock. hard exit if error found (to be changed to throw later) */
459-
static void check_unidir_switchblock(const t_switchblock_inf* sb) {
459+
static void check_unidir_switchblock(const t_switchblock_inf& sb) {
460460
/* Check that the destination wire points are always the starting points (i.e. of wire point 0) */
461-
for (const t_wireconn_inf& wireconn : sb->wireconns) {
461+
for (const t_wireconn_inf& wireconn : sb.wireconns) {
462462
for (const t_wire_switchpoints& wire_to_points : wireconn.to_switchpoint_set) {
463463
if (wire_to_points.switchpoints.size() > 1 || wire_to_points.switchpoints[0] != 0) {
464464
archfpga_throw(__FILE__, __LINE__, "Unidirectional switch blocks are currently only allowed to drive the start points of wire segments\n");
@@ -472,7 +472,7 @@ static void check_bidir_switchblock(const t_permutation_map* permutation_map) {
472472
/**** check that if side1->side2 is specified, then side2->side1 is not, as it is implicit ****/
473473

474474
/* variable used to index into the permutation map */
475-
SB_Side_Connection conn;
475+
SBSideConnection conn;
476476

477477
/* iterate over all combinations of from_side -> to side */
478478
for (e_side from_side : TOTAL_2D_SIDES) {
@@ -486,7 +486,7 @@ static void check_bidir_switchblock(const t_permutation_map* permutation_map) {
486486
conn.set_sides(from_side, to_side);
487487

488488
/* check if a connection between these sides exists */
489-
t_permutation_map::const_iterator it = (*permutation_map).find(conn);
489+
auto it = (*permutation_map).find(conn);
490490
if (it != (*permutation_map).end()) {
491491
/* the two sides are connected */
492492
/* check if the opposite connection has been specified */
@@ -498,8 +498,6 @@ static void check_bidir_switchblock(const t_permutation_map* permutation_map) {
498498
}
499499
}
500500
}
501-
502-
return;
503501
}
504502

505503
static void check_wireconn(const t_arch* arch, const t_wireconn_inf& wireconn) {

libs/libarchfpga/src/parse_switchblocks.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void read_sb_wireconns(const std::vector<t_arch_switch_inf>& switches,
4343
const pugiutil::loc_data& loc_data);
4444

4545
/* checks for correctness of switch block read-in from the XML architecture file */
46-
void check_switchblock(const t_switchblock_inf* sb, const t_arch* arch);
46+
void check_switchblock(const t_switchblock_inf& sb, const t_arch* arch);
4747

4848
/* returns integer result according to the specified formula and data */
4949
int get_sb_formula_raw_result(vtr::FormulaParser& formula_parser, const char* formula, const vtr::t_formula_data& mydata);

libs/libarchfpga/src/read_xml_arch_file.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4008,12 +4008,12 @@ static void ProcessSwitchblocks(pugi::xml_node Parent, t_arch* arch, const pugiu
40084008
SubElem = get_first_child(Node, "switchfuncs", loc_data);
40094009
read_sb_switchfuncs(SubElem, sb, loc_data);
40104010

4011-
read_sb_wireconns(arch->switches, Node, &sb, loc_data);
4011+
read_sb_wireconns(arch->switches, Node, sb, loc_data);
40124012

4013-
/* run error checks on switch blocks */
4014-
check_switchblock(&sb, arch);
4013+
// run error checks on switch blocks
4014+
check_switchblock(sb, arch);
40154015

4016-
/* assign the sb to the switchblocks vector */
4016+
// assign the sb to the switchblocks vector
40174017
arch->switchblocks.push_back(sb);
40184018

40194019
Node = Node.next_sibling(Node.name());

libs/libarchfpga/src/switchblock_types.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ struct t_sb_loc_spec {
5151
};
5252

5353
/* represents a connection between two sides of a switchblock */
54-
class SB_Side_Connection {
54+
class SBSideConnection {
5555
public:
5656
/* specify the two SB sides that form a connection */
5757
enum e_side from_side = TOP;
@@ -62,15 +62,15 @@ class SB_Side_Connection {
6262
to_side = to;
6363
}
6464

65-
SB_Side_Connection() = default;
65+
SBSideConnection() = default;
6666

67-
SB_Side_Connection(enum e_side from, enum e_side to)
67+
SBSideConnection(enum e_side from, enum e_side to)
6868
: from_side(from)
6969
, to_side(to) {
7070
}
7171

7272
/* overload < operator which will be used by std::map */
73-
bool operator<(const SB_Side_Connection& obj) const {
73+
bool operator<(const SBSideConnection& obj) const {
7474
bool result;
7575

7676
if (from_side < obj.from_side) {
@@ -125,7 +125,7 @@ struct t_wireconn_inf {
125125
};
126126

127127
/* Use a map to index into the string permutation functions used to connect from one side to another */
128-
typedef std::map<SB_Side_Connection, std::vector<std::string>> t_permutation_map;
128+
typedef std::map<SBSideConnection, std::vector<std::string>> t_permutation_map;
129129

130130
/**
131131
* @brief Lists all information about a particular switch block specified in the architecture file

vpr/src/route/rr_graph_generation/build_switchblocks.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ static void compute_wire_connections(int x_coord,
792792
e_rr_type from_chan_type, to_chan_type; /* the type of channel - i.e. CHANX or CHANY */
793793
from_x = from_y = to_x = to_y = from_layer = to_layer = UNDEFINED;
794794

795-
SB_Side_Connection side_conn(from_side, to_side); /* for indexing into this switchblock's permutation funcs */
795+
SBSideConnection side_conn(from_side, to_side); /* for indexing into this switchblock's permutation funcs */
796796
Switchblock_Lookup sb_conn(x_coord, y_coord, layer_coord, from_side, to_side); /* for indexing into FPGA's switchblock map */
797797

798798
// Can't connect a switchblock side to itself
@@ -971,7 +971,7 @@ static void compute_wireconn_connections(
971971
}
972972

973973
// Evaluate permutation functions for the from_wire
974-
SB_Side_Connection side_conn(sb_conn.from_side, sb_conn.to_side);
974+
SBSideConnection side_conn(sb_conn.from_side, sb_conn.to_side);
975975
auto iter = sb.permutation_map.find(side_conn);
976976
if (iter == sb.permutation_map.end()) {
977977
continue;

0 commit comments

Comments
 (0)