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

Private Member Functions

 PLUGIN_DESCRIPTION ("Explorer plugin that adds machine components to a " "given machine.")
 
 ComponentAdder ()
 
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 addComponents (TTAMachine::Machine *mach)
 
void addRegisterFiles (TTAMachine::Machine *mach)
 

Private Attributes

ComponentImplementationSelector selector_
 Selector used by the plugin. More...
 
std::string RFName_
 
int RFCount_
 
int RFSize_
 
int RFReadPorts_
 
int RFWritePorts_
 
std::string adf_
 name of the adf file if wanted to use idf generation More...
 
bool buildIdf_
 do we build idf More...
 

Static Private Attributes

static const std::string RFNamePN_
 
static const std::string RFCountPN_
 
static const std::string RFSizePN_
 
static const std::string RFReadPortsPN_
 
static const std::string RFWritePortsPN_
 
static const std::string adfPN_
 
static const std::string buildIdfPN_
 

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 adds machine components to a given machine.

Supported parameters:

Definition at line 63 of file ComponentAdder.cc.

Constructor & Destructor Documentation

◆ ComponentAdder()

ComponentAdder::ComponentAdder ( )
inlineprivate

Definition at line 67 of file ComponentAdder.cc.

68  RFName_("rf"),
69  RFCount_(1),
70  RFSize_(4),
71  RFReadPorts_(1),
72  RFWritePorts_(1),
73  adf_(""),
74  buildIdf_(false) {
75 
76  // compulsory parameters
77  // no compulsory parameters
78 
79  // parameters that have a default value
85  addParameter(adfPN_, STRING, false, adf_);
87  }

References BOOL, STRING, Conversion::toString(), and UINT.

Here is the call graph for this function:

Member Function Documentation

◆ addComponents()

void ComponentAdder::addComponents ( TTAMachine::Machine mach)
inlineprivate

Builds the machine in basis of the analyzed data from the applications.

Returns
The initial machine of NULL if an error occurred.

Definition at line 204 of file ComponentAdder.cc.

204  {
205  // add register files
206  addRegisterFiles(mach);
207  }

◆ addRegisterFiles()

void ComponentAdder::addRegisterFiles ( TTAMachine::Machine mach)
inlineprivate

Adds register file(s) to the machine

TODO: add type and guard latency setting

Returns
void

Definition at line 217 of file ComponentAdder.cc.

217  {
218  for (int i = 0; i < RFCount_; i++) {
219  std::string RFName = RFName_ + Conversion::toString(i);
220 
222  mach->registerFileNavigator();
223  if (RFNav.hasItem(RFName)) {
224  RFName = RFName_ + Conversion::toString(i+RFNav.count());
225  }
226 
228  RFName, RFSize_, 32, RFReadPorts_, RFWritePorts_, 0,
230  for (int n = 0; n < RFReadPorts_; n++) {
231  new TTAMachine::RFPort("read" +
232  Conversion::toString( + 1), *rf);
233  }
234  for (int n = 0; n < RFWritePorts_; n++) {
235  new TTAMachine::RFPort("write" +
236  Conversion::toString(n + 1), *rf);
237  }
238  try {
239  mach->addRegisterFile(*rf);
240  } catch (const ComponentAlreadyExists& e) {
241  verboseLog("ComponentAdder: Tried to add RF with a already"
242  "existing name (" + RFName)
244  }
245  }
246  }

References TTAMachine::Machine::addRegisterFile(), TTAMachine::Machine::Navigator< ComponentType >::count(), Application::exitProgram(), TTAMachine::Machine::Navigator< ComponentType >::hasItem(), TTAMachine::RegisterFile::NORMAL, TTAMachine::Machine::registerFileNavigator(), Conversion::toString(), and verboseLog.

Here is the call graph for this function:

◆ explore()

virtual std::vector<RowID> ComponentAdder::explore ( const RowID configurationID,
const unsigned int &   
)
inlineprivatevirtual

Explorer plugin that adds machine components to a given machine with adf parameter or with configuration id in dsdb.

Reimplemented from DesignSpaceExplorerPlugin.

Definition at line 100 of file ComponentAdder.cc.

100  {
101  readParameters();
102  std::vector<RowID> result;
103 
104  // check if adf given
105  if (configurationID == 0 && adf_ == "") {
106  std::ostringstream msg(std::ostringstream::out);
107  msg << "No configuration nor adf defined. Use -s <confID> to "
108  << "define the configuration to be optimized or give adf "
109  << "as plugin parameter." << endl;
110  verboseLog(msg.str());
111  return result;
112  }
113 
114  DSDBManager& dsdb = db();
116  conf.hasImplementation = false;
117  TTAMachine::Machine* mach = NULL;
118 
119  // load the adf from file or from dsdb
120  try {
121  if (adf_ != "") {
123  } else {
124  conf = dsdb.configuration(configurationID);
125  mach = dsdb.architecture(conf.architectureID);
126  }
127  } catch (const Exception& e) {
128  std::ostringstream msg(std::ostringstream::out);
129  msg << "Error loading the adf." << std::endl;
130  verboseLog(msg.str());
131  return result;
132  }
133  assert(mach != NULL);
134 
135  // add components
136  addComponents(mach);
137 
138  if (buildIdf_) {
139  try {
140  // add idf to configuration
141  selector_.selectComponentsToConf(conf, dsdb, mach);
142  } catch (const Exception& e) {
143  std::ostringstream msg(std::ostringstream::out);
144  msg << e.errorMessage()
145  << " " << e.fileName()
146  << " " << e.lineNum() << std::endl;
147  verboseLog(msg.str());
148  }
149  } else {
150  conf.hasImplementation = false;
151  }
152 
153  // add machine to configuration
154  conf.architectureID = dsdb.addArchitecture(*mach);
155 
156  // add new configuration to dsdb
157  RowID confID = dsdb.addConfiguration(conf);
158  result.push_back(confID);
159  return result;
160  }

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

