Skip to content

Commit ec6da7f

Browse files
committed
[core] syntax
1 parent ed4faca commit ec6da7f

File tree

8 files changed

+19
-61
lines changed

8 files changed

+19
-61
lines changed

libs/EXTERNAL/sockpp

vpr/src/base/SetupVPR.cpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,12 @@ static void SetupAnalysisOpts(const t_options& Options, t_analysis_opts& analysi
4444
static void SetupPowerOpts(const t_options& Options, t_power_opts* power_opts, t_arch* Arch);
4545

4646
static void SetupVibInf(const std::vector<t_physical_tile_type>& PhysicalTileTypes,
47-
const int num_switches,
48-
const t_arch_switch_inf* Switches,
47+
const std::vector<t_arch_switch_inf>& Switches,
4948
const std::vector<t_segment_inf>& Segments,
5049
std::vector<VibInf>& vib_infs);
5150

5251
static void ProcessFromOrToTokens(const std::vector<std::string> Tokens, const std::vector<t_physical_tile_type>& PhysicalTileTypes, const std::vector<t_segment_inf> segments, std::vector<t_from_or_to_inf>& froms);
53-
static void parse_pin_name(char* src_string, int* start_pin_index, int* end_pin_index, char* pb_type_name, char* port_name);
52+
static void parse_pin_name(const char* src_string, int* start_pin_index, int* end_pin_index, char* pb_type_name, char* port_name);
5453

5554

5655
/**
@@ -242,7 +241,7 @@ void SetupVPR(const t_options* options,
242241
routingArch->write_rr_graph_filename = options->write_rr_graph_file;
243242
routingArch->read_rr_graph_filename = options->read_rr_graph_file;
244243

245-
SetupVibInf(device_ctx.physical_tile_types, arch->num_switches, arch->Switches, arch->Segments, arch->vib_infs);
244+
SetupVibInf(device_ctx.physical_tile_types, arch->switches, arch->Segments, arch->vib_infs);
246245

247246
for (auto has_global_routing : arch->layer_global_routing) {
248247
device_ctx.inter_cluster_prog_routing_resources.emplace_back(has_global_routing);
@@ -1019,14 +1018,13 @@ static void do_reachability_analysis(t_physical_tile_type* physical_tile,
10191018
}
10201019

10211020
static void SetupVibInf(const std::vector<t_physical_tile_type>& PhysicalTileTypes,
1022-
const int num_switches,
1023-
const t_arch_switch_inf* Switches,
1021+
const std::vector<t_arch_switch_inf>& switches,
10241022
const std::vector<t_segment_inf>& Segments,
10251023
std::vector<VibInf>& vib_infs) {
10261024
VTR_ASSERT(!vib_infs.empty());
10271025
for (auto& vib_inf : vib_infs) {
1028-
for (int i_switch = 0; i_switch < num_switches; i_switch++) {
1029-
if (vib_inf.get_switch_name() == Switches[i_switch].name) {
1026+
for (size_t i_switch = 0; i_switch < switches.size(); i_switch++) {
1027+
if (vib_inf.get_switch_name() == switches[i_switch].name) {
10301028
vib_inf.set_switch_idx(i_switch);
10311029
break;
10321030
}
@@ -1095,7 +1093,7 @@ static void ProcessFromOrToTokens(const std::vector<std::string> Tokens, const s
10951093
port_name = nullptr;
10961094
pb_type_name = new char[strlen(Token_char)];
10971095
port_name = new char[strlen(Token_char)];
1098-
parse_pin_name((char*)Token_char, &start_pin_index, &end_pin_index, pb_type_name, port_name);
1096+
parse_pin_name(Token_char, &start_pin_index, &end_pin_index, pb_type_name, port_name);
10991097

11001098
std::vector<int> all_sub_tile_to_tile_pin_indices;
11011099
for (auto& sub_tile : PhysicalTileTypes[i_phy_type].sub_tiles) {
@@ -1213,17 +1211,16 @@ static void ProcessFromOrToTokens(const std::vector<std::string> Tokens, const s
12131211
}
12141212
}
12151213

1216-
static void parse_pin_name(char* src_string, int* start_pin_index, int* end_pin_index, char* pb_type_name, char* port_name) {
1214+
static void parse_pin_name(const char* src_string, int* start_pin_index, int* end_pin_index, char* pb_type_name, char* port_name) {
12171215
/* Parses out the pb_type_name and port_name *
12181216
* If the start_pin_index and end_pin_index is specified, parse them too. *
12191217
* Return the values parsed by reference. */
12201218

12211219
char source_string[128];
1222-
char* find_format = nullptr;
12231220
int ichar, match_count;
12241221

12251222
// parse out the pb_type and port name, possibly pin_indices
1226-
find_format = strstr(src_string, "[");
1223+
const char* find_format = strstr(src_string, "[");
12271224
if (find_format == nullptr) {
12281225
/* Format "pb_type_name.port_name" */
12291226
*start_pin_index = *end_pin_index = -1;

vpr/src/route/connection_router.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,18 +1064,16 @@ static inline void update_router_stats(RouterStats* router_stats,
10641064
auto node_type = rr_graph->node_type(rr_node_id);
10651065
VTR_ASSERT(node_type != NUM_RR_TYPES);
10661066

1067-
1067+
/* TODO: Eliminate the use of global var here!!! */
10681068
const VibInf* vib;
1069-
if (!device_ctx.arch->vib_infs.empty()) {
1070-
vib = device_ctx.vib_grid[rr_graph->node_layer(rr_node_id)][rr_graph->node_xlow(rr_node_id)][rr_graph->node_ylow(rr_node_id)];
1069+
if (!g_vpr_ctx.device().arch->vib_infs.empty()) {
1070+
vib = g_vpr_ctx.device().vib_grid.get_vib(rr_graph->node_layer(rr_node_id), rr_graph->node_xlow(rr_node_id), rr_graph->node_ylow(rr_node_id));
10711071
}
10721072
else {
10731073
vib = nullptr;
10741074
}
10751075
if constexpr (VTR_ENABLE_DEBUG_LOGGING_CONST_EXPR) {
1076-
auto node_type = rr_graph->node_type(rr_node_id);
1077-
VTR_ASSERT(node_type != NUM_RR_TYPES);
1078-
1076+
t_physical_tile_type_ptr physical_type = g_vpr_ctx.device().grid.get_physical_type({rr_graph->node_xlow(rr_node_id), rr_graph->node_ylow(rr_node_id), rr_graph->node_layer(rr_node_id)});
10791077
if (is_inter_cluster_node(physical_type, vib, node_type, rr_graph->node_ptc_num(rr_node_id))) {
10801078
if (is_push) {
10811079
router_stats->inter_cluster_node_pushes++;

vpr/src/tileable_rr_graph/tileable_rr_graph_edge_builder.cpp

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,7 @@ void build_rr_graph_edges(const RRGraphView& rr_graph,
134134
segment_inf,
135135
segment_inf_x,
136136
segment_inf_y,
137-
Fc_in,
138-
Fc_out,
139-
sb_type,
140-
Fs,
141-
sb_subtype,
142-
subFs,
143137
perimeter_cb,
144-
opin2all_sides,
145-
concat_wire,
146-
wire_opposite_side,
147138
delayless_switch);
148139
}
149140
else {
@@ -375,16 +366,7 @@ void build_rr_graph_vib_edges(const RRGraphView& rr_graph,
375366
const std::vector<t_segment_inf>& segment_inf,
376367
const std::vector<t_segment_inf>& segment_inf_x,
377368
const std::vector<t_segment_inf>& segment_inf_y,
378-
const std::vector<vtr::Matrix<int>>& Fc_in,
379-
const std::vector<vtr::Matrix<int>>& Fc_out,
380-
const e_switch_block_type& sb_type,
381-
const int& Fs,
382-
const e_switch_block_type& sb_subtype,
383-
const int& subFs,
384369
const bool& perimeter_cb,
385-
const bool& opin2all_sides,
386-
const bool& concat_wire,
387-
const bool& wire_opposite_side,
388370
const RRSwitchId& delayless_switch) {
389371
/* Create map from medium mux name to index */
390372
// std::vector<std::vector<std::vector<std::map<std::string, size_t>>>> medium_mux_name2medium_index;
@@ -423,7 +405,7 @@ void build_rr_graph_vib_edges(const RRGraphView& rr_graph,
423405
/* adapt the bend_conn */
424406
t_bend_track2track_map sb_bend_conn; /* [0..from_gsb_side][0..chan_width-1][track_indices] */
425407
sb_bend_conn = build_bend_track_to_track_map(grids, rr_graph_builder, rr_graph,
426-
device_chan_width, segment_inf,
408+
segment_inf,
427409
layer, gsb_coord, delayless_switch, rr_node_driver_switches);
428410

429411
/* Create a GSB object */

vpr/src/tileable_rr_graph/tileable_rr_graph_edge_builder.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,7 @@ void build_rr_graph_vib_edges(const RRGraphView& rr_graph,
7474
const std::vector<t_segment_inf>& segment_inf,
7575
const std::vector<t_segment_inf>& segment_inf_x,
7676
const std::vector<t_segment_inf>& segment_inf_y,
77-
const std::vector<vtr::Matrix<int>>& Fc_in,
78-
const std::vector<vtr::Matrix<int>>& Fc_out,
79-
const e_switch_block_type& sb_type,
80-
const int& Fs,
81-
const e_switch_block_type& sb_subtype,
82-
const int& subFs,
8377
const bool& perimeter_cb,
84-
const bool& opin2all_sides,
85-
const bool& concat_wire,
86-
const bool& wire_opposite_side,
8778
const RRSwitchId& delayless_switch);
8879

8980
void build_rr_graph_regular_edges(const RRGraphView& rr_graph,

vpr/src/tileable_rr_graph/tileable_rr_graph_gsb.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,6 @@ t_track2track_map build_gsb_track_to_track_map(const RRGraphView& rr_graph,
537537
t_bend_track2track_map build_bend_track_to_track_map(const DeviceGrid& grids,
538538
RRGraphBuilder& rr_graph_builder,
539539
const RRGraphView& rr_graph,
540-
const vtr::Point<size_t>& device_chan_width,
541540
const std::vector<t_segment_inf>& segment_inf,
542541
const size_t& layer,
543542
const vtr::Point<size_t>& gsb_coordinate,
@@ -582,12 +581,10 @@ t_bend_track2track_map build_bend_track_to_track_map(const DeviceGrid& grids,
582581
CHANY);
583582

584583
for (auto inode : rr_nodes) {
585-
VTR_ASSERT(rr_graph.node_type(inode) ==CHANY);
584+
VTR_ASSERT(rr_graph.node_type(inode) == CHANY);
586585
Direction direction = rr_graph.node_direction(inode);
587586
size_t xlow = rr_graph.node_xlow(inode);
588-
size_t xhigh = rr_graph.node_xhigh(inode);
589587
size_t ylow = rr_graph.node_ylow(inode);
590-
size_t yhigh = rr_graph.node_yhigh(inode);
591588
int bend_start = rr_graph.node_bend_start(inode);
592589
int bend_end = rr_graph.node_bend_end(inode);
593590

@@ -624,9 +621,7 @@ t_bend_track2track_map build_bend_track_to_track_map(const DeviceGrid& grids,
624621
VTR_ASSERT(rr_graph.node_type(inode) == CHANX);
625622
Direction direction = rr_graph.node_direction(inode);
626623
size_t xlow = rr_graph.node_xlow(inode);
627-
size_t xhigh = rr_graph.node_xhigh(inode);
628624
size_t ylow = rr_graph.node_ylow(inode);
629-
size_t yhigh = rr_graph.node_yhigh(inode);
630625
int bend_start = rr_graph.node_bend_start(inode);
631626
int bend_end = rr_graph.node_bend_end(inode);
632627

@@ -661,9 +656,7 @@ t_bend_track2track_map build_bend_track_to_track_map(const DeviceGrid& grids,
661656
for (auto inode : rr_nodes) {
662657
VTR_ASSERT(rr_graph.node_type(inode) == CHANY);
663658
Direction direction = rr_graph.node_direction(inode);
664-
size_t xlow = rr_graph.node_xlow(inode);
665659
size_t xhigh = rr_graph.node_xhigh(inode);
666-
size_t ylow = rr_graph.node_ylow(inode);
667660
size_t yhigh = rr_graph.node_yhigh(inode);
668661
int bend_start = rr_graph.node_bend_start(inode);
669662
int bend_end = rr_graph.node_bend_end(inode);
@@ -699,9 +692,7 @@ t_bend_track2track_map build_bend_track_to_track_map(const DeviceGrid& grids,
699692
for (auto inode : rr_nodes) {
700693
VTR_ASSERT(rr_graph.node_type(inode) == CHANX);
701694
Direction direction = rr_graph.node_direction(inode);
702-
size_t xlow = rr_graph.node_xlow(inode);
703695
size_t xhigh = rr_graph.node_xhigh(inode);
704-
size_t ylow = rr_graph.node_ylow(inode);
705696
size_t yhigh = rr_graph.node_yhigh(inode);
706697
int bend_start = rr_graph.node_bend_start(inode);
707698
int bend_end = rr_graph.node_bend_end(inode);
@@ -726,7 +717,7 @@ t_bend_track2track_map build_bend_track_to_track_map(const DeviceGrid& grids,
726717
}
727718
}
728719
std::map<RRNodeId, RRNodeId> bend_seg_head2bend_seg_end_map;
729-
for (size_t ibend_seg = 0; ibend_seg < bend_seg_num; ibend_seg++) {
720+
for (size_t ibend_seg = 0; ibend_seg < (size_t)bend_seg_num; ibend_seg++) {
730721
int bend_type = bend_seg_type[ibend_seg]; //bend_type 1:U 2:D
731722
VTR_ASSERT(bend_type == 1 || bend_type == 2);
732723

@@ -1820,7 +1811,7 @@ t_vib_map build_vib_map(const RRGraphView& rr_graph,
18201811

18211812
const VibInf* vib = vib_grid.get_vib(layer, actual_coordinate.x(), actual_coordinate.y());
18221813
auto phy_type = grids.get_physical_type({(int)actual_coordinate.x(), (int)actual_coordinate.y(), (int)layer});
1823-
VTR_ASSERT(!strcmp(vib->get_pbtype_name().c_str(), phy_type->name));
1814+
VTR_ASSERT(vib->get_pbtype_name() == phy_type->name);
18241815
const std::vector<t_first_stage_mux_inf> first_stages = vib->get_first_stages();
18251816
for (size_t i_first_stage = 0; i_first_stage < first_stages.size(); i_first_stage++) {
18261817
std::vector<t_from_or_to_inf> froms = first_stages[i_first_stage].froms;

vpr/src/tileable_rr_graph/tileable_rr_graph_gsb.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ t_track2track_map build_gsb_track_to_track_map(const RRGraphView& rr_graph,
4646
t_bend_track2track_map build_bend_track_to_track_map(const DeviceGrid& grids,
4747
RRGraphBuilder& rr_graph_builder,
4848
const RRGraphView& rr_graph,
49-
const vtr::Point<size_t>& device_chan_width,
5049
const std::vector<t_segment_inf>& segment_inf,
5150
const size_t& layer,
5251
const vtr::Point<size_t>& gsb_coordinate,

0 commit comments

Comments
 (0)