52
52
#include " vtr_memory.h"
53
53
#include " vtr_digest.h"
54
54
#include " vtr_token.h"
55
+ #include " vtr_bimap.h"
55
56
56
57
#include " arch_types.h"
57
58
#include " arch_util.h"
@@ -3251,7 +3252,7 @@ static void ProcessEquivalentSiteDirects(pugi::xml_node Parent,
3251
3252
" There are no direct pin mappings between site %s and tile %s.\n " , site_name.c_str (), PhysicalTileType->name );
3252
3253
}
3253
3254
3254
- std::unordered_map< int , int > directs_map;
3255
+ vtr::bimap<t_logical_pin, t_physical_pin > directs_map;
3255
3256
3256
3257
CurDirect = Parent.first_child ();
3257
3258
while (CurDirect) {
@@ -3279,7 +3280,16 @@ static void ProcessEquivalentSiteDirects(pugi::xml_node Parent,
3279
3280
3280
3281
int num_pins = from_pins.second - from_pins.first ;
3281
3282
for (int i = 0 ; i < num_pins; i++) {
3282
- directs_map[to_pins.first + i] = from_pins.first + i;
3283
+ t_physical_pin phy_pin (from_pins.first + i);
3284
+ t_logical_pin log_pin (to_pins.first + i);
3285
+
3286
+ auto result = directs_map.insert (log_pin, phy_pin);
3287
+ if (!result.second ) {
3288
+ archfpga_throw (loc_data.filename_c_str (), loc_data.line (Parent),
3289
+ " Duplicate logical pin (%d) to physical pin (%d) mappings found for "
3290
+ " Physical Tile %s and Logical Block %s.\n " ,
3291
+ log_pin.pin , phy_pin.pin , PhysicalTileType->name , LogicalBlockType->name );
3292
+ }
3283
3293
}
3284
3294
3285
3295
CurDirect = CurDirect.next_sibling (CurDirect.name ());
@@ -4791,6 +4801,42 @@ static void link_physical_logical_types(std::vector<t_physical_tile_type>& Physi
4791
4801
archfpga_throw (__FILE__, __LINE__,
4792
4802
" Logical Block %s does not have any equivalent tiles.\n " , logical_block.name );
4793
4803
}
4804
+
4805
+ std::unordered_map<int , bool > ignored_pins_check_map;
4806
+ std::unordered_map<int , bool > global_pins_check_map;
4807
+
4808
+ for (int pin = 0 ; pin < logical_block.pb_type ->num_pins ; pin++) {
4809
+ for (auto & tile : logical_block.equivalent_tiles ) {
4810
+ auto direct_map = tile->tile_block_pin_directs_map .at (logical_block.index );
4811
+ auto result = direct_map.find (t_logical_pin (pin));
4812
+ if (result == direct_map.end ()) {
4813
+ archfpga_throw (__FILE__, __LINE__,
4814
+ " Logical pin %d not present in pin mapping between Tile %s and Block %s.\n " ,
4815
+ pin, tile->name , logical_block.name );
4816
+ }
4817
+
4818
+ int phy_index = result->second .pin ;
4819
+
4820
+ bool is_ignored = tile->is_ignored_pin [phy_index];
4821
+ bool is_global = tile->is_pin_global [phy_index];
4822
+
4823
+ auto ignored_result = ignored_pins_check_map.insert (std::pair<int , bool >(pin, is_ignored));
4824
+ if (!ignored_result.second && ignored_result.first ->second != is_ignored) {
4825
+ archfpga_throw (__FILE__, __LINE__,
4826
+ " Physical Tile %s has a different value for the ignored pin (physical pin: %d, logical pin: %d) "
4827
+ " different from the corresponding pins of the other equivalent sites\n ." ,
4828
+ tile->name , phy_index, pin);
4829
+ }
4830
+
4831
+ auto global_result = global_pins_check_map.insert (std::pair<int , bool >(pin, is_global));
4832
+ if (!global_result.second && global_result.first ->second != is_global) {
4833
+ archfpga_throw (__FILE__, __LINE__,
4834
+ " Physical Tile %s has a different value for the global pin (physical pin: %d, logical pin: %d) "
4835
+ " different from the corresponding pins of the other equivalent sites\n ." ,
4836
+ tile->name , phy_index, pin);
4837
+ }
4838
+ }
4839
+ }
4794
4840
}
4795
4841
}
4796
4842
@@ -4812,8 +4858,8 @@ static void check_port_direct_mappings(t_physical_tile_type_ptr physical_tile, t
4812
4858
}
4813
4859
4814
4860
for (auto pin_map : pin_direct_mapping) {
4815
- auto block_port = get_port_by_pin (logical_block, pin_map.first );
4816
- auto tile_port = get_port_by_pin (physical_tile, pin_map.second );
4861
+ auto block_port = get_port_by_pin (logical_block, pin_map.first . pin );
4862
+ auto tile_port = get_port_by_pin (physical_tile, pin_map.second . pin );
4817
4863
4818
4864
VTR_ASSERT (block_port != nullptr );
4819
4865
VTR_ASSERT (tile_port != nullptr );
0 commit comments