OpenASIP  2.0
Public Member Functions | List of all members
StrictMatchRFEstimator Class Reference
Inheritance diagram for StrictMatchRFEstimator:
Inheritance graph
Collaboration diagram for StrictMatchRFEstimator:
Collaboration graph

Public Member Functions

 StrictMatchRFEstimator (const std::string &name)
 
virtual ~StrictMatchRFEstimator ()
 
 DESCRIPTION ("Simple RF cost estimator plugin that estimates costs of RFs " "simply by looking up direct matches from HDB. In case there's " "no cost data available for the given RF, it's unable to estimate " "it by using linearization etc.")
 
bool estimateArea (const TTAMachine::BaseRegisterFile &, const IDF::RFImplementationLocation &implementation, AreaInGates &area, HDB::HDBManager &hdb)
 
bool estimatePortWriteDelay (const TTAMachine::RFPort &, const IDF::RFImplementationLocation &implementation, DelayInNanoSeconds &delay, HDB::HDBManager &hdb)
 
bool estimatePortReadDelay (const TTAMachine::RFPort &, const IDF::RFImplementationLocation &implementation, DelayInNanoSeconds &delay, HDB::HDBManager &hdb)
 
bool estimateMaximumComputationDelay (const TTAMachine::BaseRegisterFile &, const IDF::RFImplementationLocation &implementation, DelayInNanoSeconds &delay, HDB::HDBManager &hdb)
 
bool estimateEnergy (const TTAMachine::BaseRegisterFile &rf, const IDF::RFImplementationLocation &implementation, const TTAProgram::Program &, const ExecutionTrace &trace, EnergyInMilliJoules &energy, HDB::HDBManager &hdb)
 
- Public Member Functions inherited from CostEstimator::RFCostEstimationPlugin
 RFCostEstimationPlugin (const std::string &name)
 
virtual ~RFCostEstimationPlugin ()
 
- Public Member Functions inherited from CostEstimator::CostEstimationPlugin
 CostEstimationPlugin (const std::string &name)
 
virtual ~CostEstimationPlugin ()
 
virtual std::string name () const
 
virtual std::string description () const
 

Additional Inherited Members

- Protected Attributes inherited from CostEstimator::CostEstimationPlugin
std::string name_
 the name of the plugin class in the HDB; used to identify cost data More...
 

Detailed Description

Definition at line 46 of file StrictMatchRFEstimator.cc.

Constructor & Destructor Documentation

◆ StrictMatchRFEstimator()

StrictMatchRFEstimator::StrictMatchRFEstimator ( const std::string &  name)
inline

Definition at line 48 of file StrictMatchRFEstimator.cc.

48  :
50  }

◆ ~StrictMatchRFEstimator()

virtual StrictMatchRFEstimator::~StrictMatchRFEstimator ( )
inlinevirtual

Definition at line 52 of file StrictMatchRFEstimator.cc.

52  {
53  }

Member Function Documentation

◆ DESCRIPTION()

StrictMatchRFEstimator::DESCRIPTION ( "Simple RF cost estimator plugin that estimates costs of RFs " "simply by looking up direct matches from HDB. In case there's " "no cost data available for the given  RF,
it 's unable to estimate " "it by using linearization etc."   
)

◆ estimateArea()

bool StrictMatchRFEstimator::estimateArea ( const TTAMachine::BaseRegisterFile ,
const IDF::RFImplementationLocation implementation,
AreaInGates area,
HDB::HDBManager hdb 
)
inlinevirtual

Estimates the register file's area by fetching cost data named 'area' from HDB.

Reimplemented from CostEstimator::RFCostEstimationPlugin.

Definition at line 67 of file StrictMatchRFEstimator.cc.

71  {
72 
73 //#define DEBUG_AREA_ESTIMATION
74 
75  try {
76  // simply fetch the area data of the FU, if any
77  DataObject areaFromDB = hdb.rfCostEstimationData(
78  "area", implementation.id(), name_);
79  area = areaFromDB.doubleValue();
80 #ifdef DEBUG_AREA_ESTIMATION
82  << rf.name() << " area " << area << std::endl;
83 #endif
84  return true;
85  } catch (const KeyNotFound&) {
86  // if no area data found, don't even try to estimate the area
87  // somehow
88  Application::logStream() << "No area data found in HDB.";
89 
90  return false;
91  } catch (const Exception& e) {
92  // for example, if doubleValue() conversion failed, then it's
93  // a problem with HDB contents
95  return false;
96  }
97  return false;
98  }

