Go to the documentation of this file.
66 "RF cost estimator plugin that estimates costs of RFs by generating"
67 "cost database from cost values of HDB and uses interpolation to "
68 "estimate the costs. In case there's no cost data available for the "
69 "given RF the plugin interpolates the estimate if possible.");
85 initializeEstimator(hdb);
87 CostDBTypes::EntryTable::const_iterator i = results.begin();
90 for (;i < results.end(); i++) {
91 for (
int n = 0; n < (*i)->statisticsCount(); n++) {
92 if (area < (*i)->statistics(n).area()) {
93 area = (*i)->statistics(n).area();
98 #ifdef DEBUG_AREA_ESTIMATION
99 std::cout <<
"Exception: " << e.name() << std::endl
100 <<
"Error message: " << e.errorMsg() << std::endl
101 <<
"File: " << e.
fileName() << std::endl
102 <<
" Line: " e.
lineNum() << std::endl;
103 #endif //DEBUG_AREA_ESTIMATION
106 #ifdef DEBUG_AREA_ESTIMATION
108 << rf.
name() <<
" area " << area << std::endl;
109 #endif //DEBUG_AREA_ESTIMATION
129 initializeEstimator(hdb);
132 CostDBTypes::EntryTable::const_iterator i = results.begin();
135 for (;i < results.end(); i++) {
136 for (
int n = 0; n < (*i)->statisticsCount(); n++) {
137 #ifndef UNIQUE_PORT_DELAY
138 if (delay < (*i)->statistics(n).delayPort(
"input_delay")) {
139 delay = (*i)->statistics(n).delayPort(
"input_delay");
141 #endif // UNIQUE_PORT_DELAY
142 #ifdef UNIQUE_PORT_DELAY
145 if (delay < (*i)->statistics(n).delayPort(port.
name())) {
146 delay = (*i)->statistics(n).delayPort(port.
name());
148 #endif // UNIQUE_PORT_DELAY
152 #ifdef DEBUG_DELAY_ESTIMATION
156 <<
" found in HDB." << std::endl;
157 #endif // DEBUG_DELAY_ESTIMATION
160 #ifdef DEBUG_DELAY_ESTIMATION
162 << port.
name() <<
" (port) delay " << delay << std::endl;
163 #endif // DEBUG_DELAY_ESTIMATION
183 initializeEstimator(hdb);
185 CostDBTypes::EntryTable::const_iterator i = results.begin();
188 for (;i < results.end(); i++) {
189 for (
int n = 0; n < (*i)->statisticsCount(); n++) {
190 #ifndef UNIQUE_PORT_DELAY
191 if (delay < (*i)->statistics(n).delayPort(
"output_delay")) {
192 delay = (*i)->statistics(n).delayPort(
"output_delay");
194 #endif // UNIQUE_PORT_DELAY
195 #ifdef UNIQUE_PORT_DELAY
198 if (delay < (*i)->statistics(n).delayPort(port.
name())) {
199 delay = (*i)->statistics(n).delayPort(port.
name());
201 #endif // UNIQUE_PORT_DELAY
205 #ifdef DEBUG_DELAY_ESTIMATION
209 <<
" found in HDB." << std::endl;
210 #endif // DEBUG_DELAY_ESTIMATION
213 #ifdef DEBUG_DELAY_ESTIMATION
215 << port.
name() <<
" (port) delay " << delay << std::endl;
216 #endif // DEBUG_DELAY_ESTIMATION
233 initializeEstimator(hdb);
235 CostDBTypes::EntryTable::const_iterator i = results.begin();
238 for (;i < results.end(); i++) {
239 for (
int n = 0; n < (*i)->statisticsCount(); n++) {
240 if (delay < (*i)->statistics(n).delay()) {
241 delay = (*i)->statistics(n).delay();
248 #ifdef DEBUG_DELAY_ESTIMATION
250 <<
" computation delay "
251 << delay << std::endl;
252 #endif // DEBUG_DELAY_ESTIMATION
281 initializeEstimator(hdb);
282 results = createSearch(rf);
284 #ifdef DEBUG_ENERGY_ESTIMATION
286 <<
"## register file " << rf.
name() <<
": " << std::endl;
292 const_iterator i = accessList->begin();
293 i != accessList->end(); ++i) {
297 const std::size_t reads = accessCount.get<0>();
298 const std::size_t writes = accessCount.get<1>();
301 const std::string dataName =
302 std::string(
"rf_access_energy ") +
306 CostDBTypes::EntryTable::const_iterator i = results.begin();
307 for (;i < results.end(); i++) {
313 for (
int n = 0; n < (*i)->statisticsCount(); n++) {
314 if (((*i)->statistics(n).energyReadWrite(
315 reads, writes) * count) > energyTemp) {
317 (*i)->statistics(n).energyReadWrite(
318 reads, writes) * count;
320 #ifdef DEBUG_ENERGY_ESTIMATION
323 <<
" NOTE: Multiple register access energy "
326 << (*i)->statistics(n).energyReadWrite(
332 energy += energyTemp;
334 cyclesWithRFAccess += count;
340 <<
"Cost estimation data '" << dataName
341 <<
"' not found in HDB." << std::endl;
360 const std::string dataName = std::string(
"rf_idle_energy");
363 CostDBTypes::EntryTable::const_iterator i = results.begin();
364 for (;i < results.end(); i++) {
370 for (
int n = 0; n < (*i)->statisticsCount(); n++) {
371 if (((*i)->statistics(n).energyIdle() * idleCycles) >
375 (*i)->statistics(n).energyIdle() * idleCycles;
377 #ifdef DEBUG_ENERGY_ESTIMATION
380 <<
" NOTE: Multiple register idle energy "
382 <<
" " << (*i)->statistics(n).energyIdle()
387 energy += energyTemp;
392 <<
"Cost estimation data '" << dataName
393 <<
"' not found in HDB." << std::endl;
501 results = costdb_->
search(*searchKey, interpMatchType_);
518 interpMatchType_.push_back(
522 interpMatchType_.push_back(
526 interpMatchType_.push_back(
530 interpMatchType_.push_back(
534 interpMatchType_.push_back(
538 interpMatchType_.push_back(
542 interpMatchType_.push_back(
546 interpMatchType_.push_back(
550 interpMatchType_.push_back(
554 interpMatchType_.push_back(
std::map< const EntryKeyProperty *, CostDBTypes::MatchTypeTable > MatchTypeMap
Search type for each entry type.
static const std::string EK_RFILE
Entry type for register files.
CostDatabase * costdb_
Cost database being used.
InterpolatingRFEstimator(const std::string &name)
static const std::string EKF_GUARD_SUPPORT
Field type for guard support in an entry.
static const std::string EKF_BIT_WIDTH
Field type for bit width of an entry.
std::vector< MatchType * > MatchTypeTable
Table of types of match.
SearchStrategy * strategy_
Search strategy to be used with the cost database.
virtual TCEString name() const
CostDatabase & costDatabase(const HDB::HDBManager &hdb)
#define DESCRIPTION(TEXT__)
static const std::string EKF_WRITE_PORTS
Field type for number of write ports in an entry.
std::vector< CostDBEntry * > EntryTable
Table of database entries.
EntryKeyProperty * rfileProperty_
Entry key property of register file.
double AreaInGates
type for area values in equivalent gates
static std::ostream & logStream()
static std::string toString(const T &source)
static CostDatabaseRegistry & instance()
std::string fileName() const
double EnergyInMilliJoules
type for consumed energy in milli joules
static const std::string EKF_NUM_REGISTERS
Field type for number of registers in an entry.
CostDBTypes::EntryTable search(const CostDBEntryKey &searchKey, const CostDBTypes::MatchTypeTable &match) const
#define EXPORT_RF_COST_ESTIMATOR_PLUGIN(PLUGIN_NAME__)
MatchTypeMap searchTypes_
Types of matches used for searching entries from the cost database.
void addField(EntryKeyField *field)
void initializeEstimator(const HDBManager &hdb)
bool estimateMaximumComputationDelay(const TTAMachine::BaseRegisterFile &rf, const IDF::RFImplementationLocation &, DelayInNanoSeconds &delay, HDB::HDBManager &hdb)
static const std::string EKF_BIDIR_PORTS
Field type for number of bidirectional ports in an entry.
std::string errorMessage() const
ConcurrentRFAccessCountList * registerFileAccessCounts(RegisterFileID registerFile) const
double DelayInNanoSeconds
type for propagation delays in nano seconds
bool hasGuardSupport() const
CostDatabaseRegistry * costDatabaseRegistry_
Registry of cost databases.
BaseRegisterFile * parentUnit() const
CostDBTypes::MatchTypeTable interpMatchType_
Table of types of match.
bool estimateEnergy(const TTAMachine::BaseRegisterFile &rf, const IDF::RFImplementationLocation &, const TTAProgram::Program &, const ExecutionTrace &trace, EnergyInMilliJoules &energy, HDB::HDBManager &hdb)
static const std::string EKF_MAX_WRITES
Field type for number of max simultaneous writes in an entry.
virtual std::string name() const
ClockCycleCount simulatedCycleCount() const
ExecutionTrace * trace
the execution trace database
boost::tuple< RegisterAccessCount, RegisterAccessCount, ClockCycleCount > ConcurrentRFAccessCount
type to be used as a key for storing concurrent RF access info
int readPortCount() const
virtual ~InterpolatingRFEstimator()
static const std::string EKF_READ_PORTS
Field type for number of read ports in an entry.
CycleCount ClockCycleCount
Alias for ClockCycleCount.
static const std::string EKF_MAX_READS
Field type for number of max simultaneous reads in an entry.
std::list< ConcurrentRFAccessCount > ConcurrentRFAccessCountList
type to be used for a list of concurrent RF accesses
bool estimatePortReadDelay(const TTAMachine::RFPort &port, const IDF::RFImplementationLocation &, DelayInNanoSeconds &delay, HDB::HDBManager &hdb)
static EntryKeyProperty * find(std::string type)
int bidirPortCount() const
static const std::string EKF_GUARD_LATENCY
Field type for guard latency in an entry.
void setSearchStrategy(SearchStrategy *strategy)
static const std::string EKF_LATENCY
Field type for latency of an entry.
CostDBTypes::EntryTable createSearch(const BaseRegisterFile &rf) const
EntryKeyFieldProperty * fieldProperty(std::string field) const
bool estimatePortWriteDelay(const TTAMachine::RFPort &port, const IDF::RFImplementationLocation &, DelayInNanoSeconds &delay, HDB::HDBManager &hdb)
bool estimateArea(const TTAMachine::BaseRegisterFile &rf, const IDF::RFImplementationLocation &, AreaInGates &area, HDB::HDBManager &hdb)
int writePortCount() const