OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
CostEstimator::Estimator Class Reference

#include <Estimator.hh>

Collaboration diagram for CostEstimator::Estimator:
Collaboration graph

Public Member Functions

 Estimator ()
 
virtual ~Estimator ()
 
AreaInGates totalArea (const TTAMachine::Machine &machine, const IDF::MachineImplementation &machineImplementation)
 area estimation functions
 
AreaInGates totalAreaOfFunctionUnits (const TTAMachine::Machine &machine, const IDF::MachineImplementation &machineImplementation)
 
AreaInGates totalAreaOfRegisterFiles (const TTAMachine::Machine &machine, const IDF::MachineImplementation &machineImplementation)
 
AreaInGates icArea (const TTAMachine::Machine &machine, const IDF::MachineImplementation &machineImplementation)
 
AreaInGates functionUnitArea (const TTAMachine::FunctionUnit &architecture, const IDF::FUImplementationLocation &implementationEntry)
 
AreaInGates registerFileArea (const TTAMachine::BaseRegisterFile &architecture, const IDF::RFImplementationLocation &implementationEntry)
 
EnergyInMilliJoules totalEnergy (const TTAMachine::Machine &machine, const IDF::MachineImplementation &machineImplementation, const TTAProgram::Program &program, const ExecutionTrace &traceDB)
 energy estimation functions
 
EnergyInMilliJoules icEnergy (const TTAMachine::Machine &machine, const IDF::MachineImplementation &machineImplementation, const TTAProgram::Program &program, const ExecutionTrace &traceDB)
 
EnergyInMilliJoules functionUnitEnergy (const TTAMachine::FunctionUnit &architecture, const IDF::FUImplementationLocation &implementationEntry, const TTAProgram::Program &program, const ExecutionTrace &traceDB)
 
EnergyInMilliJoules registerFileEnergy (const TTAMachine::BaseRegisterFile &architecture, const IDF::RFImplementationLocation &implementationEntry, const TTAProgram::Program &program, const ExecutionTrace &traceDB)
 
EnergyInMilliJoules totalEnergyOfFunctionUnits (const TTAMachine::Machine &machine, const IDF::MachineImplementation &machineImplementation, const TTAProgram::Program &program, const ExecutionTrace &traceDB)
 
EnergyInMilliJoules totalEnergyOfRegisterFiles (const TTAMachine::Machine &machine, const IDF::MachineImplementation &machineImplementation, const TTAProgram::Program &program, const ExecutionTrace &traceDB)
 
DelayInNanoSeconds longestPath (const TTAMachine::Machine &machine, const IDF::MachineImplementation &machineImplementation)
 delay estimation functions
 
DelayInNanoSeconds decompressorDelay (const TTAMachine::Machine &machine, const IDF::MachineImplementation &machineImplementation)
 
DelayInNanoSeconds functionUnitPortWriteDelay (const TTAMachine::FUPort &port, const IDF::FUImplementationLocation &implementationEntry)
 
DelayInNanoSeconds functionUnitPortReadDelay (const TTAMachine::FUPort &port, const IDF::FUImplementationLocation &implementationEntry)
 
DelayInNanoSeconds functionUnitMaximumComputationDelay (const TTAMachine::FunctionUnit &architecture, const IDF::FUImplementationLocation &implementation)
 
DelayInNanoSeconds registerFileMaximumComputationDelay (const TTAMachine::BaseRegisterFile &architecture, const IDF::RFImplementationLocation &implementationEntry)
 
DelayInNanoSeconds registerFilePortWriteDelay (const TTAMachine::RFPort &port, const IDF::RFImplementationLocation &implementationEntry)
 
DelayInNanoSeconds registerFilePortReadDelay (const TTAMachine::RFPort &port, const IDF::RFImplementationLocation &implementationEntry)
 

Private Member Functions

DelayInNanoSeconds estimateSocketToSocketDelayOfPath (const std::string pluginPath, const std::string pluginName, const TransportPath &path, const IDF::MachineImplementation &machineImplementation, const IDF::SocketImplementationLocation &sourceSocketImplementation, const IDF::BusImplementationLocation &busImplementation, const IDF::SocketImplementationLocation &destinationSocketImplementation)
 
FUCostEstimationPluginfuCostFunctionPluginOfImplementation (const IDF::FUImplementationLocation &implementation)
 
RFCostEstimationPluginrfCostFunctionPluginOfImplementation (const IDF::RFImplementationLocation &implementation)
 

Static Private Member Functions

static TransportPathListfindAllICPaths (const TTAMachine::Machine &machine)
 

Private Attributes

FUCostEstimationPluginRegistry fuEstimatorPluginRegistry_
 all accessed FU estimation plugins are stored in this registry
 
RFCostEstimationPluginRegistry rfEstimatorPluginRegistry_
 all accessed RF estimation plugins are stored in this registry
 
ICDecoderCostEstimationPluginRegistry icDecoderEstimatorPluginRegistry_
 all accessed IC&decoder plugins are stored in this registry
 

Detailed Description

The frontend to hardware cost estimation functionality.

This class is used by clients that need to estimate area, energy, or delay of a whole TTA processor or parts of it.

The estimation functions of this interface throw CannotEstimateCost, because it really is an exceptional situation when this class cannot estimate, because it's client's responsibility to make sure all plugins etc. can be found for estimating the machine. In case of single plugins, the situation is not exceptional, but they provide estimation as a "capability", thus they signal explicitly whether they can estimate a cost or not by returning true or false, respectively.

Definition at line 85 of file Estimator.hh.

Constructor & Destructor Documentation

◆ Estimator()

CostEstimator::Estimator::Estimator ( )

Constructor.

Definition at line 64 of file Estimator.cc.

64 {
65}

◆ ~Estimator()

CostEstimator::Estimator::~Estimator ( )
virtual

Destructor.

Definition at line 70 of file Estimator.cc.

70 {
71}

Member Function Documentation

◆ decompressorDelay()

DelayInNanoSeconds CostEstimator::Estimator::decompressorDelay ( const TTAMachine::Machine machine,
const IDF::MachineImplementation machineImplementation 
)

◆ estimateSocketToSocketDelayOfPath()

DelayInNanoSeconds CostEstimator::Estimator::estimateSocketToSocketDelayOfPath ( const std::string  pluginPath,
const std::string  pluginName,
const TransportPath path,
const IDF::MachineImplementation machineImplementation,
const IDF::SocketImplementationLocation sourceSocketImplementation,
const IDF::BusImplementationLocation busImplementation,
const IDF::SocketImplementationLocation destinationSocketImplementation 
)
private

Estimates the delay of a single socket-to-socket path.

Delegates the task to the given IC&decoder plugin.

Parameters
pluginPathThe path of the IC&decoder estimator plugin to use.
pluginNameThe name of the IC&decoder estimator plugin to use.
pluginDataHDBThe HDB from which the plugin should fetch its data.
pathThe path to estimate.
machineImplementationImplementation of the machine.
sourceSocketImplementationThe implementation descriptor of source socket.
busImplementationThe implementation descriptor of bus.
destinationSocketImplementationThe implementation descriptor of destination socket.

Definition at line 1316 of file Estimator.cc.

1322 {
1323 DelayInNanoSeconds delay = 0.0;
1324 try {
1325
1326 ICDecoderEstimatorPlugin& plugin =
1328 pluginPath, pluginName);
1329
1330 if (!plugin.estimateICDelayOfPath(
1331 HDBRegistry::instance(), path, machineImplementation,
1332 sourceSocketImplementation,
1333 busImplementation, destinationSocketImplementation, delay)) {
1334 throw CannotEstimateCost(
1335 __FILE__, __LINE__, __func__,
1336 (boost::format(
1337 "The IC&decoder estimator plugin '%s' could not estimate "
1338 "delay of a path.") % pluginName).str());
1339 }
1340 } catch (const Exception& e) {
1341 throw CannotEstimateCost(
1342 __FILE__, __LINE__, __func__,
1343 std::string("Error while using ICDecoder estimation plugin. ") +
1344 e.errorMessage());
1345 }
1346 return delay;
1347}
#define __func__
T & plugin(const std::string &pluginFileName, const std::string &pluginName)
ICDecoderCostEstimationPluginRegistry icDecoderEstimatorPluginRegistry_
all accessed IC&decoder plugins are stored in this registry
Definition Estimator.hh:206
std::string errorMessage() const
Definition Exception.cc:123
static HDBRegistry & instance()
double DelayInNanoSeconds
type for propagation delays in nano seconds

References __func__, Exception::errorMessage(), CostEstimator::ICDecoderEstimatorPlugin::estimateICDelayOfPath(), icDecoderEstimatorPluginRegistry_, HDB::HDBRegistry::instance(), and CostEstimator::CostEstimationPluginRegistry< T >::plugin().

Referenced by longestPath().

Here is the call graph for this function:

◆ findAllICPaths()

TransportPathList * CostEstimator::Estimator::findAllICPaths ( const TTAMachine::Machine machine)
staticprivate

Finds all paths in the interconnection network of the given machine.

Parameters
machineMachine to search the paths in.
Returns
List of transport paths. Becomes property of the client.
Exceptions
IllegalMachineIn case the machine is badly formed, for example, has features that are not supported yet.

