OpenASIP  2.0
Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ImplementationSelector Class Reference
Inheritance diagram for ImplementationSelector:
Inheritance graph
Collaboration diagram for ImplementationSelector:
Collaboration graph

Private Member Functions

 PLUGIN_DESCRIPTION ("Creates implementation for the given machine.")
 
 ImplementationSelector ()
 
virtual bool requiresStartingPointArchitecture () const
 
virtual bool producesArchitecture () const
 
virtual bool requiresHDB () const
 
virtual bool requiresSimulationData () const
 
virtual bool requiresApplication () const
 
virtual std::vector< RowIDexplore (const RowID &configurationID, const unsigned int &)
 
void readParameters ()
 
void setupSelector ()
 

Private Attributes

ComponentImplementationSelector selector_
 Selector used by the plugin. More...
 
std::string icDec_
 name of the ic decoder plugin for idf More...
 
std::string icDecHDB_
 name of the hdb used by ic decoder More...
 
std::string adf_
 name of the adf file if wanted to use idf generation More...
 

Static Private Attributes

static const std::string icDecPN_
 
static const std::string icDecHDBPN_
 
static const std::string adfPN_
 

Additional Inherited Members

- Public Types inherited from DesignSpaceExplorerPlugin
typedef std::pair< std::string, ExplorerPluginParameterParameter
 
typedef std::map< std::string, ExplorerPluginParameterParameterMap
 
typedef std::map< std::string, ExplorerPluginParameter >::iterator PMIt
 
typedef std::map< std::string, ExplorerPluginParameter >::const_iterator PMCIt
 
- Public Member Functions inherited from DesignSpaceExplorerPlugin
virtual std::string description () const
 
void addParameter (TCEString name, ExplorerPluginParameterType type, bool compulsory=true, TCEString defaultValue="", TCEString description="")
 
template<typename T >
void readCompulsoryParameter (const std::string paramName, T &param) const
 
template<typename T >
void readOptionalParameter (const std::string paramName, T &param) const
 
template<typename RT >
RT parameterValue (const std::string &paramName) const
 
virtual ~DesignSpaceExplorerPlugin ()
 
virtual void giveParameter (const std::string &name, const std::string &value)
 
virtual std::string name () const
 
virtual void setPluginName (const std::string &pluginName)
 
virtual bool hasParameter (const std::string &paramName) const
 
ParameterMap parameters () const
 
virtual bool booleanValue (const std::string &parameter) const
 
- Public Member Functions inherited from DesignSpaceExplorer
 DesignSpaceExplorer ()
 
virtual ~DesignSpaceExplorer ()
 
virtual void setDSDB (DSDBManager &dsdb)
 
virtual bool evaluate (const DSDBManager::MachineConfiguration &configuration, CostEstimates &results=dummyEstimate_, bool estimate=false)
 
virtual DSDBManagerdb ()
 
std::vector< DesignSpaceExplorerPlugin * > getPlugins ()
 
RowID createImplementationAndStore (const DSDBManager::MachineConfiguration &conf, const double &frequency=0.0, const double &maxArea=0.0, const bool &createEstimates=true, const std::string &icDec="DefaultICDecoder", const std::string &icDecHDB="asic_130nm_1.5V.hdb")
 
bool createImplementation (const DSDBManager::MachineConfiguration &conf, DSDBManager::MachineConfiguration &newConf, const double &frequency=0.0, const double &maxArea=0.0, const bool &createEstimates=true, const std::string &icDec="DefaultICDecoder", const std::string &icDecHDB="asic_130nm_1.5V.hdb")
 
IDF::MachineImplementationselectComponents (const TTAMachine::Machine &mach, const double &frequency=0.0, const double &maxArea=0.0, const std::string &icDec="DefaultICDecoder", const std::string &icDecHDB="asic_130nm_1.5V.hdb") const
 
void createEstimateData (const TTAMachine::Machine &mach, const IDF::MachineImplementation &idf, CostEstimator::AreaInGates &area, CostEstimator::DelayInNanoSeconds &longestPathDelay)
 
RowID addConfToDSDB (const DSDBManager::MachineConfiguration &conf)
 
- Static Public Member Functions inherited from DesignSpaceExplorer
static DesignSpaceExplorerPluginloadExplorerPlugin (const std::string &pluginName, DSDBManager *dsdb=NULL)
 
