OpenASIP 2.2
Loading...
Searching...
No Matches
OperationContextPimpl.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 OperationContextPimpl.hh
26 *
27 * Declaration of OperationContextPimpl (private implementation) class.
28 *
29 * @author Viljami Korhonen 2008 (viljami.korhonen-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#ifndef OPERATION_CONTEXT_PIMPL_HH
34#define OPERATION_CONTEXT_PIMPL_HH
35
36#include <string>
37#include <map>
38
39#include "BaseType.hh"
40#include "TCEString.hh"
41
42class OperationState;
43class SimValue;
44class Memory;
46
48public:
49 friend class OperationContext;
50
52
53 /// Type of state registry.
54 typedef std::map<std::string, OperationState*> StateRegistry;
55
60
61private:
64 const TCEString& name,
68 int delayCycles);
69
70 Memory& memory();
71 void setMemory(Memory* memory);
72 int contextId() const;
73 CycleCount cycleCount() const;
77
80 void setUpdateProgramCounter(bool value);
81 bool updateProgramCounter() const;
82 void setSaveReturnAddress(bool value);
83 bool saveReturnAddress();
85
87 bool isEmpty() const;
88 bool hasMemoryModel() const;
90
92
93 // These methods are only for internal use. Used by the macro definitions
94 // of OSAL.hh.
96 void unregisterState(const char* name);
97 OperationState& state(const char* name) const;
98
99 bool hasState(const char* name) const;
100 void initializeContextId();
101
102 /// The Memory model instance.
104 /// Unique number that identifies a context instance.
106 /// Context id for the next created context instance.
107 static int nextContextId_;
108 /// Simulates the program counter value.
110 /// Simulates the procedure return address.
112 /// The state registry.
114 /// Should the return address be saved?
116 /// Should program counter be updated?
118 /// Number of times advanceClock() has been called since
119 /// the creation.
121 /// The external variable that contains the current simulation
122 /// cycle count.
124 /// Name of the FU instance -- passed down from MachineStateBuilder
126 /// Amount of delay cycles caused by pipeline
128};
129
130#endif
long long CycleCount
Type for storing simulation cycle counts.
Definition BaseType.hh:187
UInt32 InstructionAddress
Definition BaseType.hh:175
void setMemory(Memory *memory)
StateRegistry & stateRegistry()
void setUpdateProgramCounter(bool value)
InstructionAddress & programCounter()
CycleCount cycleCount_
Number of times advanceClock() has been called since the creation.
StateRegistry * stateRegistry_
The state registry.
bool updateProgramCounter_
Should program counter be updated?
static int nextContextId_
Context id for the next created context instance.
int branchDelayCycles_
Amount of delay cycles caused by pipeline.
CycleCount * cycleCountVar_
The external variable that contains the current simulation cycle count.
void advanceClock(OperationContext &)
const TCEString FUName_
Name of the FU instance – passed down from MachineStateBuilder.
InstructionAddress & irfBlockStart()
void setCycleCountVariable(CycleCount &cycleCount)
const TCEString & functionUnitName()
Memory * memory_
The Memory model instance.
bool hasState(const char *name) const
std::map< std::string, OperationState * > StateRegistry
Type of state registry.
void registerState(OperationState *state)
InstructionAddress & programCounter_
Simulates the program counter value.
void setSaveReturnAddress(bool value)
SimValue & returnAddress_
Simulates the procedure return address.
void unregisterState(const char *name)
void setStateRegistry(StateRegistry &stateRegistry)
int contextId_
Unique number that identifies a context instance.
bool saveReturnAddress_
Should the return address be saved?
OperationState & state(const char *name) const