OpenASIP  2.0
CostDBEntryStats.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 CostDBEntryStats.hh
26  *
27  * Declaration of CostDBEntryStats class.
28  *
29  * @author Tommi Rantanen 2003 (tommi.rantanen-no.spam-tut.fi)
30  * @author Jari Mäntyneva 2005 (jari.mantyneva-no.spam-tut.fi)
31  * @note rating: red
32  */
33 
34 #ifndef TTA_COSTDB_ENTRY_STATS_HH
35 #define TTA_COSTDB_ENTRY_STATS_HH
36 
37 
38 #include <map>
39 
40 #include "Exception.hh"
41 
42 
43 /**
44  * Stores area, delay and energy statistics.
45  */
47 public:
48  CostDBEntryStats(double areaData, double internalDelayData);
49  virtual ~CostDBEntryStats();
51  const CostDBEntryStats& stats1, const CostDBEntryStats& stats2,
52  double coefficient);
53  virtual CostDBEntryStats* copy() const;
54 
55  virtual double area() const;
56  virtual double delay() const;
57  virtual double delayPort(const std::string& port) const;
58 
59  virtual void setDelay(const std::string& port, double delay);
60 
61  virtual double energyActive() const;
62  virtual double energyIdle() const;
63  virtual double energyOperation(const std::string& name) const;
64  virtual bool hasEnergyOperation(const std::string& name) const;
65  virtual double energyRead() const;
66  virtual double energyWrite() const;
67  virtual double energyReadWrite(int reads, int writes) const;
68 
69  virtual void setEnergyActive(double energy);
70  virtual void setEnergyIdle(double energy);
71  virtual void setEnergyOperation(const std::string& name, double energy);
72  virtual void setEnergyRead(double energy);
73  virtual void setEnergyWrite(double energy);
74  virtual void setEnergyReadWrite(int reads, int writes, double energy);
75 
76 protected:
77  virtual bool hasEnergy(const std::string& key) const;
78  virtual double findEnergy(const std::string& key) const;
79  virtual void addEnergy(const std::string& name, double energy);
80  virtual bool hasDelay(const std::string& key) const;
81  virtual double findDelay(const std::string& key) const;
82  virtual void addDelay(const std::string& name, double delay);
83  virtual CostDBEntryStats* createStats() const;
84 
85  /// String for active energy.
86  static const std::string ENERGY_ACTIVE;
87  /// String for idle energy.
88  static const std::string ENERGY_IDLE;
89  /// String for read energy.
90  static const std::string ENERGY_READ;
91  /// String for write energy.
92  static const std::string ENERGY_WRITE;
93  /// String for reads and writes energy.
94  static const std::string ENERGY_READ_WRITE;
95 
96 private:
97  /// Map of energies.
98  typedef std::map<const std::string, double> EnergyMap;
99  /// Map of delays.
100  typedef std::map<const std::string, double> DelayMap;
101 
102  /// area in gates.
103  double area_;
104  /// delay in nanoseconds.
105  double delay_;
106  /// input and output delays in nanoseconds.
108  /// Energies of one specific type of usage of a resource.
109  /// Usually the map contains energies for active and idle usage of
110  /// a resource. However, in case of FUs the active energy does not
111  /// exist and but energies are defined for each operation.
113 
114  /// Copying not allowed.
116  /// Assignment not allowed.
118 };
119 
120 #include "CostDBEntryStats.icc"
121 
122 #endif
CostDBEntryStats::ENERGY_WRITE
static const std::string ENERGY_WRITE
String for write energy.
Definition: CostDBEntryStats.hh:92
CostDBEntryStats::setEnergyWrite
virtual void setEnergyWrite(double energy)
Definition: CostDBEntryStats.cc:384
Exception.hh
CostDBEntryStats::delays_
DelayMap delays_
input and output delays in nanoseconds.
Definition: CostDBEntryStats.hh:107
CostDBEntryStats::ENERGY_READ_WRITE
static const std::string ENERGY_READ_WRITE
String for reads and writes energy.
Definition: CostDBEntryStats.hh:94
CostDBEntryStats::hasEnergy
virtual bool hasEnergy(const std::string &key) const
Definition: CostDBEntryStats.cc:294
CostDBEntryStats::delay
virtual double delay() const
CostDBEntryStats::delay_
double delay_
delay in nanoseconds.
Definition: CostDBEntryStats.hh:105
CostDBEntryStats::ENERGY_IDLE
static const std::string ENERGY_IDLE
String for idle energy.
Definition: CostDBEntryStats.hh:88
CostDBEntryStats::createStats
virtual CostDBEntryStats * createStats() const
Definition: CostDBEntryStats.cc:177
CostDBEntryStats::energyActive
virtual double energyActive() const
Definition: CostDBEntryStats.cc:190
CostDBEntryStats::DelayMap
std::map< const std::string, double > DelayMap
Map of delays.
Definition: CostDBEntryStats.hh:100
CostDBEntryStats::EnergyMap
std::map< const std::string, double > EnergyMap
Map of energies.
Definition: CostDBEntryStats.hh:98
CostDBEntryStats::energyOperation
virtual double energyOperation(const std::string &name) const
Definition: CostDBEntryStats.cc:219
CostDBEntryStats.icc
CostDBEntryStats::hasDelay
virtual bool hasDelay(const std::string &key) const
Definition: CostDBEntryStats.cc:496
CostDBEntryStats::setEnergyRead
virtual void setEnergyRead(double energy)
Definition: CostDBEntryStats.cc:371
CostDBEntryStats::ENERGY_READ
static const std::string ENERGY_READ
String for read energy.
Definition: CostDBEntryStats.hh:90
CostDBEntryStats::setDelay
virtual void setDelay(const std::string &port, double delay)
Definition: CostDBEntryStats.cc:446
CostDBEntryStats::~CostDBEntryStats
virtual ~CostDBEntryStats()
Definition: CostDBEntryStats.cc:144
CostDBEntryStats::addDelay
virtual void addDelay(const std::string &name, double delay)
Definition: CostDBEntryStats.cc:477
CostDBEntryStats::area
virtual double area() const
CostDBEntryStats::copy
virtual CostDBEntryStats * copy() const
Definition: CostDBEntryStats.cc:153
CostDBEntryStats::findDelay
virtual double findDelay(const std::string &key) const
Definition: CostDBEntryStats.cc:459
CostDBEntryStats::setEnergyIdle
virtual void setEnergyIdle(double energy)
Definition: CostDBEntryStats.cc:338
CostDBEntryStats::operator=
CostDBEntryStats & operator=(const CostDBEntryStats &)
Assignment not allowed.
CostDBEntryStats::energies_
EnergyMap energies_
Energies of one specific type of usage of a resource. Usually the map contains energies for active an...
Definition: CostDBEntryStats.hh:112
CostDBEntryStats::addEnergy
virtual void addEnergy(const std::string &name, double energy)
Definition: CostDBEntryStats.cc:413
CostDBEntryStats::energyWrite
virtual double energyWrite() const
Definition: CostDBEntryStats.cc:264
CostDBEntryStats::ENERGY_ACTIVE
static const std::string ENERGY_ACTIVE
String for active energy.
Definition: CostDBEntryStats.hh:86
CostDBEntryStats::setEnergyActive
virtual void setEnergyActive(double energy)
Definition: CostDBEntryStats.cc:323
CostDBEntryStats::findEnergy
virtual double findEnergy(const std::string &key) const
Definition: CostDBEntryStats.cc:308
CostDBEntryStats::setEnergyReadWrite
virtual void setEnergyReadWrite(int reads, int writes, double energy)
Definition: CostDBEntryStats.cc:399
CostDBEntryStats::hasEnergyOperation
virtual bool hasEnergyOperation(const std::string &name) const
Definition: CostDBEntryStats.cc:234
CostDBEntryStats::energyRead
virtual double energyRead() const
Definition: CostDBEntryStats.cc:249
CostDBEntryStats
Definition: CostDBEntryStats.hh:46
CostDBEntryStats::energyIdle
virtual double energyIdle() const
Definition: CostDBEntryStats.cc:202
CostDBEntryStats::area_
double area_
area in gates.
Definition: CostDBEntryStats.hh:103
CostDBEntryStats::CostDBEntryStats
CostDBEntryStats(double areaData, double internalDelayData)
Definition: CostDBEntryStats.cc:58
CostDBEntryStats::setEnergyOperation
virtual void setEnergyOperation(const std::string &name, double energy)
Definition: CostDBEntryStats.cc:358
CostDBEntryStats::energyReadWrite
virtual double energyReadWrite(int reads, int writes) const
Definition: CostDBEntryStats.cc:281
CostDBEntryStats::delayPort
virtual double delayPort(const std::string &port) const
Definition: CostDBEntryStats.cc:434