Skip to content

Commit fc15b62

Browse files
committed
formatting fix
1 parent 10135ae commit fc15b62

File tree

8 files changed

+60
-51
lines changed

8 files changed

+60
-51
lines changed

vpr/src/pack/cluster.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ std::map<t_logical_block_type_ptr, size_t> do_clustering(const t_packer_opts& pa
190190

191191
if (packer_opts.hill_climbing_flag) {
192192
clustering_data.hill_climbing_inputs_avail = new int[helper_ctx.max_cluster_size + 1];
193-
for(int i = 0 ; i < helper_ctx.max_cluster_size + 1; i++)
194-
clustering_data.hill_climbing_inputs_avail[i] = 0;
193+
for (int i = 0; i < helper_ctx.max_cluster_size + 1; i++)
194+
clustering_data.hill_climbing_inputs_avail[i] = 0;
195195
} else {
196196
clustering_data.hill_climbing_inputs_avail = nullptr; /* if used, die hard */
197197
}

vpr/src/pack/cluster_feasibility_filter.cpp

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -320,18 +320,29 @@ static void expand_pb_graph_node_and_load_output_to_input_connections(t_pb_graph
320320
reference_pin, depth);
321321
}
322322
if (current_pb_graph_pin->is_primitive_pin()
323-
&& current_pb_graph_pin->port->type == IN_PORT) {
324-
reference_pin->num_connectable_primitive_input_pins[depth]++;
325-
reference_pin->list_of_connectable_input_pin_ptrs[depth] = (t_pb_graph_pin**)vtr::realloc(
326-
reference_pin->list_of_connectable_input_pin_ptrs[depth],
327-
reference_pin->num_connectable_primitive_input_pins[depth]
328-
* sizeof(t_pb_graph_pin*));
329-
reference_pin->list_of_connectable_input_pin_ptrs[depth][reference_pin->num_connectable_primitive_input_pins[depth]
330-
- 1]
331-
= current_pb_graph_pin;
332-
}
323+
&& current_pb_graph_pin->port->type == IN_PORT) {
324+
reference_pin->num_connectable_primitive_input_pins[depth]++;
325+
326+
// std::vector<t_pb_graph_pin*> temp(reference_pin->list_of_connectable_input_pin_ptrs[depth],
327+
// reference_pin->list_of_connectable_input_pin_ptrs[depth] + reference_pin->num_connectable_primitive_input_pins[depth] - 1);
328+
//
329+
// delete[]reference_pin->list_of_connectable_input_pin_ptrs[depth];
330+
// reference_pin->list_of_connectable_input_pin_ptrs[depth] = new t_pb_graph_pin*[reference_pin->num_connectable_primitive_input_pins[depth]];
331+
// for (i = 0 ; i < reference_pin->num_connectable_primitive_input_pins[depth] - 1 ; i++)
332+
// reference_pin->list_of_connectable_input_pin_ptrs[depth][i] = temp[i];
333+
//
334+
// reference_pin->list_of_connectable_input_pin_ptrs[depth][reference_pin->num_connectable_primitive_input_pins[depth]
335+
// - 1] = current_pb_graph_pin;
336+
337+
reference_pin->list_of_connectable_input_pin_ptrs[depth] = (t_pb_graph_pin**)vtr::realloc(
338+
reference_pin->list_of_connectable_input_pin_ptrs[depth],
339+
reference_pin->num_connectable_primitive_input_pins[depth]
340+
* sizeof(t_pb_graph_pin*));
341+
reference_pin->list_of_connectable_input_pin_ptrs[depth][reference_pin->num_connectable_primitive_input_pins[depth]
342+
- 1]
343+
= current_pb_graph_pin;
333344
}
334-
345+
}
335346
}
336347