Definition at line 1228 of file Estimator.cc.

1228 {
1229 TransportPathList* paths = new TransportPathList();
1230
1232 for (int bi = 0; bi < busNav.count(); ++bi) {
1233 typedef std::set<const TTAMachine::Socket*> SocketSet;
1234 SocketSet outputSockets, inputSockets;
1235
1236 const TTAMachine::Bus& bus = *busNav.item(bi);
1237 if (bus.segmentCount() > 1) {
1238 throw IllegalMachine(
1239 __FILE__, __LINE__, __func__,
1240 "Segmented buses not supported yet.");
1241 }
1242
1243 const TTAMachine::Segment& segment = *bus.segment(0);
1244
1245 // fetch all input and output sockets connected to the bus (segment)
1246 for (int ci = 0; ci < segment.connectionCount(); ++ci) {
1247 const TTAMachine::Socket& socket = *segment.connection(ci);
1248 if (socket.direction() == TTAMachine::Socket::INPUT) {
1249 inputSockets.insert(&socket);
1250 } else if (socket.direction() == TTAMachine::Socket::OUTPUT) {
1251 outputSockets.insert(&socket);
1252 } else {
1253 throw IllegalMachine(
1254 __FILE__, __LINE__, __func__,
1255 "Unsupported socket direction.");
1256 }
1257 }
1258
1259 for (SocketSet::iterator osi = outputSockets.begin();
1260 osi != outputSockets.end(); ++osi) {
1261 const TTAMachine::Socket& outputSocket = **osi;
1262
1263 // iterate through all (output) ports connected to the socket
1264 for (int opi = 0; opi < outputSocket.portCount(); ++opi) {
1265 const TTAMachine::Port& outputPort = *outputSocket.port(opi);
1266
1267 // iterate through all input sockets connected to the bus
1268 for (SocketSet::iterator isi = inputSockets.begin();
1269 isi != inputSockets.end(); ++isi) {
1270 const TTAMachine::Socket& inputSocket = **isi;
1271
1272 // iterate through all endpoints of the path (input ports)
1273 for (int ipi = 0; ipi < inputSocket.portCount(); ++ipi) {
1274 const TTAMachine::Port& inputPort = *inputSocket.port(
1275 ipi);
1276 TransportPath path(
1277 outputPort, outputSocket, bus, inputSocket,
1278 inputPort);
1279 paths->push_back(path);
1280#if 0
1282 << "path: {" << outputPort.parentUnit()->name()
1283 << "::" << outputPort.name() << ", "
1284 << outputSocket.name() << ", "
1285 << bus.name() << ", "
1286 << inputSocket.name() << ", "
1287 << inputPort.parentUnit()->name()
1288 << "::" << inputPort.name() << "}" << std::endl;
1289#endif
1290 }
1291 }
1292 }
1293 }
1294 }
1295 return paths;
1296}
TTAMachine::Machine * machine
the architecture definition of the estimated processor
static std::ostream & logStream()
virtual Segment * segment(int index) const
Definition Bus.cc:329
virtual int segmentCount() const
Definition Bus.cc:385
virtual TCEString name() const
ComponentType * item(int index) const
virtual BusNavigator busNavigator() const
Definition Machine.cc:356
Unit * parentUnit() const
virtual std::string name() const
Definition Port.cc:141
const Connection & connection(const Socket &socket) const
Definition Segment.cc:250
int connectionCount() const
@ OUTPUT
Data goes from port to bus.
Definition Socket.hh:60
@ INPUT
Data goes from bus to port.
Definition Socket.hh:59
Direction direction() const
Port * port(int index) const
Definition Socket.cc:266
int portCount() const
std::list< TransportPath > TransportPathList

References __func__, TTAMachine::Machine::busNavigator(), TTAMachine::Segment::connection(), TTAMachine::Segment::connectionCount(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Socket::direction(), TTAMachine::Socket::INPUT, TTAMachine::Machine::Navigator< ComponentType >::item(), Application::logStream(), machine, TTAMachine::Component::name(), TTAMachine::Port::name(), TTAMachine::Socket::OUTPUT, TTAMachine::Port::parentUnit(), TTAMachine::Socket::port(), TTAMachine::Socket::portCount(), TTAMachine::Bus::segment(), and TTAMachine::Bus::segmentCount().

Referenced by longestPath().

Here is the call graph for this function:

◆ fuCostFunctionPluginOfImplementation()

FUCostEstimationPlugin & CostEstimator::Estimator::fuCostFunctionPluginOfImplementation ( const IDF::FUImplementationLocation implementationEntry)
private

Loads an FU cost estimation plugin for the given FU implementation.

Parameters
implementationEntryThe implementation of the FU.
Returns
The plugin.
Exceptions
ExceptionIn case the plugin was not found or could not be loaded.

Definition at line 260 of file Estimator.cc.

261 {
262 std::string pluginFileName = "";
263 std::string pluginName = "";
264 HDB::HDBManager* theHDB = NULL;
265 try {
266 // use the HDB to find the estimation plugin from the plugin
267 // registry
268 theHDB = &HDBRegistry::instance().hdb(implementationEntry.hdbFile());
269 HDB::FUEntry* fuEntry = theHDB->fuByEntryID(implementationEntry.id());
270
271 if (fuEntry == NULL || !fuEntry->hasCostFunction()) {
272 delete fuEntry;
273 fuEntry = NULL;
274 throw Exception(
275 __FILE__, __LINE__, __func__,
276 (boost::format(
277 "Function unit entry %d does not have cost "
278 "estimation plugin set.") %
279 implementationEntry.id()).str());
280 }
281
282 HDB::CostFunctionPlugin& pluginData = fuEntry->costFunction();
283 pluginFileName = pluginData.pluginFilePath();
284 pluginName = pluginData.name();
285
286 try {
288 pluginFileName, pluginName);
289 } catch (const Exception& e) {
290 throw CannotEstimateCost(
291 __FILE__, __LINE__, __func__,
292 std::string("Unable to open FU estimation plugin '") +
293 pluginFileName + "'. " + e.errorMessage());
294 }
295 } catch (const Exception& e) {
296 throw Exception(
297 __FILE__, __LINE__, __func__, e.errorMessage());
298 }
299 // avoid warnings with some compilers
300 throw 1;
301}
FUCostEstimationPluginRegistry fuEstimatorPluginRegistry_
all accessed FU estimation plugins are stored in this registry
Definition Estimator.hh:202
std::string pluginFilePath() const
bool hasCostFunction() const
Definition HDBEntry.cc:99
CostFunctionPlugin & costFunction() const
Definition HDBEntry.cc:111
FUEntry * fuByEntryID(RowID id) const
CachedHDBManager & hdb(const std::string fileName)

References __func__, HDB::HDBEntry::costFunction(), Exception::errorMessage(), HDB::HDBManager::fuByEntryID(), fuEstimatorPluginRegistry_, HDB::HDBEntry::hasCostFunction(), HDB::HDBRegistry::hdb(), IDF::UnitImplementationLocation::hdbFile(), IDF::UnitImplementationLocation::id(), HDB::HDBRegistry::instance(), HDB::CostFunctionPlugin::name(), CostEstimator::CostEstimationPluginRegistry< T >::plugin(), and HDB::CostFunctionPlugin::pluginFilePath().

Referenced by functionUnitArea(), functionUnitEnergy(), functionUnitMaximumComputationDelay(), functionUnitPortReadDelay(), and functionUnitPortWriteDelay().

Here is the call graph for this function:

◆ functionUnitArea()

AreaInGates CostEstimator::Estimator::functionUnitArea ( const TTAMachine::FunctionUnit architecture,
const IDF::FUImplementationLocation implementationEntry 
)

Estimates the area of the given function unit.

Parameters
architectureThe FU architecture of which area to estimate.
implementationEntryThe implementation information of FU. Can be an instance of NullFUImplementationLocation.
Exceptions
CannotEstimateCostIn case the area could not be estimated.
Returns
Estimate of area.

Definition at line 364 of file Estimator.cc.

366 {
367 try {
368 AreaInGates area = 0.0;
370 implementationEntry.hdbFile());
371 if (!fuCostFunctionPluginOfImplementation(implementationEntry).
372 estimateArea(architecture, implementationEntry, area, hdb)) {
373 throw CannotEstimateCost(
374 __FILE__, __LINE__, __func__,
375 std::string(
376 "Plugin was unable to estimate area of function unit '") +
377 architecture.name() + ".");
378 }
379 return area;
380 } catch (const Exception& e) {
381 throw CannotEstimateCost(
382 __FILE__, __LINE__, __func__,
383 std::string("Unable to estimate area of function unit '") +
384 architecture.name() + "'. " + e.errorMessage());
385 }
386}
FUCostEstimationPlugin & fuCostFunctionPluginOfImplementation(const IDF::FUImplementationLocation &implementation)
Definition Estimator.cc:260
double AreaInGates
type for area values in equivalent gates

References __func__, Exception::errorMessage(), fuCostFunctionPluginOfImplementation(), HDB::HDBRegistry::hdb(), IDF::UnitImplementationLocation::hdbFile(), HDB::HDBRegistry::instance(), and TTAMachine::Component::name().

Referenced by ComponentImplementationSelector::fuImplementations(), and totalAreaOfFunctionUnits().

