OpenASIP  2.0
Public Member Functions | Private Attributes | List of all members
CostEstimates Class Reference

#include <CostEstimates.hh>

Collaboration diagram for CostEstimates:
Collaboration graph

Public Member Functions

 CostEstimates ()
 
virtual ~CostEstimates ()
 
void setArea (double area)
 
void setLongestPathDelay (double delay)
 
void setEnergy (const TTAProgram::Program &program, double energy)
 
void setCycleCount (const TTAProgram::Program &program, ClockCycleCount cycles)
 
double area () const
 
double longestPathDelay () const
 
int energies () const
 
double energy (int index) const
 
double energy (const TTAProgram::Program &program) const
 

Private Attributes

std::map< const TTAProgram::Program *, double > energyMap_
 Map containing programs and energies consumed in running the programs. More...
 
double area_
 Area estimation value (in gates). More...
 
double longestPathDelay_
 Longest path delay estimation value (in nano seconds). More...
 

Detailed Description

This class represents cost estimates for a machine configuration.

Class stores estimates of area (in gates), longest path delay (in nano seconds) and energy consumptions (in milli joules) when the configuration is used to run different programs. Area and longest path delay are constants to one configuration while there can be multiple programs executed so multiple energy consumption estimations and cycle counts as well. Each energy consumption is bound to one program.

Definition at line 57 of file CostEstimates.hh.

Constructor & Destructor Documentation

◆ CostEstimates()

CostEstimates::CostEstimates ( )

The contstructor.

Definition at line 42 of file CostEstimates.cc.

42  :
43  area_(0), longestPathDelay_(0) {
44 }

◆ ~CostEstimates()

CostEstimates::~CostEstimates ( )
virtual

The destructor.

Definition at line 49 of file CostEstimates.cc.

49  {
50 }

Member Function Documentation

◆ area()

double CostEstimates::area ( ) const

Returns the area estimate (in gates).

Returns
Returns the area estimate (in gates).

Definition at line 101 of file CostEstimates.cc.

101  {
102 
103  return area_;
104 }

References area_.

Referenced by MinimizeMachine::minimizeBuses(), Evaluate::printEstimates(), ComponentImplementationSelector::selectFUs(), ComponentImplementationSelector::selectIUs(), ComponentImplementationSelector::selectRFs(), and setArea().

◆ energies()

int CostEstimates::energies ( ) const

Returns the number of different energy estimates (one for each program) in the cost estimation data.

Returns
Returns the number of stored energy estimates.

Definition at line 124 of file CostEstimates.cc.

124  {
125 
126  return energyMap_.size();
127 }

References energyMap_.

Referenced by energy(), and Evaluate::printEstimates().

◆ energy() [1/2]

double CostEstimates::energy ( const TTAProgram::Program program) const

Returns the energy value corresponding to the Program.

Parameters
programProgram of which energy is returned.
Returns
The energy of the Program.
Exceptions
KeyNotFoundIs thrown if program has no energy set.

Definition at line 159 of file CostEstimates.cc.

159  {
160  map<const TTAProgram::Program*, double>::const_iterator iter =
161  energyMap_.find(&program);
162  if (iter == energyMap_.end()) {
163  throw KeyNotFound(__FILE__, __LINE__, __func__);
164  }
165  return (*iter).second;
166 }

References __func__, energyMap_, and program.

◆ energy() [2/2]

double CostEstimates::energy ( int  index) const

Returns the energy value from the given index.

Parameters
indexThe index.
Returns
The energy value in the given index.
Exceptions
OutOfRangeIf the given index is less than 0 or greater or equal to the number of energies.

Definition at line 138 of file CostEstimates.cc.

138  {
139  if (index < 0 || index >= energies()) {
140  throw OutOfRange(__FILE__, __LINE__, __func__);
141  }
142  map<const TTAProgram::Program*, double>::const_iterator iter =
143  energyMap_.begin();
144  while (index > 0) {
145  iter++;
146  index--;
147  }
148  return (*iter).second;
149 }

References __func__, energies(), and energyMap_.

Referenced by Evaluate::printEstimates(), and setEnergy().

Here is the call graph for this function:

◆ longestPathDelay()

double CostEstimates::longestPathDelay ( ) const

