OpenASIP  2.0
AddressSpace.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2010 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 AddressSpace.hh
26  *
27  * Declaration of AddressSpace class.
28  *
29  * @author Lasse Laasonen 2003 (lasse.laasonen-no.spam-tut.fi)
30  * @author Pekka Jääskeläinen 2010
31  * @note reviewed 10 Jun 2004 by vpj, am, tr, ll
32  * @note rating: red
33  */
34 
35 #ifndef TTA_ADDRESS_SPACE_HH
36 #define TTA_ADDRESS_SPACE_HH
37 
38 #include <string>
39 #include <set>
40 
41 #include "MachinePart.hh"
42 #include "BaseType.hh"
43 
44 namespace TTAMachine {
45 
46 class Machine;
47 
48 /**
49  * Represents an address space in the machine.
50  */
51 class AddressSpace : public Component {
52 public:
54  const std::string& name, int width, ULongWord minAddress,
55  ULongWord maxAddress, Machine& owner);
56  AddressSpace(const ObjectState* state, Machine& owner);
57  virtual ~AddressSpace();
58 
59  virtual int width() const;
60  virtual ULongWord start() const;
61  virtual ULongWord end() const;
62 
63  virtual void setName(const std::string& name);
64  virtual void setWidth(int width);
66 
67  virtual void addNumericalId(unsigned id);
68  virtual bool hasNumericalId(unsigned id) const;
69  std::set<unsigned> numericalIds() const;
70  bool setNumericalIds(const std::set<unsigned>& ids);
71  virtual void setShared(bool shared) { shared_ = shared; }
72  virtual bool isShared() const { return shared_; }
73 
74  virtual void setMachine(Machine& mach);
75  virtual void unsetMachine();
76 
77  virtual ObjectState* saveState() const;
78  virtual void loadState(const ObjectState* state);
79 
80  bool operator==(const AddressSpace& other) const;
81  bool operator!=(const AddressSpace& other) const;
82 
83  /// ObjectState name for AddressSpace.
84  static const std::string OSNAME_ADDRESS_SPACE;
85  /// ObjectState attribute key for the bit width.
86  static const std::string OSKEY_WIDTH;
87  /// ObjectState attribute key for minimum address.
88  static const std::string OSKEY_MIN_ADDRESS;
89  /// ObjectState attribute key for maximum address.
90  static const std::string OSKEY_MAX_ADDRESS;
91  static const std::string OSKEY_SHARED_MEMORY;
92  static const std::string OSKEY_NUMERICAL_ID;
93 
94 private:
95  typedef std::set<unsigned> IDSet;
96  /// Bit width of the minimum addressable word.
97  int width_;
98  /// Lowest address in the address space.
100  /// Highest address in the address space.
102  /// The numerical ids mapped to this address space.
104  /// True in case this address space maps to a memory that is shared
105  /// across all the cores in the multicore.
106  bool shared_;
107 
108 };
109 }
110 
111 #endif
TTAMachine::AddressSpace::unsetMachine
virtual void unsetMachine()
Definition: AddressSpace.cc:261
BaseType.hh
TTAMachine::Component::name
virtual TCEString name() const
Definition: MachinePart.cc:125
TTAMachine::AddressSpace::addNumericalId
virtual void addNumericalId(unsigned id)
Definition: AddressSpace.cc:378
TTAMachine::AddressSpace::numericalIds
std::set< unsigned > numericalIds() const
Definition: AddressSpace.cc:393
TTAMachine::AddressSpace
Definition: AddressSpace.hh:51
TTAMachine::AddressSpace::hasNumericalId
virtual bool hasNumericalId(unsigned id) const
Definition: AddressSpace.cc:383
TTAMachine::AddressSpace::width_
int width_
Bit width of the minimum addressable word.
Definition: AddressSpace.hh:97
TTAMachine::AddressSpace::OSKEY_NUMERICAL_ID
static const std::string OSKEY_NUMERICAL_ID
Definition: AddressSpace.hh:92
TTAMachine::AddressSpace::operator!=
bool operator!=(const AddressSpace &other) const
Definition: AddressSpace.cc:441
ObjectState
Definition: ObjectState.hh:59
MachinePart.hh
TTAMachine::AddressSpace::setShared
virtual void setShared(bool shared)
Definition: AddressSpace.hh:71
TTAMachine::AddressSpace::OSNAME_ADDRESS_SPACE
static const std::string OSNAME_ADDRESS_SPACE
ObjectState name for AddressSpace.
Definition: AddressSpace.hh:84
TTAMachine::AddressSpace::OSKEY_MAX_ADDRESS
static const std::string OSKEY_MAX_ADDRESS
ObjectState attribute key for maximum address.
Definition: AddressSpace.hh:90
TTAMachine::AddressSpace::isShared
virtual bool isShared() const
Definition: AddressSpace.hh:72
TTAMachine::AddressSpace::~AddressSpace
virtual ~AddressSpace()
Definition: AddressSpace.cc:144
TTAMachine::AddressSpace::setWidth
virtual void setWidth(int width)
Definition: AddressSpace.cc:215
TTAMachine::AddressSpace::OSKEY_WIDTH
static const std::string OSKEY_WIDTH
ObjectState attribute key for the bit width.
Definition: AddressSpace.hh:86
TTAMachine::AddressSpace::AddressSpace
AddressSpace(const std::string &name, int width, ULongWord minAddress, ULongWord maxAddress, Machine &owner)
Definition: AddressSpace.cc:74
TTAMachine::AddressSpace::setAddressBounds
virtual void setAddressBounds(ULongWord start, ULongWord end)
Definition: AddressSpace.cc:232
TTAMachine::Component
Definition: MachinePart.hh:90
TTAMachine::AddressSpace::OSKEY_SHARED_MEMORY
static const std::string OSKEY_SHARED_MEMORY
Definition: AddressSpace.hh:91
TTAMachine::AddressSpace::saveState
virtual ObjectState * saveState() const
Definition: AddressSpace.cc:295
TTAMachine::AddressSpace::setNumericalIds
bool setNumericalIds(const std::set< unsigned > &ids)
Definition: AddressSpace.cc:404
TTAMachine::AddressSpace::width
virtual int width() const
Definition: AddressSpace.cc:155
TTAMachine::AddressSpace::IDSet
std::set< unsigned > IDSet
Definition: AddressSpace.hh:95
TTAMachine::AddressSpace::OSKEY_MIN_ADDRESS
static const std::string OSKEY_MIN_ADDRESS
ObjectState attribute key for minimum address.
Definition: AddressSpace.hh:88
TTAMachine::AddressSpace::setMachine
virtual void setMachine(Machine &mach)
Definition: AddressSpace.cc:250
TTAMachine::AddressSpace::loadState
virtual void loadState(const ObjectState *state)
Definition: AddressSpace.cc:334
ULongWord
unsigned long ULongWord
Definition: BaseType.hh:51
TTAMachine::AddressSpace::operator==
bool operator==(const AddressSpace &other) const
Definition: AddressSpace.cc:432
TTAMachine
Definition: Assembler.hh:48
TTAMachine::AddressSpace::shared_
bool shared_
True in case this address space maps to a memory that is shared across all the cores in the multicore...
Definition: AddressSpace.hh:106
TTAMachine::AddressSpace::minAddress_
ULongWord minAddress_
Lowest address in the address space.
Definition: AddressSpace.hh:99
TTAMachine::AddressSpace::numericalIds_
IDSet numericalIds_
The numerical ids mapped to this address space.
Definition: AddressSpace.hh:103
TTAMachine::AddressSpace::start
virtual ULongWord start() const
Definition: AddressSpace.cc:166
TTAMachine::AddressSpace::end
virtual ULongWord end() const
Definition: AddressSpace.cc:177
TTAMachine::AddressSpace::maxAddress_
ULongWord maxAddress_
Highest address in the address space.
Definition: AddressSpace.hh:101
TTAMachine::AddressSpace::setName
virtual void setName(const std::string &name)
Definition: AddressSpace.cc:191
TTAMachine::Machine
Definition: Machine.hh:73