References debugLog, DataObject::doubleValue(), Exception::errorMessage(), implementation, Application::logStream(), and HDB::HDBManager::rfCostEstimationData().

Here is the call graph for this function:

◆ estimateEnergy()

bool StrictMatchRFEstimator::estimateEnergy ( const TTAMachine::BaseRegisterFile rf,
const IDF::RFImplementationLocation implementation,
const TTAProgram::Program ,
const ExecutionTrace trace,
EnergyInMilliJoules energy,
HDB::HDBManager hdb 
)
inlinevirtual

Estimates the energy consumed by given RF.

Estimate is done by computing the sum of all register file access type energies and RF idle energy. Register file access energies are stored with entries named 'rf_access_energy Nr Nw'. Nr is the number of read accesses, Nw the number of write accesses. For example, 'rf_access_energy 1 3' is the name of entry which tells how much energy is consumed by the RF in case RF is accessed simultaneously once for reading and trice for writing. Idle energy is stored in entry 'rf_idle_energy'.

Reimplemented from CostEstimator::RFCostEstimationPlugin.

Definition at line 230 of file StrictMatchRFEstimator.cc.

236  {
237 
238 //#define DEBUG_ENERGY_ESTIMATION
239 
240  energy = 0.0;
241  ClockCycleCount cyclesWithRFAccess = 0;
242 #ifdef DEBUG_ENERGY_ESTIMATION
244  << "## register file " << rf.name() << ": " << std::endl;
245 #endif
246  try {
250  const_iterator i = accessList->begin();
251  i != accessList->end(); ++i) {
252  const ExecutionTrace::ConcurrentRFAccessCount& accessCount =
253  *i;
254 
255  const std::size_t reads = accessCount.get<0>();
256  const std::size_t writes = accessCount.get<1>();
257  const ClockCycleCount count = accessCount.get<2>();
258  const std::string dataName =
259  std::string("rf_access_energy ") +
260  Conversion::toString(reads) + " " +
261  Conversion::toString(writes);
262 
263  try {
264  DataObject energyFromDB = hdb.rfCostEstimationData(
265  dataName, implementation.id(), name_);
266  EnergyInMilliJoules energyOfAccess =
267  energyFromDB.doubleValue()*count;
268 #ifdef DEBUG_ENERGY_ESTIMATION
270  << "## reads " << accessCount.get<0>() << " "
271  << "writes " << accessCount.get<1>() << " = "
272  << energyFromDB.doubleValue() << " times "
273  << count << " = " << energyOfAccess << std::endl;
274 #endif
275  energy += energyOfAccess;
276  cyclesWithRFAccess += count;
277  } catch (const KeyNotFound&) {
278  // if no data found, don't even try to estimate the area
279  delete accessList;
280  accessList = NULL;
282  << "Cost estimation data '" << dataName
283  << "' not found in HDB." << std::endl;
284  return false;
285  } catch (const Exception& e) {
286  delete accessList;
287  accessList = NULL;
288  debugLog(e.errorMessage());
289  return false;
290  }
291  }
292  delete accessList;
293  accessList = NULL;
294  } catch (const Exception& e) {
295  debugLog(e.errorMessage());
296  return false;
297  }
298 
299  // add the cost of RF idling
300  const ClockCycleCount idleCycles =
301  trace.simulatedCycleCount() - cyclesWithRFAccess;
302  const std::string dataName = std::string("rf_idle_energy");
303 
304  try {
305  DataObject energyFromDB = hdb.rfCostEstimationData(
306  dataName, implementation.id(), name_);
307  EnergyInMilliJoules idleEnergy =
308  energyFromDB.doubleValue()*idleCycles;
309 #ifdef DEBUG_ENERGY_ESTIMATION
311  << "## idle energy " << energyFromDB.doubleValue() << " times "
312  << idleCycles << " = " << idleEnergy << std::endl;
313 
314 #endif
315  energy += idleEnergy;
316 
317  } catch (const KeyNotFound&) {
318  // if no data found, don't even try to estimate the area
320  << "Cost estimation data '" << dataName
321  << "' not found in HDB." << std::endl;
322  return false;
323  } catch (const Exception& e) {
324  debugLog(e.errorMessage());
325  return false;
326  }
327 
328  return true;
329  }

