Go to the documentation of this file.
73 "FU cost estimator plugin that estimates costs of FUs by generating"
74 "cost database from cost values of HDB and uses interpolation to "
75 "estimate the costs. In case there's no cost data available for the "
76 "given FU the plugin interpolates the estimate if possible.");
92 initializeEstimator(hdb);
94 CostDBTypes::EntryTable::const_iterator i = results.begin();
97 for (;i < results.end(); i++) {
98 for (
int n = 0; n < (*i)->statisticsCount(); n++) {
99 if (area < (*i)->statistics(n).area()) {
100 area = (*i)->statistics(n).area();
107 #ifdef DEBUG_AREA_ESTIMATION
109 << fu.
name() <<
" area " << area << std::endl;
131 initializeEstimator(hdb);
134 CostDBTypes::EntryTable::const_iterator i = results.begin();
137 for (;i < results.end(); i++) {
138 for (
int n = 0; n < (*i)->statisticsCount(); n++) {
139 #ifndef UNIQUE_PORT_DELAY
140 if (delay < (*i)->statistics(n).delayPort(
"input_delay")) {
141 delay = (*i)->statistics(n).delayPort(
"input_delay");
143 #endif // UNIQUE_PORT_DELAY
144 #ifdef UNIQUE_PORT_DELAY
147 if (delay < (*i)->statistics(n).delayPort(port.
name())) {
148 delay = (*i)->statistics(n).delayPort(port.
name());
150 #endif // UNIQUE_PORT_DELAY
154 #ifdef DEBUG_DELAY_ESTIMATION
158 <<
" found in HDB." << std::endl;
159 #endif // DEBUG_DELAY_ESTIMATION
162 #ifdef DEBUG_DELAY_ESTIMATION
164 << port.
name() <<
" (port) delay " << delay << std::endl;
185 initializeEstimator(hdb);
187 CostDBTypes::EntryTable::const_iterator i = results.begin();
190 for (;i < results.end(); i++) {
191 for (
int n = 0; n < (*i)->statisticsCount(); n++) {
192 #ifndef UNIQUE_PORT_DELAY
193 if (delay < (*i)->statistics(n).delayPort(
"output_delay")) {
194 delay = (*i)->statistics(n).delayPort(
"output_delay");
196 #endif // UNIQUE_PORT_DELAY
197 #ifdef UNIQUE_PORT_DELAY
200 if (delay < (*i)->statistics(n).delayPort(port.
name())) {
201 delay = (*i)->statistics(n).delayPort(port.
name());
203 #endif // UNIQUE_PORT_DELAY
207 #ifdef DEBUG_DELAY_ESTIMATION
211 <<
" found in HDB." << std::endl;
212 #endif // DEBUG_DELAY_ESTIMATION
215 #ifdef DEBUG_DELAY_ESTIMATION
217 << port.
name() <<
" (port) delay " << delay << std::endl;
218 #endif // DEBUG_DELAY_ESTIMATION
234 initializeEstimator(hdb);
236 CostDBTypes::EntryTable::const_iterator i = results.begin();
239 for (;i < results.end(); i++) {
240 for (
int n = 0; n < (*i)->statisticsCount(); n++) {
241 if (delay < (*i)->statistics(n).delay()) {
242 delay = (*i)->statistics(n).delay();
249 #ifdef DEBUG_DELAY_ESTIMATION
251 << fu.
name() <<
" computation delay " << delay << std::endl;
252 #endif // DEBUG_DELAY_ESTIMATION
273 initializeEstimator(hdb);
278 #ifdef DEBUG_ENERGY_ESTIMATION
280 <<
"## function unit " << fu.
name() <<
": " << std::endl;
285 const_iterator i = operationTriggers->begin();
286 i != operationTriggers->end(); ++i) {
295 triggerCount.get<1>();
297 const std::string dataName =
298 std::string(
"operation_execution_energy ") + operation;
301 CostDBTypes::EntryTable::const_iterator i = results.begin();
302 for (;i < results.end(); i++) {
308 for (
int n = 0; n < (*i)->statisticsCount(); n++) {
309 if (((*i)->statistics(n).energyOperation(
310 operation) * count) > tempEnergy) {
313 (*i)->statistics(n).energyOperation(
316 #ifdef DEBUG_ENERGY_ESTIMATION
319 <<
" NOTE: Multiple fu execution energy"
321 <<
" operation: " << operation
323 << (*i)->statistics(n).energyOperation(
329 energy += tempEnergy;
331 cyclesWithFUAccess += count;
334 delete operationTriggers;
335 operationTriggers = NULL;
337 <<
"Cost estimation data '" << dataName
338 <<
"' not found in HDB." << std::endl;
341 delete operationTriggers;
342 operationTriggers = NULL;
348 delete operationTriggers;
349 operationTriggers = NULL;
354 const std::string dataName = std::string(
"fu_idle_energy");
357 CostDBTypes::EntryTable::const_iterator i = results.begin();
358 for (;i < results.end(); i++) {
364 for (
int n = 0; n < (*i)->statisticsCount(); n++) {
365 if (((*i)->statistics(n).energyIdle() * idleCycles) >
369 (*i)->statistics(n).energyIdle() * idleCycles;
371 #ifdef DEBUG_ENERGY_ESTIMATION
374 <<
" NOTE: Multiple fu idle energy results found!"
375 << (*i)->statistics(n).energyIdle()
380 energy += tempEnergy;
385 <<
"Cost estimation data '" << dataName
387 <<
" not found in HDB." << std::endl;
436 unitMatchType_.push_back(
440 unitMatchType_.push_back(
458 for (
int n = 0; n < ports; n++) {
460 if (
dynamic_cast<FUPort*
>(port) != NULL) {
463 width = fuPort->
width();
464 }
else if (width != fuPort->
width()) {
480 results = costdb_->
search(*searchKey, unitMatchType_);
bool estimateMaximumComputationDelay(const TTAMachine::FunctionUnit &fu, const IDF::FUImplementationLocation &, DelayInNanoSeconds &delay, HDB::HDBManager &hdb)
CostDatabase * costdb_
Cost database being used.
ClockCycleCount OperationTriggerCount
a type for operation trigger counts
static const std::string EKF_BIT_WIDTH
Field type for bit width of an entry.
std::vector< MatchType * > MatchTypeTable
Table of types of match.
virtual TCEString name() const
CostDBTypes::EntryTable createSearch(const FunctionUnit &fu) const
CostDatabase & costDatabase(const HDB::HDBManager &hdb)
#define DESCRIPTION(TEXT__)
IDF::MachineImplementation * implementation
the implementation definition of the estimated processor
FunctionUnit * parentUnit() const
virtual bool estimateEnergy(const TTAMachine::FunctionUnit &fu, const IDF::FUImplementationLocation &implementation, const TTAProgram::Program &, const ExecutionTrace &trace, EnergyInMilliJoules &energy, HDB::HDBManager &hdb)
std::vector< CostDBEntry * > EntryTable
Table of database entries.
std::list< FUOperationTriggerCount > FUOperationTriggerCountList
type to be used for lists of function operation execution counts
virtual BaseFUPort * port(const std::string &name) const
double AreaInGates
type for area values in equivalent gates
static const std::string EK_UNIT
Entry type for function units.
static std::ostream & logStream()
std::map< const EntryKeyProperty *, CostDBTypes::MatchTypeTable > MatchTypeMap
Search type for each entry type.
static CostDatabaseRegistry & instance()
double EnergyInMilliJoules
type for consumed energy in milli joules
CostDBTypes::EntryTable search(const CostDBEntryKey &searchKey, const CostDBTypes::MatchTypeTable &match) const
void addField(EntryKeyField *field)
#define EXPORT_FU_COST_ESTIMATOR_PLUGIN(PLUGIN_NAME__)
std::string OperationID
a type for storing operation identifiers
virtual int operationPortCount() const
FUOperationTriggerCountList * functionUnitOperationTriggerCounts(FunctionUnitID functionUnit) const
std::string errorMessage() const
CostDatabaseRegistry * costDatabaseRegistry_
Registry of cost databases.
EntryKeyProperty * unitProperty_
Entry key property of function unit.
double DelayInNanoSeconds
type for propagation delays in nano seconds
CostDBTypes::MatchTypeTable unitMatchType_
Table of types of match.
bool estimateArea(const TTAMachine::FunctionUnit &fu, const IDF::FUImplementationLocation &, AreaInGates &area, HDB::HDBManager &hdb)
bool estimatePortWriteDelay(const TTAMachine::FUPort &port, const IDF::FUImplementationLocation &, DelayInNanoSeconds &delay, HDB::HDBManager &hdb)
bool estimatePortReadDelay(const TTAMachine::FUPort &port, const IDF::FUImplementationLocation &, DelayInNanoSeconds &delay, HDB::HDBManager &hdb)
virtual std::string name() const
static const std::string EKF_FUNCTION_UNIT
Field type for function unit entry;.
ClockCycleCount simulatedCycleCount() const
ExecutionTrace * trace
the execution trace database
void initializeEstimator(const HDBManager &hdb)
CycleCount ClockCycleCount
Alias for ClockCycleCount.
SearchStrategy * strategy_
Search strategy to be used with the cost database.
static EntryKeyProperty * find(std::string type)
MatchTypeMap searchTypes_
Types of matches used for searching entries from the cost database.
boost::tuple< OperationID, OperationTriggerCount > FUOperationTriggerCount
type to be used as a key for storing function unit operation execution counts
void setSearchStrategy(SearchStrategy *strategy)
EntryKeyFieldProperty * fieldProperty(std::string field) const
InterpolatingFUEstimator(const std::string &name)
virtual int width() const
virtual ~InterpolatingFUEstimator()