OpenASIP
2.0
|
#include <MachineResourceModifier.hh>
Public Types | |
typedef std::multimap< double, TTAMachine::Bus * > | BusMap |
Map of bus amounts in percents. More... | |
typedef std::multimap< double, TTAMachine::RegisterFile * > | RegisterMap |
Map of register amounts in percents. More... | |
typedef std::multimap< double, TTAMachine::FunctionUnit * > | FunctionUnitMap |
Map of function unit amounts in percents. More... | |
Public Member Functions | |
MachineResourceModifier () | |
virtual | ~MachineResourceModifier () |
void | addBusesByAmount (int busesToAdd, TTAMachine::Machine &mach) |
void | increaseAllRFsThatDiffersByAmount (int registersToAdd, TTAMachine::Machine &mach) |
void | percentualRegisterIncrease (double percentsOfRegistersToAdd, TTAMachine::Machine &mach) |
void | increaseAllFUsThatDiffersByAmount (int moreFUs, TTAMachine::Machine &mach) |
void | percentualFUIncrease (double percentualFUIncrease, TTAMachine::Machine &mach) |
void | reduceBuses (const int &busesToRemove, TTAMachine::Machine &mach, std::list< std::string > &removedBusNames) |
bool | removeBuses (const int &countToRemove, TTAMachine::Machine &mach, std::list< std::string > &removedBusNames) |
void | removeNotConnectedSockets (TTAMachine::Machine &mach, std::list< std::string > &removedSocketNames) |
void | analyzeBuses (const TTAMachine::Machine &mach, BusMap &busMap) const |
void | analyzeRegisters (const TTAMachine::Machine &mach, RegisterMap ®isterMap) const |
void | analyzeFunctionUnits (const TTAMachine::Machine &mach, FunctionUnitMap &unitMap) const |
Private Member Functions | |
bool | hasSlot (const TTAMachine::Machine &mach, const std::string &slotName) |
Class that adds or removes resources of the given architecture.
Definition at line 49 of file MachineResourceModifier.hh.
typedef std::multimap<double, TTAMachine::Bus*> MachineResourceModifier::BusMap |
Map of bus amounts in percents.
Definition at line 52 of file MachineResourceModifier.hh.
typedef std::multimap<double, TTAMachine::FunctionUnit*> MachineResourceModifier::FunctionUnitMap |
Map of function unit amounts in percents.
Definition at line 56 of file MachineResourceModifier.hh.
typedef std::multimap<double, TTAMachine::RegisterFile*> MachineResourceModifier::RegisterMap |
Map of register amounts in percents.
Definition at line 54 of file MachineResourceModifier.hh.
MachineResourceModifier::MachineResourceModifier | ( | ) |
|
virtual |
void MachineResourceModifier::addBusesByAmount | ( | int | busesToAdd, |
TTAMachine::Machine & | mach | ||
) |
Adds given number of buses to the given architecture.
Determines the bus parameters in basis of the original architecture and the most common bus types are added first.
busesToAdd | Number of buses to add. @mach Architecture where the buses are added. |
Definition at line 67 of file MachineResourceModifier.cc.
References TTAMachine::Machine::addBus(), TTAMachine::Machine::busNavigator(), TTAMachine::Bus::copy(), TTAMachine::Bus::copyGuardsTo(), FullyConnectedCheck::fix(), TTAMachine::Machine::Navigator< ComponentType >::hasItem(), TTAMachine::Component::name(), TTAMachine::Bus::setName(), and Conversion::toString().
Referenced by GrowMachine::explore().
void MachineResourceModifier::analyzeBuses | ( | const TTAMachine::Machine & | mach, |
BusMap & | busMap | ||
) | const |
Analyzes the bus types of the architecture.
mach | Machine to be analyzed. |
busMap | Map where bus counts are stored. |
Definition at line 272 of file MachineResourceModifier.cc.
References assert, TTAMachine::Machine::busNavigator(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Bus::isArchitectureEqual(), TTAMachine::Machine::Navigator< ComponentType >::item(), Conversion::toDouble(), and Conversion::toInt().
void MachineResourceModifier::analyzeFunctionUnits | ( | const TTAMachine::Machine & | mach, |
FunctionUnitMap & | unitMap | ||
) | const |
Analyzes the unit types of the architecture.
mach | Machine which function units are analyzed. |
unitMap | Map where unit counts are stored. FU pointers in the map are pointers to the machine units. |
Definition at line 554 of file MachineResourceModifier.cc.
References assert, TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::functionUnitNavigator(), TTAMachine::FunctionUnit::isArchitectureEqual(), TTAMachine::Machine::Navigator< ComponentType >::item(), Conversion::toDouble(), and Conversion::toInt().
Referenced by MinimizeMachine::minimizeFunctionUnits().
void MachineResourceModifier::analyzeRegisters | ( | const TTAMachine::Machine & | mach, |
RegisterMap & | registerMap | ||
) | const |
Analyzes the register types of the architecture.
mach | Machine which registers are analyzed. |
registerMap | Map where register counts are stored. |
Definition at line 410 of file MachineResourceModifier.cc.
References assert, TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::RegisterFile::isArchitectureEqual(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Machine::registerFileNavigator(), Conversion::toDouble(), and Conversion::toInt().
Referenced by MinimizeMachine::minimizeRegisterFiles().
|
private |
Returns true if the machine contains an Instruction template slot for given bus name.
mach | Machine where the slot is searched. |
busName | Name of the slot that is searched. |
Definition at line 218 of file MachineResourceModifier.cc.
References TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::instructionTemplateNavigator(), and TTAMachine::Machine::Navigator< ComponentType >::item().
void MachineResourceModifier::increaseAllFUsThatDiffersByAmount | ( | int | unitsToAdd, |
TTAMachine::Machine & | mach | ||
) |
Increase all different funtion units by given amount.
unitsToAdd | How many function units are added for each fu type. |
mach | Machine where the function units are added. |
Definition at line 451 of file MachineResourceModifier.cc.
References TTAMachine::Machine::addFunctionUnit(), FullyConnectedCheck::fix(), TTAMachine::Machine::functionUnitNavigator(), TTAMachine::Machine::Navigator< ComponentType >::hasItem(), TTAMachine::FunctionUnit::setAddressSpace(), TTAMachine::FunctionUnit::setName(), and Conversion::toString().
Referenced by GrowMachine::explore().
void MachineResourceModifier::increaseAllRFsThatDiffersByAmount | ( | int | registersToAdd, |
TTAMachine::Machine & | mach | ||
) |
Increase all different register files by given amount.
registersToAdd | Number of every register type will be added. |
mach | Machine which registers are added. |
Definition at line 311 of file MachineResourceModifier.cc.
References TTAMachine::Machine::addRegisterFile(), FullyConnectedCheck::fix(), TTAMachine::Machine::Navigator< ComponentType >::hasItem(), TTAMachine::Machine::registerFileNavigator(), TTAMachine::RegisterFile::setName(), and Conversion::toString().
Referenced by GrowMachine::explore().
void MachineResourceModifier::percentualFUIncrease | ( | double | percentualFUIncrease, |
TTAMachine::Machine & | mach | ||
) |
Increase all different function units by percentage value.
Fully connects the machine after adding the units.
percentualFUIncrease | How much will the function units be increased in percents. |
mach | Machine which function units are increased. |
Definition at line 501 of file MachineResourceModifier.cc.
References TTAMachine::Machine::addFunctionUnit(), TTAMachine::Machine::Navigator< ComponentType >::end(), FullyConnectedCheck::fix(), TTAMachine::Machine::functionUnitNavigator(), TTAMachine::Machine::Navigator< ComponentType >::hasItem(), TTAMachine::FunctionUnit::setAddressSpace(), TTAMachine::FunctionUnit::setName(), Conversion::toInt(), and Conversion::toString().
void MachineResourceModifier::percentualRegisterIncrease | ( | double | percentsOfRegistersToAdd, |
TTAMachine::Machine & | mach | ||
) |
Increase all different register files by percentage value.
Fully connects the machine after adding the units.
percentualRegisterIncrease | How much will the register files be increased in percents. |
mach | Machine which registers are increased. |
Definition at line 359 of file MachineResourceModifier.cc.
References TTAMachine::Machine::addRegisterFile(), TTAMachine::Machine::Navigator< ComponentType >::end(), FullyConnectedCheck::fix(), TTAMachine::Machine::Navigator< ComponentType >::hasItem(), TTAMachine::Machine::registerFileNavigator(), TTAMachine::RegisterFile::setName(), Conversion::toInt(), and Conversion::toString().
void MachineResourceModifier::reduceBuses | ( | const int & | busesToRemove, |
TTAMachine::Machine & | mach, | ||
std::list< std::string > & | removedBusNames | ||
) |
Reduces the amount of buses with a given number using some strange algorithm.
Won't remove buses that are immediate template slots. Remove slots first. Slots may cause that given number of buses cannot be removed. (I, maattae, have really no idea why this function does what it does. And what it does isn't actually very clear.)
busesToRemove | Number of buses to remove. |
mach | Machine where the buses are removed. |
removedBusName | Names of the removed buses are added at the end of this list. |
Definition at line 125 of file MachineResourceModifier.cc.
References TTAMachine::Machine::busNavigator(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::instructionTemplateNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), and TTAMachine::Machine::removeBus().
bool MachineResourceModifier::removeBuses | ( | const int & | countToRemove, |
TTAMachine::Machine & | mach, | ||
std::list< std::string > & | removedBusNames | ||
) |
Removes busses from machine.
Doens't remove buses that have template slots.
countToRemove | Number of buses to remove in optimal case. |
mach | Machine where buses are going to be removed. |
removedBusName | Names of the removed buses are added at the end of this list. |
Definition at line 182 of file MachineResourceModifier.cc.
References TTAMachine::Machine::busNavigator(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::instructionTemplateNavigator(), TTAMachine::Machine::Navigator< ComponentType >::item(), and TTAMachine::Machine::removeBus().
Referenced by MinimizeMachine::minimizeBuses().
void MachineResourceModifier::removeNotConnectedSockets | ( | TTAMachine::Machine & | mach, |
std::list< std::string > & | removedSocketNames | ||
) |
Removes not sockets that have no connection to any port from the machine.
mach | Machine where the sockets are removed. |
removedSocketNames | Names of the removed sockets are inserted at the end of this list. |
Definition at line 244 of file MachineResourceModifier.cc.
References TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Machine::removeSocket(), and TTAMachine::Machine::socketNavigator().
Referenced by MinimizeMachine::minimizeFunctionUnits(), MinimizeMachine::minimizeRegisterFiles(), RemoveUnconnectedComponents::removeSockets(), and ProGe::ProcessorGenerator::removeUnconnectedSockets().