OpenASIP  2.0
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 
39 class GPRGuardEncoding;
40 class FUGuardEncoding;
42 class 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  */
55 class GuardField : public InstructionField {
56 public:
58  GuardField(const ObjectState* state, MoveSlot& parent);
59  virtual ~GuardField();
60 
61  MoveSlot* parent() const;
62 
63  void addGuardEncoding(GPRGuardEncoding& encoding);
64  void removeGuardEncoding(GPRGuardEncoding& encoding);
65 
66  void addGuardEncoding(FUGuardEncoding& encoding);
67  void removeGuardEncoding(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;
81  bool hasFUGuardEncoding(
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 
101 private:
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 
108  void deleteFUGuardEncodings();
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 
GuardField::saveState
virtual ObjectState * saveState() const
Definition: GuardField.cc:622
GuardField::deleteFUGuardEncodings
void deleteFUGuardEncodings()
Definition: GuardField.cc:664
InstructionField.hh
GuardField::hasFUGuardEncoding
bool hasFUGuardEncoding(const std::string &fu, const std::string &port, bool inverted) const
Definition: GuardField.cc:410
MoveSlot
Definition: MoveSlot.hh:60
GuardField::childFieldCount
virtual int childFieldCount() const
Definition: GuardField.cc:509
GuardField::~GuardField
virtual ~GuardField()
Definition: GuardField.cc:100
GuardField::fuGuardEncoding
FUGuardEncoding & fuGuardEncoding(int index) const
Definition: GuardField.cc:387
GuardField::FUGuardTable
std::vector< FUGuardEncoding * > FUGuardTable
A container type for FU guard encodings.
Definition: GuardField.hh:105
GuardField::removeUnconditionalGuardEncoding
void removeUnconditionalGuardEncoding(UnconditionalGuardEncoding &encoding)
Definition: GuardField.cc:252
GuardField::gprGuards_
GPRGuardTable gprGuards_
GPR guard encodings.
Definition: GuardField.hh:113
ObjectState
Definition: ObjectState.hh:59
GuardField
Definition: GuardField.hh:55
GuardField::unconditionalGuardEncoding
UnconditionalGuardEncoding & unconditionalGuardEncoding(bool inverted) const
Definition: GuardField.cc:490
FUGuardEncoding
Definition: FUGuardEncoding.hh:47
InstructionField
Definition: InstructionField.hh:43
GuardField::addGuardEncoding
void addGuardEncoding(GPRGuardEncoding &encoding)
Definition: GuardField.cc:141
GuardField::loadState
virtual void loadState(const ObjectState *state)
Definition: GuardField.cc:585
GuardField::gprGuardEncoding
GPRGuardEncoding & gprGuardEncoding(int index) const
Definition: GuardField.cc:290
GuardField::GPRGuardTable
std::vector< GPRGuardEncoding * > GPRGuardTable
A container type for GPR guard encodings.
Definition: GuardField.hh:103
GuardField::isAssigned
bool isAssigned(unsigned int encoding) const
Definition: GuardField.cc:692
GuardField::parent
MoveSlot * parent() const
Definition: GuardField.cc:117
GuardField::GuardField
GuardField(MoveSlot &parent)
Definition: GuardField.cc:60
GuardField::hasGPRGuardEncoding
bool hasGPRGuardEncoding(const std::string &regFile, int index, bool inverted) const
Definition: GuardField.cc:313
GuardField::fuGuards_
FUGuardTable fuGuards_
FU guard encodings.
Definition: GuardField.hh:115
GuardField::hasUnconditionalGuardEncoding
bool hasUnconditionalGuardEncoding(bool inverted) const
Definition: GuardField.cc:471
GuardField::OSNAME_GUARD_FIELD
static const std::string OSNAME_GUARD_FIELD
ObjectState name for guard field.
Definition: GuardField.hh:99
GuardField::deleteUnconditionalGuardEncodings
void deleteUnconditionalGuardEncodings()
Definition: GuardField.cc:673
GuardField::gprGuardEncodingCount
int gprGuardEncodingCount() const
Definition: GuardField.cc:276
GuardField::removeGuardEncoding
void removeGuardEncoding(GPRGuardEncoding &encoding)
Definition: GuardField.cc:163
GuardField::fuGuardEncodingCount
int fuGuardEncodingCount() const
Definition: GuardField.cc:373
GuardField::childField
virtual InstructionField & childField(int) const
Definition: GuardField.cc:522
GuardField::alwaysTrue_
UnconditionalGuardEncoding * alwaysTrue_
Unconditional guard encoding for always-true expression.
Definition: GuardField.hh:117
GuardField::alwaysFalse_
UnconditionalGuardEncoding * alwaysFalse_
Unconditional guard encoding for always-false expression.
Definition: GuardField.hh:119
GPRGuardEncoding
Definition: GPRGuardEncoding.hh:47
UnconditionalGuardEncoding
Definition: UnconditionalGuardEncoding.hh:47
GuardField::width
virtual int width() const
Definition: GuardField.cc:533
GuardField::deleteGPRGuardEncodings
void deleteGPRGuardEncodings()
Definition: GuardField.cc:655