- Protected Member Functions inherited from DesignSpaceExplorerPlugin
 DesignSpaceExplorerPlugin ()
 
void checkParameters () const
 
- Protected Member Functions inherited from DesignSpaceExplorer
TTAProgram::Programschedule (const std::string applicationFile, TTAMachine::Machine &machine, TCEString paramOptions="-O3")
 
const ExecutionTracesimulate (const TTAProgram::Program &program, const TTAMachine::Machine &machine, const TestApplication &testApplication, const ClockCycleCount &maxCycles, ClockCycleCount &runnedCycles, const bool tracing, const bool useCompiledSimulation=false, std::vector< ClockCycleCount > *executionCounts=NULL)
 
- Protected Attributes inherited from DesignSpaceExplorerPlugin
std::string pluginName_
 the name of the explorer plugin More...
 
ParameterMap parameters_
 Parameters for the plugin. More...
 

Detailed Description

Explorer plugin that selects implementations for units in a given adf. Creates a new config with a idf.

Supported parameters:

Definition at line 78 of file ImplementationSelector.cc.

Constructor & Destructor Documentation

◆ ImplementationSelector()

ImplementationSelector::ImplementationSelector ( )
inlineprivate

Definition at line 81 of file ImplementationSelector.cc.

82  icDec_("DefaultICDecoder"),
83  icDecHDB_("asic_130nm_1.5V.hdb"),
84  adf_("") {
85 
86  // compulsory parameters
87  // no compulsory parameters
88 
89  // parameters that have a default value
92  addParameter(adfPN_, STRING, false, adf_);
93  }

References STRING.

Member Function Documentation

◆ explore()

virtual std::vector<RowID> ImplementationSelector::explore ( const RowID startPointConfigurationID,
const unsigned int &  maxIter 
)
inlineprivatevirtual

Explores the design space from the starting point machine and returns best exploring results as configuration IDs.

Exploring creates new machine configurations (architecture, implementation) that are ordered so that the best results are first in the result vector.

Parameters
startPointStarting point machine configuration for the plugin.
maxIterMaximum number of design space points the plugin is allowed to explore. Default value for maxIter is zero when the iteration number is not taken into account. In that case the exploration runs indefinetly or stops at a point defined by the algorithm.
Returns
Ordered vector of IDs of the best machine configurations where the target programs can be successfully run. The IDs of the best machine configurations are first in the result vector. Returns an empty vector if does not find any possible machine configurations.

Reimplemented from DesignSpaceExplorerPlugin.

Definition at line 104 of file ImplementationSelector.cc.

104  {
105  readParameters();
106  setupSelector();
107  std::vector<RowID> result;
108 
109  // check if adf given
110  if (configurationID == 0 && adf_ == "") {
111  std::ostringstream msg(std::ostringstream::out);
112  msg << "No configuration nor adf defined. Use -s <confID> to "
113  << "define the configuration to be optimized or give adf "
114  << "as plugin parameter." << endl;
115  verboseLog(msg.str());
116  return result;
117  }
118 
119  DSDBManager& dsdb = db();
121  conf.hasImplementation = false;
122  TTAMachine::Machine* mach = NULL;
123 
124  // load the adf from file or from dsdb
125  try {
126  if (adf_ != "") {
128  } else {
129  conf = dsdb.configuration(configurationID);
130  mach = dsdb.architecture(conf.architectureID);
131  }
132  } catch (const Exception& e) {
133  std::ostringstream msg(std::ostringstream::out);
134  msg << "Error loading the adf." << std::endl;
135  verboseLog(msg.str());
136  return result;
137  }
138 
139  IDF::MachineImplementation* idf = NULL;
140  try {
141  // building the idf
143  } catch (const Exception& e) {
144  std::ostringstream msg(std::ostringstream::out);
145  msg << e.errorMessage()
146  << " " << e.fileName()
147  << " " << e.lineNum() << std::endl;
148  verboseLog(msg.str());
149  return result;
150  }
151 
152  // create a new configuration
153 
154  try {
155  conf.architectureID = dsdb.addArchitecture(*mach);
156  } catch (const RelationalDBException& e) {
157  std::ostringstream msg(std::ostringstream::out);
158  msg << "Error while adding ADF to the dsdb. "
159  << "ADF probably too big." << endl;
160  verboseLog(msg.str());
161  return result;
162  }
163  conf.implementationID = dsdb.addImplementation(*idf, 0, 0);
164  conf.hasImplementation = true;
165 
166  RowID confID = dsdb.addConfiguration(conf);
167  result.push_back(confID);
168 
169  return result;
170  }

