OpenASIP 2.2
Loading...
Searching...
No Matches
Private Member Functions | Private Attributes | Static Private Attributes | List of all members
RemoveUnconnectedComponents Class Reference
Inheritance diagram for RemoveUnconnectedComponents:
Inheritance graph
Collaboration diagram for RemoveUnconnectedComponents:
Collaboration graph

Private Member Functions

 PLUGIN_DESCRIPTION ("Removes unconnected components from a configuration.")
 
 RemoveUnconnectedComponents ()
 
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 removeUnconnectedFUs (TTAMachine::Machine &mach, std::vector< std::string > &removedFUNames)
 
void checkFUPorts (TTAMachine::Machine &mach)
 
void checkRFPorts (TTAMachine::Machine &mach, std::vector< std::string > &removedRFNames)
 
void checkBuses (TTAMachine::Machine &mach)
 
void removeSockets (TTAMachine::Machine &mach)
 

Private Attributes

bool allowRemoval_
 parameter allow removal of unused ports and RFs without ports.
 

Static Private Attributes

static const std::string allowRemovalPN_
 

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 removes unconnected ports from units or creates connections to these ports in case of a FUs. Also removes unconnected buses. If all ports from a unit are removed, removes also the unit.

Definition at line 57 of file RemoveUnconnectedComponents.cc.

Constructor & Destructor Documentation

◆ RemoveUnconnectedComponents()

RemoveUnconnectedComponents::RemoveUnconnectedComponents ( )
inlineprivate

Definition at line 60 of file RemoveUnconnectedComponents.cc.

61 allowRemoval_(false) {
62
63 // compulsory parameters
64 // no compulsory parameters
65
66 // parameters that have a default value
69 }
#define BOOL()
static std::string toString(const T &source)
void addParameter(TCEString name, ExplorerPluginParameterType type, bool compulsory=true, TCEString defaultValue="", TCEString description="")
bool allowRemoval_
parameter allow removal of unused ports and RFs without ports.

References DesignSpaceExplorerPlugin::addParameter(), allowRemoval_, allowRemovalPN_, BOOL, and Conversion::toString().

Here is the call graph for this function:

Member Function Documentation

◆ checkBuses()

void RemoveUnconnectedComponents::checkBuses ( TTAMachine::Machine mach)
inlineprivate

Checks buses and removes the ones that have no connections to sockets.

Parameters
machMachine which buses are checked.

Definition at line 300 of file RemoveUnconnectedComponents.cc.

300 {
301 Machine::SocketNavigator socketNav = mach.socketNavigator();
302 Machine::BusNavigator busNav = mach.busNavigator();
303 for (int i = 0; i < busNav.count(); ++i) {
304 bool isConnected = false;
305 for (int j = 0; j < socketNav.count(); ++j) {
306 if ((busNav.item(i))->isConnectedTo(
307 *socketNav.item(j))) {
308 isConnected = true;
309 }
310 }
311 // if not connected to any socket remove bus
312 if (!isConnected) {
313 mach.removeBus(*busNav.item(i));
314 }
315 }
316 }
ComponentType * item(int index) const
virtual SocketNavigator socketNavigator() const
Definition Machine.cc:368
virtual void removeBus(Bus &bus)
Definition Machine.cc:477
virtual BusNavigator busNavigator() const
Definition Machine.cc:356

