OpenASIP  2.0
ComponentImplementationSelector.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 ComponentImplementationSelector.hh
26  *
27  * Declaration of ComponentImplementationSelector class
28  *
29  * @author Jari Mäntyneva 2006 (jari.mantyneva-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_COMPONENT_IMPLEMENTATION_SELECTOR_HH
34 #define TTA_COMPONENT_IMPLEMENTATION_SELECTOR_HH
35 
36 #include <set>
37 #include <map>
38 #include <list>
39 #include <string>
40 #include "Application.hh"
41 #include "HDBRegistry.hh"
42 #include "HDBManager.hh"
43 #include "Estimator.hh"
44 #include "DSDBManager.hh"
45 
46 namespace TTAMachine {
47  class FunctionUnit;
48  class RegisterFile;
49  class ImmediateUnit;
50 }
51 namespace TTAProgram {
52  class Program;
53 }
54 namespace IDF {
59 }
60 
61 class Operation;
62 class ExecutionTrace;
63 class CostEstimates;
64 
65 /**
66  * Purpose of the component implementation selector class is to select suitable
67  * implementations to architecture components. The component implementation
68  * selector uses HDB to look for implementations and returns set of suitable
69  * implementations that fulfill the given cost requirements.
70  * Class uses cost estimator to estimate the costs of suitable implementations.
71  * Cost estimation data includes energy estimations of all program cases that
72  * are set.
73  */
75 public:
78 
79  void addHDB(const HDB::HDBManager& hdb);
80  void addCase(
81  const TTAProgram::Program& program, const ExecutionTrace& traceDB);
82 
83  std::map<const IDF::FUImplementationLocation*, CostEstimates*>
85  const TTAMachine::FunctionUnit& fu, double frequencyMHz = 0,
86  double maxArea = 0);
87  std::list<TTAMachine::FunctionUnit*>
89  const std::set<std::string>& operationSet, int width = 0) const;
90 
91  std::map<const IDF::RFImplementationLocation*, CostEstimates*>
93  const TTAMachine::RegisterFile& rf, bool guarded = false,
94  double frequencyMHz = 0, double maxArea = 0);
95 
96  std::map<const IDF::IUImplementationLocation*, CostEstimates*>
98  const TTAMachine::ImmediateUnit& iu, double frequencyMHz = 0,
99  double maxArea = 0);
100 
103  TTAMachine::Machine* mach = NULL,
104  const std::string& icDecoder = "ic_hdb",
105  const std::string& icDecoderHDB = "asic_130nm_1.5V.hdb",
106  const double& frequency = 0, const double& maxArea = 0);
107 
109  const TTAMachine::Machine* mach,
110  const std::string& icDecoder = "ic_hdb",
111  const std::string& icDecoderHDB = "asic_130nm_1.5V.hdb",
112  const double& frequency = 0, const double& maxArea = 0);
113 
114  void selectFUs(
116  const double& frequency = 0, const double& maxArea = 0,
117  const bool& filterLongestPathDelay = true);
118 
119  void selectRFs(
121  const double& frequency = 0, const double& maxArea = 0);
122 
123  void selectIUs(
125  const double& frequency = 0, const double& maxArea = 0);
126 
127 private:
128  /// HDBs from which implementations are serched are stored in this set
129  std::set<std::string> usedHDBs_;
130  /// Cost estimator to estimate the unit costs.
132 
133  struct implComp {
134  bool operator() (const std::pair<const IDF::UnitImplementationLocation*, CostEstimates*>& p1,
135  const std::pair<const IDF::UnitImplementationLocation*, CostEstimates*>& p2) const {
136  return p1.first->id() < p2.first->id();
137  }
138  };
139 
140 };
141 
142 #endif
IDF::UnitImplementationLocation
Definition: UnitImplementationLocation.hh:48
TTAProgram
Definition: Estimator.hh:65
ComponentImplementationSelector::selectComponents
IDF::MachineImplementation * selectComponents(const TTAMachine::Machine *mach, const std::string &icDecoder="ic_hdb", const std::string &icDecoderHDB="asic_130nm_1.5V.hdb", const double &frequency=0, const double &maxArea=0)
Definition: ComponentImplementationSelector.cc:645
TTAProgram::Program
Definition: Program.hh:63
IDF::RFImplementationLocation
UnitImplementationLocation RFImplementationLocation
Definition: ComponentImplementationSelector.hh:57
ComponentImplementationSelector::implComp::operator()
bool operator()(const std::pair< const IDF::UnitImplementationLocation *, CostEstimates * > &p1, const std::pair< const IDF::UnitImplementationLocation *, CostEstimates * > &p2) const
Definition: ComponentImplementationSelector.hh:134
ComponentImplementationSelector::addHDB
void addHDB(const HDB::HDBManager &hdb)
Definition: ComponentImplementationSelector.cc:83
ComponentImplementationSelector::~ComponentImplementationSelector
virtual ~ComponentImplementationSelector()
Definition: ComponentImplementationSelector.cc:73
CostEstimates
Definition: CostEstimates.hh:57
ComponentImplementationSelector::selectIUs
void selectIUs(const TTAMachine::Machine *mach, IDF::MachineImplementation *idf, const double &frequency=0, const double &maxArea=0)
Definition: ComponentImplementationSelector.cc:867
ComponentImplementationSelector::addCase
void addCase(const TTAProgram::Program &program, const ExecutionTrace &traceDB)
Definition: ComponentImplementationSelector.cc:94
ComponentImplementationSelector::rfImplementations
std::map< const IDF::RFImplementationLocation *, CostEstimates * > rfImplementations(const TTAMachine::RegisterFile &rf, bool guarded=false, double frequencyMHz=0, double maxArea=0)
Definition: ComponentImplementationSelector.cc:377
CostEstimator::Estimator
Definition: Estimator.hh:85
Estimator.hh
ComponentImplementationSelector::implComp
Definition: ComponentImplementationSelector.hh:133
ComponentImplementationSelector::estimator_
CostEstimator::Estimator estimator_
Cost estimator to estimate the unit costs.
Definition: ComponentImplementationSelector.hh:131
ComponentImplementationSelector::ComponentImplementationSelector
ComponentImplementationSelector()
Definition: ComponentImplementationSelector.cc:67
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
DSDBManager::MachineConfiguration
Definition: DSDBManager.hh:78
ComponentImplementationSelector::fuImplementations
std::map< const IDF::FUImplementationLocation *, CostEstimates * > fuImplementations(const TTAMachine::FunctionUnit &fu, double frequencyMHz=0, double maxArea=0)
Definition: ComponentImplementationSelector.cc:116
ExecutionTrace
Definition: ExecutionTrace.hh:56
Application.hh
ComponentImplementationSelector::selectFUs
void selectFUs(const TTAMachine::Machine *mach, IDF::MachineImplementation *idf, const double &frequency=0, const double &maxArea=0, const bool &filterLongestPathDelay=true)
Definition: ComponentImplementationSelector.cc:691
IDF::FUImplementationLocation
UnitImplementationLocation FUImplementationLocation
Definition: ComponentImplementationSelector.hh:55
ComponentImplementationSelector::usedHDBs_
std::set< std::string > usedHDBs_
HDBs from which implementations are serched are stored in this set.
Definition: ComponentImplementationSelector.hh:129
HDB::HDBManager
Definition: HDBManager.hh:82
DSDBManager
Definition: DSDBManager.hh:76
Operation
Definition: Operation.hh:59
DSDBManager.hh
ComponentImplementationSelector
Definition: ComponentImplementationSelector.hh:74
ComponentImplementationSelector::selectRFs
void selectRFs(const TTAMachine::Machine *mach, IDF::MachineImplementation *idf, const double &frequency=0, const double &maxArea=0)
Definition: ComponentImplementationSelector.cc:783
IDF::IUImplementationLocation
UnitImplementationLocation IUImplementationLocation
Definition: ComponentImplementationSelector.hh:58
ComponentImplementationSelector::fuArchsByOpSetWithMinLatency
std::list< TTAMachine::FunctionUnit * > fuArchsByOpSetWithMinLatency(const std::set< std::string > &operationSet, int width=0) const
Definition: ComponentImplementationSelector.cc:212
ComponentImplementationSelector::iuImplementations
std::map< const IDF::IUImplementationLocation *, CostEstimates * > iuImplementations(const TTAMachine::ImmediateUnit &iu, double frequencyMHz=0, double maxArea=0)
Definition: ComponentImplementationSelector.cc:494
program
find Finds info of the inner loops in the program
Definition: InnerLoopFinder.cc:80
TTAMachine::RegisterFile
Definition: RegisterFile.hh:47
ComponentImplementationSelector::selectComponentsToConf
void selectComponentsToConf(DSDBManager::MachineConfiguration &conf, DSDBManager &dsdb, TTAMachine::Machine *mach=NULL, const std::string &icDecoder="ic_hdb", const std::string &icDecoderHDB="asic_130nm_1.5V.hdb", const double &frequency=0, const double &maxArea=0)
Definition: ComponentImplementationSelector.cc:601
TTAMachine
Definition: Assembler.hh:48
HDBManager.hh
HDBRegistry.hh
IDF::MachineImplementation
Definition: MachineImplementation.hh:54
IDF
Definition: DSDBManager.hh:54
TTAMachine::Machine
Definition: Machine.hh:73
TTAMachine::ImmediateUnit
Definition: ImmediateUnit.hh:50