References debugLog, DataObject::doubleValue(), Exception::errorMessage(), implementation, Application::logStream(), TTAMachine::Component::name(), ExecutionTrace::registerFileAccessCounts(), HDB::HDBManager::rfCostEstimationData(), ExecutionTrace::simulatedCycleCount(), Conversion::toString(), and trace.

Here is the call graph for this function:

◆ estimateMaximumComputationDelay()

bool StrictMatchRFEstimator::estimateMaximumComputationDelay ( const TTAMachine::BaseRegisterFile ,
const IDF::RFImplementationLocation implementation,
DelayInNanoSeconds delay,
HDB::HDBManager hdb 
)
inlinevirtual

Estimates the register file maximum computation delay by fetching cost data named 'computation_delay' from HDB.

Reimplemented from CostEstimator::RFCostEstimationPlugin.

Definition at line 186 of file StrictMatchRFEstimator.cc.

190  {
191 
192  try {
193  // simply fetch the delay data of the RF, if any
194  DataObject delayFromDB = hdb.rfCostEstimationData(
195  "computation_delay", implementation.id(), name_);
196  delay = delayFromDB.doubleValue();
197 #ifdef DEBUG_DELAY_ESTIMATION
199  << rf.name() << " computation delay " << delay << std::endl;
200 #endif
201  return true;
202  } catch (const KeyNotFound&) {
203  // if no data found, don't even try to estimate the area
205  << "No computation_delay cost data found for RF "
206  << implementation.id() << ", plugin " << name_ << std::endl;
207  return false;
208  } catch (const Exception& e) {
209  // for example, if doubleValue() conversion failed, then it's
210  // a problem with HDB contents
211  debugLog(e.errorMessage());
212  return false;
213  }
214 
215  return false;
216  }

References debugLog, DataObject::doubleValue(), Exception::errorMessage(), implementation, Application::logStream(), and HDB::HDBManager::rfCostEstimationData().

Here is the call graph for this function:

◆ estimatePortReadDelay()

bool StrictMatchRFEstimator::estimatePortReadDelay ( const TTAMachine::RFPort ,
const IDF::RFImplementationLocation implementation,
DelayInNanoSeconds delay,
HDB::HDBManager hdb 
)
inlinevirtual

Estimates the register file port read delay by fetching cost data named 'output_delay' from HDB.

Assumes that all ports have the same output delay, that is, there is only one 'output_delay' entry for a RF in HDB.

Reimplemented from CostEstimator::RFCostEstimationPlugin.

Definition at line 149 of file StrictMatchRFEstimator.cc.

153  {
154 
155  try {
156  // simply fetch the delay data of the RF port, if any
157  DataObject delayFromDB = hdb.rfCostEstimationData(
158  "output_delay", implementation.id(), name_);
159  delay = delayFromDB.doubleValue();
160 #ifdef DEBUG_DELAY_ESTIMATION
162  << port.name() << " read delay " << delay << std::endl;
163 #endif
164  return true;
165  } catch (const KeyNotFound&) {
166  // if no data found, don't even try to estimate the area
168  << "No output_delay cost data found for RF "
169  << implementation.id() << ", plugin " << name_ << std::endl;
170  return false;
171  } catch (const Exception& e) {
172  // for example, if doubleValue() conversion failed, then it's
173  // a problem with HDB contents
174  debugLog(e.errorMessage());
175  return false;
176  }
177 
178  return false;
179  }

References debugLog, DataObject::doubleValue(), Exception::errorMessage(), implementation, Application::logStream(), and HDB::HDBManager::rfCostEstimationData().

Here is the call graph for this function:

◆ estimatePortWriteDelay()

