OpenASIP 2.2
Loading...
Searching...
No Matches
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
44namespace TTAMachine {
45
46class Machine;
47
48/**
49 * Represents an address space in the machine.
50 */
51class AddressSpace : public Component {
52public:
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
94private:
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.
107
108};
109}
110
111#endif
unsigned long ULongWord
Definition BaseType.hh:51
static const std::string OSKEY_NUMERICAL_ID
static const std::string OSNAME_ADDRESS_SPACE
ObjectState name for AddressSpace.
bool shared_
True in case this address space maps to a memory that is shared across all the cores in the multicore...
virtual void loadState(const ObjectState *state)
ULongWord minAddress_
Lowest address in the address space.
static const std::string OSKEY_SHARED_MEMORY
virtual bool hasNumericalId(unsigned id) const
ULongWord maxAddress_
Highest address in the address space.
bool operator!=(const AddressSpace &other) const
bool operator==(const AddressSpace &other) const
static const std::string OSKEY_MAX_ADDRESS
ObjectState attribute key for maximum address.
virtual ULongWord end() const
virtual void setAddressBounds(ULongWord start, ULongWord end)
static const std::string OSKEY_MIN_ADDRESS
ObjectState attribute key for minimum address.
virtual void setMachine(Machine &mach)
std::set< unsigned > numericalIds() const
virtual ObjectState * saveState() const
virtual void setShared(bool shared)
virtual void setName(const std::string &name)
bool setNumericalIds(const std::set< unsigned > &ids)
virtual void addNumericalId(unsigned id)
virtual void unsetMachine()
virtual bool isShared() const
virtual int width() const
IDSet numericalIds_
The numerical ids mapped to this address space.
virtual ULongWord start() const
static const std::string OSKEY_WIDTH
ObjectState attribute key for the bit width.
int width_
Bit width of the minimum addressable word.
std::set< unsigned > IDSet
virtual void setWidth(int width)
virtual TCEString name() const