OpenASIP
2.0
|
#include <MemorySystem.hh>
Public Types | |
typedef boost::shared_ptr< Memory > | MemoryPtr |
Public Member Functions | |
MemorySystem (const TTAMachine::Machine &machine) | |
virtual | ~MemorySystem () |
void | addAddressSpace (const TTAMachine::AddressSpace &as, MemoryPtr mem, bool shared=true) |
MemoryPtr | memory (const TTAMachine::AddressSpace &as) |
const MemoryPtr | memoryConst (const TTAMachine::AddressSpace &as) const |
MemoryPtr | memory (const std::string &addressSpaceName) |
unsigned int | memoryCount () const |
MemoryPtr | memory (unsigned int i) |
const TTAMachine::AddressSpace & | addressSpace (unsigned int i) |
const TTAMachine::AddressSpace & | addressSpace (const std::string &name) |
void | shareMemoriesWith (MemorySystem &other) |
void | advanceClockOfLocalMemories () |
void | advanceClockOfSharedMemories () |
void | resetAllMemories () |
void | fillAllMemoriesWithZero () |
void | deleteSharedMemories () |
bool | hasMemory (const TCEString &aSpaceName) const |
Private Types | |
typedef std::map< const TTAMachine::AddressSpace *, MemoryPtr > | MemoryMap |
Maps address spaces to memory instances. More... | |
typedef std::vector< MemoryPtr > | MemoryContainer |
Container for memory instances for faster traversal. More... | |
Private Member Functions | |
MemorySystem (const MemorySystem &) | |
Copying not allowed. More... | |
MemorySystem & | operator= (const MemorySystem &) |
Assignment not allowed. More... | |
Private Attributes | |
const TTAMachine::Machine * | machine_ |
Machine in which MemorySystem belongs to. More... | |
MemoryMap | memories_ |
Contains all memories indexed by AddressSpaces. More... | |
MemoryContainer | memoryList_ |
List of all the memories for faster traversal. More... | |
MemoryContainer | sharedMemories_ |
All memories shared between multiple cores. More... | |
MemoryContainer | localMemories_ |
All private/local memories used by a single core only. More... | |
MemoryContainer | replacedSharedMemories_ |
Shared memories which have been replaced with a shared memory from another core. Just for garbage removal. More... | |
The collection of memory simulation models seen by a single core.
Definition at line 55 of file MemorySystem.hh.
|
private |
Container for memory instances for faster traversal.
Definition at line 95 of file MemorySystem.hh.
|
private |
Maps address spaces to memory instances.
Definition at line 92 of file MemorySystem.hh.
typedef boost::shared_ptr<Memory> MemorySystem::MemoryPtr |
Definition at line 57 of file MemorySystem.hh.
|
explicit |
Constructor.
machine | Machine in which MemorySystem belongs to. |
Definition at line 54 of file MemorySystem.cc.
|
virtual |
Destructor.
Deletes all the Memory instances.
Definition at line 73 of file MemorySystem.cc.
References localMemories_, and replacedSharedMemories_.
|
private |
Copying not allowed.
void MemorySystem::addAddressSpace | ( | const TTAMachine::AddressSpace & | as, |
MemoryPtr | mem, | ||
bool | shared = true |
||
) |
Adds AddressSpace and corresponding memory to data structure.
as | AddressSpace to be added. |
mem | Memory to be added. Becomes property of the MemorySystem, that is, MemorySystems is responsible for deallocating it. |
shared | If the given Memory instace is shared by multiple MemorySystems (cores). |
IllegalRegistration | If the AddressSpace does not belong to the target machine. |
Definition at line 90 of file MemorySystem.cc.
References __func__, TTAMachine::Machine::addressSpaceNavigator(), TTAMachine::Machine::Navigator< ComponentType >::hasItem(), localMemories_, machine_, memories_, memoryList_, TTAMachine::Component::name(), and sharedMemories_.
Referenced by SimulatorFrontend::initializeMemorySystem().
const AddressSpace & MemorySystem::addressSpace | ( | const std::string & | name | ) |
Returns the address space with the given name.
name | The name of the address space. |
InstanceNotFound | if the address space is not found. |
Definition at line 286 of file MemorySystem.cc.
const AddressSpace & MemorySystem::addressSpace | ( | unsigned int | i | ) |
Returns the address space of the ith Memory instance in the memory system.
OutOfRange | if i is out of bounds. |
Definition at line 261 of file MemorySystem.cc.
References __func__, memories_, memoryCount(), and Conversion::toString().
Referenced by MemDumpCommand::execute(), SimulatorFrontend::initializeDataMemories(), ProximMemoryWindow::loadProgramMemory(), ProximMemoryWindow::onASChoice(), and shareMemoriesWith().
void MemorySystem::advanceClockOfLocalMemories | ( | ) |
Referenced by OTASimulationController::advanceMachineCycle(), and SimulationController::simulateCycle().
void MemorySystem::advanceClockOfSharedMemories | ( | ) |
Referenced by OTASimulationController::advanceMachineCycle(), and SimulationController::simulateCycle().
void MemorySystem::deleteSharedMemories | ( | ) |
Deletes all shared memory instances.
Must be called only once for all MemorySystems sharing the memories.
Definition at line 64 of file MemorySystem.cc.
References sharedMemories_.
void MemorySystem::fillAllMemoriesWithZero | ( | ) |
Referenced by SimulatorFrontend::initializeDataMemories().
bool MemorySystem::hasMemory | ( | const TCEString & | aSpaceName | ) | const |
Definition at line 109 of file MemorySystem.cc.
References memories_, and TTAMachine::Component::name().
Referenced by shareMemoriesWith().
MemorySystem::MemoryPtr MemorySystem::memory | ( | const std::string & | addressSpaceName | ) |
Returns Memory instance bound to an address space with the given name.
The returned memory instance is writable.
addressSpaceName | The name of the address space. |
InstanceNotFound | If no memory is found with the name. |
Definition at line 184 of file MemorySystem.cc.
References __func__, memories_, and TTAMachine::Component::name().
MemorySystem::MemoryPtr MemorySystem::memory | ( | const TTAMachine::AddressSpace & | as | ) |
Returns Memory instance bound to the given AddressSpace.
The returned memory instance is writable.
as | AddressSpace in which memory is asked. |
InstanceNotFound | If no memory is bound to the given AddressSpace. |
Definition at line 170 of file MemorySystem.cc.
References TTAMachine::Component::name().
Referenced by MachineStateBuilder::buildMachineState(), CompiledSimulation::FUMemory(), SimulatorFrontend::initializeDataMemories(), SimulatorFrontend::initializeMemorySystem(), ProximMemoryWindow::loadMemory(), ProximMemoryWindow::onSimulationStop(), SimulatorFrontend::setControllerForMemories(), SimControlLanguageCommand::setMemoryPointer(), and shareMemoriesWith().
MemorySystem::MemoryPtr MemorySystem::memory | ( | unsigned int | i | ) |
Returns the ith Memory instance in the memory system.
OutOfRange | if i is out of bounds. |
Definition at line 237 of file MemorySystem.cc.
References __func__, memories_, memoryCount(), and Conversion::toString().
const MemorySystem::MemoryPtr MemorySystem::memoryConst | ( | const TTAMachine::AddressSpace & | as | ) | const |
Returns Memory instance bound to the given AddressSpace.
The returned memory instance is read-only.
as | AddressSpace in which memory is asked. |
InstanceNotFound | If no memory is bound to the given AddressSpace. |
Definition at line 211 of file MemorySystem.cc.
References __func__, memories_, and TTAMachine::Component::name().
unsigned int MemorySystem::memoryCount | ( | ) | const |
Returns the count of Memory instances in this memory system.
Definition at line 226 of file MemorySystem.cc.
References memories_.
Referenced by addressSpace(), ProximMemoryWindow::loadProgramMemory(), memory(), SimulatorFrontend::setControllerForMemories(), and shareMemoriesWith().
|
private |
Assignment not allowed.
void MemorySystem::resetAllMemories | ( | ) |
Referenced by SimulatorFrontend::initializeDataMemories().
void MemorySystem::shareMemoriesWith | ( | MemorySystem & | other | ) |
In case two TTA simulation models share memories in an heterogeneous multicore simulation, this method should be called after initializing the simulation frontends between all such pairs to fix the memory model references to point to the same memory model.
The matching is done by the address space name. The shared address space must have the 'shared' attribute set.
@fixme An untested method.
remove the replaced memory as it should not be controlled by this MemorySystem anymore
Definition at line 133 of file MemorySystem.cc.
References addressSpace(), TTAMachine::Machine::addressSpaceNavigator(), hasMemory(), TTAMachine::AddressSpace::isShared(), TTAMachine::Machine::Navigator< ComponentType >::item(), machine_, memories_, memory(), memoryCount(), memoryList_, TTAMachine::Component::name(), replacedSharedMemories_, and sharedMemories_.
|
private |
All private/local memories used by a single core only.
Definition at line 106 of file MemorySystem.hh.
Referenced by addAddressSpace(), and ~MemorySystem().
|
private |
Machine in which MemorySystem belongs to.
Definition at line 98 of file MemorySystem.hh.
Referenced by addAddressSpace(), and shareMemoriesWith().
|
private |
Contains all memories indexed by AddressSpaces.
Definition at line 100 of file MemorySystem.hh.
Referenced by addAddressSpace(), addressSpace(), hasMemory(), memory(), memoryConst(), memoryCount(), and shareMemoriesWith().
|
private |
List of all the memories for faster traversal.
Definition at line 102 of file MemorySystem.hh.
Referenced by addAddressSpace(), and shareMemoriesWith().
|
private |
Shared memories which have been replaced with a shared memory from another core. Just for garbage removal.
Definition at line 109 of file MemorySystem.hh.
Referenced by shareMemoriesWith(), and ~MemorySystem().
|
private |
All memories shared between multiple cores.
Definition at line 104 of file MemorySystem.hh.
Referenced by addAddressSpace(), deleteSharedMemories(), and shareMemoriesWith().