bool StrictMatchRFEstimator::estimatePortWriteDelay ( const TTAMachine::RFPort ,
const IDF::RFImplementationLocation implementation,
DelayInNanoSeconds delay,
HDB::HDBManager hdb 
)
inlinevirtual

Estimates the register file port write delay by fetching cost data named 'input_delay' from HDB.

Assumes that all ports have the same input delay, that is, there is only one 'input_delay' entry for a RF in HDB.

Reimplemented from CostEstimator::RFCostEstimationPlugin.

Definition at line 108 of file StrictMatchRFEstimator.cc.

112  {
113 
114 //#define DEBUG_DELAY_ESTIMATION
115  try {
116  // simply fetch the delay data of the RF port, if any
117  DataObject delayFromDB = hdb.rfCostEstimationData(
118  "input_delay", implementation.id(), name_);
119  delay = delayFromDB.doubleValue();
120 #ifdef DEBUG_DELAY_ESTIMATION
122  << port.name() << " write delay " << delay << std::endl;
123 #endif
124  return true;
125  } catch (const KeyNotFound&) {
126  // if no data found, don't even try to estimate the area
128  << "No input_delay cost data found for RF "
129  << implementation.id() << ", plugin " << name_ << std::endl;
130  return false;
131  } catch (const Exception& e) {
132  // for example, if doubleValue() conversion failed, then it's
133  // a problem with HDB contents
134  debugLog(e.errorMessage());
135  return false;
136  }
137 
138  return false;
139  }

References debugLog, DataObject::doubleValue(), Exception::errorMessage(), implementation, Application::logStream(), and HDB::HDBManager::rfCostEstimationData().

Here is the call graph for this function:

The documentation for this class was generated from the following file:
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
CostEstimator::CostEstimationPlugin::name
virtual std::string name() const
Definition: CostEstimationPlugin.cc:63
implementation
IDF::MachineImplementation * implementation
the implementation definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:61
DataObject
Definition: DataObject.hh:50
Application::logStream
static std::ostream & logStream()
Definition: Application.cc:155
Conversion::toString
static std::string toString(const T &source)
DataObject::doubleValue
virtual double doubleValue() const
Definition: DataObject.cc:386
HDB::HDBManager::rfCostEstimationData
DataObject rfCostEstimationData(const std::string &valueName, RowID implementationId, const std::string &pluginName) const
Definition: HDBManager.cc:3345
CostEstimator::EnergyInMilliJoules
double EnergyInMilliJoules
type for consumed energy in milli joules
Definition: CostEstimatorTypes.hh:37
Exception
Definition: Exception.hh:54
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
ExecutionTrace::registerFileAccessCounts
ConcurrentRFAccessCountList * registerFileAccessCounts(RegisterFileID registerFile) const
Definition: ExecutionTrace.cc:505
CostEstimator::CostEstimationPlugin::name_
std::string name_
the name of the plugin class in the HDB; used to identify cost data
Definition: CostEstimationPlugin.hh:55
ExecutionTrace::simulatedCycleCount
ClockCycleCount simulatedCycleCount() const
Definition: ExecutionTrace.cc:764
trace
ExecutionTrace * trace
the execution trace database
Definition: EstimatorCmdLineUI.cc:66
ExecutionTrace::ConcurrentRFAccessCount
boost::tuple< RegisterAccessCount, RegisterAccessCount, ClockCycleCount > ConcurrentRFAccessCount
type to be used as a key for storing concurrent RF access info
Definition: ExecutionTrace.hh:105
ClockCycleCount
CycleCount ClockCycleCount
Alias for ClockCycleCount.
Definition: SimulatorConstants.hh:57
ExecutionTrace::ConcurrentRFAccessCountList
std::list< ConcurrentRFAccessCount > ConcurrentRFAccessCountList
type to be used for a list of concurrent RF accesses
Definition: ExecutionTrace.hh:108
KeyNotFound
Definition: Exception.hh:285
CostEstimator::RFCostEstimationPlugin::RFCostEstimationPlugin
RFCostEstimationPlugin(const std::string &name)
Definition: RFCostEstimationPlugin.cc:44
debugLog
#define debugLog(text)
Definition: Application.hh:95