[engine] fixing the bugs on subtiles

This commit is contained in:
tangxifan 2022-08-23 10:52:05 -07:00
parent c17e5d46ab
commit ba0ddd01d3
3 changed files with 37 additions and 0 deletions

View File

@ -38,6 +38,10 @@ void build_physical_tile_pin2port_info(const DeviceContext& vpr_device_ctx,
vpr_device_annotation.add_physical_tile_pin_subtile_index(&physical_tile, vpr_device_annotation.add_physical_tile_pin_subtile_index(&physical_tile,
absolute_pin_index, absolute_pin_index,
subtile_index); subtile_index);
vpr_device_annotation.add_physical_tile_z_to_subtile_index(&physical_tile,
subtile_index,
&sub_tile - &(physical_tile.sub_tiles[0])
);
} }
} }
/* Count the number of pins for each sub tile */ /* Count the number of pins for each sub tile */

View File

@ -348,6 +348,26 @@ int VprDeviceAnnotation::physical_tile_pin_subtile_index(t_physical_tile_type_pt
return pin_search_result->second; return pin_search_result->second;
} }
int VprDeviceAnnotation::physical_tile_z_to_subtile_index(t_physical_tile_type_ptr physical_tile,
const int& sub_tile_z) const {
/* Try to find the physical tile in the fast look-up */
auto physical_tile_search_result = physical_tile_z_to_subtile_indices_.find(physical_tile);
if (physical_tile_search_result == physical_tile_z_to_subtile_indices_.end()) {
/* Not found. Return an invalid index */
return -1;
}
/* Try to find the physical tile port info with pin index */
auto pin_search_result = physical_tile_search_result->second.find(sub_tile_z);
if (pin_search_result == physical_tile_search_result->second.end()) {
/* Not found. Return an invalid index */
return -1;
}
/* Reach here, we should find a port. Return the port information */
return pin_search_result->second;
}
/************************************************************************ /************************************************************************
* Public mutators * Public mutators
***********************************************************************/ ***********************************************************************/
@ -637,4 +657,10 @@ void VprDeviceAnnotation::add_physical_tile_pin_subtile_index(t_physical_tile_ty
physical_tile_pin_subtile_indices_[physical_tile][pin_index] = subtile_index; physical_tile_pin_subtile_indices_[physical_tile][pin_index] = subtile_index;
} }
void VprDeviceAnnotation::add_physical_tile_z_to_subtile_index(t_physical_tile_type_ptr physical_tile,
const int& subtile_z,
const int& subtile_index) {
physical_tile_z_to_subtile_indices_[physical_tile][subtile_z] = subtile_index;
}
} /* End namespace openfpga*/ } /* End namespace openfpga*/

View File

@ -90,6 +90,8 @@ class VprDeviceAnnotation {
const int& pin_index) const; const int& pin_index) const;
int physical_tile_pin_subtile_index(t_physical_tile_type_ptr physical_tile, int physical_tile_pin_subtile_index(t_physical_tile_type_ptr physical_tile,
const int& pin_index) const; const int& pin_index) const;
int physical_tile_z_to_subtile_index(t_physical_tile_type_ptr physical_tile,
const int& subtile_z) const;
public: /* Public mutators */ public: /* Public mutators */
void add_pb_type_physical_mode(t_pb_type* pb_type, t_mode* physical_mode); void add_pb_type_physical_mode(t_pb_type* pb_type, t_mode* physical_mode);
void add_physical_pb_type(t_pb_type* operating_pb_type, t_pb_type* physical_pb_type); void add_physical_pb_type(t_pb_type* operating_pb_type, t_pb_type* physical_pb_type);
@ -130,6 +132,9 @@ class VprDeviceAnnotation {
void add_physical_tile_pin_subtile_index(t_physical_tile_type_ptr physical_tile, void add_physical_tile_pin_subtile_index(t_physical_tile_type_ptr physical_tile,
const int& pin_index, const int& pin_index,
const int& subtile_index); const int& subtile_index);
void add_physical_tile_z_to_subtile_index(t_physical_tile_type_ptr physical_tile,
const int& subtile_z,
const int& subtile_index);
private: /* Internal data */ private: /* Internal data */
/* Pair a regular pb_type to its physical pb_type */ /* Pair a regular pb_type to its physical pb_type */
std::map<t_pb_type*, t_pb_type*> physical_pb_types_; std::map<t_pb_type*, t_pb_type*> physical_pb_types_;
@ -225,6 +230,8 @@ class VprDeviceAnnotation {
std::map<t_physical_tile_type_ptr, std::map<int, BasicPort>> physical_tile_pin2port_info_map_; std::map<t_physical_tile_type_ptr, std::map<int, BasicPort>> physical_tile_pin2port_info_map_;
/* A fast look-up from pin index in physical tile to sub tile index */ /* A fast look-up from pin index in physical tile to sub tile index */
std::map<t_physical_tile_type_ptr, std::map<int, int>> physical_tile_pin_subtile_indices_; std::map<t_physical_tile_type_ptr, std::map<int, int>> physical_tile_pin_subtile_indices_;
/* A fast look-up from z (absolute coordinate) in physical tile to the index in sub tile array */
std::map<t_physical_tile_type_ptr, std::map<int, int>> physical_tile_z_to_subtile_indices_;
}; };
} /* End namespace openfpga*/ } /* End namespace openfpga*/