OpenASIP 2.2
Loading...
Searching...
No Matches
InstructionMemory.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 InstructionMemory.hh
26 *
27 * Declaration of InstructionMemory class.
28 *
29 * @author Jussi Nykänen 2004 (nykanen-no.spam-cs.tut.fi)
30 * @author Pekka Jääskeläinen 2005 (pjaaskel-no.spam-cs.tut.fi)
31 * @note rating: red
32 */
33
34#ifndef TTA_INSTRUCTION_MEMORY_HH
35#define TTA_INSTRUCTION_MEMORY_HH
36
37#include <vector>
38#if __cplusplus < 201103L
39#include <map>
40#else
41#include <unordered_map>
42#endif
43
44#include "SimulatorConstants.hh"
45#include "Exception.hh"
46#include "BaseType.hh"
47
49
50/**
51 * Container for ExecutableInstructions which represent the actions performed
52 * by the simulated program's instructions to the machine's state.
53 */
55public:
56 /// Container for instructions.
57 typedef std::vector<ExecutableInstruction*> InstructionContainer;
58
60 virtual ~InstructionMemory();
61
63 InstructionAddress addr, ExecutableInstruction* instruction);
65 InstructionAddress addr, ExecutableInstruction* instruction);
68 InstructionAddress address) const;
69
71
72 bool hasInstructionAt(InstructionAddress addr) const;
73
76 InstructionAddress addr) const;
77
78private:
79 /// Copying not allowed.
81 /// Assignment not allowed.
83
84 /// The starting address of the instruction memory address space.
86
87 /// All the instructions of the memory.
89
91
92
93#if __cplusplus < 201103L
94 /// Stores the explicit instruction addresses.
95 std::map<InstructionAddress, ExecutableInstruction*> instructionMap_;
96 /// Stores implicit instructions that should be executed after the explicit
97 /// one in the same address.
98 std::map<InstructionAddress, InstructionContainer*> implicitInstructions_;
99#else
100 /// Stores the explicit instruction addresses.
101 std::unordered_map<InstructionAddress, ExecutableInstruction*> instructionMap_;
102 /// Stores implicit instructions that should be executed after the explicit
103 /// one in the same address.
104 std::unordered_map<InstructionAddress, InstructionContainer*> implicitInstructions_;
105#endif
106
107
108};
109
110#include "InstructionMemory.icc"
111
112#endif
UInt32 InstructionAddress
Definition BaseType.hh:175
std::vector< ExecutableInstruction * > InstructionContainer
Container for instructions.
ExecutableInstruction & instructionAt(InstructionAddress address)
std::map< InstructionAddress, InstructionContainer * > implicitInstructions_
Stores implicit instructions that should be executed after the explicit one in the same address.
const InstructionContainer & implicitInstructionsAt(InstructionAddress addr) const
void addImplicitExecutableInstruction(InstructionAddress addr, ExecutableInstruction *instruction)
std::map< InstructionAddress, ExecutableInstruction * > instructionMap_
Stores the explicit instruction addresses.
InstructionContainer emptyInstructions_
bool hasInstructionAt(InstructionAddress addr) const
InstructionAddress startAddress_
The starting address of the instruction memory address space.
InstructionContainer instructions_
All the instructions of the memory.
InstructionMemory & operator=(const InstructionMemory &)
Assignment not allowed.
const ExecutableInstruction & instructionAtConst(InstructionAddress address) const
void addExecutableInstruction(InstructionAddress addr, ExecutableInstruction *instruction)
InstructionMemory(const InstructionMemory &)
Copying not allowed.
bool hasImplicitInstructionsAt(InstructionAddress addr) const