add statistics for unique GSBs

This commit is contained in:
tangxifan 2019-07-10 13:08:03 -06:00
parent 57ae5dbbec
commit b7f9831bd2
3 changed files with 91 additions and 3 deletions

View File

@ -1395,17 +1395,22 @@ DeviceRRGSB build_device_rr_gsb(boolean output_sb_xml, char* sb_xml_dir,
/* Report number of unique CB Modules */
vpr_printf(TIO_MESSAGE_INFO,
"Detect %d independent connection blocks from %d X-channel connection blocks.\n",
"Detect %d unique connection blocks from %d X-channel connection blocks.\n",
LL_device_rr_gsb.get_num_cb_unique_module(CHANX), (nx + 0) * (ny + 1) );
vpr_printf(TIO_MESSAGE_INFO,
"Detect %d independent connection blocks from %d Y-channel connection blocks.\n",
"Detect %d unique connection blocks from %d Y-channel connection blocks.\n",
LL_device_rr_gsb.get_num_cb_unique_module(CHANY), (nx + 1) * (ny + 0) );
/* Report number of unique SB modules */
vpr_printf(TIO_MESSAGE_INFO,
"Detect %d independent switch blocks from %d switch blocks.\n",
"Detect %d unique switch blocks from %d switch blocks.\n",
LL_device_rr_gsb.get_num_sb_unique_module(), (nx + 1) * (ny + 1) );
/* Report number of unique GSB modules */
vpr_printf(TIO_MESSAGE_INFO,
"Detect %d unique GSBs from %d GSBs.\n",
LL_device_rr_gsb.get_num_sb_unique_module(), (nx + 1) * (ny + 1) );
/* Report number of unique mirrors */

View File

@ -2379,6 +2379,11 @@ size_t DeviceRRGSB::get_num_sb_unique_module() const {
return sb_unique_module_.size();
}
/* get the number of unique mirrors of switch blocks */
size_t DeviceRRGSB::get_num_gsb_unique_module() const {
return gsb_unique_module_.size();
}
/* Get the submodule id of a SB */
size_t DeviceRRGSB::get_sb_unique_submodule_id(DeviceCoordinator& coordinator, enum e_side side, size_t seg_id) const {
@ -2565,6 +2570,8 @@ void DeviceRRGSB::set_sb_conf_bits_msb(DeviceCoordinator& coordinator, size_t co
void DeviceRRGSB::reserve(DeviceCoordinator& coordinator) {
rr_gsb_.resize(coordinator.get_x());
gsb_unique_module_id_.resize(coordinator.get_x());
sb_unique_submodule_id_.resize(coordinator.get_x());
sb_unique_module_id_.resize(coordinator.get_x());
@ -2574,6 +2581,8 @@ void DeviceRRGSB::reserve(DeviceCoordinator& coordinator) {
for (size_t x = 0; x < coordinator.get_x(); ++x) {
rr_gsb_[x].resize(coordinator.get_y());
gsb_unique_module_id_[x].resize(coordinator.get_y());
sb_unique_submodule_id_[x].resize(coordinator.get_y());
sb_unique_module_id_[x].resize(coordinator.get_y());
@ -2769,6 +2778,45 @@ void DeviceRRGSB::add_sb_unique_side_segment_submodule(DeviceCoordinator& coordi
return;
}
/* Find repeatable GSB block in the array */
void DeviceRRGSB::build_gsb_unique_module() {
/* Make sure a clean start */
clear_gsb_unique_module();
for (size_t ix = 0; ix < rr_gsb_.size(); ++ix) {
for (size_t iy = 0; iy < rr_gsb_[ix].size(); ++iy) {
bool is_unique_module = true;
DeviceCoordinator gsb_coordinator(ix, iy);
/* Traverse the unique_mirror list and check it is an mirror of another */
for (size_t id = 0; id < get_num_gsb_unique_module(); ++id) {
/* We have alreay built sb and cb unique module list
* We just need to check if the unique module id of SBs, CBX and CBY are the same or not
*/
const DeviceCoordinator& gsb_unique_module_coordinator = gsb_unique_module_[id];
if ((sb_unique_module_id_[ix][iy] == sb_unique_module_id_[gsb_unique_module_coordinator.get_x()][gsb_unique_module_coordinator.get_y()])
&& (cbx_unique_module_id_[ix][iy] == cbx_unique_module_id_[gsb_unique_module_coordinator.get_x()][gsb_unique_module_coordinator.get_y()])
&& (cby_unique_module_id_[ix][iy] == cby_unique_module_id_[gsb_unique_module_coordinator.get_x()][gsb_unique_module_coordinator.get_y()])) {
/* This is a mirror, raise the flag and we finish */
is_unique_module = false;
/* Record the id of unique mirror */
gsb_unique_module_id_[ix][iy] = id;
break;
}
}
/* Add to list if this is a unique mirror*/
if (true == is_unique_module) {
add_gsb_unique_module(gsb_coordinator);
/* Record the id of unique mirror */
gsb_unique_module_id_[ix][iy] = get_num_gsb_unique_module() - 1;
}
}
}
return;
}
void DeviceRRGSB::build_unique_module() {
build_segment_ids();
@ -2777,6 +2825,8 @@ void DeviceRRGSB::build_unique_module() {
build_cb_unique_module(CHANX);
build_cb_unique_module(CHANY);
build_gsb_unique_module();
return;
}
@ -2797,6 +2847,11 @@ void DeviceRRGSB::add_sb_unique_side_submodule(DeviceCoordinator& coordinator,
return;
}
void DeviceRRGSB::add_gsb_unique_module(const DeviceCoordinator& coordinator) {
gsb_unique_module_.push_back(coordinator);
return;
}
void DeviceRRGSB::add_cb_unique_module(t_rr_type cb_type, const DeviceCoordinator& coordinator) {
assert (validate_cb_type(cb_type));
switch(cb_type) {
@ -2868,6 +2923,9 @@ void DeviceRRGSB::build_segment_ids() {
void DeviceRRGSB::clear() {
clear_gsb();
clear_gsb_unique_module();
clear_gsb_unique_module_id();
/* clean unique module lists */
clear_cb_unique_module(CHANX);
clear_cb_unique_module_id(CHANX);
@ -2893,6 +2951,15 @@ void DeviceRRGSB::clear_gsb() {
return;
}
void DeviceRRGSB::clear_gsb_unique_module_id() {
/* clean rr_switch_block array */
for (size_t x = 0; x < rr_gsb_.size(); ++x) {
gsb_unique_module_id_[x].clear();
}
return;
}
void DeviceRRGSB::clear_sb_unique_module_id() {
/* clean rr_switch_block array */
for (size_t x = 0; x < rr_gsb_.size(); ++x) {
@ -2950,6 +3017,14 @@ void DeviceRRGSB::clear_sb_unique_submodule() {
return;
}
/* clean the content related to unique_mirrors */
void DeviceRRGSB::clear_gsb_unique_module() {
/* clean unique mirror */
gsb_unique_module_.clear();
return;
}
/* clean the content related to unique_mirrors */
void DeviceRRGSB::clear_sb_unique_module() {
/* clean unique mirror */

View File

@ -330,6 +330,7 @@ class DeviceRRGSB {
DeviceCoordinator get_gsb_range() const; /* get the max coordinator of the switch block array */
const RRGSB get_gsb(DeviceCoordinator& coordinator) const; /* Get a rr switch block in the array with a coordinator */
const RRGSB get_gsb(size_t x, size_t y) const; /* Get a rr switch block in the array with a coordinator */
size_t get_num_gsb_unique_module() const; /* get the number of unique mirrors of GSB */
size_t get_num_sb_unique_submodule(enum e_side side, size_t seg_index) const; /* get the number of unique mirrors of switch blocks */
size_t get_num_sb_unique_module() const; /* get the number of unique mirrors of switch blocks */
size_t get_num_cb_unique_module(t_rr_type cb_type) const; /* get the number of unique mirrors of CBs */
@ -365,6 +366,8 @@ class DeviceRRGSB {
void clear_sb_unique_module_id(); /* clean the content */
void clear_sb_unique_submodule(); /* clean the content */
void clear_sb_unique_submodule_id(); /* clean the content */
void clear_gsb_unique_module(); /* clean the content */
void clear_gsb_unique_module_id(); /* clean the content */
void clear_segment_ids();
private: /* Validators */
bool validate_coordinator(DeviceCoordinator& coordinator) const; /* Validate if the (x,y) is the range of this device */
@ -376,6 +379,7 @@ class DeviceRRGSB {
bool validate_cb_type(t_rr_type cb_type) const;
private: /* Internal builders */
void build_segment_ids(); /* build a map of segment_ids */
void add_gsb_unique_module(const DeviceCoordinator& coordinator);
void add_sb_unique_side_submodule(DeviceCoordinator& coordinator, const RRGSB& rr_sb, enum e_side side);
void add_sb_unique_side_segment_submodule(DeviceCoordinator& coordinator, const RRGSB& rr_sb, enum e_side side, size_t seg_id);
void add_cb_unique_module(t_rr_type cb_type, const DeviceCoordinator& coordinator);
@ -383,9 +387,13 @@ class DeviceRRGSB {
void build_sb_unique_submodule(); /* Add a switch block to the array, which will automatically identify and update the lists of unique side module */
void build_sb_unique_module(); /* Add a switch block to the array, which will automatically identify and update the lists of unique mirrors and rotatable mirrors */
void build_cb_unique_module(t_rr_type cb_type); /* Add a switch block to the array, which will automatically identify and update the lists of unique side module */
void build_gsb_unique_module(); /* Add a switch block to the array, which will automatically identify and update the lists of unique mirrors and rotatable mirrors */
private: /* Internal Data */
std::vector< std::vector<RRGSB> > rr_gsb_;
std::vector< std::vector<size_t> > gsb_unique_module_id_; /* A map from rr_gsb to its unique mirror */
std::vector<DeviceCoordinator> gsb_unique_module_;
std::vector< std::vector<size_t> > sb_unique_module_id_; /* A map from rr_gsb to its unique mirror */
std::vector<DeviceCoordinator> sb_unique_module_;