OpenASIP  2.0
MachineResourceModifier.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file MachineResourceModifier.hh
26  *
27  * Adds or removes machine resources.
28  *
29  * @author Jari Mäntyneva 2007 (jari.mantyneva-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_MACHINE_RESOURCE_MODIFIER_HH
34 #define TTA_MACHINE_RESOURCE_MODIFIER_HH
35 
36 #include <map>
37 #include <list>
38 #include <string>
39 
40 namespace TTAMachine {
41  class Machine;
42  class Bus;
43  class RegisterFile;
44  class FunctionUnit;
45 }
46 /**
47  * Class that adds or removes resources of the given architecture.
48  */
50 public:
51  /// Map of bus amounts in percents.
52  typedef std::multimap<double, TTAMachine::Bus*> BusMap;
53  /// Map of register amounts in percents.
54  typedef std::multimap<double, TTAMachine::RegisterFile*> RegisterMap;
55  /// Map of function unit amounts in percents.
56  typedef std::multimap<double, TTAMachine::FunctionUnit*> FunctionUnitMap;
57 
59  virtual ~MachineResourceModifier();
60  void addBusesByAmount(int busesToAdd, TTAMachine::Machine& mach);
61 
62  //void percentualBusIncrease(
63  // int percentualBusIncrease, TTAMachine::Machine& mach);
64  // not implemented
65 
67  int registersToAdd, TTAMachine::Machine& mach);
69  double percentsOfRegistersToAdd, TTAMachine::Machine& mach);
71  int moreFUs, TTAMachine::Machine& mach);
74 
75  void reduceBuses(
76  const int& busesToRemove,
77  TTAMachine::Machine& mach,
78  std::list<std::string>& removedBusNames);
79  bool removeBuses(
80  const int& countToRemove,
81  TTAMachine::Machine& mach,
82  std::list<std::string>& removedBusNames);
83 
85  TTAMachine::Machine& mach, std::list<std::string>& removedSocketNames);
86 
87  void analyzeBuses(const TTAMachine::Machine& mach, BusMap& busMap) const;
88  void analyzeRegisters(
89  const TTAMachine::Machine& mach, RegisterMap& registerMap) const;
91  const TTAMachine::Machine& mach, FunctionUnitMap& unitMap) const;
92 
93 private:
94  bool hasSlot(const TTAMachine::Machine& mach, const std::string& slotName);
95 };
96 
97 #endif
MachineResourceModifier::FunctionUnitMap
std::multimap< double, TTAMachine::FunctionUnit * > FunctionUnitMap
Map of function unit amounts in percents.
Definition: MachineResourceModifier.hh:56
MachineResourceModifier::removeBuses
bool removeBuses(const int &countToRemove, TTAMachine::Machine &mach, std::list< std::string > &removedBusNames)
Definition: MachineResourceModifier.cc:182
MachineResourceModifier::increaseAllRFsThatDiffersByAmount
void increaseAllRFsThatDiffersByAmount(int registersToAdd, TTAMachine::Machine &mach)
Definition: MachineResourceModifier.cc:311
MachineResourceModifier::MachineResourceModifier
MachineResourceModifier()
Definition: MachineResourceModifier.cc:48
MachineResourceModifier::RegisterMap
std::multimap< double, TTAMachine::RegisterFile * > RegisterMap
Map of register amounts in percents.
Definition: MachineResourceModifier.hh:54
MachineResourceModifier
Definition: MachineResourceModifier.hh:49
MachineResourceModifier::reduceBuses
void reduceBuses(const int &busesToRemove, TTAMachine::Machine &mach, std::list< std::string > &removedBusNames)
Definition: MachineResourceModifier.cc:125
MachineResourceModifier::analyzeFunctionUnits
void analyzeFunctionUnits(const TTAMachine::Machine &mach, FunctionUnitMap &unitMap) const
Definition: MachineResourceModifier.cc:554
MachineResourceModifier::percentualRegisterIncrease
void percentualRegisterIncrease(double percentsOfRegistersToAdd, TTAMachine::Machine &mach)
Definition: MachineResourceModifier.cc:359
MachineResourceModifier::analyzeBuses
void analyzeBuses(const TTAMachine::Machine &mach, BusMap &busMap) const
Definition: MachineResourceModifier.cc:272
MachineResourceModifier::increaseAllFUsThatDiffersByAmount
void increaseAllFUsThatDiffersByAmount(int moreFUs, TTAMachine::Machine &mach)
Definition: MachineResourceModifier.cc:451
MachineResourceModifier::hasSlot
bool hasSlot(const TTAMachine::Machine &mach, const std::string &slotName)
Definition: MachineResourceModifier.cc:218
MachineResourceModifier::addBusesByAmount
void addBusesByAmount(int busesToAdd, TTAMachine::Machine &mach)
Definition: MachineResourceModifier.cc:67
MachineResourceModifier::percentualFUIncrease
void percentualFUIncrease(double percentualFUIncrease, TTAMachine::Machine &mach)
Definition: MachineResourceModifier.cc:501
MachineResourceModifier::~MachineResourceModifier
virtual ~MachineResourceModifier()
Definition: MachineResourceModifier.cc:54
MachineResourceModifier::BusMap
std::multimap< double, TTAMachine::Bus * > BusMap
Map of bus amounts in percents.
Definition: MachineResourceModifier.hh:52
MachineResourceModifier::analyzeRegisters
void analyzeRegisters(const TTAMachine::Machine &mach, RegisterMap &registerMap) const
Definition: MachineResourceModifier.cc:410
TTAMachine
Definition: Assembler.hh:48
MachineResourceModifier::removeNotConnectedSockets
void removeNotConnectedSockets(TTAMachine::Machine &mach, std::list< std::string > &removedSocketNames)
Definition: MachineResourceModifier.cc:244
TTAMachine::Machine
Definition: Machine.hh:73