OpenASIP  2.0
Estimator.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2013 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file Estimator.cc
26  *
27  * Implementation of Estimator class
28  *
29  * @author Pekka Jääskeläinen 2005 (pjaaskel-no.spam-cs.tut.fi)
30  *
31  * @note rating: red
32  */
33 
34 #include <algorithm>
35 #include "boost/format.hpp"
36 
37 #include "Estimator.hh"
38 #include "Application.hh"
39 #include "Machine.hh"
44 #include "MachineImplementation.hh"
45 #include "HDBManager.hh"
46 #include "HDBRegistry.hh"
47 #include "CostFunctionPlugin.hh"
48 #include "FUEntry.hh"
49 #include "RFEntry.hh"
50 #include "Segment.hh"
51 #include "FUPort.hh"
52 #include "RFPort.hh"
53 #include "ControlUnit.hh"
54 #include "FullyConnectedCheck.hh"
55 #include "MachineCheckResults.hh"
56 
57 using namespace HDB;
58 
59 namespace CostEstimator {
60 
61 /**
62  * Constructor.
63  */
64 Estimator::Estimator() {
65 }
66 
67 /**
68  * Destructor.
69  */
70 Estimator::~Estimator() {
71 }
72 
73 /**
74  * Estimates the total area of given machine.
75  *
76  * Area estimate is calculated as a sum of areas of different machine parts.
77  *
78  * @param machine The machine architecture to estimate.
79  * @param machineImplementation The machine implementation information.
80  * @exception CannotEstimateCost In case cost cannot be estimated for some
81  * reason. Reason is given in error message.
82  */
84 Estimator::totalArea(
86  const IDF::MachineImplementation& machineImplementation) {
87  return totalAreaOfFunctionUnits(machine, machineImplementation) +
88  totalAreaOfRegisterFiles(machine, machineImplementation) +
89  icArea(machine, machineImplementation);
90 }
91 
92 /**
93  * Estimates the total area of all function units in the given machine.
94  *
95  * GCU is not treated as an FU. It should be estimated as a part of IC.
96  *
97  * @param machine The machine architecture to estimate.
98  * @param machineImplementation The machine implementation information.
99  * @exception CannotEstimateCost In case cost cannot be estimated for some
100  * reason. Reason is given in error message.
101  */
103 Estimator::totalAreaOfFunctionUnits(
105  const IDF::MachineImplementation& machineImplementation) {
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 }
152 
153 /**
154  * Estimates the total area of all register files in the given machine.
155  *
156  * @param machine The machine architecture to estimate.
157  * @param machineImplementation The machine implementation information.
158  * @exception CannotEstimateCost In case cost cannot be estimated for some
159  * reason. Reason is given in error message.
160  */
162 Estimator::totalAreaOfRegisterFiles(
164  const IDF::MachineImplementation& machineImplementation) {
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 }
196 
197 /**
198  * Estimates the area consumed by the interconnection network.
199  *
200  * @param machine The machine of which IC area to estimate.
201  * @param machineImplementation The machine implementation information.
202  * @exception CannotEstimateCost In case cost cannot be estimated for some
203  * reason. Reason is given in error message.
204  */
206 Estimator::icArea(
208  const IDF::MachineImplementation& machineImplementation) {
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 =
221  icDecoderEstimatorPluginRegistry_.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 }
250 
251 /**
252  * Loads an FU cost estimation plugin for the given FU implementation.
253  *
254  * @param implementationEntry The implementation of the FU.
255  * @return The plugin.
256  * @exception Exception In case the plugin was not found or could not be
257  * loaded.
258  */
260 Estimator::fuCostFunctionPluginOfImplementation(
261  const IDF::FUImplementationLocation& implementationEntry) {
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 {
287  return fuEstimatorPluginRegistry_.plugin(
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 }
302 
303 /**
304  * Loads a RF cost estimation plugin for the given RF implementation.
305  *
306  * @param implementationEntry The implementation of the RF.
307  * @return The plugin.
308  * @exception Exception In case the plugin was not found or could not be
309  * loaded.
310  */
312 Estimator::rfCostFunctionPluginOfImplementation(
313  const IDF::RFImplementationLocation& implementationEntry) {
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 {
338  return rfEstimatorPluginRegistry_.plugin(
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 }
353 
354 /**
355  * Estimates the area of the given function unit.
356  *
357  * @param architecture The FU architecture of which area to estimate.
358  * @param implementationEntry The implementation information of FU. Can be
359  * an instance of NullFUImplementationLocation.
360  * @exception CannotEstimateCost In case the area could not be estimated.
361  * @return Estimate of area.
362  */
364 Estimator::functionUnitArea(
365  const TTAMachine::FunctionUnit& architecture,
366  const IDF::FUImplementationLocation& implementationEntry) {
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 }
387 
388 /**
389  * Estimates the area of the given register file.
390  *
391  * @param architecture The RF architecture of which area to estimate.
392  * @param implementationEntry The implementation information of RF. Can be
393  * an instance of NullRFImplementationLocation.
394  * @exception CannotEstimateCost In case the area could not be estimated.
395  * @return Estimate of area.
396  */
398 Estimator::registerFileArea(
399  const TTAMachine::BaseRegisterFile& architecture,
400  const IDF::RFImplementationLocation& implementationEntry) {
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 }
420 
421 /**
422  * Estimates the total energy consumed by the given processor running the
423  * given program.
424  *
425  * @param machine Architecture of the processor.
426  * @param machineImplementation Implementation information of the processor.
427  * @param traceDB The execution trace database obtained from simulating the
428  * program.
429  * @return Energy in milli joules.
430  * @exception CannotEstimateCost If the energy could not be estimated.
431  */
433 Estimator::totalEnergy(
435  const IDF::MachineImplementation& machineImplementation,
436  const TTAProgram::Program& program, const ExecutionTrace& traceDB) {
437  return totalEnergyOfFunctionUnits(
438  machine, machineImplementation, program, traceDB) +
439  totalEnergyOfRegisterFiles(
440  machine, machineImplementation, program, traceDB) +
441  icEnergy(machine, machineImplementation, program, traceDB);
442 }
443 
444 /**
445  * Estimates the total energy consumed by the interconnection network
446  * of the given machine running the given program.
447  *
448  * @param machine Architecture of the processor.
449  * @param machineImplementation Implementation information of the processor.
450  * @param traceDB The simulation trace database obtained from simulating the
451  * program.
452  * @return Energy in milli joules.
453  * @exception CannotEstimateCost If the energy could not be estimated.
454  */
456 Estimator::icEnergy(
458  const IDF::MachineImplementation& machineImplementation,
459  const TTAProgram::Program& program, const ExecutionTrace& traceDB) {
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 =
472  icDecoderEstimatorPluginRegistry_.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 }
495 
496 /**
497  * Estimates the energy consumed by the given FU when running the given
498  * program.
499  *
500  * @param architecture The FU architecture of which area to estimate.
501  * @param implementationEntry The implementation information of FU. Can be
502  * an instance of NullFUImplementationLocation.
503  * @param program The program of which energy to calculate.
504  * @param traceDB The simulation trace database of the program running in the
505  * target architecture.
506  * @return Estimate of consumed energy.
507  * @exception CannotEstimateCost In case the energy could not be estimated.
508  */
510 Estimator::functionUnitEnergy(
511  const TTAMachine::FunctionUnit& architecture,
512  const IDF::FUImplementationLocation& implementationEntry,
513  const TTAProgram::Program& program, const ExecutionTrace& traceDB) {
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 }
536 
537 /**
538  * Estimates the energy consumed by the given register file when running
539  * the given program.
540  *
541  * @param architecture The RF architecture of which area to estimate.
542  * @param implementationEntry The implementation information of RF. Can be
543  * an instance of NullRFImplementationLocation.
544  * @param program The program of which energy to calculate.
545  * @param traceDB The simulation trace database of the program running in the
546  * target architecture.
547  * @return Estimate of consumed energy.
548  * @exception CannotEstimateCost In case the energy could not be estimated.
549  */
551 Estimator::registerFileEnergy(
552  const TTAMachine::BaseRegisterFile& architecture,
553  const IDF::RFImplementationLocation& implementationEntry,
554  const TTAProgram::Program& program, const ExecutionTrace& traceDB) {
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 }
576 
577 /**
578  * Estimates the total energy consumed by all function units in the machine
579  * (GCU not included).
580  *
581  * Energy estimate is calculated as a sum of consumed energies of all FUs.
582  *
583  * @param machine The machine architecture to estimate.
584  * @param machineImplementation The machine implementation information.
585  * @param program The program of which energy to calculate.
586  * @param traceDB The simulation trace database of the program running in the
587  * target architecture.
588  * @exception CannotEstimateCost In case cost cannot be estimated for some
589  * reason. Reason is given in error message.
590  */
592 Estimator::totalEnergyOfFunctionUnits(
594  const IDF::MachineImplementation& machineImplementation,
595  const TTAProgram::Program& program, const ExecutionTrace& traceDB) {
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 }
630 
631 /**
632  * Estimates the total energy consumed by all register files in the machine.
633  *
634  * Energy estimate is calculated as a sum of energies of RFs.
635  *
636  * @param machine The machine architecture to estimate.
637  * @param machineImplementation The machine implementation information.
638  * @param program The program of which energy to calculate.
639  * @param traceDB The simulation trace database of the program running in the
640  * target architecture.
641  * @exception CannotEstimateCost In case cost cannot be estimated for some
642  * reason. Reason is given in error message.
643  */
645 Estimator::totalEnergyOfRegisterFiles(
647  const IDF::MachineImplementation& machineImplementation,
648  const TTAProgram::Program& program, const ExecutionTrace& traceDB) {
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 }
667 
668 /**
669  * Estimates the input delay of the given function unit port.
670  *
671  * @param port The architecture of FU port of which area to estimate.
672  * @param implementationEntry The implementation information of the FU the port
673  * belongs to.
674  * @exception CannotEstimateCost In case the input delay could not be
675  * estimated.
676  * @return Estimate of input delay of the given FU port.
677  */
679 Estimator::functionUnitPortWriteDelay(
680  const TTAMachine::FUPort& port,
681  const IDF::FUImplementationLocation& implementationEntry) {
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 }
706 
707 /**
708  * Estimates the output delay of the given function unit port.
709  *
710  * @param port The architecture of the FU port of which area to estimate.
711  * @param implementationEntry The implementation information of the FU port
712  * belongs to.
713  * @exception CannotEstimateCost In case the output delay could not be
714  * estimated.
715  * @return Estimate of output delay of the given FU port.
716  */
718 Estimator::functionUnitPortReadDelay(
719  const TTAMachine::FUPort& port,
720  const IDF::FUImplementationLocation& implementationEntry) {
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 }
744 
745 /**
746  * Estimates the input delay of the given register file port.
747  *
748  * @param port The RF port of which input delay to estimate.
749  * @param implementationEntry The implementation information of the RF the
750  * port belongs to.
751  * @exception CannotEstimateCost In case the input delay could not be
752  * estimated.
753  * @return Estimate of input delay of the given RF port.
754  */
756 Estimator::registerFilePortWriteDelay(
757  const TTAMachine::RFPort& port,
758  const IDF::RFImplementationLocation& implementationEntry) {
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 }
782 
783 /**
784  * Estimates the output delay of the given register file port.
785  *
786  * @param port The RF port of which output delay to estimate.
787  * @param implementationEntry The implementation information of RF.
788  * @exception CannotEstimateCost In case the output delay could not be
789  * estimated.
790  * @return Estimate of output delay of the given RF.
791  */
793 Estimator::registerFilePortReadDelay(
794  const TTAMachine::RFPort& port,
795  const IDF::RFImplementationLocation& implementationEntry) {
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 }
819 
820 /**
821  * Estimates the maximum computation delay of the given function unit.
822  *
823  * The maximum computation delay is the longest stage in the FU unit's
824  * pipeline. It's used mainly for calculating the maximum clock frequency
825  * of target architecture by finding the longest path of the machine.
826  *
827  * @param architecture The FU architecture of which area to estimate.
828  * @param implementationEntry The implementation information of FU.
829  * @exception CannotEstimateCost In case the computation delay could not be
830  * estimated.
831  * @return Estimate of computation delay of the given FU.
832  */
834 Estimator::functionUnitMaximumComputationDelay(
835  const TTAMachine::FunctionUnit& architecture,
836  const IDF::FUImplementationLocation& implementationEntry) {
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 }
861 
862 /**
863  * Estimates the maximum computation delay of the given register file.
864  *
865  * The maximum computation delay is the longest stage in a RF's execution.
866  * It's used mainly for calculating the maximum clock frequency of target
867  * architecture.
868  *
869  * @param architecture The RF architecture of which area to estimate.
870  * @param implementationEntry The implementation information of RF.
871  * @exception CannotEstimateCost In case the computation delay could not be
872  * estimated.
873  * @return Estimate of computation delay of the given RF.
874  */
876 Estimator::registerFileMaximumComputationDelay(
877  const TTAMachine::BaseRegisterFile& architecture,
878  const IDF::RFImplementationLocation& implementationEntry) {
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 }
903 
904 /**
905  * Calculates the longest path of the machine.
906  *
907  * The longest path is the longest delay in the machine. It can be a path
908  * in interconnection network or a computation delay of an FU.
909  *
910  * @param machine Machine to calculate the longest path for.
911  * @param machineImplementation Implementation identifier for the machine.
912  * @return The delay of the longest path.
913  */
915 Estimator::longestPath(
917  const IDF::MachineImplementation& machineImplementation) {
918  //#define LONGEST_PATH_DEBUGGING
919 
920  DelayInNanoSeconds maximumICDelay = 0.0;
921 
922  // find all the paths in IC
923  TransportPathList* icPaths = findAllICPaths(machine);
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);
977  const TTAMachine::BaseRegisterFile& rf =
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 =
1102  estimateSocketToSocketDelayOfPath(
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 =
1146  functionUnitMaximumComputationDelay(
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 =
1201  registerFileMaximumComputationDelay(
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 }
1218 
1219 /**
1220  * Finds all paths in the interconnection network of the given machine.
1221  *
1222  * @param machine Machine to search the paths in.
1223  * @return List of transport paths. Becomes property of the client.
1224  * @exception IllegalMachine In case the machine is badly formed, for example,
1225  * has features that are not supported yet.
1226  */
1228 Estimator::findAllICPaths(const TTAMachine::Machine& machine) {
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 }
1297 
1298 /**
1299  * Estimates the delay of a single socket-to-socket path.
1300  *
1301  * Delegates the task to the given IC&decoder plugin.
1302  *
1303  * @param pluginPath The path of the IC&decoder estimator plugin to use.
1304  * @param pluginName The name of the IC&decoder estimator plugin to use.
1305  * @param pluginDataHDB The HDB from which the plugin should fetch its data.
1306  * @param path The path to estimate.
1307  * @param machineImplementation Implementation of the machine.
1308  * @param sourceSocketImplementation The implementation descriptor of source
1309  * socket.
1310  * @param busImplementation The implementation descriptor of bus.
1311  * @param destinationSocketImplementation The implementation descriptor of
1312  * destination socket.
1313 
1314  */
1316 Estimator::estimateSocketToSocketDelayOfPath(
1317  const std::string pluginPath, const std::string pluginName,
1318  const TransportPath& path,
1319  const IDF::MachineImplementation& machineImplementation,
1320  const IDF::SocketImplementationLocation& sourceSocketImplementation,
1321  const IDF::BusImplementationLocation& busImplementation,
1322  const IDF::SocketImplementationLocation& destinationSocketImplementation) {
1323  DelayInNanoSeconds delay = 0.0;
1324  try {
1325 
1326  ICDecoderEstimatorPlugin& plugin =
1327  icDecoderEstimatorPluginRegistry_.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 }
1348 }
1349 
CostEstimator::RFCostEstimationPlugin
Definition: RFCostEstimationPlugin.hh:67
IDF::UnitImplementationLocation
Definition: UnitImplementationLocation.hh:48
HDB::FUEntry
Definition: FUEntry.hh:49
TTAProgram::Program
Definition: Program.hh:63
HDB::HDBEntry::costFunction
CostFunctionPlugin & costFunction() const
Definition: HDBEntry.cc:111
IDF::MachineImplementation::hasRFImplementation
bool hasRFImplementation(const std::string &unitName) const
Definition: MachineImplementation.cc:245
IDF::MachineImplementation::hasICDecoderPluginFile
bool hasICDecoderPluginFile() const
Definition: MachineImplementation.cc:168
TTAMachine::Socket::port
Port * port(int index) const
Definition: Socket.cc:266
TTAMachine::Socket::portCount
int portCount() const
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
HDB
Definition: CostDatabase.hh:49
machine
TTAMachine::Machine * machine
the architecture definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:59
TTAMachine::Socket::OUTPUT
@ OUTPUT
Data goes from port to bus.
Definition: Socket.hh:60
TTAMachine::BaseFUPort::parentUnit
FunctionUnit * parentUnit() const
Definition: BaseFUPort.cc:96
TTAMachine::Segment
Definition: Segment.hh:54
TTAMachine::Bus
Definition: Bus.hh:53
TTAMachine::BaseFUPort
Definition: BaseFUPort.hh:44
CannotEstimateCost
Definition: Exception.hh:748
HDB::RFEntry
Definition: RFEntry.hh:47
IDF::MachineImplementation::iuImplementation
RFImplementationLocation & iuImplementation(const std::string &iu) const
Definition: MachineImplementation.cc:399
HDB::HDBRegistry::hdb
CachedHDBManager & hdb(const std::string fileName)
Definition: HDBRegistry.cc:80
CostEstimator::TransportPath::bus
const TTAMachine::Bus & bus() const
Definition: TransportPath.cc:82
Application::verboseLevel
static int verboseLevel()
Definition: Application.hh:176
IDF::MachineImplementation::socketImplementation
SocketImplementationLocation & socketImplementation(const std::string &socket) const
Definition: MachineImplementation.cc:441
CostEstimator::AreaInGates
double AreaInGates
type for area values in equivalent gates
Definition: CostEstimatorTypes.hh:35
Application::logStream
static std::ostream & logStream()
Definition: Application.cc:155
Estimator.hh
TTAMachine::Machine::Navigator::count
int count() const
TTAMachine::Socket::direction
Direction direction() const
TTAMachine::Bus::segment
virtual Segment * segment(int index) const
Definition: Bus.cc:329
HDB::HDBEntry::hasCostFunction
bool hasCostFunction() const
Definition: HDBEntry.cc:99
IDF::MachineImplementation::hasFUImplementation
bool hasFUImplementation(const std::string &unitName) const
Definition: MachineImplementation.cc:231
FullyConnectedCheck.hh
TTAMachine::RFPort
Definition: RFPort.hh:45
FUCostEstimationPlugin.hh
IDF::MachineImplementation::hasIUImplementation
bool hasIUImplementation(const std::string &unitName) const
Definition: MachineImplementation.cc:259
CostEstimator::ICDecoderEstimatorPlugin::estimateICEnergy
virtual bool estimateICEnergy(HDB::HDBRegistry &hdbRegistry, const TTAMachine::Machine &machine, const IDF::MachineImplementation &machineImplementation, const TTAProgram::Program &program, const ExecutionTrace &traceDB, EnergyInMilliJoules &energy)
Definition: ICDecoderEstimatorPlugin.cc:124
CostEstimator::TransportPath::destinationSocket
const TTAMachine::Socket & destinationSocket() const
Definition: TransportPath.cc:92
CostEstimator::EnergyInMilliJoules
double EnergyInMilliJoules
type for consumed energy in milli joules
Definition: CostEstimatorTypes.hh:37
IDF::MachineImplementation::rfImplementation
RFImplementationLocation & rfImplementation(const std::string &rf) const
Definition: MachineImplementation.cc:377
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
TTAMachine::Segment::connectionCount
int connectionCount() const
TTAMachine::FUPort
Definition: FUPort.hh:46
CostEstimator::FUCostEstimationPlugin
Definition: FUCostEstimationPlugin.hh:66
Segment.hh
TTAMachine::BaseRegisterFile
Definition: BaseRegisterFile.hh:48
IDF::NullUnitImplementationLocation::instance
static NullUnitImplementationLocation & instance()
Definition: NullUnitImplementationLocation.cc:65
CostEstimator::TransportPathList
std::list< TransportPath > TransportPathList
Definition: TransportPath.hh:76
IDF::MachineImplementation::hasBusImplementation
bool hasBusImplementation(const std::string &busName) const
Definition: MachineImplementation.cc:272
TTAMachine::ControlUnit
Definition: ControlUnit.hh:50
NullFUImplementationLocation.hh
TTAMachine::Port
Definition: Port.hh:54
ExecutionTrace
Definition: ExecutionTrace.hh:56
Application.hh
FUEntry.hh
NullUnitImplementationLocation.hh
__func__
#define __func__
Definition: Application.hh:67
TTAMachine::Machine::functionUnitNavigator
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition: Machine.cc:380
TTAMachine::Socket
Definition: Socket.hh:53
CostEstimator::TransportPath::sourceSocket
const TTAMachine::Socket & sourceSocket() const
Definition: TransportPath.cc:72
HDB::HDBManager
Definition: HDBManager.hh:82
Machine.hh
Exception
Definition: Exception.hh:54
TTAMachine::Machine::socketNavigator
virtual SocketNavigator socketNavigator() const
Definition: Machine.cc:368
IDF::MachineImplementation::busImplementation
BusImplementationLocation & busImplementation(const std::string &bus) const
Definition: MachineImplementation.cc:420
TTAMachine::Segment::connection
const Connection & connection(const Socket &socket) const
Definition: Segment.cc:250
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
CostEstimator::DelayInNanoSeconds
double DelayInNanoSeconds
type for propagation delays in nano seconds
Definition: CostEstimatorTypes.hh:39
CostEstimator::TransportPath::destinationPort
const TTAMachine::Port & destinationPort() const
Definition: TransportPath.cc:102
MachineCheckResults.hh
TTAMachine::RFPort::parentUnit
BaseRegisterFile * parentUnit() const
Definition: RFPort.cc:93
TTAMachine::Machine::registerFileNavigator
virtual RegisterFileNavigator registerFileNavigator() const
Definition: Machine.cc:450
CostEstimator::ICDecoderEstimatorPlugin
Definition: ICDecoderEstimatorPlugin.hh:64
IDF::MachineImplementation::icDecoderPluginFile
std::string icDecoderPluginFile() const
Definition: MachineImplementation.cc:153
IllegalMachine
Definition: Exception.hh:878
IDF::UnitImplementationLocation::id
virtual int id() const
Definition: UnitImplementationLocation.cc:127
CostEstimator::TransportPath::sourcePort
const TTAMachine::Port & sourcePort() const
Definition: TransportPath.cc:62
TTAMachine::Port::name
virtual std::string name() const
Definition: Port.cc:141
HDB::CostFunctionPlugin::pluginFilePath
std::string pluginFilePath() const
Definition: CostFunctionPlugin.cc:94
FUPort.hh
ControlUnit.hh
TTAMachine::Machine::busNavigator
virtual BusNavigator busNavigator() const
Definition: Machine.cc:356
Application::warningStream
static std::ostream & warningStream()
Definition: Application.cc:188
CostFunctionPlugin.hh
RFEntry.hh
RFPort.hh
TTAMachine::Machine::Navigator::item
ComponentType * item(int index) const
program
find Finds info of the inner loops in the program
Definition: InnerLoopFinder.cc:80
IDF::UnitImplementationLocation::hdbFile
virtual std::string hdbFile() const
Definition: UnitImplementationLocation.cc:99
IDF::MachineImplementation::hasICDecoderPluginName
bool hasICDecoderPluginName() const
Definition: MachineImplementation.cc:142
IDF::MachineImplementation::fuImplementation
FUImplementationLocation & fuImplementation(const std::string &fu) const
Definition: MachineImplementation.cc:355
CostEstimator::TransportPath
Definition: TransportPath.hh:52
HDBManager.hh
CostEstimator
Definition: CostEstimationPlugin.cc:36
HDBRegistry.hh
HDB::HDBManager::fuByEntryID
FUEntry * fuByEntryID(RowID id) const
Definition: HDBManager.cc:2828
IDF::MachineImplementation::icDecoderPluginName
std::string icDecoderPluginName() const
Definition: MachineImplementation.cc:132
TTAMachine::Machine::Navigator
Definition: Machine.hh:186
CostEstimator::ICDecoderEstimatorPlugin::estimateICArea
virtual bool estimateICArea(HDB::HDBRegistry &hdbRegistry, const TTAMachine::Machine &machine, const IDF::MachineImplementation &machineImplementation, AreaInGates &area)
Definition: ICDecoderEstimatorPlugin.cc:102
IDF::MachineImplementation::hasICDecoderHDB
bool hasICDecoderHDB() const
Definition: MachineImplementation.cc:193
TTAMachine::Bus::segmentCount
virtual int segmentCount() const
Definition: Bus.cc:385
NullRFImplementationLocation.hh
HDB::CostFunctionPlugin::name
std::string name() const
Definition: CostFunctionPlugin.cc:84
CostEstimator::ICDecoderEstimatorPlugin::estimateICDelayOfPath
virtual bool estimateICDelayOfPath(HDB::HDBRegistry &hdbRegistry, const TransportPath &path, const IDF::MachineImplementation &machineImplementation, const IDF::SocketImplementationLocation &sourceSocketImplementation, const IDF::BusImplementationLocation &busImplementation, const IDF::SocketImplementationLocation &destinationSocketImplementation, DelayInNanoSeconds &delay)
Definition: ICDecoderEstimatorPlugin.cc:80
HDB::CostFunctionPlugin
Definition: CostFunctionPlugin.hh:43
IDF::MachineImplementation
Definition: MachineImplementation.hh:54
MachineImplementation.hh
TTAMachine::Machine
Definition: Machine.hh:73
TTAMachine::Socket::INPUT
@ INPUT
Data goes from bus to port.
Definition: Socket.hh:59
HDB::HDBManager::rfByEntryID
RFEntry * rfByEntryID(RowID id) const
Definition: HDBManager.cc:2885
HDB::HDBRegistry::instance
static HDBRegistry & instance()
Definition: HDBRegistry.cc:62
IDF::MachineImplementation::hasSocketImplementation
bool hasSocketImplementation(const std::string &socketName) const
Definition: MachineImplementation.cc:286
TTAMachine::Port::parentUnit
Unit * parentUnit() const