337348
/**

vpr/src/pack/cluster_placement.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ t_cluster_placement_stats* alloc_and_load_cluster_placement_stats() {
6565
for (const auto& type : device_ctx.logical_block_types) {
6666
cluster_placement_stats_list[type.index] = t_cluster_placement_stats();
6767
if (!is_empty_type(&type)) {
68-
cluster_placement_stats_list[type.index].valid_primitives = new t_cluster_placement_primitive* [get_max_primitives_in_pb_type(type.pb_type) + 1];
69-
for (int i = 0 ; i < get_max_primitives_in_pb_type(type.pb_type) + 1; i ++)
70-
cluster_placement_stats_list[type.index].valid_primitives[i] = nullptr;
68+
cluster_placement_stats_list[type.index].valid_primitives = new t_cluster_placement_primitive*[get_max_primitives_in_pb_type(type.pb_type) + 1];
69+
for (int i = 0; i < get_max_primitives_in_pb_type(type.pb_type) + 1; i++)
70+
cluster_placement_stats_list[type.index].valid_primitives[i] = nullptr;
7171

7272
/* too much memory allocated but shouldn't be a problem */
7373
cluster_placement_stats_list[type.index].curr_molecule = nullptr;

vpr/src/pack/cluster_util.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -577,9 +577,9 @@ void alloc_and_init_clustering(const t_molecule_stats& max_molecule_stats,
577577
}
578578
cur_molecule = cur_molecule->next;
579579
}
580-
*primitives_list = new t_pb_graph_node* [max_molecule_size];
581-
for (int i = 0 ; i < max_molecule_size; i ++)
582-
(*primitives_list)[i] = nullptr;
580+
*primitives_list = new t_pb_graph_node*[max_molecule_size];
581+
for (int i = 0; i < max_molecule_size; i++)
582+
(*primitives_list)[i] = nullptr;
583583
}
584584

