OpenASIP 2.2
Loading...
Searching...
No Matches
MemorySystem.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 MemorySystem.hh
26 *
27 * Declaration of MemorySystem class.
28 *
29 * @author Jussi Nykänen 2004 (nykanen-no.spam-cs.tut.fi)
30 * @author Pekka Jääskeläinen 2005,2009 (pjaaskel-no.spam-cs.tut.fi)
31 * @note rating: red
32 */
33
34#ifndef TTA_MEMORY_SYSTEM_HH
35#define TTA_MEMORY_SYSTEM_HH
36
37#include <map>
38#include <vector>
39#include <string>
40#include <boost/shared_ptr.hpp>
41
42#include "Exception.hh"
43
44class Memory;
45class TCEString;
46
47namespace TTAMachine {
48 class Machine;
49 class AddressSpace;
50}
51
52/**
53 * The collection of memory simulation models seen by a single core.
54 */
56public:
57 typedef boost::shared_ptr<Memory> MemoryPtr;
58
60 virtual ~MemorySystem();
61
62 void addAddressSpace(
63 const TTAMachine::AddressSpace& as, MemoryPtr mem, bool shared = true);
64
66 const MemoryPtr memoryConst(const TTAMachine::AddressSpace& as) const;
67
68 MemoryPtr memory(const std::string& addressSpaceName);
69
70 unsigned int memoryCount() const;
71 MemoryPtr memory(unsigned int i);
72 const TTAMachine::AddressSpace& addressSpace(unsigned int i);
73 const TTAMachine::AddressSpace& addressSpace(const std::string& name);
74
76
82
83 bool hasMemory(const TCEString& aSpaceName) const;
84
85private:
86 /// Copying not allowed.
88 /// Assignment not allowed.
90
91 /// Maps address spaces to memory instances.
92 typedef std::map<const TTAMachine::AddressSpace*, MemoryPtr> MemoryMap;
93
94 /// Container for memory instances for faster traversal.
95 typedef std::vector<MemoryPtr> MemoryContainer;
96
97 /// Machine in which MemorySystem belongs to.
99 /// Contains all memories indexed by AddressSpaces.
101 /// List of all the memories for faster traversal.
103 /// All memories shared between multiple cores.
105 /// All private/local memories used by a single core only.
107 /// Shared memories which have been replaced with a shared memory
108 /// from another core. Just for garbage removal.
110};
111#include "MemorySystem.icc"
112
113#endif
TTAMachine::Machine * machine
the architecture definition of the estimated processor
MemorySystem & operator=(const MemorySystem &)
Assignment not allowed.
const MemoryPtr memoryConst(const TTAMachine::AddressSpace &as) const
MemoryPtr memory(const TTAMachine::AddressSpace &as)
MemoryMap memories_
Contains all memories indexed by AddressSpaces.
MemoryContainer replacedSharedMemories_
Shared memories which have been replaced with a shared memory from another core. Just for garbage rem...
void advanceClockOfSharedMemories()
MemoryContainer memoryList_
List of all the memories for faster traversal.
void deleteSharedMemories()
std::vector< MemoryPtr > MemoryContainer
Container for memory instances for faster traversal.
void shareMemoriesWith(MemorySystem &other)
MemoryContainer localMemories_
All private/local memories used by a single core only.
std::map< const TTAMachine::AddressSpace *, MemoryPtr > MemoryMap
Maps address spaces to memory instances.
unsigned int memoryCount() const
virtual ~MemorySystem()
bool hasMemory(const TCEString &aSpaceName) const
void fillAllMemoriesWithZero()
MemoryContainer sharedMemories_
All memories shared between multiple cores.
boost::shared_ptr< Memory > MemoryPtr
void addAddressSpace(const TTAMachine::AddressSpace &as, MemoryPtr mem, bool shared=true)
void advanceClockOfLocalMemories()
const TTAMachine::AddressSpace & addressSpace(unsigned int i)
void resetAllMemories()
MemorySystem(const MemorySystem &)
Copying not allowed.
const TTAMachine::Machine * machine_
Machine in which MemorySystem belongs to.