Here is the call graph for this function:

◆ functionUnitEnergy()

EnergyInMilliJoules CostEstimator::Estimator::functionUnitEnergy ( const TTAMachine::FunctionUnit architecture,
const IDF::FUImplementationLocation implementationEntry,
const TTAProgram::Program program,
const ExecutionTrace traceDB 
)

Estimates the energy consumed by the given FU when running the given program.

Parameters
architectureThe FU architecture of which area to estimate.
implementationEntryThe implementation information of FU. Can be an instance of NullFUImplementationLocation.
programThe program of which energy to calculate.
traceDBThe simulation trace database of the program running in the target architecture.
Returns
Estimate of consumed energy.
Exceptions
CannotEstimateCostIn case the energy could not be estimated.

Definition at line 510 of file Estimator.cc.

513 {
514 try {
515 AreaInGates area = 0.0;
517 implementationEntry.hdbFile());
518 if (!fuCostFunctionPluginOfImplementation(implementationEntry).
519 estimateEnergy(
520 architecture, implementationEntry, program, traceDB, area,
521 hdb)) {
522 throw CannotEstimateCost(
523 __FILE__, __LINE__, __func__,
524 std::string("Plugin was unable to estimate energy."));
525 }
526 return area;
527 } catch (const Exception& e) {
528 throw CannotEstimateCost(
529 __FILE__, __LINE__, __func__,
530 std::string("Unable to estimate energy of function unit '") +
531 architecture.name() + "'. " + e.errorMessage());
532 }
533
534 return 0.0;
535}
find Finds info of the inner loops in the program

References __func__, Exception::errorMessage(), fuCostFunctionPluginOfImplementation(), HDB::HDBRegistry::hdb(), IDF::UnitImplementationLocation::hdbFile(), HDB::HDBRegistry::instance(), TTAMachine::Component::name(), and program.

Referenced by totalEnergyOfFunctionUnits().

Here is the call graph for this function:

◆ functionUnitMaximumComputationDelay()

DelayInNanoSeconds CostEstimator::Estimator::functionUnitMaximumComputationDelay ( const TTAMachine::FunctionUnit architecture,
const IDF::FUImplementationLocation implementationEntry 
)

Estimates the maximum computation delay of the given function unit.

The maximum computation delay is the longest stage in the FU unit's pipeline. It's used mainly for calculating the maximum clock frequency of target architecture by finding the longest path of the machine.

Parameters
architectureThe FU architecture of which area to estimate.
implementationEntryThe implementation information of FU.
Exceptions
CannotEstimateCostIn case the computation delay could not be estimated.
Returns
Estimate of computation delay of the given FU.

Definition at line 834 of file Estimator.cc.

836 {
837 try {
838 DelayInNanoSeconds delay = 0.0;
840 implementationEntry.hdbFile());
841 if (!fuCostFunctionPluginOfImplementation(implementationEntry).
842 estimateMaximumComputationDelay(
843 architecture, implementationEntry, delay, hdb)) {
844 throw CannotEstimateCost(
845 __FILE__, __LINE__, __func__,
846 std::string(
847 "Plugin was unable to estimate computation delay of FU ") +
848 architecture.name());
849 }
850 return delay;
851 } catch (const Exception& e) {
852 throw CannotEstimateCost(
853 __FILE__, __LINE__, __func__,
854 std::string(
855 "Computation delay estimation could not be done for the given "
856 "function unit entry. ") +
857 e.errorMessage());
858 }
859 return 0.0;
860}

References __func__, Exception::errorMessage(), fuCostFunctionPluginOfImplementation(), HDB::HDBRegistry::hdb(), IDF::UnitImplementationLocation::hdbFile(), HDB::HDBRegistry::instance(), and TTAMachine::Component::name().

Referenced by ComponentImplementationSelector::fuImplementations(), and longestPath().

Here is the call graph for this function:

◆ functionUnitPortReadDelay()

DelayInNanoSeconds CostEstimator::Estimator::functionUnitPortReadDelay ( const TTAMachine::FUPort port,
const IDF::FUImplementationLocation implementationEntry 
)

Estimates the output delay of the given function unit port.

Parameters
portThe architecture of the FU port of which area to estimate.
implementationEntryThe implementation information of the FU port belongs to.
Exceptions
CannotEstimateCostIn case the output delay could not be estimated.
Returns
Estimate of output delay of the given FU port.

Definition at line 718 of file Estimator.cc.

720 {
721 try {
722 DelayInNanoSeconds delay = 0.0;
724 implementationEntry.hdbFile());
725 if (!fuCostFunctionPluginOfImplementation(implementationEntry).
726 estimatePortReadDelay(port, implementationEntry, delay, hdb)) {
727 throw CannotEstimateCost(
728 __FILE__, __LINE__, __func__,
729 (boost::format(
730 "Plugin was unable to estimate output delay of port "
731 "%s::%s.") % port.parentUnit()->name() % port.name()).
732 str());
733 }
734 return delay;
735 } catch (const Exception& e) {
736 throw CannotEstimateCost(
737 __FILE__, __LINE__, __func__,
738 std::string(
739 "Output delay estimation could not be done for the given "
740 "function unit entry. ") + e.errorMessage());
741 }
742 return 0.0;
743}
FunctionUnit * parentUnit() const
Definition BaseFUPort.cc:96

References __func__, Exception::errorMessage(), fuCostFunctionPluginOfImplementation(), HDB::HDBRegistry::hdb(), IDF::UnitImplementationLocation::hdbFile(), HDB::HDBRegistry::instance(), TTAMachine::Component::name(), TTAMachine::Port::name(), and TTAMachine::BaseFUPort::parentUnit().

Referenced by longestPath().

Here is the call graph for this function:

◆ functionUnitPortWriteDelay()

DelayInNanoSeconds CostEstimator::Estimator::functionUnitPortWriteDelay ( const TTAMachine::FUPort port,
const IDF::FUImplementationLocation implementationEntry 
)

Estimates the input delay of the given function unit port.

Parameters
portThe architecture of FU port of which area to estimate.
implementationEntryThe implementation information of the FU the port belongs to.
Exceptions
CannotEstimateCostIn case the input delay could not be estimated.
Returns
Estimate of input delay of the given FU port.

Definition at line 679 of file Estimator.cc.

681 {
682 try {
683 DelayInNanoSeconds delay = 0.0;
685 implementationEntry.hdbFile());
686 if (!fuCostFunctionPluginOfImplementation(implementationEntry).
687 estimatePortWriteDelay(port, implementationEntry, delay, hdb)) {
688 throw CannotEstimateCost(
689 __FILE__, __LINE__, __func__,
690 (boost::format(
691 "Plugin was unable to estimate input delay of port "
692 "%s::%s.") % port.parentUnit()->name() % port.name()).
693 str());
694 }
695 return delay;
696 } catch (const Exception& e) {
697 throw CannotEstimateCost(
698 __FILE__, __LINE__, __func__,
699 std::string(
700 "Input delay estimation could not be done for the given "
701 "function unit entry. ") +
702 e.errorMessage());
703 }
704 return 0.0;
705}

References __func__, Exception::errorMessage(), fuCostFunctionPluginOfImplementation(), HDB::HDBRegistry::hdb(), IDF::UnitImplementationLocation::hdbFile(), HDB::HDBRegistry::instance(), TTAMachine::Component::name(), TTAMachine::Port::name(), and TTAMachine::BaseFUPort::parentUnit().

Referenced by longestPath().

Here is the call graph for this function:

◆ icArea()

AreaInGates CostEstimator::Estimator::icArea ( const TTAMachine::Machine machine,
const IDF::MachineImplementation machineImplementation 
)

Estimates the area consumed by the interconnection network.

Parameters
machineThe machine of which IC area to estimate.
machineImplementationThe machine implementation information.
Exceptions
CannotEstimateCostIn case cost cannot be estimated for some reason. Reason is given in error message.

Definition at line 206 of file Estimator.cc.

208 {
209 if (!machineImplementation.hasICDecoderPluginName() ||
210 !machineImplementation.hasICDecoderPluginFile() ||
211 !machineImplementation.hasICDecoderHDB()) {
212 throw CannotEstimateCost(
213 __FILE__, __LINE__, __func__,
214 "Missing IC&decoder plugin information.");
215 }
216
217 AreaInGates area = 0.0;
218 try {
219
220 ICDecoderEstimatorPlugin& plugin =
222 machineImplementation.icDecoderPluginFile(),
223 machineImplementation.icDecoderPluginName());
224
225 if (!plugin.estimateICArea(
226 HDBRegistry::instance(), machine, machineImplementation,
227 area)) {
228 throw CannotEstimateCost(
229 __FILE__, __LINE__, __func__,
230 (boost::format(
231 "The IC&decoder estimator plugin '%s' unable to estimate "
232 "area of IC.") %
233 machineImplementation.icDecoderPluginName()).str());
234 }
235 } catch (const Exception& e) {
236 throw CannotEstimateCost(
237 __FILE__, __LINE__, __func__,
238 std::string("Error while using ICDecoder estimation plugin. ") +
239 e.errorMessage());
240 }
241
242 if (Application::verboseLevel() > 0) {
244 << "IC contributes " << area << " gates"
245 << std::endl;
246 }
247
248 return area;
249}
static int verboseLevel()
std::string icDecoderPluginName() const
std::string icDecoderPluginFile() const

