OpenASIP  2.0
GCUState.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 GCUState.hh
26  *
27  * Declaration of GCUState 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_GCU_STATE_HH
35 #define TTA_GCU_STATE_HH
36 
37 #include <vector>
38 
39 #include "FUState.hh"
40 #include "SimValue.hh"
41 #include "SimulatorConstants.hh"
42 
43 /**
44  * Models the global control unit state.
45  */
46 class GCUState : public FUState {
47 public:
48  GCUState(
49  int latency,
50  int nww,
51  int cuDelaySlots,
52  int instructionAddressIncrement = 1);
53  virtual ~GCUState();
54 
57 
58  void setProgramCounter(const InstructionAddress& value);
59  void setReturnAddress(const InstructionAddress& value);
60  void setReturnAddress();
61 
62  virtual void advanceClock();
63  virtual void reset();
64 
65  virtual OperationContext& context();
66 
67 private:
68  /// Copying not allowed.
69  GCUState(const GCUState&);
70  /// Assignment not allowed.
71  GCUState& operator=(const GCUState&);
72  /// Natural word width as minimum addressable units.
74  /// The return address register.
76  /// Program counter.
78  /// In case an control flow operation is pending, this variable
79  /// contains the program counter value that should be updated
80  /// when the control stage counter goes down.
82  /// The delay of the control flow operations to take place.
83  int latency_;
84  /// The delay of branch operations in the pipeline, as opposed to this unit
86  /// If this this is true, there's a control flow operation pending.
88  /// This indicates how many cycles the operation has been pending,
89  /// when this reaches the latency, the PC is updated with the
90  /// new value.
92  /// The operation context for this FU.
94  /// The increment to instruction address to retrieve next instruction.
96 };
97 
98 #include "GCUState.icc"
99 
100 #endif
InstructionAddress
UInt32 InstructionAddress
Definition: BaseType.hh:175
GCUState::~GCUState
virtual ~GCUState()
Definition: GCUState.cc:76
GCUState::branchDelayCycles_
int branchDelayCycles_
The delay of branch operations in the pipeline, as opposed to this unit.
Definition: GCUState.hh:85
GCUState::setReturnAddress
void setReturnAddress()
GCUState::returnAddressRegister_
SimValue returnAddressRegister_
The return address register.
Definition: GCUState.hh:75
GCUState::naturalWordWidth_
int naturalWordWidth_
Natural word width as minimum addressable units.
Definition: GCUState.hh:73
GCUState
Definition: GCUState.hh:46
OperationContext
Definition: OperationContext.hh:56
FUState.hh
GCUState::programCounter
InstructionAddress & programCounter()
SimValue
Definition: SimValue.hh:96
SimulatorConstants.hh
GCUState::operationPending_
bool operationPending_
If this this is true, there's a control flow operation pending.
Definition: GCUState.hh:87
FUState
Definition: FUState.hh:58
GCUState::operationContext_
OperationContext operationContext_
The operation context for this FU.
Definition: GCUState.hh:93
GCUState::returnAddressRegister
SimValue & returnAddressRegister()
GCUState::programCounter_
InstructionAddress programCounter_
Program counter.
Definition: GCUState.hh:77
GCUState::reset
virtual void reset()
this is called at (re)initialization of the simulation
Definition: GCUState.cc:65
GCUState::newProgramCounter_
InstructionAddress newProgramCounter_
In case an control flow operation is pending, this variable contains the program counter value that s...
Definition: GCUState.hh:81
GCUState.icc
GCUState::instructionAddressIncrement_
int instructionAddressIncrement_
The increment to instruction address to retrieve next instruction.
Definition: GCUState.hh:95
GCUState::advanceClock
virtual void advanceClock()
Definition: GCUState.cc:98
GCUState::operationPendingTime_
int operationPendingTime_
This indicates how many cycles the operation has been pending, when this reaches the latency,...
Definition: GCUState.hh:91
GCUState::GCUState
GCUState(int latency, int nww, int cuDelaySlots, int instructionAddressIncrement=1)
Definition: GCUState.cc:49
GCUState::context
virtual OperationContext & context()
Definition: GCUState.cc:88
SimValue.hh
GCUState::latency_
int latency_
The delay of the control flow operations to take place.
Definition: GCUState.hh:83
GCUState::operator=
GCUState & operator=(const GCUState &)
Assignment not allowed.
GCUState::setProgramCounter
void setProgramCounter(const InstructionAddress &value)