[Engine] Add a new API to the MemoryBankShiftRegisterBank to access all the unique modules

This commit is contained in:
tangxifan 2021-09-29 20:34:25 -07:00
parent b87b7a99c5
commit f456c7e236
2 changed files with 16 additions and 0 deletions

View File

@ -1,9 +1,22 @@
#include <algorithm>
#include "vtr_assert.h"
#include "memory_bank_shift_register_banks.h"
/* begin namespace openfpga */
namespace openfpga {
std::vector<ModuleId> MemoryBankShiftRegisterBanks::shift_register_bank_unique_modules() const {
std::vector<ModuleId> sr_bank_modules;
for (const auto& region : sr_instance_info_) {
for (const auto& pair : region) {
if (sr_bank_modules.end() == std::find(sr_bank_modules.begin(), sr_bank_modules.end(), pair.first.first)) {
sr_bank_modules.push_back(pair.first.first);
}
}
}
return sr_bank_modules;
}
std::vector<ModuleId> MemoryBankShiftRegisterBanks::shift_register_bank_modules(const ConfigRegionId& region) const {
std::vector<ModuleId> sr_bank_modules;
VTR_ASSERT(valid_region_id(region));

View File

@ -22,6 +22,9 @@ namespace openfpga {
******************************************************************************/
class MemoryBankShiftRegisterBanks {
public: /* Accessors */
/* @brief Return a list of modules of unique shift register banks across all the regions */
std::vector<ModuleId> shift_register_bank_unique_modules() const;
/* @brief Return a list of modules of shift register banks under a specific configuration region of top-level module */
std::vector<ModuleId> shift_register_bank_modules(const ConfigRegionId& region) const;