References __func__, Exception::errorMessage(), CostEstimator::ICDecoderEstimatorPlugin::estimateICArea(), IDF::MachineImplementation::hasICDecoderHDB(), IDF::MachineImplementation::hasICDecoderPluginFile(), IDF::MachineImplementation::hasICDecoderPluginName(), icDecoderEstimatorPluginRegistry_, IDF::MachineImplementation::icDecoderPluginFile(), IDF::MachineImplementation::icDecoderPluginName(), HDB::HDBRegistry::instance(), Application::logStream(), machine, CostEstimator::CostEstimationPluginRegistry< T >::plugin(), and Application::verboseLevel().

Referenced by totalArea().

Here is the call graph for this function:

◆ icEnergy()

EnergyInMilliJoules CostEstimator::Estimator::icEnergy ( const TTAMachine::Machine machine,
const IDF::MachineImplementation machineImplementation,
const TTAProgram::Program program,
const ExecutionTrace traceDB 
)

Estimates the total energy consumed by the interconnection network of the given machine running the given program.

Parameters
machineArchitecture of the processor.
machineImplementationImplementation information of the processor.
traceDBThe simulation trace database obtained from simulating the program.
Returns
Energy in milli joules.
Exceptions
CannotEstimateCostIf the energy could not be estimated.

Definition at line 456 of file Estimator.cc.

459 {
460 if (!machineImplementation.hasICDecoderPluginName() ||
461 !machineImplementation.hasICDecoderPluginFile() ||
462 !machineImplementation.hasICDecoderHDB()) {
463 throw CannotEstimateCost(
464 __FILE__, __LINE__, __func__,
465 "Missing IC&decoder plugin information.");
466 }
467
468 EnergyInMilliJoules energy = 0.0;
469 try {
470
471 ICDecoderEstimatorPlugin& plugin =
473 machineImplementation.icDecoderPluginFile(),
474 machineImplementation.icDecoderPluginName());
475
476 if (!plugin.estimateICEnergy(
477 HDBRegistry::instance(), machine, machineImplementation,
478 program, traceDB, energy)) {
479 throw CannotEstimateCost(
480 __FILE__, __LINE__, __func__,
481 (boost::format(
482 "The IC&decoder estimator plugin '%s' could not estimate "
483 "energy for IC.") %
484 machineImplementation.icDecoderPluginName()).str());
485
486 }
487 } catch (const Exception& e) {
488 throw CannotEstimateCost(
489 __FILE__, __LINE__, __func__,
490 std::string("Error while using ICDecoder estimation plugin. ") +
491 e.errorMessage());
492 }
493 return energy;
494}
double EnergyInMilliJoules
type for consumed energy in milli joules

References __func__, Exception::errorMessage(), CostEstimator::ICDecoderEstimatorPlugin::estimateICEnergy(), IDF::MachineImplementation::hasICDecoderHDB(), IDF::MachineImplementation::hasICDecoderPluginFile(), IDF::MachineImplementation::hasICDecoderPluginName(), icDecoderEstimatorPluginRegistry_, IDF::MachineImplementation::icDecoderPluginFile(), IDF::MachineImplementation::icDecoderPluginName(), HDB::HDBRegistry::instance(), machine, CostEstimator::CostEstimationPluginRegistry< T >::plugin(), and program.

Referenced by totalEnergy().

Here is the call graph for this function:

◆ longestPath()

DelayInNanoSeconds CostEstimator::Estimator::longestPath ( const TTAMachine::Machine machine,
const IDF::MachineImplementation machineImplementation 
)

delay estimation functions

Calculates the longest path of the machine.

The longest path is the longest delay in the machine. It can be a path in interconnection network or a computation delay of an FU.

Parameters
machineMachine to calculate the longest path for.
machineImplementationImplementation identifier for the machine.
Returns
The delay of the longest path.

Definition at line 915 of file Estimator.cc.