Here is the call graph for this function:

◆ PLUGIN_DESCRIPTION()

ComponentAdder::PLUGIN_DESCRIPTION ( "Explorer plugin that adds machine components to a " "given machine."  )
private

◆ producesArchitecture()

virtual bool ComponentAdder::producesArchitecture ( ) const
inlineprivatevirtual

Implements DesignSpaceExplorerPlugin.

Definition at line 90 of file ComponentAdder.cc.

90 { return true; }

◆ readParameters()

void ComponentAdder::readParameters ( )
inlineprivate

◆ requiresApplication()

virtual bool ComponentAdder::requiresApplication ( ) const
inlineprivatevirtual

Reimplemented from DesignSpaceExplorerPlugin.

Definition at line 93 of file ComponentAdder.cc.

93 { return false; }

◆ requiresHDB()

virtual bool ComponentAdder::requiresHDB ( ) const
inlineprivatevirtual

Implements DesignSpaceExplorerPlugin.

Definition at line 91 of file ComponentAdder.cc.

91 { return false; }

◆ requiresSimulationData()

virtual bool ComponentAdder::requiresSimulationData ( ) const
inlineprivatevirtual

Implements DesignSpaceExplorerPlugin.

Definition at line 92 of file ComponentAdder.cc.

92 { return true; }

◆ requiresStartingPointArchitecture()

virtual bool ComponentAdder::requiresStartingPointArchitecture ( ) const
inlineprivatevirtual

Implements DesignSpaceExplorerPlugin.

Definition at line 89 of file ComponentAdder.cc.

89 { return false; }

Member Data Documentation

◆ adf_

std::string ComponentAdder::adf_
private

name of the adf file if wanted to use idf generation

Definition at line 181 of file ComponentAdder.cc.

◆ adfPN_

const std::string ComponentAdder::adfPN_
staticprivate

Definition at line 171 of file ComponentAdder.cc.

◆ buildIdf_

bool ComponentAdder::buildIdf_
private

do we build idf

Definition at line 183 of file ComponentAdder.cc.

◆ buildIdfPN_

const std::string ComponentAdder::buildIdfPN_
staticprivate

Definition at line 172 of file ComponentAdder.cc.

◆ RFCount_

int ComponentAdder::RFCount_
private

Definition at line 176 of file ComponentAdder.cc.

◆ RFCountPN_

const std::string ComponentAdder::RFCountPN_
staticprivate

Definition at line 167 of file ComponentAdder.cc.

◆ RFName_

std::string ComponentAdder::RFName_
private

Definition at line 175 of file ComponentAdder.cc.

◆ RFNamePN_

const std::string ComponentAdder::RFNamePN_
staticprivate

Definition at line 166 of file ComponentAdder.cc.

◆ RFReadPorts_

int ComponentAdder::RFReadPorts_
private

Definition at line 178 of file ComponentAdder.cc.

◆ RFReadPortsPN_

const std::string ComponentAdder::RFReadPortsPN_
staticprivate

Definition at line 169 of file ComponentAdder.cc.

◆ RFSize_

int ComponentAdder::RFSize_
private

Definition at line 177 of file ComponentAdder.cc.

◆ RFSizePN_

const std::string ComponentAdder::RFSizePN_
staticprivate

Definition at line 168 of file ComponentAdder.cc.

◆ RFWritePorts_

int ComponentAdder::RFWritePorts_
private

Definition at line 179 of file ComponentAdder.cc.

◆ RFWritePortsPN_

const std::string ComponentAdder::RFWritePortsPN_
staticprivate

Definition at line 170 of file ComponentAdder.cc.

◆ selector_

ComponentImplementationSelector ComponentAdder::selector_
private

Selector used by the plugin.

Definition at line 164 of file ComponentAdder.cc.


