OpenASIP  2.0
MoveSlot.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2014 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 MoveSlot.hh
26  *
27  * Declaration of MoveSlot class.
28  *
29  * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30  * @author Pekka Jääskeläinen 2014
31  * @note rating: red
32  */
33 
34 #ifndef TTA_MOVE_SLOT_HH
35 #define TTA_MOVE_SLOT_HH
36 
37 #include <set>
38 
39 #include "TCEString.hh"
40 #include "InstructionField.hh"
41 
42 class GuardField;
43 class SourceField;
44 class DestinationField;
45 class ShortImmediateControlField;
46 class BinaryEncoding;
47 
48 /**
49  * The MoveSlot class represents move slots, fields of the TTA instruction
50  * dedicated to program data transports.
51  *
52  * Move slots are subdivided into 2 or 3 fields: the guard (optional),
53  * source and destination fields. Each type of move slot field is
54  * modelled by a different class. MoveSlot has handles to the
55  * instances of these classes. A move slot is identified by the name
56  * of the transport bus it controls. MoveSlot instances cannot exist
57  * alone. They belong to a binary encoding and are always registered
58  * to a BinaryEncoding object.
59  */
60 class MoveSlot : public InstructionField {
61 public:
62  MoveSlot(const std::string& busName, BinaryEncoding& parent);
63  MoveSlot(const ObjectState* state, BinaryEncoding& parent);
64  virtual ~MoveSlot();
65 
66  BinaryEncoding* parent() const;
67 
68  std::string name() const;
69  void setName(const std::string& name);
70 
71  void setGuardField(GuardField& field);
72  void unsetGuardField();
73  bool hasGuardField() const;
74  GuardField& guardField() const;
75 
76  void setSourceField(SourceField& field);
77  void unsetSourceField();
78  bool hasSourceField() const;
79  SourceField& sourceField() const;
80 
82  void unsetDestinationField();
83  bool hasDestinationField() const;
85 
86  // virtual methods derived from InstructionField
87  virtual int childFieldCount() const;
88  virtual InstructionField& childField(int position) const;
89  virtual int width() const;
90 
91  // methods inherited from Serializable interface
92  virtual void loadState(const ObjectState* state);
93  virtual ObjectState* saveState() const;
94 
95  /// ObjectState name for move slot.
96  static const std::string OSNAME_MOVE_SLOT;
97  /// ObjectState attribute key for the name of the bus.
98  static const std::string OSKEY_BUS_NAME;
99 
100 private:
101  void deleteGuardField();
102  void deleteSourceField();
103  void deleteDestinationField();
104 
105  /// The bus name.
106  std::string name_;
107  /// The guard field.
109  /// The source field.
111  /// The destination field.
113 };
114 
115 #endif
116 
117 
MoveSlot::OSNAME_MOVE_SLOT
static const std::string OSNAME_MOVE_SLOT
ObjectState name for move slot.
Definition: MoveSlot.hh:96
BinaryEncoding
Definition: BinaryEncoding.hh:61
MoveSlot::name
std::string name() const
Definition: MoveSlot.cc:136
InstructionField.hh
MoveSlot
Definition: MoveSlot.hh:60
DestinationField
Definition: DestinationField.hh:44
MoveSlot::loadState
virtual void loadState(const ObjectState *state)
Definition: MoveSlot.cc:432
MoveSlot::hasGuardField
bool hasGuardField() const
Definition: MoveSlot.cc:202
ObjectState
Definition: ObjectState.hh:59
GuardField
Definition: GuardField.hh:55
MoveSlot::guardField_
GuardField * guardField_
The guard field.
Definition: MoveSlot.hh:108
MoveSlot::unsetDestinationField
void unsetDestinationField()
Definition: MoveSlot.cc:314
InstructionField
Definition: InstructionField.hh:43
TCEString.hh
MoveSlot::setName
void setName(const std::string &name)
Definition: MoveSlot.cc:149
MoveSlot::deleteSourceField
void deleteSourceField()
Definition: MoveSlot.cc:505
MoveSlot::hasSourceField
bool hasSourceField() const
Definition: MoveSlot.cc:264
MoveSlot::deleteDestinationField
void deleteDestinationField()
Definition: MoveSlot.cc:516
MoveSlot::~MoveSlot
virtual ~MoveSlot()
Definition: MoveSlot.cc:100
MoveSlot::guardField
GuardField & guardField() const
Definition: MoveSlot.cc:215
MoveSlot::hasDestinationField
bool hasDestinationField() const
Definition: MoveSlot.cc:327
MoveSlot::sourceField_
SourceField * sourceField_
The source field.
Definition: MoveSlot.hh:110
MoveSlot::width
virtual int width() const
Definition: MoveSlot.cc:406
MoveSlot::sourceField
SourceField & sourceField() const
Definition: MoveSlot.cc:277
MoveSlot::deleteGuardField
void deleteGuardField()
Definition: MoveSlot.cc:493
MoveSlot::saveState
virtual ObjectState * saveState() const
Definition: MoveSlot.cc:469
MoveSlot::setSourceField
void setSourceField(SourceField &field)
Definition: MoveSlot.cc:233
MoveSlot::parent
BinaryEncoding * parent() const
Definition: MoveSlot.cc:118
MoveSlot::childField
virtual InstructionField & childField(int position) const
Definition: MoveSlot.cc:380
MoveSlot::name_
std::string name_
The bus name.
Definition: MoveSlot.hh:106
MoveSlot::OSKEY_BUS_NAME
static const std::string OSKEY_BUS_NAME
ObjectState attribute key for the name of the bus.
Definition: MoveSlot.hh:98
MoveSlot::unsetGuardField
void unsetGuardField()
Definition: MoveSlot.cc:189
MoveSlot::setDestinationField
void setDestinationField(DestinationField &field)
Definition: MoveSlot.cc:296
MoveSlot::destinationField
DestinationField & destinationField() const
Definition: MoveSlot.cc:341
MoveSlot::setGuardField
void setGuardField(GuardField &field)
Definition: MoveSlot.cc:171
MoveSlot::unsetSourceField
void unsetSourceField()
Definition: MoveSlot.cc:251
MoveSlot::childFieldCount
virtual int childFieldCount() const
Definition: MoveSlot.cc:357
MoveSlot::destinationField_
DestinationField * destinationField_
The destination field.
Definition: MoveSlot.hh:112
MoveSlot::MoveSlot
MoveSlot(const std::string &busName, BinaryEncoding &parent)
Definition: MoveSlot.cc:64
SourceField
Definition: SourceField.hh:48