OpenASIP 2.2
Loading...
Searching...
No Matches
ControlUnit.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 ControlUnit.hh
26 *
27 * Declaration of ControlUnit class.
28 *
29 * @author Lasse Laasonen 2004 (lasse.laasonen-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#ifndef TTA_CONTROL_UNIT_HH
34#define TTA_CONTROL_UNIT_HH
35
36#include <string>
37#include <utility>
38
39#include "FunctionUnit.hh"
40
41class ObjectState;
42
43namespace TTAMachine {
44
45class SpecialRegisterPort;
46
47/**
48 * Represents the global control unit in the machine.
49 */
50class ControlUnit : public FunctionUnit {
51public:
53 const std::string& name, int delaySlots, int globalGuardLatency);
54 ControlUnit(const ObjectState* state);
55 virtual ~ControlUnit();
56
57 virtual ControlUnit* copy() const;
58
59 virtual void setMachine(Machine& mach);
60 virtual void unsetMachine();
61
62 int delaySlots() const;
63 void setDelaySlots(int delaySlots);
64
65 int globalGuardLatency() const;
66 void setGlobalGuardLatency(int latency);
67
68 int specialRegisterPortCount() const;
69 bool hasSpecialRegisterPort(const std::string& name) const;
71 SpecialRegisterPort* specialRegisterPort(const std::string& name) const;
72
75 bool hasReturnAddressPort() const;
77
78 virtual ObjectState* saveState() const;
79 virtual void loadState(const ObjectState* state);
80
81 /// ObjectState name for ControlUnit.
82 static const std::string OSNAME_CONTROL_UNIT;
83 /// ObjectState attribute key for the number of delay slots.
84 static const std::string OSKEY_DELAY_SLOTS;
85 /// ObjectState attribute key for the global guard latency.
86 static const std::string OSKEY_GUARD_LATENCY;
87 /// ObjectState attribute key for the name of the return address port.
88 static const std::string OSKEY_RA_PORT;
89
90protected:
91 virtual void removePort(Port& port);
92
93private:
94 void loadStateWithoutReferences(const ObjectState* state);
95 static bool hasLocalGuardLatencyOfZero(const Machine& machine);
96
97 /// Number of delay instruction slots on the transport pipeline.
99
100 /// The global guard latency.
102 /// The return address port.
104};
105}
106
107#include "ControlUnit.icc"
108
109#endif
virtual Machine * machine() const
virtual TCEString name() const
SpecialRegisterPort * returnAddressPort() const
virtual ObjectState * saveState() const
void setGlobalGuardLatency(int latency)
SpecialRegisterPort * specialRegisterPort(int index) const
int globalGuardLatency_
The global guard latency.
static const std::string OSNAME_CONTROL_UNIT
ObjectState name for ControlUnit.
void setDelaySlots(int delaySlots)
virtual void unsetMachine()
bool hasReturnAddressPort() const
int globalGuardLatency() const
static const std::string OSKEY_DELAY_SLOTS
ObjectState attribute key for the number of delay slots.
virtual ControlUnit * copy() const
void loadStateWithoutReferences(const ObjectState *state)
void setReturnAddressPort(const SpecialRegisterPort &port)
int delaySlots_
Number of delay instruction slots on the transport pipeline.
bool hasSpecialRegisterPort(const std::string &name) const
int specialRegisterPortCount() const
static bool hasLocalGuardLatencyOfZero(const Machine &machine)
virtual void setMachine(Machine &mach)
static const std::string OSKEY_GUARD_LATENCY
ObjectState attribute key for the global guard latency.
SpecialRegisterPort * raPort_
The return address port.
virtual void loadState(const ObjectState *state)
static const std::string OSKEY_RA_PORT
ObjectState attribute key for the name of the return address port.
virtual void removePort(Port &port)
virtual BaseFUPort * port(const std::string &name) const