@@ -225,6 +225,7 @@ static t_pin_inst_port block_type_pin_index_to_pin_inst(t_physical_tile_type_ptr
225
225
std::tie<int , int , int >(pin_index, inst_num, sub_tile_index) = get_pin_index_for_inst (type, pin_index);
226
226
227
227
t_pin_inst_port pin_inst_port;
228
+ pin_inst_port.sub_tile_index = sub_tile_index;
228
229
pin_inst_port.capacity_instance = inst_num;
229
230
pin_inst_port.port_index = OPEN;
230
231
pin_inst_port.pin_index_in_port = OPEN;
@@ -732,9 +733,16 @@ void get_class_range_for_block(const ClusterBlockId blk_id,
732
733
auto & place_ctx = g_vpr_ctx.placement ();
733
734
734
735
auto type = physical_tile_type (blk_id);
735
- VTR_ASSERT ((int )type->class_inf .size () % type->capacity == 0 );
736
- *class_low = place_ctx.block_locs [blk_id].loc .z * ((int )type->class_inf .size () / type->capacity );
737
- *class_high = (place_ctx.block_locs [blk_id].loc .z + 1 ) * ((int )type->class_inf .size () / type->capacity ) - 1 ;
736
+ auto sub_tile = type->sub_tiles [get_sub_tile_index (blk_id)];
737
+ int sub_tile_capacity = sub_tile.capacity .total ();
738
+ auto class_range = sub_tile.class_range ;
739
+ int class_range_total = class_range.high - class_range.low + 1 ;
740
+
741
+ VTR_ASSERT ((class_range_total) % sub_tile_capacity == 0 );
742
+ int rel_capacity = place_ctx.block_locs [blk_id].loc .z - sub_tile.capacity .low ;
743
+
744
+ *class_low = rel_capacity * (class_range_total / sub_tile_capacity) + class_range.low ;
745
+ *class_high = (rel_capacity + 1 ) * (class_range_total / sub_tile_capacity) - 1 + class_range.low ;
738
746
}
739
747
740
748
void get_pin_range_for_block (const ClusterBlockId blk_id,
@@ -744,9 +752,16 @@ void get_pin_range_for_block(const ClusterBlockId blk_id,
744
752
auto & place_ctx = g_vpr_ctx.placement ();
745
753
746
754
auto type = physical_tile_type (blk_id);
747
- VTR_ASSERT (type->num_pins % type->capacity == 0 );
748
- *pin_low = place_ctx.block_locs [blk_id].loc .z * (type->num_pins / type->capacity );
749
- *pin_high = (place_ctx.block_locs [blk_id].loc .z + 1 ) * (type->num_pins / type->capacity ) - 1 ;
755
+ auto sub_tile = type->sub_tiles [get_sub_tile_index (blk_id)];
756
+ int sub_tile_capacity = sub_tile.capacity .total ();
757
+
758
+ VTR_ASSERT (sub_tile.num_phy_pins % sub_tile_capacity == 0 );
759
+ int rel_capacity = place_ctx.block_locs [blk_id].loc .z - sub_tile.capacity .low ;
760
+ int rel_pin_low = rel_capacity * (sub_tile.num_phy_pins / sub_tile_capacity);
761
+ int rel_pin_high = (rel_capacity + 1 ) * (sub_tile.num_phy_pins / sub_tile_capacity) - 1 ;
762
+
763
+ *pin_low = sub_tile.sub_tile_to_tile_pin_indices [rel_pin_low];
764
+ *pin_high = sub_tile.sub_tile_to_tile_pin_indices [rel_pin_high];
750
765
}
751
766
752
767
t_physical_tile_type_ptr find_tile_type_by_name (std::string name, const std::vector<t_physical_tile_type>& types) {
@@ -857,7 +872,7 @@ InstPort parse_inst_port(std::string str) {
857
872
VPR_FATAL_ERROR (VPR_ERROR_ARCH, " Failed to find block type named %s" , inst_port.instance_name ().c_str ());
858
873
}
859
874
860
- int num_pins = find_tile_port_by_name (blk_type, inst_port.instance_name ().c_str ()).num_pins ;
875
+ int num_pins = find_tile_port_by_name (blk_type, inst_port.port_name ().c_str ()).num_pins ;
861
876
862
877
if (num_pins == OPEN) {
863
878
VPR_FATAL_ERROR (VPR_ERROR_ARCH, " Failed to find port %s on block type %s" , inst_port.port_name ().c_str (), inst_port.instance_name ().c_str ());
@@ -1621,18 +1636,21 @@ static void alloc_and_load_blk_pin_from_port_pin() {
1621
1636
1622
1637
/* Resize and initialize the values to OPEN (-1). */
1623
1638
int num_types = types.size ();
1624
- f_blk_pin_from_port_pin.resize (device_ctx. physical_tile_types . size () );
1639
+ f_blk_pin_from_port_pin.resize (num_types );
1625
1640
for (int itype = 1 ; itype < num_types; itype++) {
1626
1641
int blk_pin_count = 0 ;
1627
1642
auto & type = types[itype];
1628
1643
int num_sub_tiles = type.sub_tiles .size ();
1629
1644
f_blk_pin_from_port_pin[itype].resize (num_sub_tiles);
1630
- for (int isub_tile; isub_tile < num_sub_tiles; isub_tile++) {
1645
+ for (int isub_tile = 0 ; isub_tile < num_sub_tiles; isub_tile++) {
1631
1646
int num_ports = type.sub_tiles [isub_tile].ports .size ();
1632
1647
f_blk_pin_from_port_pin[itype][isub_tile].resize (num_ports);
1633
1648
for (int iport = 0 ; iport < num_ports; iport++) {
1634
- f_blk_pin_from_port_pin[itype][isub_tile][iport].push_back (blk_pin_count);
1635
- blk_pin_count++;
1649
+ int num_pins = type.sub_tiles [isub_tile].ports [iport].num_pins ;
1650
+ for (int ipin = 0 ; ipin < num_pins; ipin++) {
1651
+ f_blk_pin_from_port_pin[itype][isub_tile][iport].push_back (blk_pin_count);
1652
+ blk_pin_count++;
1653
+ }
1636
1654
}
1637
1655
}
1638
1656
}
@@ -2067,7 +2085,6 @@ void print_switch_usage() {
2067
2085
* }
2068
2086
*/
2069
2087
2070
- // TODO FIX THIS!
2071
2088
void place_sync_external_block_connections (ClusterBlockId iblk) {
2072
2089
auto & cluster_ctx = g_vpr_ctx.clustering ();
2073
2090
auto & clb_nlist = cluster_ctx.clb_nlist ;
@@ -2076,15 +2093,20 @@ void place_sync_external_block_connections(ClusterBlockId iblk) {
2076
2093
auto physical_tile = physical_tile_type (iblk);
2077
2094
auto logical_block = clb_nlist.block_type (iblk);
2078
2095
2079
- VTR_ASSERT (physical_tile->num_pins % physical_tile->capacity == 0 );
2080
- int max_num_block_pins = physical_tile->num_pins / physical_tile->capacity ;
2096
+ int sub_tile_index = get_sub_tile_index (iblk);
2097
+ auto sub_tile = physical_tile->sub_tiles [sub_tile_index];
2098
+
2099
+ VTR_ASSERT (sub_tile.num_phy_pins % sub_tile.capacity .total () == 0 );
2100
+
2101
+ int max_num_block_pins = sub_tile.num_phy_pins / sub_tile.capacity .total ();
2102
+ int physical_pin_offset = get_physical_pin_offset (&sub_tile, physical_tile);
2081
2103
/* Logical location and physical location is offset by z * max_num_block_pins */
2082
2104
2083
2105
for (auto pin : clb_nlist.block_pins (iblk)) {
2084
2106
int logical_pin_index = clb_nlist.pin_logical_index (pin);
2085
- int physical_pin_index = get_physical_pin (physical_tile, logical_block, logical_pin_index);
2107
+ int physical_pin_index = get_physical_pin (sub_tile_index, physical_tile, logical_block, logical_pin_index);
2086
2108
2087
- int new_physical_pin_index = physical_pin_index + place_ctx.block_locs [iblk].loc .z * max_num_block_pins;
2109
+ int new_physical_pin_index = physical_pin_offset + physical_pin_index + place_ctx.block_locs [iblk].loc .z * max_num_block_pins;
2088
2110
2089
2111
auto result = place_ctx.physical_pins .find (pin);
2090
2112
if (result != place_ctx.physical_pins .end ()) {
@@ -2121,6 +2143,18 @@ bool is_tile_compatible(t_physical_tile_type_ptr physical_tile, t_logical_block_
2121
2143
return std::find (equivalent_tiles.begin (), equivalent_tiles.end (), physical_tile) != equivalent_tiles.end ();
2122
2144
}
2123
2145
2146
+ bool is_tile_compatible (t_physical_tile_type_ptr physical_tile, t_logical_block_type_ptr logical_block, t_pl_loc loc) {
2147
+ bool capacity_compatible = false ;
2148
+ for (auto & sub_tile : physical_tile->sub_tiles ) {
2149
+ if (sub_tile.capacity .is_in_range (loc.z )) {
2150
+ capacity_compatible = true ;
2151
+ break ;
2152
+ }
2153
+ }
2154
+
2155
+ return capacity_compatible && is_tile_compatible (physical_tile, logical_block);
2156
+ }
2157
+
2124
2158
/* *
2125
2159
* This function returns the most common physical tile type given a logical block
2126
2160
*/
@@ -2215,6 +2249,17 @@ int get_physical_pin(t_physical_tile_type_ptr physical_tile,
2215
2249
return result->second .pin ;
2216
2250
}
2217
2251
2252
+ int get_physical_pin_offset (t_sub_tile* sub_tile,
2253
+ t_physical_tile_type_ptr physical_tile) {
2254
+ int offset = 0 ;
2255
+
2256
+ for (int isub_tile = 0 ; isub_tile < sub_tile->index ; isub_tile++) {
2257
+ offset += physical_tile->sub_tiles [isub_tile].num_phy_pins ;
2258
+ }
2259
+
2260
+ return offset;
2261
+ }
2262
+
2218
2263
int net_pin_to_tile_pin_index (const ClusterNetId net_id, int net_pin_index) {
2219
2264
auto & cluster_ctx = g_vpr_ctx.clustering ();
2220
2265
0 commit comments