917 {
918 //#define LONGEST_PATH_DEBUGGING
919
920 DelayInNanoSeconds maximumICDelay = 0.0;
921
922 // find all the paths in IC
924
925 // find if there is bus that is fully connected
926 std::string fBusName = "";
929 for (int i = 0; i < busNav.count(); ++i) {
930 const TTAMachine::Bus& bus = *busNav.item(i);
931 const TTAMachine::Segment& segment = *bus.segment(0);
932
933 // check if bus is fully connected
934 if (segment.connectionCount() == sNav.count()) {
935 fBusName = bus.name();
936 break;
937 }
938 }
939
940 // calculate delays for all the paths in the machine
941 for (TransportPathList::iterator i = icPaths->begin();
942 i != icPaths->end(); ++i) {
943
944 // if fully connected bus was found, check only paths that contain it
945 if (fBusName != "" && fBusName != (i->bus()).name()) {
946 continue;
947 }
948
949 DelayInNanoSeconds readDelay = 0, writeDelay = 0, busDelay = 0,
950 pathDelay = 0;
951
952 TransportPath& path = *i;
953
954 // calculate the port->socket, socket->port part by using FU/RF plugins
955 const TTAMachine::Port& sourcePort = path.sourcePort();
956
957 if (dynamic_cast<const TTAMachine::FUPort*>(&sourcePort) != NULL) {
958
959 const TTAMachine::FUPort& sourceFUPort =
960 dynamic_cast<const TTAMachine::FUPort&>(sourcePort);
961 const TTAMachine::FunctionUnit& fu = *sourceFUPort.parentUnit();
962 if (!machineImplementation.hasFUImplementation(fu.name())) {
963 throw CannotEstimateCost(
964 __FILE__, __LINE__, __func__,
965 (boost::format(
966 "Implementation information missing for function unit "
967 "'%s'.") % fu.name()).str());
968 }
969 // read delay
970 readDelay = functionUnitPortReadDelay(
971 sourceFUPort, machineImplementation.fuImplementation(
972 fu.name()));
973 } else if (dynamic_cast<const TTAMachine::RFPort*>(&sourcePort)
974 != NULL) {
975 const TTAMachine::RFPort& sourceRFPort =
976 dynamic_cast<const TTAMachine::RFPort&>(sourcePort);
978 *sourceRFPort.parentUnit();
979 if (machineImplementation.hasRFImplementation(rf.name())) {
980 // read delay
981 readDelay = registerFilePortReadDelay(
982 sourceRFPort, machineImplementation.rfImplementation(
983 rf.name()));
984 } else if (machineImplementation.hasIUImplementation(rf.name())) {
985 // read delay
986 readDelay = registerFilePortReadDelay(
987 sourceRFPort, machineImplementation.iuImplementation(
988 rf.name()));
989 } else {
990 throw CannotEstimateCost(
991 __FILE__, __LINE__, __func__,
992 (boost::format(
993 "Implementation information missing for register file "
994 "'%s'.") % rf.name()).str());
995 }
996 } else if (dynamic_cast<const TTAMachine::BaseFUPort*>(
997 &sourcePort) != NULL) {
998 // @todo What to do with the GCU port?
999 readDelay = 0.0;
1000 } else {
1001 throw CannotEstimateCost(
1002 __FILE__, __LINE__, __func__, "Unsupported port type.");
1003 }
1004
1005 const TTAMachine::Port& destinationPort = path.destinationPort();
1006
1007 if (dynamic_cast<const TTAMachine::FUPort*>(&destinationPort)
1008 != NULL) {
1009
1010 const TTAMachine::FUPort& destinationFUPort =
1011 dynamic_cast<const TTAMachine::FUPort&>(destinationPort);
1012
1013 const TTAMachine::FunctionUnit& fu =
1014 *destinationFUPort.parentUnit();
1015
1016 if (dynamic_cast<const TTAMachine::ControlUnit*>(&fu) != NULL) {
1017 // @todo gcu port
1018 writeDelay = 0.0;
1019 } else if (!machineImplementation.hasFUImplementation(fu.name())) {
1020 throw CannotEstimateCost(
1021 __FILE__, __LINE__, __func__,
1022 (boost::format(
1023 "Implementation information missing for function "
1024 "unit '%s'.") % fu.name()).str());
1025 } else {
1026 // write delay
1027 writeDelay = functionUnitPortWriteDelay(
1028 destinationFUPort, machineImplementation.fuImplementation(
1029 fu.name()));
1030 }
1031 } else if (dynamic_cast<const TTAMachine::RFPort*>(&destinationPort)
1032 != NULL) {
1033 const TTAMachine::RFPort& destinationRFPort =
1034 dynamic_cast<const TTAMachine::RFPort&>(destinationPort);
1035
1036 const TTAMachine::BaseRegisterFile& rf =
1037 *destinationRFPort.parentUnit();
1038 if (!machineImplementation.hasRFImplementation(rf.name())) {
1039 throw CannotEstimateCost(
1040 __FILE__, __LINE__, __func__,
1041 (boost::format(
1042 "Implementation information missing for register file "
1043 "'%s'.") % rf.name()).str());
1044 }
1045
1046 // write delay
1047 writeDelay += registerFilePortWriteDelay(
1048 destinationRFPort, machineImplementation.rfImplementation(
1049 rf.name()));
1050 } else if (dynamic_cast<const TTAMachine::BaseFUPort*>(
1051 &destinationPort) != NULL) {
1052 // @todo What to do with the GCU port?
1053 writeDelay = 0.0;
1054 } else {
1055 throw CannotEstimateCost(
1056 __FILE__, __LINE__, __func__, "Unsupported port type.");
1057 }
1058
1059
1060 if (!machineImplementation.hasICDecoderPluginName() ||
1061 !machineImplementation.hasICDecoderPluginFile() ||
1062 !machineImplementation.hasICDecoderHDB()) {
1063 throw CannotEstimateCost(
1064 __FILE__, __LINE__, __func__,
1065 "Missing IC&decoder plugin information.");
1066 }
1067
1068 // Find out if there are idf entries to sockets and bus
1069
1070 IDF::SocketImplementationLocation* sourceSocketImplementation = NULL;
1071 if (!machineImplementation.hasSocketImplementation(
1072 path.sourceSocket().name())) {
1073 sourceSocketImplementation =
1075 } else {
1076 sourceSocketImplementation =
1077 &machineImplementation.socketImplementation(
1078 path.sourceSocket().name());
1079 }
1080 IDF::SocketImplementationLocation* destinationSocketImplementation =
1081 NULL;
1082 if (!machineImplementation.hasSocketImplementation(
1083 path.destinationSocket().name())) {
1084 destinationSocketImplementation =
1086 } else {
1087 destinationSocketImplementation =
1088 &machineImplementation.socketImplementation(
1089 path.destinationSocket().name());
1090 }
1091 IDF::BusImplementationLocation* busImplementation = NULL;
1092 if (!machineImplementation.hasBusImplementation(path.bus().name())) {
1093 busImplementation =
1095 } else {
1096 busImplementation =
1097 &machineImplementation.busImplementation(path.bus().name());
1098 }
1099
1100 // calculate the socket->bus->socket part by using a ICDecoder plugin
1101 busDelay =
1103 machineImplementation.icDecoderPluginFile(),
1104 machineImplementation.icDecoderPluginName(),
1105 path,
1106 machineImplementation,
1107 *sourceSocketImplementation,
1108 *busImplementation,
1109 *destinationSocketImplementation);
1110
1111 // the total delay of the path
1112 pathDelay = readDelay + busDelay + writeDelay;
1113
1114 maximumICDelay = std::max(maximumICDelay, pathDelay);
1115
1116#ifdef LONGEST_PATH_DEBUGGING
1117 const TTAMachine::Bus& bus = path.bus();
1119 << sourcePort.parentUnit()->name() << "::"
1120 << sourcePort.name() << " (" << readDelay << "), "
1121 << bus.name() << " (" << busDelay << "), "
1122 << destinationPort.parentUnit()->name() << "::"
1123 << destinationPort.name() << " (" << writeDelay << ") = "
1124 << pathDelay << std::endl;
1125#endif
1126 } // end of a for statement to calculate delays for all paths
1127
1128 // find out if the longest path is in a function unit
1129 DelayInNanoSeconds maximumFUDelay = 0.0;
1130
1131 // go through all function units and compute the computation delays
1132 // for all of them and store the largest found delay
1135 for (int i = 0; i < fuNav.count(); ++i) {
1136 const TTAMachine::FunctionUnit& fu = *fuNav.item(i);
1137
1138 if (!machineImplementation.hasFUImplementation(fu.name())) {
1139 throw CannotEstimateCost(
1140 __FILE__, __LINE__, __func__,
1141 (boost::format(
1142 "Implementation information missing for function unit "
1143 "'%s'.") % fu.name()).str());
1144 }
1145 DelayInNanoSeconds delay =
1147 fu, machineImplementation.fuImplementation(fu.name()));
1148 maximumFUDelay = std::max(maximumFUDelay, delay);
1149
1150#ifdef LONGEST_PATH_DEBUGGING
1152 << "maximum computation delay of " << fu.name() << " = "
1153 << delay << " ns" << std::endl;
1154#endif
1155 }
1156
1157 // GCU not treated as a regular FU
1158 // GCU should be estimated with icdecoder
1159 /*
1160 const TTAMachine::FunctionUnit& gcu = *machine.controlUnit();
1161
1162 if (!machineImplementation.hasFUImplementation(gcu.name())) {
1163 throw CannotEstimateCost(
1164 __FILE__, __LINE__, __func__,
1165 (boost::format(
1166 "Implementation information missing for function unit "
1167 "'%s'.") % gcu.name()).str());
1168 }
1169
1170 DelayInNanoSeconds delay =
1171 functionUnitMaximumComputationDelay(
1172 gcu, machineImplementation.fuImplementation(gcu.name()));
1173
1174 maximumFUDelay = std::max(maximumFUDelay, delay);
1175
1176#ifdef LONGEST_PATH_DEBUGGING
1177 Application::logStream()
1178 << "maximum computation delay of " << gcu.name() << " (GCU) = "
1179 << delay << " ns" << std::endl;
1180#endif
1181 */
1182 // find out if the longest path is in a register file
1183 DelayInNanoSeconds maximumRFDelay = 0.0;
1184
1185 // go through all register files and compute the computation delays
1186 // for all of them and store the maximum of the calculated delay
1189 for (int i = 0; i < rfNav.count(); ++i) {
1190 const TTAMachine::BaseRegisterFile& rf = *rfNav.item(i);
1191
1192 if (!machineImplementation.hasRFImplementation(rf.name())) {
1193 throw CannotEstimateCost(
1194 __FILE__, __LINE__, __func__,
1195 (boost::format(
1196 "Implementation information missing for register file "
1197 "'%s'.") % rf.name()).str());
1198 }
1199
1200 DelayInNanoSeconds delay =
1202 rf, machineImplementation.rfImplementation(rf.name()));
1203
1204 maximumRFDelay = std::max(maximumRFDelay, delay);
1205
1206#ifdef LONGEST_PATH_DEBUGGING
1208 << "maximum computation delay of " << rf.name() << " = "
1209 << delay << " ns" << std::endl;
1210#endif
1211 }
1212
1213 delete icPaths;
1214 icPaths = NULL;
1215
1216 return std::max(maximumICDelay, std::max(maximumFUDelay, maximumRFDelay));
1217}
static TransportPathList * findAllICPaths(const TTAMachine::Machine &machine)
DelayInNanoSeconds registerFileMaximumComputationDelay(const TTAMachine::BaseRegisterFile &architecture, const IDF::RFImplementationLocation &implementationEntry)
Definition Estimator.cc:876
DelayInNanoSeconds functionUnitMaximumComputationDelay(const TTAMachine::FunctionUnit &architecture, const IDF::FUImplementationLocation &implementation)
Definition Estimator.cc:834
DelayInNanoSeconds estimateSocketToSocketDelayOfPath(const std::string pluginPath, const std::string pluginName, const TransportPath &path, const IDF::MachineImplementation &machineImplementation, const IDF::SocketImplementationLocation &sourceSocketImplementation, const IDF::BusImplementationLocation &busImplementation, const IDF::SocketImplementationLocation &destinationSocketImplementation)
DelayInNanoSeconds registerFilePortWriteDelay(const TTAMachine::RFPort &port, const IDF::RFImplementationLocation &implementationEntry)
Definition Estimator.cc:756
DelayInNanoSeconds functionUnitPortReadDelay(const TTAMachine::FUPort &port, const IDF::FUImplementationLocation &implementationEntry)
Definition Estimator.cc:718
DelayInNanoSeconds registerFilePortReadDelay(const TTAMachine::RFPort &port, const IDF::RFImplementationLocation &implementationEntry)
Definition Estimator.cc:793
DelayInNanoSeconds functionUnitPortWriteDelay(const TTAMachine::FUPort &port, const IDF::FUImplementationLocation &implementationEntry)
Definition Estimator.cc:679
BusImplementationLocation & busImplementation(const std::string &bus) const
SocketImplementationLocation & socketImplementation(const std::string &socket) const
RFImplementationLocation & iuImplementation(const std::string &iu) const
RFImplementationLocation & rfImplementation(const std::string &rf) const
bool hasIUImplementation(const std::string &unitName) const
FUImplementationLocation & fuImplementation(const std::string &fu) const
bool hasRFImplementation(const std::string &unitName) const
bool hasBusImplementation(const std::string &busName) const
bool hasSocketImplementation(const std::string &socketName) const
bool hasFUImplementation(const std::string &unitName) const
static NullUnitImplementationLocation & instance()
virtual RegisterFileNavigator registerFileNavigator() const
Definition Machine.cc:450
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition Machine.cc:380
virtual SocketNavigator socketNavigator() const
Definition Machine.cc:368
BaseRegisterFile * parentUnit() const
Definition RFPort.cc:93