References DSDBManager::addArchitecture(), DSDBManager::addConfiguration(), DSDBManager::addImplementation(), DSDBManager::architecture(), DSDBManager::MachineConfiguration::architectureID, DSDBManager::configuration(), Exception::errorMessage(), Exception::fileName(), DSDBManager::MachineConfiguration::hasImplementation, DSDBManager::MachineConfiguration::implementationID, Exception::lineNum(), TTAMachine::Machine::loadFromADF(), and verboseLog.

Here is the call graph for this function:

◆ PLUGIN_DESCRIPTION()

ImplementationSelector::PLUGIN_DESCRIPTION ( "Creates implementation for the given machine."  )
private

◆ producesArchitecture()

virtual bool ImplementationSelector::producesArchitecture ( ) const
inlineprivatevirtual

Implements DesignSpaceExplorerPlugin.

Definition at line 96 of file ImplementationSelector.cc.

96 { return false; }

◆ readParameters()

void ImplementationSelector::readParameters ( )
inlineprivate

Reads the parameters given to the plugin.

Definition at line 193 of file ImplementationSelector.cc.

◆ requiresApplication()

virtual bool ImplementationSelector::requiresApplication ( ) const
inlineprivatevirtual

Reimplemented from DesignSpaceExplorerPlugin.

Definition at line 99 of file ImplementationSelector.cc.

99 { return false; }

◆ requiresHDB()

virtual bool ImplementationSelector::requiresHDB ( ) const
inlineprivatevirtual

Implements DesignSpaceExplorerPlugin.

Definition at line 97 of file ImplementationSelector.cc.

97 { return true; }

◆ requiresSimulationData()

virtual bool ImplementationSelector::requiresSimulationData ( ) const
inlineprivatevirtual

Implements DesignSpaceExplorerPlugin.

Definition at line 98 of file ImplementationSelector.cc.

98 { return false; }

◆ requiresStartingPointArchitecture()

virtual bool ImplementationSelector::requiresStartingPointArchitecture ( ) const
inlineprivatevirtual

Implements DesignSpaceExplorerPlugin.

Definition at line 95 of file ImplementationSelector.cc.

95 { return true; }

◆ setupSelector()

void ImplementationSelector::setupSelector ( )
inlineprivate

Sets up the component implementation selector by adding the HDBs.

Definition at line 203 of file ImplementationSelector.cc.

203  {
204  HDBRegistry& hdbRegistry = HDBRegistry::instance();
205 
206  // if HDBRegistry contains no HDBManagers load from default paths
207  if (hdbRegistry.hdbCount() == 0) {
208  hdbRegistry.loadFromSearchPaths();
209  }
210 
211  // give all HDBs from registry to the selector to select from
212  for (int i = 0; i < hdbRegistry.hdbCount(); i++) {
213  HDBManager* hdb = &hdbRegistry.hdb(i);
214  selector_.addHDB(*hdb);
215  }
216  }

References ComponentImplementationSelector::addHDB(), HDB::HDBRegistry::hdb(), HDB::HDBRegistry::hdbCount(), and HDB::HDBRegistry::loadFromSearchPaths().

Here is the call graph for this function:

Member Data Documentation

◆ adf_

std::string ImplementationSelector::adf_
private

name of the adf file if wanted to use idf generation

Definition at line 187 of file ImplementationSelector.cc.

◆ adfPN_

const std::string ImplementationSelector::adfPN_
staticprivate

Definition at line 179 of file ImplementationSelector.cc.

◆ icDec_

std::string ImplementationSelector::icDec_
private

name of the ic decoder plugin for idf

Definition at line 183 of file ImplementationSelector.cc.

◆ icDecHDB_

std::string ImplementationSelector::icDecHDB_
private

name of the hdb used by ic decoder

Definition at line 185 of file ImplementationSelector.cc.

◆ icDecHDBPN_

const std::string ImplementationSelector::icDecHDBPN_
staticprivate

Definition at line 178 of file ImplementationSelector.cc.

◆ icDecPN_

const std::string ImplementationSelector::icDecPN_
staticprivate

Definition at line 177 of file ImplementationSelector.cc.

◆ selector_

ComponentImplementationSelector ImplementationSelector::selector_
private

Selector used by the plugin.