References TTAMachine::Machine::busNavigator(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Machine::removeBus(), and TTAMachine::Machine::socketNavigator().

Referenced by explore().

Here is the call graph for this function:

◆ checkFUPorts()

void RemoveUnconnectedComponents::checkFUPorts ( TTAMachine::Machine mach)
inlineprivate

Checks that every FU port has at least one connection.

Adds an new connection to some available socket if port has no connections

Parameters
machMachine which FU ports are checked.

Definition at line 221 of file RemoveUnconnectedComponents.cc.

221 {
222 MachineTester& tester = mach.machineTester();
223 Machine::SocketNavigator socketNav = mach.socketNavigator();
224
226 for (int i = 0; i < FUNav.count(); ++i) {
227 FunctionUnit* FU = FUNav.item(i);
228 for (int j = 0; j < FU->portCount(); ++j) {
229 Port* port = FU->port(j);
230 // if no connections, make a connection to some socket
231 if (port->socketCount() < 1) {
232 Socket* socket = NULL;
233 // find a socket where FU port can be connected
234 for (int soc = 0; i < socketNav.count(); ++soc) {
235 socket = socketNav.item(soc);
236 if (tester.canConnect(*socket, *port)) {
237 port->attachSocket(*socket);
238 break;
239 }
240 }
241 }
242 }
243 }
244 }
const string FU
virtual bool canConnect(const TTAMachine::Socket &socket, const TTAMachine::Segment &segment)
virtual FunctionUnitNavigator functionUnitNavigator() const
Definition Machine.cc:380
MachineTester & machineTester() const
Definition Machine.cc:671
virtual void attachSocket(Socket &socket)
Definition Port.cc:191
virtual int socketCount() const
Definition Port.cc:375

References TTAMachine::Port::attachSocket(), MachineTester::canConnect(), TTAMachine::Machine::Navigator< ComponentType >::count(), FU, TTAMachine::Machine::functionUnitNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Machine::machineTester(), TTAMachine::Port::socketCount(), and TTAMachine::Machine::socketNavigator().

Referenced by explore().

Here is the call graph for this function:

◆ checkRFPorts()

void RemoveUnconnectedComponents::checkRFPorts ( TTAMachine::Machine mach,
std::vector< std::string > &  removedRFNames 
)
inlineprivate

Checks that every RF port has connections.

Removes every port of a RF that has no connections to sockets if allowRemoval_ is true else makes connection to available socket. If RF ends up having no ports, removes the RF from machine.

Parameters
machMachine which RF ports are checked.
removedRFNamesNames of RF units that were removed from machine content only added not read in this function.

Definition at line 257 of file RemoveUnconnectedComponents.cc.

258 {
259
260 MachineTester& tester = mach.machineTester();
261 Machine::SocketNavigator socketNav = mach.socketNavigator();
262
264 for (int i = 0; i < RFNav.count(); ++i) {
265 RegisterFile* RF = RFNav.item(i);
266 for (int j = 0; j < RF->portCount(); ++j) {
267 Port* port = RF->port(j);
268 // if no connections
269 if (port->socketCount() < 1) {
270 if (allowRemoval_) {
271 delete port;
272 port = NULL;
273 --j;
274 if (RF->portCount() < 1) {
275 mach.removeRegisterFile(*RF);
276 removedRFNames.push_back(RF->name());
277 --i;
278 }
279 } else {
280 Socket* socket = NULL;
281 // find a socket where RF port can be connected
282 for (int soc = 0; i < socketNav.count(); ++soc) {
283 socket = socketNav.item(soc);
284 if (tester.canConnect(*socket, *port)) {
285 port->attachSocket(*socket);
286 break;
287 }
288 }
289 }
290 }
291 }
292 }
293 }
const string RF
virtual RegisterFileNavigator registerFileNavigator() const
Definition Machine.cc:450
virtual void removeRegisterFile(RegisterFile &unit)
Definition Machine.cc:554

References allowRemoval_, TTAMachine::Port::attachSocket(), MachineTester::canConnect(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Machine::machineTester(), TTAMachine::Machine::registerFileNavigator(), TTAMachine::Machine::removeRegisterFile(), RF, TTAMachine::Port::socketCount(), and TTAMachine::Machine::socketNavigator().

Referenced by explore().

Here is the call graph for this function:

◆ explore()

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

Removes unconnected components from a configuration.

Explorer plugin that removes unconnected ports from units or creates connections to these ports in case of a FUs. Also removes unconnected buses. If all ports from a unit are removed, removes also the unit. Removes also unconnected FUs. First unconnected sockets are removed.

Supported parameters:

  • allow_remove, Allows the RFs port removal and portless RFs removal.
Parameters
configurationIDConfiguration to optimize.

Reimplemented from DesignSpaceExplorerPlugin.

Definition at line 92 of file RemoveUnconnectedComponents.cc.

92 {
93
94 std::vector<RowID> result;
95
97
98 try {
99 DSDBManager& dsdb = db();
101 dsdb.configuration(configurationID);
102
103 // get the machine belonging to the configuration
104 Machine* mach = NULL;
105 try {
106 mach = dsdb.architecture(conf.architectureID);
107 } catch (const Exception& e) {
108 return result;
109 }
110
111 // removes sockets not connected to any bus
112 removeSockets(*mach);
113
114 // removes FUs not connected to any socket by any port
115 std::vector<std::string> removedFUNames;
116 removeUnconnectedFUs(*mach, removedFUNames);
117
118 // checks that every FU port is connected to a socket
119 checkFUPorts(*mach);
120
121 // register files are removed only if allow_remove parameter is
122 // given, else connections to sockets are made for RFs
123 std::vector<std::string> removedRFNames;
124 checkRFPorts(*mach, removedRFNames);
125
126 // removes buses that have no connections to any socket
127 checkBuses(*mach);
128
130 if (conf.hasImplementation) {
131 newConf.hasImplementation = true;
134 // removes removed RFs from idf
135 while (!removedRFNames.empty()) {
136 idf->removeRFImplementation(removedRFNames.at(
137 removedRFNames.size()-1));
138 removedRFNames.pop_back();
139 }
140 // removes removed FUs from idf
141 while (!removedFUNames.empty()) {
142 idf->removeFUImplementation(removedFUNames.at(
143 removedFUNames.size()-1));
144 removedFUNames.pop_back();
145 }
146 newConf.implementationID =
147 dsdb.addImplementation(*idf, 0, 0);
148 } else {
149 newConf.hasImplementation = false;
150 }
151 newConf.architectureID = dsdb.addArchitecture(*mach);
152
153 RowID confID = dsdb.addConfiguration(newConf);
154 result.push_back(confID);
155
156 } catch (const Exception& e) {
157 std::ostringstream msg(std::ostringstream::out);
158 msg << "Error while using RemoveUnconnectedComponents:"
159 << endl << e.errorMessage() << endl;
160 verboseLog(msg.str());
161 return result;
162 }
163 return result;
164 }
#define verboseLog(text)
int RowID
Type definition of row ID in relational databases.
Definition DBTypes.hh:37
RowID addArchitecture(const TTAMachine::Machine &mom)
TTAMachine::Machine * architecture(RowID id) const
IDF::MachineImplementation * implementation(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 errorMessage() const
Definition Exception.cc:123
void removeFUImplementation(const std::string &unitName)
void removeRFImplementation(const std::string &unitName)
void checkFUPorts(TTAMachine::Machine &mach)
void removeSockets(TTAMachine::Machine &mach)
void removeUnconnectedFUs(TTAMachine::Machine &mach, std::vector< std::string > &removedFUNames)
void checkRFPorts(TTAMachine::Machine &mach, std::vector< std::string > &removedRFNames)
void checkBuses(TTAMachine::Machine &mach)

References DSDBManager::addArchitecture(), DSDBManager::addConfiguration(), DSDBManager::addImplementation(), DSDBManager::architecture(), DSDBManager::MachineConfiguration::architectureID, checkBuses(), checkFUPorts(), checkRFPorts(), DSDBManager::configuration(), DesignSpaceExplorer::db(), Exception::errorMessage(), DSDBManager::MachineConfiguration::hasImplementation, DSDBManager::implementation(), DSDBManager::MachineConfiguration::implementationID, readParameters(), IDF::MachineImplementation::removeFUImplementation(), IDF::MachineImplementation::removeRFImplementation(), removeSockets(), removeUnconnectedFUs(), and verboseLog.

Here is the call graph for this function:

◆ PLUGIN_DESCRIPTION()

RemoveUnconnectedComponents::PLUGIN_DESCRIPTION ( "Removes unconnected components from a configuration."  )
private

◆ producesArchitecture()

virtual bool RemoveUnconnectedComponents::producesArchitecture ( ) const
inlineprivatevirtual

Implements DesignSpaceExplorerPlugin.

Definition at line 73 of file RemoveUnconnectedComponents.cc.

73{ return true; }

◆ readParameters()

void RemoveUnconnectedComponents::readParameters ( )
inlineprivate

Reads the parameters given to the plugin.

Definition at line 175 of file RemoveUnconnectedComponents.cc.

175 {
177 }
void readOptionalParameter(const std::string paramName, T &param) const

References allowRemoval_, allowRemovalPN_, and DesignSpaceExplorerPlugin::readOptionalParameter().

Referenced by explore().

Here is the call graph for this function:

◆ removeSockets()

void RemoveUnconnectedComponents::removeSockets ( TTAMachine::Machine mach)
inlineprivate

Removes sockets that are not needed in the machine.

Parameters
machMachine which extra sockets are removed.

Definition at line 323 of file RemoveUnconnectedComponents.cc.

323 {
324
325 // remove not connected sockets
327 std::list<std::string> removedSocketNames;
328 modifier.removeNotConnectedSockets(mach, removedSocketNames);
329 }
void removeNotConnectedSockets(TTAMachine::Machine &mach, std::list< std::string > &removedSocketNames)

References MachineResourceModifier::removeNotConnectedSockets().

Referenced by explore().

Here is the call graph for this function:

◆ removeUnconnectedFUs()

void RemoveUnconnectedComponents::removeUnconnectedFUs ( TTAMachine::Machine mach,
std::vector< std::string > &  removedFUNames 
)
inlineprivate

Removes totally unconnected FUs.

Parameters
machMachine which unconnected FUs are removed.
removedFUNamesNames of FU units that were removed from machine

Definition at line 186 of file RemoveUnconnectedComponents.cc.

187 {
188
189 //MachineTester& tester = mach.machineTester();
190 Machine::SocketNavigator socketNav = mach.socketNavigator();
191
193 for (int i = 0; i < FUNav.count(); ++i) {
194 FunctionUnit* FU = FUNav.item(i);
195 bool noConnections = true;
196 for (int j = 0; j < FU->portCount(); ++j) {
197 Port* port = FU->port(j);
198 // if no connections
199 if (port->socketCount() > 0) {
200 noConnections = false;
201 break;
202 }
203 }
204 // remove FU if it did not have any connections
205 if (noConnections) {
206 mach.removeFunctionUnit(*FU);
207 removedFUNames.push_back(FU->name());
208 --i;
209 }
210 }
211 }
virtual void removeFunctionUnit(FunctionUnit &unit)
Definition Machine.cc:530

References TTAMachine::Machine::Navigator< ComponentType >::count(), FU, TTAMachine::Machine::functionUnitNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Machine::removeFunctionUnit(), TTAMachine::Port::socketCount(), and TTAMachine::Machine::socketNavigator().

Referenced by explore().

Here is the call graph for this function:

◆ requiresApplication()

virtual bool RemoveUnconnectedComponents::requiresApplication ( ) const
inlineprivatevirtual

Reimplemented from DesignSpaceExplorerPlugin.

Definition at line 76 of file RemoveUnconnectedComponents.cc.

76{ return false; }

◆ requiresHDB()

virtual bool RemoveUnconnectedComponents::requiresHDB ( ) const
inlineprivatevirtual

Implements DesignSpaceExplorerPlugin.

Definition at line 74 of file RemoveUnconnectedComponents.cc.

74{ return false; }

◆ requiresSimulationData()

virtual bool RemoveUnconnectedComponents::requiresSimulationData ( ) const
inlineprivatevirtual

Implements DesignSpaceExplorerPlugin.

Definition at line 75 of file RemoveUnconnectedComponents.cc.

75{ return false; }

◆ requiresStartingPointArchitecture()

virtual bool RemoveUnconnectedComponents::requiresStartingPointArchitecture ( ) const
inlineprivatevirtual

Implements DesignSpaceExplorerPlugin.

Definition at line 72 of file RemoveUnconnectedComponents.cc.

72{ return true; }

Member Data Documentation

◆ allowRemoval_

bool RemoveUnconnectedComponents::allowRemoval_
private

parameter allow removal of unused ports and RFs without ports.

Definition at line 169 of file RemoveUnconnectedComponents.cc.

Referenced by checkRFPorts(), readParameters(), and RemoveUnconnectedComponents().

◆ allowRemovalPN_

const std::string RemoveUnconnectedComponents::allowRemovalPN_
staticprivate

Definition at line 167 of file RemoveUnconnectedComponents.cc.

Referenced by readParameters(), and RemoveUnconnectedComponents().


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