OpenASIP  2.0
SourceField.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 SourceField.hh
26  *
27  * Declaration of SourceField class.
28  *
29  * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_SOURCE_FIELD_HH
34 #define TTA_SOURCE_FIELD_HH
35 
36 #include "SlotField.hh"
37 
38 class ImmediateEncoding;
39 class BridgeEncoding;
40 
41 /**
42  * SourceField class represents the source field of a move slot.
43  *
44  * It is a specialisation of InstructionField class. In addition to socket
45  * encodings, a source field may encode an inline immediate or up to two
46  * bridge sources.
47  */
48 class SourceField : public SlotField {
49 public:
51  SourceField(const ObjectState* state, MoveSlot& parent);
52  virtual ~SourceField();
53 
54  void addBridgeEncoding(BridgeEncoding& encoding);
55  void removeBridgeEncoding(BridgeEncoding& encoding);
56  bool hasBridgeEncoding(const std::string& bridge) const;
57  BridgeEncoding& bridgeEncoding(const std::string& bridge) const;
58  int bridgeEncodingCount() const;
59  BridgeEncoding& bridgeEncoding(int index) const;
60 
63  bool hasImmediateEncoding() const;
65 
66  // methods inherited from InstructionField
67  virtual int width() const;
68 
69  // methods inherited from Serializable interface
70  virtual void loadState(const ObjectState* state);
71  virtual ObjectState* saveState() const;
72 
73  /// ObjectState name for source field.
74  static const std::string OSNAME_SOURCE_FIELD;
75 
76 private:
77  /// Container type for bridge encodings.
78  typedef std::vector<BridgeEncoding*> BridgeEncodingTable;
79 
80  void clearBridgeEncodings();
82 
83  /// Container for bridge encodings.
85  /// The immediate encoding.
87 };
88 
89 #endif
SourceField::setImmediateEncoding
void setImmediateEncoding(ImmediateEncoding &encoding)
Definition: SourceField.cc:243
SourceField::loadState
virtual void loadState(const ObjectState *state)
Definition: SourceField.cc:336
SourceField::saveState
virtual ObjectState * saveState() const
Definition: SourceField.cc:372
MoveSlot
Definition: MoveSlot.hh:60
SourceField::bridgeEncodings_
BridgeEncodingTable bridgeEncodings_
Container for bridge encodings.
Definition: SourceField.hh:84
SourceField::unsetImmediateEncoding
void unsetImmediateEncoding()
Definition: SourceField.cc:265
SourceField::hasImmediateEncoding
bool hasImmediateEncoding() const
Definition: SourceField.cc:279
SourceField::BridgeEncodingTable
std::vector< BridgeEncoding * > BridgeEncodingTable
Container type for bridge encodings.
Definition: SourceField.hh:78
BridgeEncoding
Definition: BridgeEncoding.hh:47
ObjectState
Definition: ObjectState.hh:59
SourceField::immEncoding_
ImmediateEncoding * immEncoding_
The immediate encoding.
Definition: SourceField.hh:86
SourceField::hasBridgeEncoding
bool hasBridgeEncoding(const std::string &bridge) const
Definition: SourceField.cc:169
SlotField.hh
BinaryEncoding::Position
Position
Definition: BinaryEncoding.hh:63
SourceField::immediateEncoding
ImmediateEncoding & immediateEncoding() const
Definition: SourceField.cc:293
SourceField::removeBridgeEncoding
void removeBridgeEncoding(BridgeEncoding &encoding)
Definition: SourceField.cc:154
SourceField::width
virtual int width() const
Definition: SourceField.cc:308
SourceField::clearBridgeEncodings
void clearBridgeEncodings()
Definition: SourceField.cc:396
SourceField::clearImmediateEncoding
void clearImmediateEncoding()
Definition: SourceField.cc:405
SlotField
Definition: SlotField.hh:58
SourceField::bridgeEncodingCount
int bridgeEncodingCount() const
Definition: SourceField.cc:209
SourceField::~SourceField
virtual ~SourceField()
Definition: SourceField.cc:108
SourceField::bridgeEncoding
BridgeEncoding & bridgeEncoding(const std::string &bridge) const
Definition: SourceField.cc:191
SourceField::addBridgeEncoding
void addBridgeEncoding(BridgeEncoding &encoding)
Definition: SourceField.cc:130
ImmediateEncoding
Definition: ImmediateEncoding.hh:44
SlotField::parent
MoveSlot * parent() const
Definition: SlotField.cc:98
SourceField::OSNAME_SOURCE_FIELD
static const std::string OSNAME_SOURCE_FIELD
ObjectState name for source field.
Definition: SourceField.hh:74
SourceField::SourceField
SourceField(BinaryEncoding::Position componentIDPos, MoveSlot &parent)
Definition: SourceField.cc:65
SourceField
Definition: SourceField.hh:48