OpenASIP  2.0
FUCostEstimationPlugin.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 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 FUCostEstimationPlugin.hh
26  *
27  * Declaration of FUCostEstimationPlugin class and definition of CPP macro
28  * used to export FU cost estimation plugins.
29  *
30  * @author Pekka Jääskeläinen 2005 (pjaaskel-no.spam-cs.tut.fi)
31  * @note rating: red
32  */
33 
34 #ifndef TTA_FU_COST_ESTIMATION_PLUGIN_HH
35 #define TTA_FU_COST_ESTIMATION_PLUGIN_HH
36 
37 #include <string>
38 
39 #include "Exception.hh"
40 #include "CostEstimatorTypes.hh"
41 #include "CostEstimationPlugin.hh"
43 
44 namespace HDB {
45  class HDBManager;
46  class FUEntry;
47 }
48 
49 namespace TTAProgram {
50  class Program;
51 }
52 
53 namespace TTAMachine {
54  class FunctionUnit;
55  class FUPort;
56 }
57 
58 class ExecutionTrace;
59 class UtilizationStats;
60 
61 namespace CostEstimator {
62 /**
63  * An interface for classes that implement pluggable function unit cost
64  * estimation algorithms.
65  */
67 public:
68  FUCostEstimationPlugin(const std::string& name);
69  virtual ~FUCostEstimationPlugin();
70 
71  virtual bool estimateArea(
72  const TTAMachine::FunctionUnit& architecture,
74  AreaInGates& area,
75  HDB::HDBManager& hdb);
76 
77  virtual bool estimateEnergy(
78  const TTAMachine::FunctionUnit& architecture,
81  const ExecutionTrace& traceDB,
82  EnergyInMilliJoules& energy,
83  HDB::HDBManager& hdb);
84 
85  virtual bool estimatePortWriteDelay(
86  const TTAMachine::FUPort& port,
88  DelayInNanoSeconds& inputDelay,
89  HDB::HDBManager& hdb);
90 
91  virtual bool estimatePortReadDelay(
92  const TTAMachine::FUPort& port,
94  DelayInNanoSeconds& outputDelay,
95  HDB::HDBManager& hdb);
96 
98  const TTAMachine::FunctionUnit& architecture,
100  DelayInNanoSeconds& computationDelay,
101  HDB::HDBManager& hdb);
102 };
103 
104 /**
105  * Exports the given class as an FU cost estimation plugin.
106  */
107 #define EXPORT_FU_COST_ESTIMATOR_PLUGIN(PLUGIN_NAME__) \
108 extern "C" { \
109  FUCostEstimationPlugin* create_estimator_plugin_##PLUGIN_NAME__(\
110  ) { \
111  PLUGIN_NAME__* instance = new PLUGIN_NAME__(#PLUGIN_NAME__);\
112  return instance;\
113  }\
114  void delete_estimator_plugin_##PLUGIN_NAME__(\
115  FUCostEstimationPlugin* target) {\
116  delete target;\
117  }\
118 }
119 
120 }
121 
122 /**
123  * Defines the description string for the plugin.
124  *
125  * Can be used only inside a plugin class definition.
126  *
127  * @param TEXT__ The description string.
128  */
129 #define DESCRIPTION(TEXT__) \
130 public:\
131  virtual std::string description() const { return TEXT__; }\
132  int* XXXXXd_escrip__tion__
133 
134 #endif
IDF::UnitImplementationLocation
Definition: UnitImplementationLocation.hh:48
TTAProgram
Definition: Estimator.hh:65
TTAProgram::Program
Definition: Program.hh:63
HDB
Definition: CostDatabase.hh:49
CostEstimator::CostEstimationPlugin::name
virtual std::string name() const
Definition: CostEstimationPlugin.cc:63
Exception.hh
implementation
IDF::MachineImplementation * implementation
the implementation definition of the estimated processor
Definition: EstimatorCmdLineUI.cc:61
CostEstimator::FUCostEstimationPlugin::estimatePortReadDelay
virtual bool estimatePortReadDelay(const TTAMachine::FUPort &port, const IDF::FUImplementationLocation &implementation, DelayInNanoSeconds &outputDelay, HDB::HDBManager &hdb)
Definition: FUCostEstimationPlugin.cc:128
CostEstimator::AreaInGates
double AreaInGates
type for area values in equivalent gates
Definition: CostEstimatorTypes.hh:35
CostEstimator::EnergyInMilliJoules
double EnergyInMilliJoules
type for consumed energy in milli joules
Definition: CostEstimatorTypes.hh:37
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
TTAMachine::FUPort
Definition: FUPort.hh:46
CostEstimator::FUCostEstimationPlugin
Definition: FUCostEstimationPlugin.hh:66
CostEstimatorTypes.hh
ExecutionTrace
Definition: ExecutionTrace.hh:56
CostEstimator::FUCostEstimationPlugin::FUCostEstimationPlugin
FUCostEstimationPlugin(const std::string &name)
Definition: FUCostEstimationPlugin.cc:44
CostEstimator::FUCostEstimationPlugin::~FUCostEstimationPlugin
virtual ~FUCostEstimationPlugin()
Definition: FUCostEstimationPlugin.cc:52
FUImplementationLocation.hh
HDB::HDBManager
Definition: HDBManager.hh:82
CostEstimator::CostEstimationPlugin
Definition: CostEstimationPlugin.hh:45
CostEstimator::FUCostEstimationPlugin::estimateEnergy
virtual bool estimateEnergy(const TTAMachine::FunctionUnit &architecture, const IDF::FUImplementationLocation &implementation, const TTAProgram::Program &program, const ExecutionTrace &traceDB, EnergyInMilliJoules &energy, HDB::HDBManager &hdb)
Definition: FUCostEstimationPlugin.cc:88
CostEstimator::DelayInNanoSeconds
double DelayInNanoSeconds
type for propagation delays in nano seconds
Definition: CostEstimatorTypes.hh:39
CostEstimator::FUCostEstimationPlugin::estimateArea
virtual bool estimateArea(const TTAMachine::FunctionUnit &architecture, const IDF::FUImplementationLocation &implementation, AreaInGates &area, HDB::HDBManager &hdb)
Definition: FUCostEstimationPlugin.cc:65
CostEstimator::FUCostEstimationPlugin::estimatePortWriteDelay
virtual bool estimatePortWriteDelay(const TTAMachine::FUPort &port, const IDF::FUImplementationLocation &implementation, DelayInNanoSeconds &inputDelay, HDB::HDBManager &hdb)
Definition: FUCostEstimationPlugin.cc:109
CostEstimationPlugin.hh
program
find Finds info of the inner loops in the program
Definition: InnerLoopFinder.cc:80
TTAMachine
Definition: Assembler.hh:48
CostEstimator
Definition: CostEstimationPlugin.cc:36
UtilizationStats
Definition: UtilizationStats.hh:50
CostEstimator::FUCostEstimationPlugin::estimateMaximumComputationDelay
virtual bool estimateMaximumComputationDelay(const TTAMachine::FunctionUnit &architecture, const IDF::FUImplementationLocation &implementation, DelayInNanoSeconds &computationDelay, HDB::HDBManager &hdb)
Definition: FUCostEstimationPlugin.cc:151