References __func__, CostEstimator::TransportPath::bus(), IDF::MachineImplementation::busImplementation(), TTAMachine::Machine::busNavigator(), TTAMachine::Segment::connectionCount(), TTAMachine::Machine::Navigator< ComponentType >::count(), CostEstimator::TransportPath::destinationPort(), CostEstimator::TransportPath::destinationSocket(), estimateSocketToSocketDelayOfPath(), findAllICPaths(), IDF::MachineImplementation::fuImplementation(), functionUnitMaximumComputationDelay(), TTAMachine::Machine::functionUnitNavigator(), functionUnitPortReadDelay(), functionUnitPortWriteDelay(), IDF::MachineImplementation::hasBusImplementation(), IDF::MachineImplementation::hasFUImplementation(), IDF::MachineImplementation::hasICDecoderHDB(), IDF::MachineImplementation::hasICDecoderPluginFile(), IDF::MachineImplementation::hasICDecoderPluginName(), IDF::MachineImplementation::hasIUImplementation(), IDF::MachineImplementation::hasRFImplementation(), IDF::MachineImplementation::hasSocketImplementation(), IDF::MachineImplementation::icDecoderPluginFile(), IDF::MachineImplementation::icDecoderPluginName(), IDF::NullUnitImplementationLocation::instance(), TTAMachine::Machine::Navigator< ComponentType >::item(), IDF::MachineImplementation::iuImplementation(), Application::logStream(), machine, TTAMachine::Component::name(), TTAMachine::Port::name(), TTAMachine::BaseFUPort::parentUnit(), TTAMachine::Port::parentUnit(), TTAMachine::RFPort::parentUnit(), registerFileMaximumComputationDelay(), TTAMachine::Machine::registerFileNavigator(), registerFilePortReadDelay(), registerFilePortWriteDelay(), IDF::MachineImplementation::rfImplementation(), TTAMachine::Bus::segment(), IDF::MachineImplementation::socketImplementation(), TTAMachine::Machine::socketNavigator(), CostEstimator::TransportPath::sourcePort(), and CostEstimator::TransportPath::sourceSocket().

Referenced by DesignSpaceExplorer::createEstimateData(), ImmediateGenerator::explore(), and main().

Here is the call graph for this function:

◆ registerFileArea()

AreaInGates CostEstimator::Estimator::registerFileArea ( const TTAMachine::BaseRegisterFile architecture,
const IDF::RFImplementationLocation implementationEntry 
)

Estimates the area of the given register file.

Parameters
architectureThe RF architecture of which area to estimate.
implementationEntryThe implementation information of RF. Can be an instance of NullRFImplementationLocation.
Exceptions
CannotEstimateCostIn case the area could not be estimated.
Returns
Estimate of area.

Definition at line 398 of file Estimator.cc.

400 {
401 try {
402 AreaInGates area = 0.0;
404 implementationEntry.hdbFile());
405 if (!rfCostFunctionPluginOfImplementation(implementationEntry).
406 estimateArea(architecture, implementationEntry, area, hdb)) {
407 throw CannotEstimateCost(
408 __FILE__, __LINE__, __func__,
409 std::string("Plugin was unable to estimate area."));
410 }
411 return area;
412 } catch (const Exception& e) {
413 throw CannotEstimateCost(
414 __FILE__, __LINE__, __func__,
415 std::string("Unable to estimate area of register file '") +
416 architecture.name() + "'. " + e.errorMessage());
417 }
418 return 0.0;
419}
RFCostEstimationPlugin & rfCostFunctionPluginOfImplementation(const IDF::RFImplementationLocation &implementation)
Definition Estimator.cc:312

References __func__, Exception::errorMessage(), HDB::HDBRegistry::hdb(), IDF::UnitImplementationLocation::hdbFile(), HDB::HDBRegistry::instance(), TTAMachine::Component::name(), and rfCostFunctionPluginOfImplementation().

Referenced by ComponentImplementationSelector::iuImplementations(), ComponentImplementationSelector::rfImplementations(), and totalAreaOfRegisterFiles().

Here is the call graph for this function:

◆ registerFileEnergy()

EnergyInMilliJoules CostEstimator::Estimator::registerFileEnergy ( const TTAMachine::BaseRegisterFile architecture,
const IDF::RFImplementationLocation implementationEntry,
const TTAProgram::Program program,
const ExecutionTrace traceDB 
)

Estimates the energy consumed by the given register file when running the given program.

Parameters
architectureThe RF architecture of which area to estimate.
implementationEntryThe implementation information of RF. Can be an instance of NullRFImplementationLocation.
programThe program of which energy to calculate.
traceDBThe simulation trace database of the program running in the target architecture.
Returns
Estimate of consumed energy.
Exceptions
CannotEstimateCostIn case the energy could not be estimated.

Definition at line 551 of file Estimator.cc.

554 {
555 try {
556 AreaInGates area = 0.0;
558 implementationEntry.hdbFile());
559 if (!rfCostFunctionPluginOfImplementation(implementationEntry).
560 estimateEnergy(
561 architecture, implementationEntry, program, traceDB, area,
562 hdb)) {
563 throw CannotEstimateCost(
564 __FILE__, __LINE__, __func__,
565 std::string("Plugin was unable to estimate energy."));
566 }
567 return area;
568 } catch (const Exception& e) {
569 throw CannotEstimateCost(
570 __FILE__, __LINE__, __func__,
571 std::string("Unable to estimate energy of register file '") +
572 architecture.name() + "'. " + e.errorMessage());
573 }
574 return 0.0;
575}

References __func__, Exception::errorMessage(), HDB::HDBRegistry::hdb(), IDF::UnitImplementationLocation::hdbFile(), HDB::HDBRegistry::instance(), TTAMachine::Component::name(), program, and rfCostFunctionPluginOfImplementation().

Referenced by totalEnergyOfRegisterFiles().

Here is the call graph for this function:

◆ registerFileMaximumComputationDelay()

DelayInNanoSeconds CostEstimator::Estimator::registerFileMaximumComputationDelay ( const TTAMachine::BaseRegisterFile architecture,
const IDF::RFImplementationLocation implementationEntry 
)

Estimates the maximum computation delay of the given register file.

The maximum computation delay is the longest stage in a RF's execution. It's used mainly for calculating the maximum clock frequency of target architecture.

Parameters
architectureThe RF architecture of which area to estimate.
implementationEntryThe implementation information of RF.
Exceptions
CannotEstimateCostIn case the computation delay could not be estimated.
Returns
Estimate of computation delay of the given RF.

Definition at line 876 of file Estimator.cc.

878 {
879 try {
880 DelayInNanoSeconds delay = 0.0;
882 implementationEntry.hdbFile());
883 if (!rfCostFunctionPluginOfImplementation(implementationEntry).
884 estimateMaximumComputationDelay(
885 architecture, implementationEntry, delay, hdb)) {
886 throw CannotEstimateCost(
887 __FILE__, __LINE__, __func__,
888 std::string(
889 "Plugin was unable to estimate computation delay of RF ") +
890 architecture.name());
891 }
892 return delay;
893 } catch (const Exception& e) {
894 throw CannotEstimateCost(
895 __FILE__, __LINE__, __func__,
896 std::string(
897 "Computation delay estimation could not be done for the given "
898 "register file entry. ") +
899 e.errorMessage());
900 }
901 return 0.0;
902}

References __func__, Exception::errorMessage(), HDB::HDBRegistry::hdb(), IDF::UnitImplementationLocation::hdbFile(), HDB::HDBRegistry::instance(), TTAMachine::Component::name(), and rfCostFunctionPluginOfImplementation().

Referenced by ComponentImplementationSelector::iuImplementations(), longestPath(), and ComponentImplementationSelector::rfImplementations().

Here is the call graph for this function:

◆ registerFilePortReadDelay()

DelayInNanoSeconds CostEstimator::Estimator::registerFilePortReadDelay ( const TTAMachine::RFPort port,
const IDF::RFImplementationLocation implementationEntry 
)

Estimates the output delay of the given register file port.

Parameters
portThe RF port of which output delay to estimate.
implementationEntryThe implementation information of RF.
Exceptions
CannotEstimateCostIn case the output delay could not be estimated.
Returns
Estimate of output delay of the given RF.

Definition at line 793 of file Estimator.cc.

795 {
796 try {
797 DelayInNanoSeconds delay = 0.0;
799 implementationEntry.hdbFile());
800 if (!rfCostFunctionPluginOfImplementation(implementationEntry).
801 estimatePortReadDelay(port, implementationEntry, delay, hdb)) {
802 throw CannotEstimateCost(
803 __FILE__, __LINE__, __func__,
804 (boost::format(
805 "Plugin was unable to estimate output delay of port "
806 "%s::%s.") % port.parentUnit()->name() % port.name()).
807 str());
808 }
809 return delay;
810 } catch (const Exception& e) {
811 throw CannotEstimateCost(
812 __FILE__, __LINE__, __func__,
813 std::string(
814 "Output delay estimation could not be done for the given "
815 "register file entry. ") + e.errorMessage());
816 }
817 return 0.0;
818}

References __func__, Exception::errorMessage(), HDB::HDBRegistry::hdb(), IDF::UnitImplementationLocation::hdbFile(), HDB::HDBRegistry::instance(), TTAMachine::Component::name(), TTAMachine::Port::name(), TTAMachine::RFPort::parentUnit(), and rfCostFunctionPluginOfImplementation().

Referenced by longestPath().

Here is the call graph for this function:

◆ registerFilePortWriteDelay()

DelayInNanoSeconds CostEstimator::Estimator::registerFilePortWriteDelay ( const TTAMachine::RFPort port,
const IDF::RFImplementationLocation implementationEntry 
)

Estimates the input delay of the given register file port.

