@@ -51,10 +51,10 @@ struct t_mux_size_distribution {
51
51
};
52
52
53
53
struct t_clb_to_clb_directs {
54
- t_logical_block_type_ptr from_clb_type;
54
+ t_physical_tile_type_ptr from_clb_type;
55
55
int from_clb_pin_start_index;
56
56
int from_clb_pin_end_index;
57
- t_logical_block_type_ptr to_clb_type;
57
+ t_physical_tile_type_ptr to_clb_type;
58
58
int to_clb_pin_start_index;
59
59
int to_clb_pin_end_index;
60
60
int switch_index; // The switch type used by this direct connection
@@ -2653,94 +2653,103 @@ static void build_unidir_rr_opins(const int i, const int j, const e_side side, c
2653
2653
* TODO: The function that does this parsing in placement is poorly done because it lacks generality on heterogeniety, should replace with this one
2654
2654
*/
2655
2655
static t_clb_to_clb_directs* alloc_and_load_clb_to_clb_directs (const t_direct_inf* directs, const int num_directs, int delayless_switch) {
2656
- int i, j;
2657
- unsigned int itype;
2656
+ int i;
2658
2657
t_clb_to_clb_directs* clb_to_clb_directs;
2659
- char *pb_type_name , *port_name;
2658
+ char *tile_name , *port_name;
2660
2659
int start_pin_index, end_pin_index;
2661
- t_pb_type* pb_type;
2660
+ t_physical_tile_type_ptr physical_tile = nullptr ;
2661
+ t_physical_tile_port tile_port;
2662
2662
2663
2663
auto & device_ctx = g_vpr_ctx.device ();
2664
2664
2665
2665
clb_to_clb_directs = (t_clb_to_clb_directs*)vtr::calloc (num_directs, sizeof (t_clb_to_clb_directs));
2666
2666
2667
- pb_type_name = nullptr ;
2667
+ tile_name = nullptr ;
2668
2668
port_name = nullptr ;
2669
2669
2670
2670
for (i = 0 ; i < num_directs; i++) {
2671
- pb_type_name = (char *)vtr::malloc ((strlen (directs[i].from_pin ) + strlen (directs[i].to_pin )) * sizeof (char ));
2671
+ tile_name = (char *)vtr::malloc ((strlen (directs[i].from_pin ) + strlen (directs[i].to_pin )) * sizeof (char ));
2672
2672
port_name = (char *)vtr::malloc ((strlen (directs[i].from_pin ) + strlen (directs[i].to_pin )) * sizeof (char ));
2673
2673
2674
2674
// Load from pins
2675
2675
// Parse out the pb_type name, port name, and pin range
2676
- parse_direct_pin_name (directs[i].from_pin , directs[i].line , &start_pin_index, &end_pin_index, pb_type_name , port_name);
2676
+ parse_direct_pin_name (directs[i].from_pin , directs[i].line , &start_pin_index, &end_pin_index, tile_name , port_name);
2677
2677
2678
2678
// Figure out which type, port, and pin is used
2679
- for (itype = 0 ; itype < device_ctx.logical_block_types .size (); ++itype) {
2680
- if (strcmp (device_ctx.logical_block_types [itype].name , pb_type_name) == 0 ) {
2679
+ for (auto & type : device_ctx.physical_tile_types ) {
2680
+ if (strcmp (type.name , tile_name) == 0 ) {
2681
+ physical_tile = &type;
2681
2682
break ;
2682
2683
}
2683
2684
}
2684
2685
2685
- if (itype >= device_ctx. logical_block_types . size () ) {
2686
- vpr_throw (VPR_ERROR_ARCH, get_arch_file_name (), directs[i]. line , " Unable to find block %s.\n " , pb_type_name );
2686
+ if (physical_tile == nullptr ) {
2687
+ VPR_THROW (VPR_ERROR_ARCH, " Unable to find block %s.\n " , tile_name );
2687
2688
}
2688
2689
2689
- clb_to_clb_directs[i].from_clb_type = &device_ctx.logical_block_types [itype];
2690
- pb_type = clb_to_clb_directs[i].from_clb_type ->pb_type ;
2690
+ clb_to_clb_directs[i].from_clb_type = physical_tile;
2691
2691
2692
- for (j = 0 ; j < pb_type->num_ports ; j++) {
2693
- if (strcmp (pb_type->ports [j].name , port_name) == 0 ) {
2692
+ bool port_found = false ;
2693
+ for (auto port : physical_tile->ports ) {
2694
+ if (0 == strcmp (port.name , port_name)) {
2695
+ tile_port = port;
2696
+ port_found = true ;
2694
2697
break ;
2695
2698
}
2696
2699
}
2697
- if (j >= pb_type->num_ports ) {
2698
- vpr_throw (VPR_ERROR_ARCH, get_arch_file_name (), directs[i].line , " Unable to find port %s (on block %s).\n " , port_name, pb_type_name);
2700
+
2701
+ if (!port_found) {
2702
+ VPR_THROW (VPR_ERROR_ARCH, " Unable to find port %s (on block %s).\n " , port_name, tile_name);
2699
2703
}
2700
2704
2701
2705
if (start_pin_index == OPEN) {
2702
2706
VTR_ASSERT (start_pin_index == end_pin_index);
2703
2707
start_pin_index = 0 ;
2704
- end_pin_index = pb_type-> ports [j] .num_pins - 1 ;
2708
+ end_pin_index = tile_port .num_pins - 1 ;
2705
2709
}
2706
- get_blk_pin_from_port_pin (clb_to_clb_directs[i].from_clb_type ->index , j, start_pin_index, &clb_to_clb_directs[i].from_clb_pin_start_index );
2707
- get_blk_pin_from_port_pin (clb_to_clb_directs[i].from_clb_type ->index , j, end_pin_index, &clb_to_clb_directs[i].from_clb_pin_end_index );
2710
+
2711
+ clb_to_clb_directs[i].from_clb_pin_start_index = tile_port.absolute_first_pin_index + start_pin_index;
2712
+ clb_to_clb_directs[i].from_clb_pin_end_index = tile_port.absolute_first_pin_index + end_pin_index;
2708
2713
2709
2714
// Load to pins
2710
2715
// Parse out the pb_type name, port name, and pin range
2711
- parse_direct_pin_name (directs[i].to_pin , directs[i].line , &start_pin_index, &end_pin_index, pb_type_name , port_name);
2716
+ parse_direct_pin_name (directs[i].to_pin , directs[i].line , &start_pin_index, &end_pin_index, tile_name , port_name);
2712
2717
2713
2718
// Figure out which type, port, and pin is used
2714
- for (itype = 0 ; itype < device_ctx.logical_block_types .size (); ++itype) {
2715
- if (strcmp (device_ctx.logical_block_types [itype].name , pb_type_name) == 0 ) {
2719
+ for (auto & type : device_ctx.physical_tile_types ) {
2720
+ if (strcmp (type.name , tile_name) == 0 ) {
2721
+ physical_tile = &type;
2716
2722
break ;
2717
2723
}
2718
2724
}
2719
2725
2720
- if (itype >= device_ctx. logical_block_types . size () ) {
2721
- vpr_throw (VPR_ERROR_ARCH, get_arch_file_name (), directs[i]. line , " Unable to find block %s.\n " , pb_type_name );
2726
+ if (physical_tile == nullptr ) {
2727
+ VPR_THROW (VPR_ERROR_ARCH, " Unable to find block %s.\n " , tile_name );
2722
2728
}
2723
2729
2724
- clb_to_clb_directs[i].to_clb_type = &device_ctx.logical_block_types [itype];
2725
- pb_type = clb_to_clb_directs[i].to_clb_type ->pb_type ;
2730
+ clb_to_clb_directs[i].from_clb_type = physical_tile;
2726
2731
2727
- for (j = 0 ; j < pb_type->num_ports ; j++) {
2728
- if (strcmp (pb_type->ports [j].name , port_name) == 0 ) {
2732
+ port_found = false ;
2733
+ for (auto port : physical_tile->ports ) {
2734
+ if (0 == strcmp (port.name , port_name)) {
2735
+ tile_port = port;
2736
+ port_found = true ;
2729
2737
break ;
2730
2738
}
2731
2739
}
2732
- if (j >= pb_type->num_ports ) {
2733
- vpr_throw (VPR_ERROR_ARCH, get_arch_file_name (), directs[i].line , " Unable to find port %s (on block %s).\n " , port_name, pb_type_name);
2740
+
2741
+ if (!port_found) {
2742
+ VPR_THROW (VPR_ERROR_ARCH, " Unable to find port %s (on block %s).\n " , port_name, tile_name);
2734
2743
}
2735
2744
2736
2745
if (start_pin_index == OPEN) {
2737
2746
VTR_ASSERT (start_pin_index == end_pin_index);
2738
2747
start_pin_index = 0 ;
2739
- end_pin_index = pb_type-> ports [j] .num_pins - 1 ;
2748
+ end_pin_index = tile_port .num_pins - 1 ;
2740
2749
}
2741
2750
2742
- get_blk_pin_from_port_pin ( clb_to_clb_directs[i].to_clb_type -> index , j, start_pin_index, &clb_to_clb_directs[i]. to_clb_pin_start_index ) ;
2743
- get_blk_pin_from_port_pin ( clb_to_clb_directs[i].to_clb_type -> index , j, end_pin_index, &clb_to_clb_directs[i]. to_clb_pin_end_index ) ;
2751
+ clb_to_clb_directs[i].to_clb_pin_start_index = tile_port. absolute_first_pin_index + start_pin_index ;
2752
+ clb_to_clb_directs[i].to_clb_pin_end_index = tile_port. absolute_first_pin_index + end_pin_index ;
2744
2753
2745
2754
if (abs (clb_to_clb_directs[i].from_clb_pin_start_index - clb_to_clb_directs[i].from_clb_pin_end_index ) != abs (clb_to_clb_directs[i].to_clb_pin_start_index - clb_to_clb_directs[i].to_clb_pin_end_index )) {
2746
2755
vpr_throw (VPR_ERROR_ARCH, get_arch_file_name (), directs[i].line ,
@@ -2755,7 +2764,7 @@ static t_clb_to_clb_directs* alloc_and_load_clb_to_clb_directs(const t_direct_in
2755
2764
// Use the delayless switch by default
2756
2765
clb_to_clb_directs[i].switch_index = delayless_switch;
2757
2766
}
2758
- free (pb_type_name );
2767
+ free (tile_name );
2759
2768
free (port_name);
2760
2769
2761
2770
// We must be careful to clean-up anything that we may have incidentally allocated.
@@ -2803,7 +2812,7 @@ static int get_opin_direct_connecions(int x,
2803
2812
/* Iterate through all direct connections */
2804
2813
for (int i = 0 ; i < num_directs; i++) {
2805
2814
/* Find matching direct clb-to-clb connections with the same type as current grid location */
2806
- if (clb_to_clb_directs[i].from_clb_type == logical_block_type ( curr_type) ) { // We are at a valid starting point
2815
+ if (clb_to_clb_directs[i].from_clb_type == curr_type) { // We are at a valid starting point
2807
2816
2808
2817
if (directs[i].from_side != NUM_SIDES && directs[i].from_side != side) continue ;
2809
2818
@@ -2814,7 +2823,7 @@ static int get_opin_direct_connecions(int x,
2814
2823
&& y + directs[i].y_offset > 0 ) {
2815
2824
// Only add connections if the target clb type matches the type in the direct specification
2816
2825
t_physical_tile_type_ptr target_type = device_ctx.grid [x + directs[i].x_offset ][y + directs[i].y_offset ].type ;
2817
- if (clb_to_clb_directs[i].to_clb_type == logical_block_type ( target_type)
2826
+ if (clb_to_clb_directs[i].to_clb_type == target_type
2818
2827
&& z + directs[i].z_offset < int (target_type->capacity )
2819
2828
&& z + directs[i].z_offset >= 0 ) {
2820
2829
/* Compute index of opin with regards to given pins */
0 commit comments