OpenASIP
2.0
|
#include <CostDatabase.hh>
Public Member Functions | |
virtual | ~CostDatabase () |
void | buildDefaultCostDatabase () |
void | buildRegisterFiles (const std::string &rfEstimatorPluginName) |
void | buildFunctionUnits (const std::string &fuEstimatorPluginName) |
void | buildBuses (const std::string &busEstimatorPluginName) |
void | buildSockets (const std::string &socketEstimatorPluginName) |
bool | isRegisterFilesBuilt () |
bool | isFunctionUnitsBuilt () |
bool | isBusesBuilt () |
bool | isSocketsBuilt () |
void | insertEntry (CostDBEntry *entry) |
void | setSearchStrategy (SearchStrategy *strategy) |
CostDBTypes::EntryTable | search (const CostDBEntryKey &searchKey, const CostDBTypes::MatchTypeTable &match) const |
Static Public Member Functions | |
static CostDatabase & | instance (const HDB::HDBManager &hdb) |
Private Types | |
typedef std::pair< const EntryKeyProperty *, CostDBTypes::MatchTypeTable > | MatchTypeMapType |
Value type for map of search types. More... | |
typedef std::map< const EntryKeyProperty *, CostDBTypes::EntryTable > | EntryMap |
Map of database entries according to entry type. More... | |
typedef std::map< const EntryKeyProperty *, CostDBTypes::MatchTypeTable > | MatchTypeMap |
Search type for each entry type. More... | |
Private Member Functions | |
CostDatabase (const HDB::HDBManager &hdb) | |
CostDatabase must be created with instance() method. More... | |
boost::smatch | getValues (const std::string &text, const std::string ®ex) |
Finds string matches using regular expressions. More... | |
CostDatabase (const CostDatabase &) | |
Copying not allowed. More... | |
CostDatabase & | operator= (const CostDatabase &) |
Assignment not allowed. More... | |
Private Attributes | |
SearchStrategy * | searchStrategy_ |
Search strategy used for queries. More... | |
EntryMap | entries_ |
Database entries. More... | |
const HDB::HDBManager & | hdb_ |
HDB used for creating cost database. More... | |
bool | registerFilesBuilt_ |
Flag to note is register files built. More... | |
bool | functionUnitsBuilt_ |
Flag to note is function units built. More... | |
bool | busesBuilt_ |
Flag to note is buses built. More... | |
bool | socketsBuilt_ |
Flag to note is sockets built. More... | |
CostDatabaseRegistry * | registry_ |
Registry of CostDatabases. More... | |
Static Private Attributes | |
static CostDatabase * | instance_ = NULL |
Unique instance of the class. More... | |
Stores database entries and search strategy for making queries.
Definition at line 64 of file CostDatabase.hh.
|
private |
Map of database entries according to entry type.
Definition at line 97 of file CostDatabase.hh.
|
private |
Search type for each entry type.
Definition at line 100 of file CostDatabase.hh.
|
private |
Value type for map of search types.
Definition at line 94 of file CostDatabase.hh.
|
virtual |
Destructor.
Deallocates memory reserved for the search strategy.
Definition at line 137 of file CostDatabase.cc.
References entries_, and searchStrategy_.
|
private |
CostDatabase must be created with instance() method.
Default constructor.
hdb | HDBManager to be used with the cost database. |
Definition at line 76 of file CostDatabase.cc.
References buildDefaultCostDatabase(), EntryKeyProperty::create(), EntryKeyProperty::createFieldProperty(), CostDBTypes::EK_INLINE_IMM_SOCKET, CostDBTypes::EK_INPUT_SOCKET, CostDBTypes::EK_MBUS, CostDBTypes::EK_OUTPUT_SOCKET, CostDBTypes::EK_RFILE, CostDBTypes::EK_SOCKET, CostDBTypes::EK_UNIT, CostDBTypes::EKF_BIDIR_PORTS, CostDBTypes::EKF_BIT_WIDTH, CostDBTypes::EKF_BUS_FANIN, CostDBTypes::EKF_BUS_FANOUT, CostDBTypes::EKF_FUNCTION_UNIT, CostDBTypes::EKF_GUARD_LATENCY, CostDBTypes::EKF_GUARD_SUPPORT, CostDBTypes::EKF_INPUT_SOCKET_FANIN, CostDBTypes::EKF_LATENCY, CostDBTypes::EKF_MAX_READS, CostDBTypes::EKF_MAX_WRITES, CostDBTypes::EKF_NUM_REGISTERS, CostDBTypes::EKF_OUTPUT_SOCKET_FANOUT, CostDBTypes::EKF_READ_PORTS, and CostDBTypes::EKF_WRITE_PORTS.
Referenced by instance().
|
private |
Copying not allowed.
void CostDatabase::buildBuses | ( | const std::string & | busEstimatorPluginName | ) |
Reads buses from the set HDB and builds bus entries in to the cost database.
busEstimatorPluginName | Name of the bus estimator plugin which cost data are read and used in the cost database. |
Exception | if an error occured during the cost database building. |
Definition at line 642 of file CostDatabase.cc.
References CostDBEntryKey::addField(), CostDBEntry::addStatistics(), HDB::HDBManager::busEntryIDs(), busesBuilt_, HDB::HDBManager::costEstimationData(), HDB::HDBManager::costEstimationDataIDs(), HDB::HDBManager::costFunctionPluginByID(), HDB::HDBManager::costFunctionPluginIDs(), DataObject::doubleValue(), CostDBTypes::EK_MBUS, CostDBTypes::EKF_BIT_WIDTH, CostDBTypes::EKF_BUS_FANIN, CostDBTypes::EKF_BUS_FANOUT, EntryKeyProperty::fieldProperty(), EntryKeyProperty::find(), hdb_, insertEntry(), DataObject::integerValue(), CostEstimationData::name(), HDB::CostFunctionPlugin::name(), CostEstimationData::setBusReference(), CostDBEntryStats::setEnergyActive(), CostDBEntryStats::setEnergyIdle(), CostEstimationData::setPluginID(), and CostEstimationData::value().
Referenced by buildDefaultCostDatabase().
void CostDatabase::buildDefaultCostDatabase | ( | ) |
Creates default cost database from all HDB entries.
Exception | if an error occured during the cost database building. |
Definition at line 180 of file CostDatabase.cc.
References buildBuses(), buildFunctionUnits(), buildRegisterFiles(), buildSockets(), isBusesBuilt(), isFunctionUnitsBuilt(), isRegisterFilesBuilt(), and isSocketsBuilt().
Referenced by CostDatabase().
void CostDatabase::buildFunctionUnits | ( | const std::string & | fuEstimatorPluginName | ) |
Reads function units from the set HDB and builds function unit entries in to the cost database.
fuEstimatorPluginName | Name of the function unit estimator plugin which cost data are read and used in the cost database. |
Exception | if an error occured during the cost database building. |
Definition at line 441 of file CostDatabase.cc.
References CostDBEntryKey::addField(), CostDBEntry::addStatistics(), HDB::FUEntry::architecture(), HDB::FUArchitecture::architecture(), HDB::HDBManager::costEstimationData(), HDB::HDBManager::costEstimationDataIDs(), HDB::HDBEntry::costFunction(), HDB::HDBManager::costFunctionPluginByID(), HDB::HDBManager::costFunctionPluginIDs(), HDB::HDBManager::deleteCostEstimationDataIDsQueries(), DataObject::doubleValue(), CostDBTypes::EK_UNIT, CostDBTypes::EKF_BIT_WIDTH, CostDBTypes::EKF_FUNCTION_UNIT, EntryKeyProperty::fieldProperty(), EntryKeyProperty::find(), HDB::HDBManager::fuByEntryID(), HDB::HDBManager::fuEntryIDs(), functionUnitsBuilt_, getValues(), HDB::FUEntry::hasArchitecture(), HDB::HDBEntry::hasCostFunction(), HDB::FUArchitecture::hasParameterizedWidth(), hdb_, HDB::CostFunctionPlugin::id(), insertEntry(), TTAMachine::FunctionUnit::maxLatency(), CostEstimationData::name(), TTAMachine::Port::name(), HDB::CostFunctionPlugin::name(), TTAMachine::FunctionUnit::port(), TTAMachine::Unit::portCount(), CostDBEntryStats::setDelay(), CostDBEntryStats::setEnergyIdle(), CostDBEntryStatsFU::setEnergyOperation(), CostEstimationData::setFUReference(), CostEstimationData::setPluginID(), CostEstimationData::value(), and TTAMachine::BaseFUPort::width().
Referenced by buildDefaultCostDatabase().
void CostDatabase::buildRegisterFiles | ( | const std::string & | rfEstimatorPluginName | ) |
Reads register files from the set HDB and builds register file entries in to the cost database.
rfEstimatorPluginName | Name of the register file estimator plugin which cost data are read and used in the cost database. |
Exception | if an error occured during the cost database building. |
Definition at line 204 of file CostDatabase.cc.
References CostDBEntryKey::addField(), CostDBEntry::addStatistics(), HDB::RFEntry::architecture(), HDB::RFArchitecture::bidirPortCount(), HDB::HDBManager::costEstimationData(), HDB::HDBManager::costEstimationDataIDs(), HDB::HDBEntry::costFunction(), HDB::HDBManager::costFunctionPluginByID(), HDB::HDBManager::costFunctionPluginIDs(), HDB::HDBManager::deleteCostEstimationDataIDsQueries(), DataObject::doubleValue(), CostDBTypes::EK_RFILE, CostDBTypes::EKF_BIDIR_PORTS, CostDBTypes::EKF_BIT_WIDTH, CostDBTypes::EKF_GUARD_LATENCY, CostDBTypes::EKF_GUARD_SUPPORT, CostDBTypes::EKF_LATENCY, CostDBTypes::EKF_MAX_READS, CostDBTypes::EKF_MAX_WRITES, CostDBTypes::EKF_NUM_REGISTERS, CostDBTypes::EKF_READ_PORTS, CostDBTypes::EKF_WRITE_PORTS, EntryKeyProperty::fieldProperty(), EntryKeyProperty::find(), getValues(), HDB::RFArchitecture::guardLatency(), HDB::RFEntry::hasArchitecture(), HDB::HDBEntry::hasCostFunction(), HDB::RFArchitecture::hasGuardSupport(), hdb_, HDB::CostFunctionPlugin::id(), insertEntry(), HDB::RFArchitecture::latency(), HDB::RFArchitecture::maxReads(), HDB::RFArchitecture::maxWrites(), CostEstimationData::name(), HDB::CostFunctionPlugin::name(), HDB::RFArchitecture::readPortCount(), registerFilesBuilt_, HDB::HDBManager::rfByEntryID(), HDB::HDBManager::rfEntryIDs(), CostDBEntryStats::setDelay(), CostDBEntryStats::setEnergyIdle(), CostDBEntryStatsRF::setEnergyReadWrite(), CostEstimationData::setPluginID(), CostEstimationData::setRFReference(), HDB::RFArchitecture::size(), Conversion::toInt(), CostEstimationData::value(), HDB::RFArchitecture::width(), and HDB::RFArchitecture::writePortCount().
Referenced by buildDefaultCostDatabase().
void CostDatabase::buildSockets | ( | const std::string & | socketEstimatorPluginName | ) |
Reads sockets from the set HDB and builds socket entries in to the cost database.
socketEstimatorPluginName | Name of the socket estimator plugin which cost data are read and used in the cost database. |
Exception | if an error occured during the cost database building. |
Definition at line 758 of file CostDatabase.cc.
References CostDBEntryKey::addField(), CostDBEntry::addStatistics(), HDB::HDBManager::costEstimationData(), HDB::HDBManager::costEstimationDataIDs(), HDB::HDBManager::costFunctionPluginByID(), HDB::HDBManager::costFunctionPluginIDs(), DataObject::doubleValue(), CostDBTypes::EK_INPUT_SOCKET, CostDBTypes::EK_OUTPUT_SOCKET, CostDBTypes::EKF_BIT_WIDTH, CostDBTypes::EKF_INPUT_SOCKET_FANIN, CostDBTypes::EKF_OUTPUT_SOCKET_FANOUT, EntryKeyProperty::fieldProperty(), EntryKeyProperty::find(), hdb_, insertEntry(), DataObject::integerValue(), CostEstimationData::name(), HDB::CostFunctionPlugin::name(), CostDBEntryStats::setDelay(), CostDBEntryStats::setEnergyActive(), CostDBEntryStats::setEnergyIdle(), CostEstimationData::setPluginID(), CostEstimationData::setSocketReference(), HDB::HDBManager::socketEntryIDs(), socketsBuilt_, and CostEstimationData::value().
Referenced by buildDefaultCostDatabase().
|
private |
Finds string matches using regular expressions.
Returns the matching strings out of the text using regexp.
text | String the regular expression is used for. |
regex | Regular expression to be matched with the text. |
Definition at line 1001 of file CostDatabase.cc.
Referenced by buildFunctionUnits(), and buildRegisterFiles().
void CostDatabase::insertEntry | ( | CostDBEntry * | entry | ) |
Inserts an entry into the database.
entry | Database entry. |
ObjectAlreadyExists | If inserted entry is already inserted. |
Definition at line 908 of file CostDatabase.cc.
References CostDBEntryStats::copy(), entries_, CostDBEntry::statistics(), CostDBEntry::statisticsCount(), and CostDBEntry::type().
Referenced by buildBuses(), buildFunctionUnits(), buildRegisterFiles(), and buildSockets().
|
static |
Creates and returns an instance of cost database build in base of the HDB.
hdb | HDB to use in building the CostDatabase. |
Exception | in case that an error occurred while creating the CostDatabase. |
Definition at line 166 of file CostDatabase.cc.
References CostDatabaseRegistry::addCostDatabase(), CostDatabaseRegistry::costDatabase(), CostDatabase(), CostDatabaseRegistry::hasCostDatabase(), and CostDatabaseRegistry::instance().
Referenced by CostDatabaseRegistry::costDatabase().
bool CostDatabase::isBusesBuilt | ( | ) |
Returns true if buses are built in the cost database.
Definition at line 965 of file CostDatabase.cc.
References busesBuilt_.
Referenced by buildDefaultCostDatabase().
bool CostDatabase::isFunctionUnitsBuilt | ( | ) |
Returns true if function units are built in the cost database.
Definition at line 955 of file CostDatabase.cc.
References functionUnitsBuilt_.
Referenced by buildDefaultCostDatabase().
bool CostDatabase::isRegisterFilesBuilt | ( | ) |
Returns true if register files are built in the cost database.
Definition at line 945 of file CostDatabase.cc.
References registerFilesBuilt_.
Referenced by buildDefaultCostDatabase().
bool CostDatabase::isSocketsBuilt | ( | ) |
Returns true if sockets are built in the cost database.
Definition at line 975 of file CostDatabase.cc.
References socketsBuilt_.
Referenced by buildDefaultCostDatabase().
|
private |
Assignment not allowed.
CostDBTypes::EntryTable CostDatabase::search | ( | const CostDBEntryKey & | searchKey, |
const CostDBTypes::MatchTypeTable & | match | ||
) | const |
Searches entries from the database matching certain search key with specific type of matches.
searchKey | Search key. |
match | Type of matches. |
KeyNotFound | If search key type is not found. |
Definition at line 888 of file CostDatabase.cc.
References entries_, SearchStrategy::search(), searchStrategy_, and CostDBEntryKey::type().
Referenced by InterpolatingRFEstimator::createSearch(), and InterpolatingFUEstimator::createSearch().
void CostDatabase::setSearchStrategy | ( | SearchStrategy * | strategy | ) |
Replaces search strategy by taking a copy of another one.
strategy | Search strategy. |
Definition at line 985 of file CostDatabase.cc.
References SearchStrategy::copy(), and searchStrategy_.
Referenced by InterpolatingFUEstimator::initializeEstimator(), and InterpolatingRFEstimator::initializeEstimator().
|
private |
Flag to note is buses built.
Definition at line 113 of file CostDatabase.hh.
Referenced by buildBuses(), and isBusesBuilt().
|
private |
Database entries.
Definition at line 105 of file CostDatabase.hh.
Referenced by insertEntry(), search(), and ~CostDatabase().
|
private |
Flag to note is function units built.
Definition at line 111 of file CostDatabase.hh.
Referenced by buildFunctionUnits(), and isFunctionUnitsBuilt().
|
private |
HDB used for creating cost database.
Definition at line 107 of file CostDatabase.hh.
Referenced by buildBuses(), buildFunctionUnits(), buildRegisterFiles(), and buildSockets().
|
staticprivate |
Unique instance of the class.
Definition at line 118 of file CostDatabase.hh.
|
private |
Flag to note is register files built.
Definition at line 109 of file CostDatabase.hh.
Referenced by buildRegisterFiles(), and isRegisterFilesBuilt().
|
private |
Registry of CostDatabases.
Definition at line 120 of file CostDatabase.hh.
|
private |
Search strategy used for queries.
Definition at line 103 of file CostDatabase.hh.
Referenced by search(), setSearchStrategy(), and ~CostDatabase().
|
private |
Flag to note is sockets built.
Definition at line 115 of file CostDatabase.hh.
Referenced by buildSockets(), and isSocketsBuilt().