OpenASIP 2.2
Loading...
Searching...
No Matches
GuardField.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 GuardField.hh
26 *
27 * Declaration of GuardField class.
28 *
29 * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#ifndef TTA_GUARD_FIELD_HH
34#define TTA_GUARD_FIELD_HH
35
36#include <vector>
37#include "InstructionField.hh"
38
40class FUGuardEncoding;
42class MoveSlot;
43
44/**
45 * GuardField class represents the guard field of the move slot.
46 *
47 * The guard field defines the guard expressions that control whether
48 * a data transport is completed or cancelled. A GuardField instance
49 * contains the control codes that identify the guard expressions
50 * supported by a given move slot. GuardField is an instruction field,
51 * hence it is derived from class InstructionField. GuardField
52 * instances cannot exist alone; they belong to a move slot and are
53 * registered to a MoveSlot object at construction time.
54 */
56public:
58 GuardField(const ObjectState* state, MoveSlot& parent);
59 virtual ~GuardField();
60
61 MoveSlot* parent() const;
62
63 void addGuardEncoding(GPRGuardEncoding& encoding);
65
66 void addGuardEncoding(FUGuardEncoding& encoding);
68
71
72 int gprGuardEncodingCount() const;
73 GPRGuardEncoding& gprGuardEncoding(int index) const;
75 const std::string& regFile, int index, bool inverted) const;
77 const std::string& regFile, int index, bool inverted) const;
78
79 int fuGuardEncodingCount() const;
80 FUGuardEncoding& fuGuardEncoding(int index) const;
82 const std::string& fu, const std::string& port, bool inverted) const;
84 const std::string& fu, const std::string& port, bool inverted) const;
85
86 bool hasUnconditionalGuardEncoding(bool inverted) const;
88
89 // methods inherited from InstructionField class
90 virtual int childFieldCount() const;
91 virtual InstructionField& childField(int) const;
92 virtual int width() const;
93
94 // methods inherited from Serializable interface
95 virtual void loadState(const ObjectState* state);
96 virtual ObjectState* saveState() const;
97
98 /// ObjectState name for guard field.
99 static const std::string OSNAME_GUARD_FIELD;
100
101private:
102 /// A container type for GPR guard encodings.
103 typedef std::vector<GPRGuardEncoding*> GPRGuardTable;
104 /// A container type for FU guard encodings.
105 typedef std::vector<FUGuardEncoding*> FUGuardTable;
106
110 bool isAssigned(unsigned int encoding) const;
111
112 /// GPR guard encodings.
114 /// FU guard encodings.
116 /// Unconditional guard encoding for always-true expression.
118 /// Unconditional guard encoding for always-false expression.
120};
121
122#endif
123
124
FUGuardEncoding & fuGuardEncoding(int index) const
bool hasUnconditionalGuardEncoding(bool inverted) const
UnconditionalGuardEncoding * alwaysFalse_
Unconditional guard encoding for always-false expression.
void deleteFUGuardEncodings()
void addGuardEncoding(GPRGuardEncoding &encoding)
int gprGuardEncodingCount() const
UnconditionalGuardEncoding & unconditionalGuardEncoding(bool inverted) const
GPRGuardEncoding & gprGuardEncoding(int index) const
void deleteGPRGuardEncodings()
bool hasGPRGuardEncoding(const std::string &regFile, int index, bool inverted) const
virtual ObjectState * saveState() const
bool isAssigned(unsigned int encoding) const
std::vector< GPRGuardEncoding * > GPRGuardTable
A container type for GPR guard encodings.
void removeGuardEncoding(GPRGuardEncoding &encoding)
UnconditionalGuardEncoding * alwaysTrue_
Unconditional guard encoding for always-true expression.
void removeUnconditionalGuardEncoding(UnconditionalGuardEncoding &encoding)
GPRGuardTable gprGuards_
GPR guard encodings.
virtual int childFieldCount() const
FUGuardTable fuGuards_
FU guard encodings.
bool hasFUGuardEncoding(const std::string &fu, const std::string &port, bool inverted) const
virtual ~GuardField()
virtual int width() const
int fuGuardEncodingCount() const
MoveSlot * parent() const
virtual void loadState(const ObjectState *state)
static const std::string OSNAME_GUARD_FIELD
ObjectState name for guard field.
Definition GuardField.hh:99
std::vector< FUGuardEncoding * > FUGuardTable
A container type for FU guard encodings.
void deleteUnconditionalGuardEncodings()
virtual InstructionField & childField(int) const