@@ -53,14 +53,12 @@ static t_pb_graph_edge* find_expansion_edge_of_pattern(const int pattern_index,
53
53
const t_pb_graph_node* pb_graph_node);
54
54
55
55
static void forward_expand_pack_pattern_from_edge (const t_pb_graph_edge* expansion_edge,
56
- std::vector<t_pack_patterns>& list_of_packing_patterns,
57
- const int curr_pattern_index,
56
+ t_pack_patterns& packing_pattern,
58
57
int * L_num_blocks,
59
58
const bool make_root_of_chain);
60
59
61
60
static void backward_expand_pack_pattern_from_edge (const t_pb_graph_edge* expansion_edge,
62
- std::vector<t_pack_patterns>& list_of_packing_patterns,
63
- const int curr_pattern_index,
61
+ t_pack_patterns& packing_pattern,
64
62
t_pb_graph_pin* destination_pin,
65
63
t_pack_pattern_block* destination_block,
66
64
int * L_num_blocks);
@@ -160,7 +158,7 @@ static std::vector<t_pack_patterns> alloc_and_load_pack_patterns(const std::vect
160
158
list_of_packing_patterns[i].base_cost = 0 ;
161
159
// use the found expansion edge to build the pack pattern
162
160
backward_expand_pack_pattern_from_edge (expansion_edge,
163
- list_of_packing_patterns, i , nullptr , nullptr , &L_num_blocks);
161
+ list_of_packing_patterns[i] , nullptr , nullptr , &L_num_blocks);
164
162
list_of_packing_patterns[i].num_blocks = L_num_blocks;
165
163
166
164
/* Default settings: A section of a netlist must match all blocks in a pack
@@ -468,15 +466,15 @@ static t_pb_graph_edge* find_expansion_edge_of_pattern(const int pattern_index,
468
466
* future multi-fanout support easier) so this function will not update connections
469
467
*/
470
468
static void forward_expand_pack_pattern_from_edge (const t_pb_graph_edge* expansion_edge,
471
- std::vector<t_pack_patterns>& list_of_packing_patterns,
472
- const int curr_pattern_index,
469
+ t_pack_patterns& packing_pattern,
473
470
int * L_num_blocks,
474
471
bool make_root_of_chain) {
475
472
int i, j, k;
476
473
int iport, ipin, iedge;
477
474
bool found; /* Error checking, ensure only one fan-out for each pattern net */
478
475
t_pack_pattern_block* destination_block = nullptr ;
479
476
t_pb_graph_node* destination_pb_graph_node = nullptr ;
477
+ int curr_pattern_index = packing_pattern.index ;
480
478
481
479
found = expansion_edge->infer_pattern ;
482
480
// if the pack pattern shouldn't be inferred check if the expansion
@@ -511,7 +509,7 @@ static void forward_expand_pack_pattern_from_edge(const t_pb_graph_edge* expansi
511
509
// 2) assign an id to this pattern block, 3) increment the number of found blocks belonging to this
512
510
// pattern and 4) expand all its edges to find the other primitives that belong to this pattern
513
511
destination_block = new t_pack_pattern_block ();
514
- list_of_packing_patterns[curr_pattern_index] .base_cost += compute_primitive_base_cost (destination_pb_graph_node);
512
+ packing_pattern .base_cost += compute_primitive_base_cost (destination_pb_graph_node);
515
513
destination_block->block_id = *L_num_blocks;
516
514
(*L_num_blocks)++;
517
515
destination_pb_graph_node->temp_scratch_pad = (void *)destination_block;
@@ -523,8 +521,7 @@ static void forward_expand_pack_pattern_from_edge(const t_pb_graph_edge* expansi
523
521
for (ipin = 0 ; ipin < destination_pb_graph_node->num_input_pins [iport]; ipin++) {
524
522
for (iedge = 0 ; iedge < destination_pb_graph_node->input_pins [iport][ipin].num_input_edges ; iedge++) {
525
523
backward_expand_pack_pattern_from_edge (destination_pb_graph_node->input_pins [iport][ipin].input_edges [iedge],
526
- list_of_packing_patterns,
527
- curr_pattern_index,
524
+ packing_pattern,
528
525
&destination_pb_graph_node->input_pins [iport][ipin],
529
526
destination_block, L_num_blocks);
530
527
}
@@ -536,8 +533,7 @@ static void forward_expand_pack_pattern_from_edge(const t_pb_graph_edge* expansi
536
533
for (ipin = 0 ; ipin < destination_pb_graph_node->num_output_pins [iport]; ipin++) {
537
534
for (iedge = 0 ; iedge < destination_pb_graph_node->output_pins [iport][ipin].num_output_edges ; iedge++) {
538
535
forward_expand_pack_pattern_from_edge (destination_pb_graph_node->output_pins [iport][ipin].output_edges [iedge],
539
- list_of_packing_patterns,
540
- curr_pattern_index, L_num_blocks, false );
536
+ packing_pattern, L_num_blocks, false );
541
537
}
542
538
}
543
539
}
@@ -547,8 +543,7 @@ static void forward_expand_pack_pattern_from_edge(const t_pb_graph_edge* expansi
547
543
for (ipin = 0 ; ipin < destination_pb_graph_node->num_clock_pins [iport]; ipin++) {
548
544
for (iedge = 0 ; iedge < destination_pb_graph_node->clock_pins [iport][ipin].num_input_edges ; iedge++) {
549
545
backward_expand_pack_pattern_from_edge (destination_pb_graph_node->clock_pins [iport][ipin].input_edges [iedge],
550
- list_of_packing_patterns,
551
- curr_pattern_index,
546
+ packing_pattern,
552
547
&destination_pb_graph_node->clock_pins [iport][ipin],
553
548
destination_block, L_num_blocks);
554
549
}
@@ -560,8 +555,8 @@ static void forward_expand_pack_pattern_from_edge(const t_pb_graph_edge* expansi
560
555
if (((t_pack_pattern_block*)destination_pb_graph_node->temp_scratch_pad )->pattern_index == curr_pattern_index) {
561
556
// if this pb_graph_node is known to be the root of the chain, update the root block and root pin
562
557
if (make_root_of_chain == true ) {
563
- list_of_packing_patterns[curr_pattern_index] .chain_root_pins = {{expansion_edge->output_pins [i]}};
564
- list_of_packing_patterns[curr_pattern_index] .root_block = destination_block;
558
+ packing_pattern .chain_root_pins = {{expansion_edge->output_pins [i]}};
559
+ packing_pattern .root_block = destination_block;
565
560
}
566
561
}
567
562
@@ -571,8 +566,7 @@ static void forward_expand_pack_pattern_from_edge(const t_pb_graph_edge* expansi
571
566
for (j = 0 ; j < expansion_edge->output_pins [i]->num_output_edges ; j++) {
572
567
if (expansion_edge->output_pins [i]->output_edges [j]->infer_pattern == true ) {
573
568
forward_expand_pack_pattern_from_edge (expansion_edge->output_pins [i]->output_edges [j],
574
- list_of_packing_patterns,
575
- curr_pattern_index,
569
+ packing_pattern,
576
570
L_num_blocks,
577
571
make_root_of_chain);
578
572
} else {
@@ -587,12 +581,11 @@ static void forward_expand_pack_pattern_from_edge(const t_pb_graph_edge* expansi
587
581
expansion_edge->output_pins [i]->parent_node ->placement_index ,
588
582
expansion_edge->output_pins [i]->port ->name ,
589
583
expansion_edge->output_pins [i]->pin_number ,
590
- list_of_packing_patterns[curr_pattern_index] .name );
584
+ packing_pattern .name );
591
585
}
592
586
found = true ;
593
587
forward_expand_pack_pattern_from_edge (expansion_edge->output_pins [i]->output_edges [j],
594
- list_of_packing_patterns,
595
- curr_pattern_index,
588
+ packing_pattern,
596
589
L_num_blocks,
597
590
make_root_of_chain);
598
591
}
@@ -610,8 +603,7 @@ static void forward_expand_pack_pattern_from_edge(const t_pb_graph_edge* expansi
610
603
* destination blocks
611
604
*/
612
605
static void backward_expand_pack_pattern_from_edge (const t_pb_graph_edge* expansion_edge,
613
- std::vector<t_pack_patterns>& list_of_packing_patterns,
614
- const int curr_pattern_index,
606
+ t_pack_patterns& packing_pattern,
615
607
t_pb_graph_pin* destination_pin,
616
608
t_pack_pattern_block* destination_block,
617
609
int * L_num_blocks) {
@@ -621,6 +613,7 @@ static void backward_expand_pack_pattern_from_edge(const t_pb_graph_edge* expans
621
613
t_pack_pattern_block* source_block = nullptr ;
622
614
t_pb_graph_node* source_pb_graph_node = nullptr ;
623
615
t_pack_pattern_connections* pack_pattern_connection = nullptr ;
616
+ int curr_pattern_index = packing_pattern.index ;
624
617
625
618
found = expansion_edge->infer_pattern ;
626
619
// if the pack pattern shouldn't be inferred check if the expansion
@@ -654,22 +647,21 @@ static void backward_expand_pack_pattern_from_edge(const t_pb_graph_edge* expans
654
647
source_block = new t_pack_pattern_block ();
655
648
source_block->block_id = *L_num_blocks;
656
649
(*L_num_blocks)++;
657
- list_of_packing_patterns[curr_pattern_index] .base_cost += compute_primitive_base_cost (source_pb_graph_node);
650
+ packing_pattern .base_cost += compute_primitive_base_cost (source_pb_graph_node);
658
651
source_pb_graph_node->temp_scratch_pad = (void *)source_block;
659
652
source_block->pattern_index = curr_pattern_index;
660
653
source_block->pb_type = source_pb_graph_node->pb_type ;
661
654
662
- if (list_of_packing_patterns[curr_pattern_index] .root_block == nullptr ) {
663
- list_of_packing_patterns[curr_pattern_index] .root_block = source_block;
655
+ if (packing_pattern .root_block == nullptr ) {
656
+ packing_pattern .root_block = source_block;
664
657
}
665
658
666
659
// explore the inputs of this primitive
667
660
for (iport = 0 ; iport < source_pb_graph_node->num_input_ports ; iport++) {
668
661
for (ipin = 0 ; ipin < source_pb_graph_node->num_input_pins [iport]; ipin++) {
669
662
for (iedge = 0 ; iedge < source_pb_graph_node->input_pins [iport][ipin].num_input_edges ; iedge++) {
670
663
backward_expand_pack_pattern_from_edge (source_pb_graph_node->input_pins [iport][ipin].input_edges [iedge],
671
- list_of_packing_patterns,
672
- curr_pattern_index,
664
+ packing_pattern,
673
665
&source_pb_graph_node->input_pins [iport][ipin],
674
666
source_block,
675
667
L_num_blocks);
@@ -682,8 +674,7 @@ static void backward_expand_pack_pattern_from_edge(const t_pb_graph_edge* expans
682
674
for (ipin = 0 ; ipin < source_pb_graph_node->num_output_pins [iport]; ipin++) {
683
675
for (iedge = 0 ; iedge < source_pb_graph_node->output_pins [iport][ipin].num_output_edges ; iedge++) {
684
676
forward_expand_pack_pattern_from_edge (source_pb_graph_node->output_pins [iport][ipin].output_edges [iedge],
685
- list_of_packing_patterns,
686
- curr_pattern_index,
677
+ packing_pattern,
687
678
L_num_blocks,
688
679
false );
689
680
}
@@ -695,8 +686,7 @@ static void backward_expand_pack_pattern_from_edge(const t_pb_graph_edge* expans
695
686
for (ipin = 0 ; ipin < source_pb_graph_node->num_clock_pins [iport]; ipin++) {
696
687
for (iedge = 0 ; iedge < source_pb_graph_node->clock_pins [iport][ipin].num_input_edges ; iedge++) {
697
688
backward_expand_pack_pattern_from_edge (source_pb_graph_node->clock_pins [iport][ipin].input_edges [iedge],
698
- list_of_packing_patterns,
699
- curr_pattern_index,
689
+ packing_pattern,
700
690
&source_pb_graph_node->clock_pins [iport][ipin],
701
691
source_block,
702
692
L_num_blocks);
@@ -739,11 +729,10 @@ static void backward_expand_pack_pattern_from_edge(const t_pb_graph_edge* expans
739
729
if (expansion_edge->input_pins [i]->parent_node ->pb_type ->parent_mode == nullptr ) {
740
730
// This pack pattern extends to CLB (root pb block) input pin,
741
731
// thus it extends across multiple logic blocks, treat as a chain
742
- list_of_packing_patterns[curr_pattern_index] .is_chain = true ;
732
+ packing_pattern .is_chain = true ;
743
733
// since this input pin has not driving nets, expand in the forward direction instead
744
734
forward_expand_pack_pattern_from_edge (expansion_edge,
745
- list_of_packing_patterns,
746
- curr_pattern_index,
735
+ packing_pattern,
747
736
L_num_blocks,
748
737
true );
749
738
}
@@ -754,8 +743,7 @@ static void backward_expand_pack_pattern_from_edge(const t_pb_graph_edge* expans
754
743
// if pattern should be inferred for this edge continue the expansion backwards
755
744
if (expansion_edge->input_pins [i]->input_edges [j]->infer_pattern == true ) {
756
745
backward_expand_pack_pattern_from_edge (expansion_edge->input_pins [i]->input_edges [j],
757
- list_of_packing_patterns,
758
- curr_pattern_index,
746
+ packing_pattern,
759
747
destination_pin,
760
748
destination_block,
761
749
L_num_blocks);
@@ -768,8 +756,7 @@ static void backward_expand_pack_pattern_from_edge(const t_pb_graph_edge* expans
768
756
/* Check assumption that each forced net has only one fan-out */
769
757
found = true ;
770
758
backward_expand_pack_pattern_from_edge (expansion_edge->input_pins [i]->input_edges [j],
771
- list_of_packing_patterns,
772
- curr_pattern_index,
759
+ packing_pattern,
773
760
destination_pin,
774
761
destination_block,
775
762
L_num_blocks);
0 commit comments