@@ -102,7 +102,7 @@ static void ProcessTilePorts(pugi::xml_node Parent,
102
102
t_physical_tile_type* PhysicalTileType,
103
103
const pugiutil::loc_data& loc_data);
104
104
static void ProcessTilePort (pugi::xml_node Node,
105
- t_physical_port * port,
105
+ t_physical_tile_port * port,
106
106
const pugiutil::loc_data& loc_data);
107
107
static void ProcessTileEquivalentSites (pugi::xml_node Parent,
108
108
t_physical_tile_type* PhysicalTileType,
@@ -212,7 +212,9 @@ e_side string_to_side(std::string side_str);
212
212
static void link_physical_logical_types (std::vector<t_physical_tile_type>& PhysicalTileTypes,
213
213
std::vector<t_logical_block_type>& LogicalBlockTypes);
214
214
215
- static const t_physical_port* get_port_by_name (t_physical_tile_type_ptr type, const char * port_name);
215
+ static void check_port_equivalence (t_physical_tile_type& physical_tile, t_logical_block_type& logical_block);
216
+
217
+ static const t_physical_tile_port* get_port_by_name (t_physical_tile_type_ptr type, const char * port_name);
216
218
217
219
/*
218
220
*
@@ -550,7 +552,7 @@ static void SetupPinLocationsAndPinClasses(pugi::xml_node Locations,
550
552
// Empty range, so full port
551
553
552
554
// Find the matching pb type to get the total number of pins
553
- const t_physical_port * port = nullptr ;
555
+ const t_physical_tile_port * port = nullptr ;
554
556
for (const auto & tmp_port : PhysicalTileType->ports ) {
555
557
if (tmp_port.name == inst_port.port_name ()) {
556
558
port = &tmp_port;
@@ -3066,7 +3068,7 @@ static void ProcessTilePorts(pugi::xml_node Parent,
3066
3068
Cur = get_first_child (Parent, " clock" , loc_data, OPTIONAL);
3067
3069
}
3068
3070
while (Cur) {
3069
- t_physical_port port;
3071
+ t_physical_tile_port port;
3070
3072
3071
3073
port.index = iport;
3072
3074
port.absolute_first_pin_index = absolute_first_pin_index;
@@ -3109,7 +3111,7 @@ static void ProcessTilePorts(pugi::xml_node Parent,
3109
3111
}
3110
3112
3111
3113
static void ProcessTilePort (pugi::xml_node Node,
3112
- t_physical_port * port,
3114
+ t_physical_tile_port * port,
3113
3115
const pugiutil::loc_data& loc_data) {
3114
3116
std::vector<std::string> expected_attributes = {" name" , " num_pins" , " equivalent" };
3115
3117
@@ -4677,31 +4679,54 @@ static void link_physical_logical_types(std::vector<t_physical_tile_type>& Physi
4677
4679
std::map<t_physical_tile_type*, t_logical_block_type*> check_equivalence;
4678
4680
4679
4681
for (auto & physical_tile : PhysicalTileTypes) {
4680
- if (physical_tile.index == 0 ) continue ;
4682
+ if (physical_tile.index == EMPTY_TYPE_INDEX ) continue ;
4681
4683
4682
4684
for (auto & equivalent_site : physical_tile.equivalent_sites ) {
4683
4685
for (auto & logical_block : LogicalBlockTypes) {
4684
- if (logical_block.index == 0 ) continue ;
4686
+ if (logical_block.index == EMPTY_TYPE_INDEX ) continue ;
4685
4687
4686
4688
// Check the corresponding Logical Block
4687
4689
if (0 == strcmp (logical_block.pb_type ->name , equivalent_site.pb_type_name )) {
4688
4690
physical_tile.logical_block_index = logical_block.index ;
4689
4691
logical_block.physical_tile_index = physical_tile.index ;
4690
4692
4691
- auto result = check_equivalence.insert (std::pair<t_physical_tile_type*, t_logical_block_type*>( &physical_tile, &logical_block) );
4693
+ auto result = check_equivalence.emplace ( &physical_tile, &logical_block);
4692
4694
if (!result.second ) {
4693
4695
archfpga_throw (__FILE__, __LINE__,
4694
4696
" Logical and Physical types do not have a one to one mapping\n " );
4695
4697
}
4696
4698
4699
+ check_port_equivalence (physical_tile, logical_block);
4700
+
4697
4701
break ;
4698
4702
}
4699
4703
}
4700
4704
}
4701
4705
}
4702
4706
}
4703
4707
4704
- static const t_physical_port* get_port_by_name (t_physical_tile_type_ptr type, const char * port_name) {
4708
+ static void check_port_equivalence (t_physical_tile_type& physical_tile, t_logical_block_type& logical_block) {
4709
+ auto pb_type = logical_block.pb_type ;
4710
+ auto pb_type_ports = pb_type->ports ;
4711
+
4712
+ if (pb_type->num_ports != (int )physical_tile.ports .size ()) {
4713
+ archfpga_throw (__FILE__, __LINE__,
4714
+ " Logical and Physical types have a different number of ports.\n " );
4715
+ }
4716
+
4717
+ for (auto & tile_port : physical_tile.ports ) {
4718
+ auto block_port = pb_type_ports[tile_port.index ];
4719
+
4720
+ if (0 != strcmp (tile_port.name , block_port.name )
4721
+ || tile_port.type != block_port.type
4722
+ || tile_port.num_pins != block_port.num_pins ) {
4723
+ archfpga_throw (__FILE__, __LINE__,
4724
+ " Logical and Physical types do not have equivalent port specifications.\n " );
4725
+ }
4726
+ }
4727
+ }
4728
+
4729
+ static const t_physical_tile_port* get_port_by_name (t_physical_tile_type_ptr type, const char * port_name) {
4705
4730
for (auto port : type->ports ) {
4706
4731
if (0 == strcmp (port.name , port_name)) {
4707
4732
return &type->ports [port.index ];
0 commit comments