@@ -220,13 +220,16 @@ e_side string_to_side(std::string side_str);
220
220
static void link_physical_logical_types (std::vector<t_physical_tile_type>& PhysicalTileTypes,
221
221
std::vector<t_logical_block_type>& LogicalBlockTypes);
222
222
223
- static void check_port_equivalence (t_physical_tile_type& physical_tile, t_logical_block_type& logical_block);
223
+ static void check_port_direct_mappings (t_physical_tile_type_ptr physical_tile, t_logical_block_type_ptr logical_block);
224
224
225
225
static const t_physical_tile_port* get_port_by_name (t_physical_tile_type_ptr type, const char * port_name);
226
226
static const t_port* get_port_by_name (t_logical_block_type_ptr type, const char * port_name);
227
227
228
+ static const t_physical_tile_port* get_port_by_pin (t_physical_tile_type_ptr type, int pin);
229
+ static const t_port* get_port_by_pin (t_logical_block_type_ptr type, int pin);
230
+
228
231
template <typename T>
229
- static T get_type_by_name (const char * type_name, std::vector<T>& types);
232
+ static T* get_type_by_name (const char * type_name, std::vector<T>& types);
230
233
231
234
/*
232
235
*
@@ -3221,7 +3224,10 @@ static void ProcessTileEquivalentSites(pugi::xml_node Parent,
3221
3224
3222
3225
auto LogicalBlockType = get_type_by_name<t_logical_block_type>(Prop.c_str (), LogicalBlockTypes);
3223
3226
3224
- ProcessEquivalentSiteDirects (CurSite, PhysicalTileType, &LogicalBlockType, Prop, loc_data);
3227
+ auto priority = get_attribute (CurSite, " priority" , loc_data, ReqOpt::OPTIONAL).as_int (0 );
3228
+ LogicalBlockType->placement_priority [priority].push_back (PhysicalTileType);
3229
+
3230
+ ProcessEquivalentSiteDirects (CurSite, PhysicalTileType, LogicalBlockType, Prop, loc_data);
3225
3231
3226
3232
CurSite = CurSite.next_sibling (CurSite.name ());
3227
3233
}
@@ -4754,7 +4760,7 @@ static void link_physical_logical_types(std::vector<t_physical_tile_type>& Physi
4754
4760
physical_tile.equivalent_sites .push_back (&logical_block);
4755
4761
logical_block.equivalent_tiles .push_back (&physical_tile);
4756
4762
4757
- // TODO: Add check direct interconnect between site and tile add also pin mapping of integers
4763
+ check_port_direct_mappings (&physical_tile, &logical_block);
4758
4764
4759
4765
logical_block_added++;
4760
4766
break ;
@@ -4769,24 +4775,34 @@ static void link_physical_logical_types(std::vector<t_physical_tile_type>& Physi
4769
4775
}
4770
4776
}
4771
4777
4772
- static void check_port_equivalence (t_physical_tile_type& physical_tile, t_logical_block_type& logical_block) {
4773
- auto pb_type = logical_block.pb_type ;
4774
- auto pb_type_ports = pb_type->ports ;
4778
+ static void check_port_direct_mappings (t_physical_tile_type_ptr physical_tile, t_logical_block_type_ptr logical_block) {
4779
+ auto pb_type = logical_block->pb_type ;
4775
4780
4776
- if (pb_type->num_ports != ( int ) physical_tile. ports . size () ) {
4781
+ if (pb_type->num_pins > physical_tile-> num_pins ) {
4777
4782
archfpga_throw (__FILE__, __LINE__,
4778
- " Logical and Physical types have a different number of ports.\n " );
4783
+ " Logical Block (%s) has more pins than the Physical Tile (%s).\n " ,
4784
+ logical_block->name , physical_tile->name );
4779
4785
}
4780
4786
4781
- for (auto & tile_port : physical_tile.ports ) {
4782
- auto block_port = pb_type_ports[tile_port.index ];
4787
+ auto & pin_direct_mapping = physical_tile->tile_block_pin_directs_map .at (logical_block->index );
4783
4788
4784
- if (0 != strcmp (tile_port.name , block_port.name )
4785
- || tile_port.type != block_port.type
4786
- || tile_port.num_pins != block_port.num_pins
4787
- || tile_port.equivalent != block_port.equivalent ) {
4789
+ if (pb_type->num_pins != (int )pin_direct_mapping.size ()) {
4790
+ archfpga_throw (__FILE__, __LINE__,
4791
+ " Logical Block (%s) has more pins than the one specified in the direct mapping.\n " ,
4792
+ logical_block->name );
4793
+ }
4794
+
4795
+ for (auto pin_map : pin_direct_mapping) {
4796
+ auto block_port = get_port_by_pin (logical_block, pin_map.first );
4797
+ auto tile_port = get_port_by_pin (physical_tile, pin_map.second );
4798
+
4799
+ if (0 != strcmp (tile_port->name , block_port->name )
4800
+ || tile_port->type != block_port->type
4801
+ || tile_port->num_pins != block_port->num_pins
4802
+ || tile_port->equivalent != block_port->equivalent ) {
4788
4803
archfpga_throw (__FILE__, __LINE__,
4789
- " Logical and Physical types do not have equivalent port specifications.\n " );
4804
+ " Logical (%s) and Physical (%s) types do not have equivalent port specifications.\n " ,
4805
+ logical_block->name , physical_tile->name );
4790
4806
}
4791
4807
}
4792
4808
}
@@ -4814,11 +4830,34 @@ static const t_port* get_port_by_name(t_logical_block_type_ptr type, const char*
4814
4830
return nullptr ;
4815
4831
}
4816
4832
4833
+ static const t_physical_tile_port* get_port_by_pin (t_physical_tile_type_ptr type, int pin) {
4834
+ for (auto port : type->ports ) {
4835
+ if (pin >= port.absolute_first_pin_index && pin < port.num_pins ) {
4836
+ return &type->ports [port.index ];
4837
+ }
4838
+ }
4839
+
4840
+ return nullptr ;
4841
+ }
4842
+
4843
+ static const t_port* get_port_by_pin (t_logical_block_type_ptr type, int pin) {
4844
+ auto pb_type = type->pb_type ;
4845
+
4846
+ for (int i = 0 ; i < pb_type->num_ports ; i++) {
4847
+ auto port = pb_type->ports [i];
4848
+ if (pin >= port.absolute_first_pin_index && pin < port.num_pins ) {
4849
+ return &pb_type->ports [port.index ];
4850
+ }
4851
+ }
4852
+
4853
+ return nullptr ;
4854
+ }
4855
+
4817
4856
template <typename T>
4818
- static T get_type_by_name (const char * type_name, std::vector<T>& types) {
4819
- for (auto type : types) {
4857
+ static T* get_type_by_name (const char * type_name, std::vector<T>& types) {
4858
+ for (auto & type : types) {
4820
4859
if (0 == strcmp (type.name , type_name)) {
4821
- return type;
4860
+ return & type;
4822
4861
}
4823
4862
}
4824
4863
0 commit comments