Parameters
portThe RF port of which input delay to estimate.
implementationEntryThe implementation information of the RF the port belongs to.
Exceptions
CannotEstimateCostIn case the input delay could not be estimated.
Returns
Estimate of input delay of the given RF port.

Definition at line 756 of file Estimator.cc.

758 {
759 try {
760 DelayInNanoSeconds delay = 0.0;
762 implementationEntry.hdbFile());
763 if (!rfCostFunctionPluginOfImplementation(implementationEntry).
764 estimatePortWriteDelay(port, implementationEntry, delay, hdb)) {
765 throw CannotEstimateCost(
766 __FILE__, __LINE__, __func__,
767 (boost::format(
768 "Plugin was unable to estimate input delay of port "
769 "%s::%s.") % port.parentUnit()->name() % port.name()).
770 str());
771 }
772 return delay;
773 } catch (const Exception& e) {
774 throw CannotEstimateCost(
775 __FILE__, __LINE__, __func__,
776 std::string(
777 "Input delay estimation could not be done for a "
778 "register file entry. ") + e.errorMessage());
779 }
780 return 0.0;
781}

References __func__, Exception::errorMessage(), HDB::HDBRegistry::hdb(), IDF::UnitImplementationLocation::hdbFile(), HDB::HDBRegistry::instance(), TTAMachine::Component::name(), TTAMachine::Port::name(), TTAMachine::RFPort::parentUnit(), and rfCostFunctionPluginOfImplementation().

Referenced by longestPath().

Here is the call graph for this function:

◆ rfCostFunctionPluginOfImplementation()

RFCostEstimationPlugin & CostEstimator::Estimator::rfCostFunctionPluginOfImplementation ( const IDF::RFImplementationLocation implementationEntry)
private

Loads a RF cost estimation plugin for the given RF implementation.

Parameters
implementationEntryThe implementation of the RF.
Returns
The plugin.
Exceptions
ExceptionIn case the plugin was not found or could not be loaded.

Definition at line 312 of file Estimator.cc.

313 {
314 std::string pluginFileName = "";
315 std::string pluginName = "";
316 HDB::HDBManager* theHDB = NULL;
317 try {
318 // use the HDB to find the estimation plugin from the plugin
319 // registry
320 theHDB = &HDBRegistry::instance().hdb(implementationEntry.hdbFile());
321 HDB::RFEntry* rfEntry = theHDB->rfByEntryID(implementationEntry.id());
322
323 if (rfEntry == NULL || !rfEntry->hasCostFunction()) {
324 delete rfEntry;
325 rfEntry = NULL;
326 throw Exception(
327 __FILE__, __LINE__, __func__,
328 (boost::format(
329 "Register file entry %d does not have cost "
330 "estimation plugin set.") % implementationEntry.id()).str());
331 }
332
333 HDB::CostFunctionPlugin& pluginData = rfEntry->costFunction();
334 pluginFileName = pluginData.pluginFilePath();
335 pluginName = pluginData.name();
336
337 try {
339 pluginFileName, pluginName);
340 } catch (const Exception& e) {
341 throw CannotEstimateCost(
342 __FILE__, __LINE__, __func__,
343 std::string("Unable to open RF estimation plugin '") +
344 pluginFileName + "'. " + e.errorMessage());
345 }
346 } catch (const Exception& e) {
347 throw Exception(
348 __FILE__, __LINE__, __func__, e.errorMessage());
349 }
350 // avoid warnings with some compilers
351 throw 1;
352}
RFCostEstimationPluginRegistry rfEstimatorPluginRegistry_
all accessed RF estimation plugins are stored in this registry
Definition Estimator.hh:204
RFEntry * rfByEntryID(RowID id) const

References __func__, HDB::HDBEntry::costFunction(), Exception::errorMessage(), HDB::HDBEntry::hasCostFunction(), HDB::HDBRegistry::hdb(), IDF::UnitImplementationLocation::hdbFile(), IDF::UnitImplementationLocation::id(), HDB::HDBRegistry::instance(), HDB::CostFunctionPlugin::name(), CostEstimator::CostEstimationPluginRegistry< T >::plugin(), HDB::CostFunctionPlugin::pluginFilePath(), HDB::HDBManager::rfByEntryID(), and rfEstimatorPluginRegistry_.

Referenced by registerFileArea(), registerFileEnergy(), registerFileMaximumComputationDelay(), registerFilePortReadDelay(), and registerFilePortWriteDelay().

Here is the call graph for this function:

◆ totalArea()

AreaInGates CostEstimator::Estimator::totalArea ( const TTAMachine::Machine machine,
const IDF::MachineImplementation machineImplementation 
)

area estimation functions

Estimates the total area of given machine.

Area estimate is calculated as a sum of areas of different machine parts.

Parameters
machineThe machine architecture to estimate.
machineImplementationThe machine implementation information.
Exceptions
CannotEstimateCostIn case cost cannot be estimated for some reason. Reason is given in error message.

Definition at line 84 of file Estimator.cc.

86 {
87 return totalAreaOfFunctionUnits(machine, machineImplementation) +
88 totalAreaOfRegisterFiles(machine, machineImplementation) +
89 icArea(machine, machineImplementation);
90}
AreaInGates icArea(const TTAMachine::Machine &machine, const IDF::MachineImplementation &machineImplementation)
Definition Estimator.cc:206
AreaInGates totalAreaOfFunctionUnits(const TTAMachine::Machine &machine, const IDF::MachineImplementation &machineImplementation)
Definition Estimator.cc:103
AreaInGates totalAreaOfRegisterFiles(const TTAMachine::Machine &machine, const IDF::MachineImplementation &machineImplementation)
Definition Estimator.cc:162

References icArea(), machine, totalAreaOfFunctionUnits(), and totalAreaOfRegisterFiles().

Referenced by DesignSpaceExplorer::createEstimateData(), ImmediateGenerator::explore(), and main().

Here is the call graph for this function:

◆ totalAreaOfFunctionUnits()

AreaInGates CostEstimator::Estimator::totalAreaOfFunctionUnits ( const TTAMachine::Machine machine,
const IDF::MachineImplementation machineImplementation 
)

Estimates the total area of all function units in the given machine.

GCU is not treated as an FU. It should be estimated as a part of IC.

Parameters
machineThe machine architecture to estimate.
machineImplementationThe machine implementation information.
Exceptions
CannotEstimateCostIn case cost cannot be estimated for some reason. Reason is given in error message.

Definition at line 103 of file Estimator.cc.

105 {
106 AreaInGates total = 0.0;
109 for (int i = 0; i < nav.count(); ++i) {
110 TTAMachine::FunctionUnit* fuArchitecture = nav.item(i);
111 IDF::FUImplementationLocation* fuImplementation =
113
114 if (machineImplementation.hasFUImplementation(
115 fuArchitecture->name())) {
116 fuImplementation = &machineImplementation.fuImplementation(
117 fuArchitecture->name());
118 }
119
121 functionUnitArea(*fuArchitecture, *fuImplementation);
122 total += areaFU;
123
124 if (areaFU <= 0) {
126 << "Warning: gate count of FU '"
127 << fuArchitecture->name() << "' was estimated as "
128 << areaFU << std::endl;
129 } else if (Application::verboseLevel() > 0) {
131 << "FU '" << fuArchitecture->name()
132 << "' contributes " << areaFU << " gates" << std::endl;
133 }
134 }
135 // GCU is not included in the MOM FU navigator, so we have to treat it
136 // separately
137 // GCU should be estimated as a part of IC.
138 /*
139 TTAMachine::FunctionUnit* fuArchitecture = machine.controlUnit();
140 IDF::FUImplementationLocation* fuImplementation =
141 &IDF::NullFUImplementationLocation::instance();
142
143 if (machineImplementation.hasFUImplementation(
144 fuArchitecture->name())) {
145 fuImplementation = &machineImplementation.fuImplementation(
146 fuArchitecture->name());
147 }
148 total += functionUnitArea(*fuArchitecture, *fuImplementation);
149 */
150 return total;
151}
static std::ostream & warningStream()
AreaInGates functionUnitArea(const TTAMachine::FunctionUnit &architecture, const IDF::FUImplementationLocation &implementationEntry)
Definition Estimator.cc:364

References TTAMachine::Machine::Navigator< ComponentType >::count(), IDF::MachineImplementation::fuImplementation(), functionUnitArea(), TTAMachine::Machine::functionUnitNavigator(), IDF::MachineImplementation::hasFUImplementation(), IDF::NullUnitImplementationLocation::instance(), TTAMachine::Machine::Navigator< ComponentType >::item(), Application::logStream(), machine, TTAMachine::Component::name(), Application::verboseLevel(), and Application::warningStream().

Referenced by totalArea().

Here is the call graph for this function:

◆ totalAreaOfRegisterFiles()

AreaInGates CostEstimator::Estimator::totalAreaOfRegisterFiles ( const TTAMachine::Machine machine,
const IDF::MachineImplementation machineImplementation 
)

Estimates the total area of all register files in the given machine.

Parameters
machineThe machine architecture to estimate.
machineImplementationThe machine implementation information.
Exceptions
CannotEstimateCostIn case cost cannot be estimated for some reason. Reason is given in error message.

