OpenASIP 2.2
Loading...
Searching...
No Matches
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.
 
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
 
bool buildIdf_
 do we build idf
 

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

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),
73 adf_(""),
74 buildIdf_(false) {
75
76 // compulsory parameters
77 // no compulsory parameters
78
79 // parameters that have a default value
87 }
#define UINT(OPERAND)
Definition OSAL.hh:313
#define BOOL()
static const std::string RFSizePN_
std::string adf_
name of the adf file if wanted to use idf generation
static const std::string RFCountPN_
static const std::string RFReadPortsPN_
static const std::string buildIdfPN_
std::string RFName_
static const std::string RFNamePN_
static const std::string RFWritePortsPN_
bool buildIdf_
do we build idf
static const std::string adfPN_
static std::string toString(const T &source)
void addParameter(TCEString name, ExplorerPluginParameterType type, bool compulsory=true, TCEString defaultValue="", TCEString description="")

References DesignSpaceExplorerPlugin::addParameter(), adf_, adfPN_, BOOL, buildIdf_, buildIdfPN_, RFCount_, RFCountPN_, RFName_, RFNamePN_, RFReadPorts_, RFReadPortsPN_, RFSize_, RFSizePN_, RFWritePorts_, RFWritePortsPN_, 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 }
void addRegisterFiles(TTAMachine::Machine *mach)

References addRegisterFiles().

Referenced by explore().

Here is the call graph for this function:

◆ 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 }
#define verboseLog(text)
static void exitProgram(const int status=EXIT_SUCCESS)
bool hasItem(const std::string &name) const
virtual RegisterFileNavigator registerFileNavigator() const
Definition Machine.cc:450
virtual void addRegisterFile(RegisterFile &unit)
Definition Machine.cc:236
@ NORMAL
Used for general register allocation.

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

Referenced by addComponents().

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 {
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 }
#define assert(condition)
int RowID
Type definition of row ID in relational databases.
Definition DBTypes.hh:37
void addComponents(TTAMachine::Machine *mach)
ComponentImplementationSelector selector_
Selector used by the plugin.
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)
RowID addArchitecture(const TTAMachine::Machine &mom)
TTAMachine::Machine * architecture(RowID id) const
MachineConfiguration configuration(RowID id) const
RowID addConfiguration(const MachineConfiguration &conf)
virtual DSDBManager & db()
std::string fileName() const
std::string errorMessage() const
Definition Exception.cc:123
int lineNum() const
static Machine * loadFromADF(const std::string &adfFileName)
Definition Machine.cc:899

References DSDBManager::addArchitecture(), addComponents(), DSDBManager::addConfiguration(), adf_, DSDBManager::architecture(), DSDBManager::MachineConfiguration::architectureID, assert, buildIdf_, DSDBManager::configuration(), DesignSpaceExplorer::db(), Exception::errorMessage(), Exception::fileName(), DSDBManager::MachineConfiguration::hasImplementation, Exception::lineNum(), TTAMachine::Machine::loadFromADF(), readParameters(), ComponentImplementationSelector::selectComponentsToConf(), selector_, 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.

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

◆ adfPN_

const std::string ComponentAdder::adfPN_
staticprivate

Definition at line 171 of file ComponentAdder.cc.

Referenced by ComponentAdder(), and readParameters().

◆ buildIdf_

bool ComponentAdder::buildIdf_
private

do we build idf

Definition at line 183 of file ComponentAdder.cc.

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

◆ buildIdfPN_

const std::string ComponentAdder::buildIdfPN_
staticprivate

Definition at line 172 of file ComponentAdder.cc.

Referenced by ComponentAdder(), and readParameters().

◆ RFCount_

int ComponentAdder::RFCount_
private

Definition at line 176 of file ComponentAdder.cc.

Referenced by addRegisterFiles(), ComponentAdder(), and readParameters().

◆ RFCountPN_

const std::string ComponentAdder::RFCountPN_
staticprivate

Definition at line 167 of file ComponentAdder.cc.

Referenced by ComponentAdder(), and readParameters().

◆ RFName_

std::string ComponentAdder::RFName_
private

Definition at line 175 of file ComponentAdder.cc.

Referenced by addRegisterFiles(), ComponentAdder(), and readParameters().

◆ RFNamePN_

const std::string ComponentAdder::RFNamePN_
staticprivate

Definition at line 166 of file ComponentAdder.cc.

Referenced by ComponentAdder(), and readParameters().

◆ RFReadPorts_

int ComponentAdder::RFReadPorts_
private

Definition at line 178 of file ComponentAdder.cc.

Referenced by addRegisterFiles(), ComponentAdder(), and readParameters().

◆ RFReadPortsPN_

const std::string ComponentAdder::RFReadPortsPN_
staticprivate

Definition at line 169 of file ComponentAdder.cc.

Referenced by ComponentAdder(), and readParameters().

◆ RFSize_

int ComponentAdder::RFSize_
private

Definition at line 177 of file ComponentAdder.cc.

Referenced by addRegisterFiles(), ComponentAdder(), and readParameters().

◆ RFSizePN_

const std::string ComponentAdder::RFSizePN_
staticprivate

Definition at line 168 of file ComponentAdder.cc.

Referenced by ComponentAdder(), and readParameters().

◆ RFWritePorts_

int ComponentAdder::RFWritePorts_
private

Definition at line 179 of file ComponentAdder.cc.

Referenced by addRegisterFiles(), ComponentAdder(), and readParameters().

◆ RFWritePortsPN_

const std::string ComponentAdder::RFWritePortsPN_
staticprivate

Definition at line 170 of file ComponentAdder.cc.

Referenced by ComponentAdder(), and readParameters().

◆ selector_

ComponentImplementationSelector ComponentAdder::selector_
private

Selector used by the plugin.

Definition at line 164 of file ComponentAdder.cc.

Referenced by explore().


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