585585
/*****************************************/
@@ -815,8 +815,8 @@ void alloc_and_load_pb_stats(t_pb* pb, const int feasible_block_array_size) {
815815
pb->pb_stats->lookahead_output_pins_used = std::vector<std::vector<AtomNetId>>(pb->pb_graph_node->num_output_pin_class);
816816
pb->pb_stats->num_feasible_blocks = NOT_VALID;
817817
pb->pb_stats->feasible_blocks = new t_pack_molecule*[feasible_block_array_size];
818-
for (int i = 0 ; i < feasible_block_array_size ; i ++)
819-
pb->pb_stats->feasible_blocks[i] = nullptr;
818+
for (int i = 0; i < feasible_block_array_size; i++)
819+
pb->pb_stats->feasible_blocks[i] = nullptr;
820820

821821
pb->pb_stats->tie_break_high_fanout_net = AtomNetId::INVALID();
822822

vpr/src/pack/lb_type_rr_graph.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ static void alloc_and_load_lb_type_rr_graph_for_pb_graph_node(const t_pb_graph_n
353353
lb_type_rr_node_graph[pin_index].num_modes = num_modes;
354354
lb_type_rr_node_graph[pin_index].num_fanout = new short[num_modes];
355355
lb_type_rr_node_graph[pin_index].outedges = new t_lb_type_rr_node_edge*[num_modes];
356-
for (int i = 0; i < num_modes; i++){
356+
for (int i = 0; i < num_modes; i++) {
357357
lb_type_rr_node_graph[pin_index].outedges[i] = nullptr;
358358
lb_type_rr_node_graph[pin_index].num_fanout[i] = 0;
359359
}
@@ -452,7 +452,7 @@ static void alloc_and_load_lb_type_rr_graph_for_pb_graph_node(const t_pb_graph_n
452452
lb_type_rr_node_graph[pin_index].num_modes = num_modes;
453453
lb_type_rr_node_graph[pin_index].num_fanout = new short[num_modes];
454454
lb_type_rr_node_graph[pin_index].outedges = new t_lb_type_rr_node_edge*[num_modes];
455-
for (int i = 0; i < num_modes; i++){
455+
for (int i = 0; i < num_modes; i++) {
456456
lb_type_rr_node_graph[pin_index].outedges[i] = nullptr;
457457
lb_type_rr_node_graph[pin_index].num_fanout[i] = 0;
458458
}
@@ -507,7 +507,7 @@ static void alloc_and_load_lb_type_rr_graph_for_pb_graph_node(const t_pb_graph_n
507507
lb_type_rr_node_graph[pin_index].num_modes = num_modes;
508508
lb_type_rr_node_graph[pin_index].num_fanout = new short[num_modes];
509509
lb_type_rr_node_graph[pin_index].outedges = new t_lb_type_rr_node_edge*[num_modes];
510-
for (int i = 0; i < num_modes; i++){
510+
for (int i = 0; i < num_modes; i++) {
511511
lb_type_rr_node_graph[pin_index].outedges[i] = nullptr;
512512
lb_type_rr_node_graph[pin_index].num_fanout[i] = 0;
513513
}
@@ -540,7 +540,7 @@ static void alloc_and_load_lb_type_rr_graph_for_pb_graph_node(const t_pb_graph_n
540540
lb_type_rr_node_graph[pin_index].num_modes = num_modes;
541541
lb_type_rr_node_graph[pin_index].num_fanout = new short[num_modes];
542542
lb_type_rr_node_graph[pin_index].outedges = new t_lb_type_rr_node_edge*[num_modes];
543-
for (int i = 0; i < num_modes; i++){
543+
for (int i = 0; i < num_modes; i++) {
544544
lb_type_rr_node_graph[pin_index].outedges[i] = nullptr;
545545
lb_type_rr_node_graph[pin_index].num_fanout[i] = 0;
546546
}
@@ -592,7 +592,7 @@ static void alloc_and_load_lb_type_rr_graph_for_pb_graph_node(const t_pb_graph_n
592592
lb_type_rr_node_graph[pin_index].num_modes = num_modes;
593593
lb_type_rr_node_graph[pin_index].num_fanout = new short[num_modes];
594594
lb_type_rr_node_graph[pin_index].outedges = new t_lb_type_rr_node_edge*[num_modes];
595-
for (int i = 0; i < num_modes; i++){
595+
for (int i = 0; i < num_modes; i++) {
596596
lb_type_rr_node_graph[pin_index].outedges[i] = nullptr;
597597
lb_type_rr_node_graph[pin_index].num_fanout[i] = 0;
598598
}

vpr/src/pack/output_clustering.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ static void print_stats() {
5656
num_clb_inputs_used = new int[device_ctx.logical_block_types.size()];
5757
num_clb_outputs_used = new int[device_ctx.logical_block_types.size()];
5858

59-
for (int i = 0 ; i < device_ctx.logical_block_types.size(); i ++){
60-
num_clb_types[i] = 0;
61-
num_clb_inputs_used[i] = 0;
62-
num_clb_outputs_used[i] = 0;
59+
for (int i = 0; i < (int)device_ctx.logical_block_types.size(); i++) {
60+
num_clb_types[i] = 0;
61+
num_clb_inputs_used[i] = 0;
62+
num_clb_outputs_used[i] = 0;
6363
}
6464

6565
for (auto net_id : atom_ctx.nlist.nets()) {

vpr/src/pack/pb_type_graph.cpp

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ static void alloc_and_load_pb_graph(t_pb_graph_node* pb_graph_node,
310310
}
311311

312312
/* Allocate and load child nodes for each mode and create interconnect in each mode */
313+
313314
pb_graph_node->child_pb_graph_nodes = (t_pb_graph_node***)vtr::calloc(pb_type->num_modes, sizeof(t_pb_graph_node**));
314315
for (i = 0; i < pb_type->num_modes; i++) {
315316
pb_graph_node->child_pb_graph_nodes[i] = (t_pb_graph_node**)vtr::calloc(pb_type->modes[i].num_pb_type_children,
@@ -324,12 +325,10 @@ static void alloc_and_load_pb_graph(t_pb_graph_node* pb_graph_node,
324325
}
325326
}
326327

327-
if (pb_type->num_modes > 0) {
328-
pb_graph_node->interconnect_pins = new t_interconnect_pins* [pb_type->num_modes] { nullptr };
329-
} else {
330-
pb_graph_node->interconnect_pins = nullptr;
331-
}
328+
pb_graph_node->interconnect_pins = new t_interconnect_pins*[pb_type->num_modes];
329+
332330
for (i = 0; i < pb_type->num_modes; i++) {
331+
pb_graph_node->interconnect_pins[i] = nullptr;
333332
/* Create interconnect for mode */
334333
alloc_and_load_mode_interconnect(pb_graph_node,
335334
pb_graph_node->child_pb_graph_nodes[i], &pb_type->modes[i],
@@ -645,14 +644,13 @@ t_pb_graph_pin*** alloc_and_load_port_pin_ptrs_from_string(const int line_num,
645644
"No matching '{' for '}' in port %s\n", port_string);
646645
}
647646

648-
pb_graph_pins = new t_pb_graph_pin** [*num_sets];
647+
pb_graph_pins = new t_pb_graph_pin**[*num_sets];
649648
*num_ptrs = new int[*num_sets];
650-
for (int i = 0 ; i < *num_sets; i ++){
651-
pb_graph_pins[i] = nullptr;
652-
(*num_ptrs)[i] = 0;
649+
for (i = 0; i < *num_sets; i++) {
650+
pb_graph_pins[i] = nullptr;
651+
(*num_ptrs)[i] = 0;
653652
}
654653

655-
656654
curr_set = 0;
657655
for (i = 0; i < num_tokens; i++) {
658656
VTR_ASSERT(tokens[i].type != TOKEN_NULL);
@@ -913,11 +911,11 @@ static void alloc_and_load_mux_interc_edges(t_interconnect* interconnect,
913911
vpr_throw(VPR_ERROR_ARCH, get_arch_file_name(), interconnect->line_num,
914912
"# of pins for a particular data line of a mux must equal number of pins at output of mux\n");
915913
}
916-
edges[i_inset].input_pins = new t_pb_graph_pin* [num_output_ptrs[0]];
917-
edges[i_inset].output_pins = new t_pb_graph_pin* [num_output_ptrs[0]];
918-
for (int i = 0 ; i < num_output_ptrs[0] ; i ++){
919-
edges[i_inset].input_pins[i] = nullptr;
920-
edges[i_inset].output_pins[i] = nullptr;
914+
edges[i_inset].input_pins = new t_pb_graph_pin*[num_output_ptrs[0]];
915+
edges[i_inset].output_pins = new t_pb_graph_pin*[num_output_ptrs[0]];
916+
for (int i = 0; i < num_output_ptrs[0]; i++) {
917+
edges[i_inset].input_pins[i] = nullptr;
918+
edges[i_inset].output_pins[i] = nullptr;
921919
}
922920

923921
edges[i_inset].num_input_pins = num_output_ptrs[0];

vpr/src/pack/prepack.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,9 @@ void free_list_of_pack_patterns(std::vector<t_pack_patterns>& list_of_pack_patte
352352
void free_pack_pattern(t_pack_patterns* pack_pattern) {
353353
if (pack_pattern) {
354354
int num_pack_pattern_blocks = pack_pattern->num_blocks;
355-
t_pack_pattern_block** pattern_block_list = new t_pack_pattern_block* [num_pack_pattern_blocks];
356-
for (int i = 0 ; i < num_pack_pattern_blocks ; i++)
357-
pattern_block_list[i] = nullptr;
355+
t_pack_pattern_block** pattern_block_list = new t_pack_pattern_block*[num_pack_pattern_blocks];
356+
for (int i = 0; i < num_pack_pattern_blocks; i++)
357+
pattern_block_list[i] = nullptr;
358358

359359
free(pack_pattern->name);
360360
delete[](pack_pattern->is_block_optional);
@@ -786,9 +786,9 @@ t_pack_molecule* alloc_and_load_pack_molecules(t_pack_patterns* list_of_pack_pat
786786
auto& atom_ctx = g_vpr_ctx.atom();
787787
auto& atom_mutable_ctx = g_vpr_ctx.mutable_atom();
788788

789-
is_used = new bool[num_packing_patterns];
790-
for (int i = 0; i < num_packing_patterns; i++)
791-
is_used[i] = false;
789+
is_used = new bool[num_packing_patterns];
790+
for (i = 0; i < num_packing_patterns; i++)
791+
is_used[i] = false;
792792

793793
cur_molecule = list_of_molecules_head = nullptr;
794794

0 commit comments

Comments
 (0)