Returns the longest path delay estimate (in nano seconds).

Returns
Returns the longest path delay estimate (in nano seconds).

Definition at line 112 of file CostEstimates.cc.

112  {
113 
114  return longestPathDelay_;
115 }

References longestPathDelay_.

Referenced by MinimizeMachine::minimizeBuses(), Evaluate::printEstimates(), ComponentImplementationSelector::selectFUs(), ComponentImplementationSelector::selectIUs(), and ComponentImplementationSelector::selectRFs().

◆ setArea()

void CostEstimates::setArea ( double  area)

Sets the area estimate (in gates).

Parameters
areaArea estimate value (in gates).

Definition at line 58 of file CostEstimates.cc.

58  {
59 
60  area_ = area;
61 }

References area(), and area_.

Referenced by DesignSpaceExplorer::evaluate(), ComponentImplementationSelector::fuImplementations(), ComponentImplementationSelector::iuImplementations(), and ComponentImplementationSelector::rfImplementations().

Here is the call graph for this function:

◆ setCycleCount()

void CostEstimates::setCycleCount ( const TTAProgram::Program program,
ClockCycleCount  cycles 
)

◆ setEnergy()

void CostEstimates::setEnergy ( const TTAProgram::Program program,
double  energy 
)

Sets new energy estimate for the given program.

If there was an old energy value for the given key it is removed first.

Parameters
programProgram that is used as a key.
energyEnergy consumed while running the program (in milli joules).

Definition at line 83 of file CostEstimates.cc.

84  {
85 
86  map<const TTAProgram::Program*, double>::iterator iter =
87  energyMap_.find(&program);
88  if (iter != energyMap_.end()) {
89  energyMap_.erase(iter);
90  }
91  energyMap_.insert(
92  std::pair<const TTAProgram::Program*, double>(&program, energy));
93 }

References energy(), energyMap_, and program.

Referenced by DesignSpaceExplorer::evaluate().

Here is the call graph for this function:

◆ setLongestPathDelay()

void CostEstimates::setLongestPathDelay ( double  delay)

Sets the longest path delay estimate (in nano seconds).

Parameters
delayLongest path delay estimte value (in nano seconds).

Definition at line 69 of file CostEstimates.cc.

69  {
70 
71  longestPathDelay_ = delay;
72 }

References longestPathDelay_.

Referenced by DesignSpaceExplorer::evaluate(), ComponentImplementationSelector::fuImplementations(), ComponentImplementationSelector::iuImplementations(), and ComponentImplementationSelector::rfImplementations().

Member Data Documentation

◆ area_

double CostEstimates::area_
private

Area estimation value (in gates).

Definition at line 76 of file CostEstimates.hh.

Referenced by area(), and setArea().

◆ energyMap_

std::map<const TTAProgram::Program*, double> CostEstimates::energyMap_
private

Map containing programs and energies consumed in running the programs.

Definition at line 74 of file CostEstimates.hh.

Referenced by energies(), energy(), and setEnergy().

◆ longestPathDelay_

double CostEstimates::longestPathDelay_
private

Longest path delay estimation value (in nano seconds).

Definition at line 78 of file CostEstimates.hh.

Referenced by longestPathDelay(), and setLongestPathDelay().


The documentation for this class was generated from the following files:
OutOfRange
Definition: Exception.hh:320
CostEstimates::energy
double energy(int index) const
Definition: CostEstimates.cc:138
CostEstimates::energyMap_
std::map< const TTAProgram::Program *, double > energyMap_
Map containing programs and energies consumed in running the programs.
Definition: CostEstimates.hh:74
CostEstimates::energies
int energies() const
Definition: CostEstimates.cc:124
__func__
#define __func__
Definition: Application.hh:67
CostEstimates::area_
double area_
Area estimation value (in gates).
Definition: CostEstimates.hh:76
CostEstimates::area
double area() const
Definition: CostEstimates.cc:101
CostEstimates::longestPathDelay_
double longestPathDelay_
Longest path delay estimation value (in nano seconds).
Definition: CostEstimates.hh:78
KeyNotFound
Definition: Exception.hh:285
program
find Finds info of the inner loops in the program
Definition: InnerLoopFinder.cc:80