OpenASIP 2.2
Loading...
Searching...
No Matches
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.
 
std::string icDec_
 name of the ic decoder plugin for idf
 
std::string icDecHDB_
 name of the hdb used by ic decoder
 
std::string adf_
 name of the adf file if wanted to use idf generation
 

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
 
ParameterMap parameters_
 Parameters for the plugin.
 

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
93 }
void addParameter(TCEString name, ExplorerPluginParameterType type, bool compulsory=true, TCEString defaultValue="", TCEString description="")
static const std::string icDecPN_
static const std::string adfPN_
std::string icDec_
name of the ic decoder plugin for idf
std::string adf_
name of the adf file if wanted to use idf generation
static const std::string icDecHDBPN_
std::string icDecHDB_
name of the hdb used by ic decoder

References DesignSpaceExplorerPlugin::addParameter(), adf_, adfPN_, icDec_, icDecHDB_, icDecHDBPN_, icDecPN_, and STRING.

Here is the call graph for this function:

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 {
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 }
#define verboseLog(text)
int RowID
Type definition of row ID in relational databases.
Definition DBTypes.hh:37
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)
RowID addArchitecture(const TTAMachine::Machine &mom)
TTAMachine::Machine * architecture(RowID id) const
MachineConfiguration configuration(RowID id) const
RowID addImplementation(const IDF::MachineImplementation &impl, double longestPathDelay, CostEstimator::AreaInGates area)
RowID addConfiguration(const MachineConfiguration &conf)
virtual DSDBManager & db()
std::string fileName() const
std::string errorMessage() const
Definition Exception.cc:123
int lineNum() const
ComponentImplementationSelector selector_
Selector used by the plugin.
static Machine * loadFromADF(const std::string &adfFileName)
Definition Machine.cc:899

References DSDBManager::addArchitecture(), DSDBManager::addConfiguration(), DSDBManager::addImplementation(), adf_, DSDBManager::architecture(), DSDBManager::MachineConfiguration::architectureID, DSDBManager::configuration(), DesignSpaceExplorer::db(), Exception::errorMessage(), Exception::fileName(), DSDBManager::MachineConfiguration::hasImplementation, icDec_, icDecHDB_, DSDBManager::MachineConfiguration::implementationID, Exception::lineNum(), TTAMachine::Machine::loadFromADF(), readParameters(), ComponentImplementationSelector::selectComponents(), selector_, setupSelector(), 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.

193 {
197 }
void readOptionalParameter(const std::string paramName, T &param) const

References adf_, adfPN_, icDec_, icDecHDB_, icDecHDBPN_, icDecPN_, and DesignSpaceExplorerPlugin::readOptionalParameter().

Referenced by explore().

Here is the call graph for this function:

◆ 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 }
static HDBRegistry & instance()
CachedHDBManager & hdb(const std::string fileName)
void loadFromSearchPaths()

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

Referenced by explore().

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.

Referenced by explore(), ImplementationSelector(), and readParameters().

◆ adfPN_

const std::string ImplementationSelector::adfPN_
staticprivate

Definition at line 179 of file ImplementationSelector.cc.

Referenced by ImplementationSelector(), and readParameters().

◆ icDec_

std::string ImplementationSelector::icDec_
private

name of the ic decoder plugin for idf

Definition at line 183 of file ImplementationSelector.cc.

Referenced by explore(), ImplementationSelector(), and readParameters().

◆ icDecHDB_

std::string ImplementationSelector::icDecHDB_
private

name of the hdb used by ic decoder

Definition at line 185 of file ImplementationSelector.cc.

Referenced by explore(), ImplementationSelector(), and readParameters().

◆ icDecHDBPN_

const std::string ImplementationSelector::icDecHDBPN_
staticprivate

Definition at line 178 of file ImplementationSelector.cc.

Referenced by ImplementationSelector(), and readParameters().

◆ icDecPN_

const std::string ImplementationSelector::icDecPN_
staticprivate

Definition at line 177 of file ImplementationSelector.cc.

Referenced by ImplementationSelector(), and readParameters().

◆ selector_

ComponentImplementationSelector ImplementationSelector::selector_
private

Selector used by the plugin.

Definition at line 174 of file ImplementationSelector.cc.

Referenced by explore(), and setupSelector().


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