The documentation for this class was generated from the following file:
Exception::lineNum
int lineNum() const
DesignSpaceExplorer::db
virtual DSDBManager & db()
Definition: DesignSpaceExplorer.cc:300
UINT
@ UINT
Definition: ExplorerPluginParameter.hh:40
DSDBManager::architecture
TTAMachine::Machine * architecture(RowID id) const
Definition: DSDBManager.cc:807
DSDBManager::MachineConfiguration::hasImplementation
bool hasImplementation
Definition: DSDBManager.hh:80
Application::exitProgram
static void exitProgram(const int status=EXIT_SUCCESS)
Definition: Application.cc:258
ComponentAdder::RFWritePorts_
int RFWritePorts_
Definition: ComponentAdder.cc:179
RowID
int RowID
Type definition of row ID in relational databases.
Definition: DBTypes.hh:37
DesignSpaceExplorerPlugin::DesignSpaceExplorerPlugin
DesignSpaceExplorerPlugin()
Definition: DesignSpaceExplorerPlugin.cc:48
ComponentAdder::RFReadPorts_
int RFReadPorts_
Definition: ComponentAdder.cc:178
TTAMachine::Machine::Navigator::count
int count() const
Conversion::toString
static std::string toString(const T &source)
verboseLog
#define verboseLog(text)
Definition: Application.hh:115
TTAMachine::RFPort
Definition: RFPort.hh:45
ComponentAdder::buildIdf_
bool buildIdf_
do we build idf
Definition: ComponentAdder.cc:183
ComponentAdder::adf_
std::string adf_
name of the adf file if wanted to use idf generation
Definition: ComponentAdder.cc:181
BOOL
@ BOOL
Definition: ExplorerPluginParameter.hh:40
Exception::fileName
std::string fileName() const
ComponentAdder::selector_
ComponentImplementationSelector selector_
Selector used by the plugin.
Definition: ComponentAdder.cc:164
assert
#define assert(condition)
Definition: Application.hh:86
TTAMachine::Machine::addRegisterFile
virtual void addRegisterFile(RegisterFile &unit)
Definition: Machine.cc:236
DesignSpaceExplorerPlugin::readOptionalParameter
void readOptionalParameter(const std::string paramName, T &param) const
ComponentAdder::RFNamePN_
static const std::string RFNamePN_
Definition: ComponentAdder.cc:166
DSDBManager::MachineConfiguration
Definition: DSDBManager.hh:78
STRING
@ STRING
Definition: ExplorerPluginParameter.hh:40
ComponentAdder::buildIdfPN_
static const std::string buildIdfPN_
Definition: ComponentAdder.cc:172
TTAMachine::Machine::Navigator::hasItem
bool hasItem(const std::string &name) const
ComponentAdder::RFSize_
int RFSize_
Definition: ComponentAdder.cc:177
ComponentAdder::RFWritePortsPN_
static const std::string RFWritePortsPN_
Definition: ComponentAdder.cc:170
Exception
Definition: Exception.hh:54
DSDBManager
Definition: DSDBManager.hh:76
ComponentAdder::RFCountPN_
static const std::string RFCountPN_
Definition: ComponentAdder.cc:167
ComponentAdder::adfPN_
static const std::string adfPN_
Definition: ComponentAdder.cc:171
Exception::errorMessage
std::string errorMessage() const
Definition: Exception.cc:123
DSDBManager::addConfiguration
RowID addConfiguration(const MachineConfiguration &conf)
Definition: DSDBManager.cc:299
DSDBManager::addArchitecture
RowID addArchitecture(const TTAMachine::Machine &mom)
Definition: DSDBManager.cc:191
TTAMachine::Machine::registerFileNavigator
virtual RegisterFileNavigator registerFileNavigator() const
Definition: Machine.cc:450
DSDBManager::configuration
MachineConfiguration configuration(RowID id) const
Definition: DSDBManager.cc:361
ComponentAdder::addComponents
void addComponents(TTAMachine::Machine *mach)
Definition: ComponentAdder.cc:204
ComponentAdder::readParameters
void readParameters()
Definition: ComponentAdder.cc:188
ComponentAdder::addRegisterFiles
void addRegisterFiles(TTAMachine::Machine *mach)
Definition: ComponentAdder.cc:217
ComponentAdder::RFReadPortsPN_
static const std::string RFReadPortsPN_
Definition: ComponentAdder.cc:169
TTAMachine::RegisterFile::NORMAL
@ NORMAL
Used for general register allocation.
Definition: RegisterFile.hh:51
ComponentAlreadyExists
Definition: Exception.hh:510
ComponentAdder::RFSizePN_
static const std::string RFSizePN_
Definition: ComponentAdder.cc:168
ComponentAdder::RFName_
std::string RFName_
Definition: ComponentAdder.cc:175
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
DSDBManager::MachineConfiguration::architectureID
RowID architectureID
Definition: DSDBManager.hh:79
ComponentAdder::RFCount_
int RFCount_
Definition: ComponentAdder.cc:176
TTAMachine::Machine::Navigator
Definition: Machine.hh:186
DesignSpaceExplorerPlugin::addParameter
void addParameter(TCEString name, ExplorerPluginParameterType type, bool compulsory=true, TCEString defaultValue="", TCEString description="")
TTAMachine::Machine
Definition: Machine.hh:73
TTAMachine::Machine::loadFromADF
static Machine * loadFromADF(const std::string &adfFileName)
Definition: Machine.cc:905