OpenASIP 2.2
Loading...
Searching...
No Matches
OperationContext.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 OperationContext.hh
26 *
27 * Declaration of OperationContext class.
28 *
29 * @author Pekka Jääskeläinen 2004 (pekka.jaaskelainen-no.spam-tut.fi)
30 * @note This file is used in compiled simulation. Keep dependencies *clean*
31 * @note rating: yellow
32 * @note reviewed 7 September 2004 by pj, jn, jm, ao
33 */
34
35#ifndef TTA_OPERATION_CONTEXT_HH
36#define TTA_OPERATION_CONTEXT_HH
37
38#include "BaseType.hh"
39#include "TCEString.hh"
40#include <map>
41
42class OperationState;
43class SimValue;
44class Memory;
46
47#define DEFAULT_FU_NAME "unnamed_fu"
48
49/**
50 * OperationContext is used to store any implementation and context dependent
51 * data that may affect the result of an operation.
52 *
53 * In typical client applications, operation implementations are related to
54 * a function unit.
55 */
57public:
58
60 OperationContext(const TCEString& name);
65 int delayCycles);
66
68
69 OperationState& state(const char* name) const;
70
71 /// Type of state registry.
72 typedef std::map<std::string, OperationState*> StateRegistry;
73
75 void unsetStateRegistry();
77
78 virtual ~OperationContext();
79
80 Memory& memory();
81 const Memory& memory() const;
82 void setMemory(Memory* memory);
83 int contextId() const;
84
87 void setUpdateProgramCounter(bool value);
88 bool updateProgramCounter() const;
89 void setSaveReturnAddress(bool value);
90 bool saveReturnAddress();
92 const SimValue& returnAddress() const;
93
94 void advanceClock();
95 bool isEmpty() const;
96 bool hasMemoryModel() const;
97 const TCEString& functionUnitName() const;
98
99 int branchDelayCycles() const;
100
101 // These methods are only for internal use. Used by the macro definitions
102 // of OSAL.hh.
104 void unregisterState(const char* name);
105
106 CycleCount cycleCount() const;
108
109private:
110 /// Assignment not allowed
112 /// Implementation in separate source file to speed up compiling.
114};
115
116#endif
long long CycleCount
Type for storing simulation cycle counts.
Definition BaseType.hh:187
UInt32 InstructionAddress
Definition BaseType.hh:175
void registerState(OperationState *state)
void setSaveReturnAddress(bool value)
bool hasMemoryModel() const
void setUpdateProgramCounter(bool value)
CycleCount cycleCount() const
int branchDelayCycles() const
OperationState & state(const char *name) const
OperationContext & operator=(const OperationContext &)
Assignment not allowed.
bool updateProgramCounter() const
void setCycleCountVariable(CycleCount &cycleCount)
void setStateRegistry(StateRegistry &stateRegistry)
StateRegistry & stateRegistry()
void setMemory(Memory *memory)
const TCEString & functionUnitName() const
std::map< std::string, OperationState * > StateRegistry
Type of state registry.
SimValue & returnAddress()
virtual ~OperationContext()
void unregisterState(const char *name)
InstructionAddress & programCounter()
OperationContextPimpl * pimpl_
Implementation in separate source file to speed up compiling.