Definition at line 174 of file ImplementationSelector.cc.


The documentation for this class was generated from the following file:
ImplementationSelector::icDec_
std::string icDec_
name of the ic decoder plugin for idf
Definition: ImplementationSelector.cc:183
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
Exception::lineNum
int lineNum() const
ComponentImplementationSelector::addHDB
void addHDB(const HDB::HDBManager &hdb)
Definition: ComponentImplementationSelector.cc:83
DesignSpaceExplorer::db
virtual DSDBManager & db()
Definition: DesignSpaceExplorer.cc:300
RelationalDBException
Definition: Exception.hh:692
DSDBManager::architecture
TTAMachine::Machine * architecture(RowID id) const
Definition: DSDBManager.cc:807
DSDBManager::MachineConfiguration::hasImplementation
bool hasImplementation
Definition: DSDBManager.hh:80
RowID
int RowID
Type definition of row ID in relational databases.
Definition: DBTypes.hh:37
DesignSpaceExplorerPlugin::DesignSpaceExplorerPlugin
DesignSpaceExplorerPlugin()
Definition: DesignSpaceExplorerPlugin.cc:48
HDB::HDBRegistry::hdb
CachedHDBManager & hdb(const std::string fileName)
Definition: HDBRegistry.cc:80
verboseLog
#define verboseLog(text)
Definition: Application.hh:115
ImplementationSelector::setupSelector
void setupSelector()
Definition: ImplementationSelector.cc:203
Exception::fileName
std::string fileName() const
DSDBManager::MachineConfiguration::implementationID
RowID implementationID
Definition: DSDBManager.hh:81
DesignSpaceExplorerPlugin::readOptionalParameter
void readOptionalParameter(const std::string paramName, T &param) const
HDB::HDBRegistry
Definition: HDBRegistry.hh:46
ImplementationSelector::adfPN_
static const std::string adfPN_
Definition: ImplementationSelector.cc:179
DSDBManager::MachineConfiguration
Definition: DSDBManager.hh:78
STRING
@ STRING
Definition: ExplorerPluginParameter.hh:40
ImplementationSelector::icDecPN_
static const std::string icDecPN_
Definition: ImplementationSelector.cc:177
HDB::HDBManager
Definition: HDBManager.hh:82
ImplementationSelector::readParameters
void readParameters()
Definition: ImplementationSelector.cc:193
Exception
Definition: Exception.hh:54
DSDBManager
Definition: DSDBManager.hh:76
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
HDB::HDBRegistry::hdbCount
int hdbCount()
Definition: HDBRegistry.cc:135
DSDBManager::addConfiguration
RowID addConfiguration(const MachineConfiguration &conf)
Definition: DSDBManager.cc:299
ImplementationSelector::icDecHDBPN_
static const std::string icDecHDBPN_
Definition: ImplementationSelector.cc:178
DSDBManager::addArchitecture
RowID addArchitecture(const TTAMachine::Machine &mom)
Definition: DSDBManager.cc:191
DSDBManager::configuration
MachineConfiguration configuration(RowID id) const
Definition: DSDBManager.cc:361
ImplementationSelector::adf_
std::string adf_
name of the adf file if wanted to use idf generation
Definition: ImplementationSelector.cc:187
HDB::HDBRegistry::loadFromSearchPaths
void loadFromSearchPaths()
Definition: HDBRegistry.cc:146
DSDBManager::MachineConfiguration::architectureID
RowID architectureID
Definition: DSDBManager.hh:79
ImplementationSelector::selector_
ComponentImplementationSelector selector_
Selector used by the plugin.
Definition: ImplementationSelector.cc:174
DesignSpaceExplorerPlugin::addParameter
void addParameter(TCEString name, ExplorerPluginParameterType type, bool compulsory=true, TCEString defaultValue="", TCEString description="")
DSDBManager::addImplementation
RowID addImplementation(const IDF::MachineImplementation &impl, double longestPathDelay, CostEstimator::AreaInGates area)
Definition: DSDBManager.cc:252
IDF::MachineImplementation
Definition: MachineImplementation.hh:54
TTAMachine::Machine
Definition: Machine.hh:73
ImplementationSelector::icDecHDB_
std::string icDecHDB_
name of the hdb used by ic decoder
Definition: ImplementationSelector.cc:185
TTAMachine::Machine::loadFromADF
static Machine * loadFromADF(const std::string &adfFileName)
Definition: Machine.cc:905