Definition at line 162 of file Estimator.cc.

164 {
165 AreaInGates total = 0.0;
168 for (int i = 0; i < nav.count(); ++i) {
169 TTAMachine::BaseRegisterFile* rfArchitecture = nav.item(i);
170 IDF::RFImplementationLocation* rfImplementation =
172
173 if (machineImplementation.hasRFImplementation(
174 rfArchitecture->name())) {
175 rfImplementation = &machineImplementation.rfImplementation(
176 rfArchitecture->name());
177 }
178
180 registerFileArea(*rfArchitecture, *rfImplementation);
181 total += areaRF;
182
183 if (areaRF <= 0) {
185 << "Warning: gate count of RF '"
186 << rfArchitecture->name() << "' was estimated as "
187 << areaRF << std::endl;
188 } else if (Application::verboseLevel() > 0) {
190 << "RF '" << rfArchitecture->name()
191 << "' contributes " << areaRF << " gates" << std::endl;
192 }
193 }
194 return total;
195}
AreaInGates registerFileArea(const TTAMachine::BaseRegisterFile &architecture, const IDF::RFImplementationLocation &implementationEntry)
Definition Estimator.cc:398

References TTAMachine::Machine::Navigator< ComponentType >::count(), IDF::MachineImplementation::hasRFImplementation(), IDF::NullUnitImplementationLocation::instance(), TTAMachine::Machine::Navigator< ComponentType >::item(), Application::logStream(), machine, TTAMachine::Component::name(), registerFileArea(), TTAMachine::Machine::registerFileNavigator(), IDF::MachineImplementation::rfImplementation(), Application::verboseLevel(), and Application::warningStream().

Referenced by totalArea().

Here is the call graph for this function:

◆ totalEnergy()

EnergyInMilliJoules CostEstimator::Estimator::totalEnergy ( const TTAMachine::Machine machine,
const IDF::MachineImplementation machineImplementation,
const TTAProgram::Program program,
const ExecutionTrace traceDB 
)

energy estimation functions

Estimates the total energy consumed by the given processor running the given program.

Parameters
machineArchitecture of the processor.
machineImplementationImplementation information of the processor.
traceDBThe execution trace database obtained from simulating the program.
Returns
Energy in milli joules.
Exceptions
CannotEstimateCostIf the energy could not be estimated.

Definition at line 433 of file Estimator.cc.

436 {
438 machine, machineImplementation, program, traceDB) +
440 machine, machineImplementation, program, traceDB) +
441 icEnergy(machine, machineImplementation, program, traceDB);
442}
EnergyInMilliJoules totalEnergyOfFunctionUnits(const TTAMachine::Machine &machine, const IDF::MachineImplementation &machineImplementation, const TTAProgram::Program &program, const ExecutionTrace &traceDB)
Definition Estimator.cc:592
EnergyInMilliJoules icEnergy(const TTAMachine::Machine &machine, const IDF::MachineImplementation &machineImplementation, const TTAProgram::Program &program, const ExecutionTrace &traceDB)
Definition Estimator.cc:456
EnergyInMilliJoules totalEnergyOfRegisterFiles(const TTAMachine::Machine &machine, const IDF::MachineImplementation &machineImplementation, const TTAProgram::Program &program, const ExecutionTrace &traceDB)
Definition Estimator.cc:645

References icEnergy(), machine, program, totalEnergyOfFunctionUnits(), and totalEnergyOfRegisterFiles().

Referenced by DesignSpaceExplorer::evaluate(), and main().

Here is the call graph for this function:

◆ totalEnergyOfFunctionUnits()

EnergyInMilliJoules CostEstimator::Estimator::totalEnergyOfFunctionUnits ( const TTAMachine::Machine machine,
const IDF::MachineImplementation machineImplementation,
const TTAProgram::Program program,
const ExecutionTrace traceDB 
)

Estimates the total energy consumed by all function units in the machine (GCU not included).

Energy estimate is calculated as a sum of consumed energies of all FUs.

Parameters
machineThe machine architecture to estimate.
machineImplementationThe machine implementation information.
programThe program of which energy to calculate.
traceDBThe simulation trace database of the program running in the target architecture.
Exceptions
CannotEstimateCostIn case cost cannot be estimated for some reason. Reason is given in error message.

Definition at line 592 of file Estimator.cc.

595 {
596 EnergyInMilliJoules total = 0.0;
599 for (int i = 0; i < nav.count(); ++i) {
600 TTAMachine::FunctionUnit* fuArchitecture = nav.item(i);
601 IDF::FUImplementationLocation* fuImplementation =
603
604 if (machineImplementation.hasFUImplementation(
605 fuArchitecture->name())) {
606 fuImplementation = &machineImplementation.fuImplementation(
607 fuArchitecture->name());
608 }
609 total += functionUnitEnergy(
610 *fuArchitecture, *fuImplementation, program, traceDB);
611 }
612 // GCU is not included in the MOM FU navigation, so we have to treat it
613 // separately
614 // GCU should be estimated by icdecoder
615 /*
616 TTAMachine::FunctionUnit* fuArchitecture = machine.controlUnit();
617 IDF::FUImplementationLocation* fuImplementation =
618 &IDF::NullFUImplementationLocation::instance();
619
620 if (machineImplementation.hasFUImplementation(
621 fuArchitecture->name())) {
622 fuImplementation = &machineImplementation.fuImplementation(
623 fuArchitecture->name());
624 }
625 total += functionUnitEnergy(
626 *fuArchitecture, *fuImplementation, program, traceDB);
627 */
628 return total;
629}
EnergyInMilliJoules functionUnitEnergy(const TTAMachine::FunctionUnit &architecture, const IDF::FUImplementationLocation &implementationEntry, const TTAProgram::Program &program, const ExecutionTrace &traceDB)
Definition Estimator.cc:510

References TTAMachine::Machine::Navigator< ComponentType >::count(), IDF::MachineImplementation::fuImplementation(), functionUnitEnergy(), TTAMachine::Machine::functionUnitNavigator(), IDF::MachineImplementation::hasFUImplementation(), IDF::NullUnitImplementationLocation::instance(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine, TTAMachine::Component::name(), and program.

Referenced by totalEnergy().

Here is the call graph for this function:

◆ totalEnergyOfRegisterFiles()

EnergyInMilliJoules CostEstimator::Estimator::totalEnergyOfRegisterFiles ( const TTAMachine::Machine machine,
const IDF::MachineImplementation machineImplementation,
const TTAProgram::Program program,
const ExecutionTrace traceDB 
)

Estimates the total energy consumed by all register files in the machine.

Energy estimate is calculated as a sum of energies of RFs.

Parameters
machineThe machine architecture to estimate.
machineImplementationThe machine implementation information.
programThe program of which energy to calculate.
traceDBThe simulation trace database of the program running in the target architecture.
Exceptions
CannotEstimateCostIn case cost cannot be estimated for some reason. Reason is given in error message.

Definition at line 645 of file Estimator.cc.

648 {
649 EnergyInMilliJoules total = 0.0;
652 for (int i = 0; i < nav.count(); ++i) {
653 TTAMachine::BaseRegisterFile* rfArchitecture = nav.item(i);
654 IDF::RFImplementationLocation* rfImplementation =
656
657 if (machineImplementation.hasRFImplementation(
658 rfArchitecture->name())) {
659 rfImplementation = &machineImplementation.rfImplementation(
660 rfArchitecture->name());
661 }
662 total += registerFileEnergy(
663 *rfArchitecture, *rfImplementation, program, traceDB);
664 }
665 return total;
666}
EnergyInMilliJoules registerFileEnergy(const TTAMachine::BaseRegisterFile &architecture, const IDF::RFImplementationLocation &implementationEntry, const TTAProgram::Program &program, const ExecutionTrace &traceDB)
Definition Estimator.cc:551

References TTAMachine::Machine::Navigator< ComponentType >::count(), IDF::MachineImplementation::hasRFImplementation(), IDF::NullUnitImplementationLocation::instance(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine, TTAMachine::Component::name(), program, registerFileEnergy(), TTAMachine::Machine::registerFileNavigator(), and IDF::MachineImplementation::rfImplementation().

Referenced by totalEnergy().

Here is the call graph for this function:

Member Data Documentation

◆ fuEstimatorPluginRegistry_

FUCostEstimationPluginRegistry CostEstimator::Estimator::fuEstimatorPluginRegistry_
private

all accessed FU estimation plugins are stored in this registry

Definition at line 202 of file Estimator.hh.

Referenced by fuCostFunctionPluginOfImplementation().

◆ icDecoderEstimatorPluginRegistry_

ICDecoderCostEstimationPluginRegistry CostEstimator::Estimator::icDecoderEstimatorPluginRegistry_
private

all accessed IC&decoder plugins are stored in this registry

Definition at line 206 of file Estimator.hh.

Referenced by estimateSocketToSocketDelayOfPath(), icArea(), and icEnergy().

◆ rfEstimatorPluginRegistry_

RFCostEstimationPluginRegistry CostEstimator::Estimator::rfEstimatorPluginRegistry_
private

all accessed RF estimation plugins are stored in this registry

Definition at line 204 of file Estimator.hh.

Referenced by rfCostFunctionPluginOfImplementation().


The documentation for this class was generated from the following files: