OpenASIP 2.2
Loading...
Searching...
No Matches
SlotField.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 SlotField.hh
26 *
27 * Declaration of SlotField class.
28 *
29 * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#ifndef TTA_SLOT_FIELD_HH
34#define TTA_SLOT_FIELD_HH
35
36#include <vector>
37#include "InstructionField.hh"
38#include "BinaryEncoding.hh"
39
40class SocketEncoding;
41class MoveSlot;
42class NOPEncoding;
43
44/**
45 * SlotField is an abstract base class that models the properties common to
46 * SourceField and DestinationField classes.
47 *
48 * SlotField contains and manages the encodings for sockets. Encodings
49 * for different sources and destinations consists of two parts:
50 * socket ID and optional socket code. Socket ID determines the
51 * socket. Socket code determines the port (and opcode) the socket is
52 * connected to. Socket ID may be on either left or right side of the
53 * socket code in the source or destination field. If socket ID is on
54 * the left side of socket code, socket ID is aligned to the left end
55 * of the whole source/destination field. In the other case, socket ID
56 * is aligned to the right end of the source/destination field.
57 */
59public:
60 virtual ~SlotField();
61
62 MoveSlot* parent() const;
63
64 void addSocketEncoding(SocketEncoding& encoding);
66
67 int socketEncodingCount() const;
68 SocketEncoding& socketEncoding(int index) const;
69 bool hasSocketEncoding(const std::string& socket) const;
70 SocketEncoding& socketEncoding(const std::string& socket) const;
71
72 void setNoOperationEncoding(NOPEncoding& encoding);
74 bool hasNoOperationEncoding() const;
76
78
79 // methods inherited from InstructionField
80 virtual int width() const;
81 virtual int childFieldCount() const;
82 virtual InstructionField& childField(int position) const;
83
84 // methods inherited from Serializable interface
85 virtual void loadState(const ObjectState* state);
86 virtual ObjectState* saveState() const;
87
88 /// ObjectState name for slot field.
89 static const std::string OSNAME_SLOT_FIELD;
90 /// ObjectState attribute key for component ID position.
91 static const std::string OSKEY_COMPONENT_ID_POSITION;
92
93protected:
95 SlotField(const ObjectState* state, MoveSlot& parent);
96
97private:
98 /// A container type for socket encodings.
99 typedef std::vector<SocketEncoding*> SocketEncodingTable;
100
103
104 /// The NOP encoding.
106 /// The container for socket encodings.
108 /// Position of the socket and bridge IDs within the field.
110};
111
112#endif
113
114
static const std::string OSNAME_SLOT_FIELD
ObjectState name for slot field.
Definition SlotField.hh:89
std::vector< SocketEncoding * > SocketEncodingTable
A container type for socket encodings.
Definition SlotField.hh:99
MoveSlot * parent() const
Definition SlotField.cc:98
void addSocketEncoding(SocketEncoding &encoding)
Definition SlotField.cc:121
bool hasSocketEncoding(const std::string &socket) const
Definition SlotField.cc:188
NOPEncoding * nopEncoding_
The NOP encoding.
Definition SlotField.hh:105
virtual int width() const
Definition SlotField.cc:307
virtual InstructionField & childField(int position) const
Definition SlotField.cc:345
SocketEncodingTable encodings_
The container for socket encodings.
Definition SlotField.hh:107
SocketEncoding & socketEncoding(int index) const
Definition SlotField.cc:170
virtual ObjectState * saveState() const
Definition SlotField.cc:388
bool hasNoOperationEncoding() const
Definition SlotField.cc:267
void removeSocketEncoding(SocketEncoding &encoding)
Definition SlotField.cc:143
void clearSocketEncodings()
Definition SlotField.cc:413
NOPEncoding & noOperationEncoding() const
Definition SlotField.cc:281
BinaryEncoding::Position componentIDPos_
Position of the socket and bridge IDs within the field.
Definition SlotField.hh:109
virtual void loadState(const ObjectState *state)
Definition SlotField.cc:358
BinaryEncoding::Position componentIDPosition() const
Definition SlotField.cc:296
void setNoOperationEncoding(NOPEncoding &encoding)
Definition SlotField.cc:234
virtual ~SlotField()
Definition SlotField.cc:88
void unsetNoOperationEncoding()
Definition SlotField.cc:253
void clearNoOperationEncoding()
Definition SlotField.cc:422
static const std::string OSKEY_COMPONENT_ID_POSITION
ObjectState attribute key for component ID position.
Definition SlotField.hh:91
virtual int childFieldCount() const
Definition SlotField.cc:333
int socketEncodingCount() const
Definition SlotField.cc:156