OpenASIP  2.0
TemplateSlot.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 TemplateSlot.hh
26  *
27  * Declaration of class TemplateSlot.
28  *
29  * @author Lasse Laasonen 2003 (lasse.laasonen-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_TEMPLATE_SLOT_HH
34 #define TTA_TEMPLATE_SLOT_HH
35 
36 #include <string>
37 #include <vector>
38 #include <map>
39 
40 #include "Application.hh"
41 
42 class ObjectState;
43 
44 namespace TTAMachine {
45 
46 class ImmediateUnit;
47 class InstructionTemplate;
48 class ImmediateSlot;
49 class Bus;
50 
51 /**
52  * Repsesents a bit field of the TTA instruction that is used to encode a
53  * piece of a long immediate for a given instruction template or a NOP move.
54  */
55 class TemplateSlot {
56 public:
57 
59  const Bus& slot,
60  int width,
63  const ImmediateSlot& slot,
64  int width,
66 
67  TemplateSlot(const Bus& slot);
68 
69  virtual ~TemplateSlot();
70 
71  int width() const;
72  std::string slot() const;
73  ImmediateUnit* destination() const;
74 
75  ObjectState* saveState() const;
76 
77  const Bus* bus() const;
78  /// ObjectState name for template slot.
79  static const std::string OSNAME_TEMPLATE_SLOT;
80  /// ObjectState attribute key for slot name.
81  static const std::string OSKEY_SLOT;
82  /// ObjectState attribute key for bit width.
83  static const std::string OSKEY_WIDTH;
84  /// ObjectState attribute key for destination.
85  static const std::string OSKEY_DESTINATION;
86  // ObjectState attribute key for RF read
87  static const std::string OSKEY_RF_READ;
88  // ObjectState attribute key for RF write
89  static const std::string OSKEY_RF_WRITE;
90  // ObjectState attribute key for FU read
91  static const std::string OSKEY_FU_READ;
92  // ObjectState attribute key for FU write
93  static const std::string OSKEY_FU_WRITE;
94 
95 
96 private:
97 
98  /// The bus which is programmed by the instruction bit
99  /// field of this template slot.
100  const Bus* bus_;
101 
102  /// The immediate slot which is programmed by the instruction bit
103  /// field of this template slot.
105 
106  /// The number of bits that can be encoded in this instruction field.
107  int width_;
108 
109  /// Destination unit.
111 
112 };
113 }
114 
115 #include "TemplateSlot.icc"
116 
117 #endif
TTAMachine::TemplateSlot::OSKEY_SLOT
static const std::string OSKEY_SLOT
ObjectState attribute key for slot name.
Definition: TemplateSlot.hh:81
TTAMachine::TemplateSlot::saveState
ObjectState * saveState() const
Definition: TemplateSlot.cc:113
TTAMachine::TemplateSlot::OSNAME_TEMPLATE_SLOT
static const std::string OSNAME_TEMPLATE_SLOT
ObjectState name for template slot.
Definition: TemplateSlot.hh:79
TTAMachine::TemplateSlot::TemplateSlot
TemplateSlot(const Bus &slot, int width, ImmediateUnit &destination)
Definition: TemplateSlot.cc:64
TTAMachine::TemplateSlot::~TemplateSlot
virtual ~TemplateSlot()
Definition: TemplateSlot.cc:103
TTAMachine::Bus
Definition: Bus.hh:53
ObjectState
Definition: ObjectState.hh:59
TTAMachine::TemplateSlot::OSKEY_WIDTH
static const std::string OSKEY_WIDTH
ObjectState attribute key for bit width.
Definition: TemplateSlot.hh:83
TTAMachine::TemplateSlot::OSKEY_FU_WRITE
static const std::string OSKEY_FU_WRITE
Definition: TemplateSlot.hh:93
TemplateSlot.icc
TTAMachine::TemplateSlot::OSKEY_RF_READ
static const std::string OSKEY_RF_READ
Definition: TemplateSlot.hh:87
TTAMachine::TemplateSlot
Definition: TemplateSlot.hh:55
Application.hh
TTAMachine::TemplateSlot::destination
ImmediateUnit * destination() const
TTAMachine::TemplateSlot::slot
std::string slot() const
TTAMachine::TemplateSlot::immSlot_
const ImmediateSlot * immSlot_
The immediate slot which is programmed by the instruction bit field of this template slot.
Definition: TemplateSlot.hh:104
TTAMachine::TemplateSlot::OSKEY_RF_WRITE
static const std::string OSKEY_RF_WRITE
Definition: TemplateSlot.hh:89
TTAMachine::TemplateSlot::width_
int width_
The number of bits that can be encoded in this instruction field.
Definition: TemplateSlot.hh:107
TTAMachine::TemplateSlot::bus
const Bus * bus() const
TTAMachine::TemplateSlot::OSKEY_FU_READ
static const std::string OSKEY_FU_READ
Definition: TemplateSlot.hh:91
TTAMachine::TemplateSlot::bus_
const Bus * bus_
The bus which is programmed by the instruction bit field of this template slot.
Definition: TemplateSlot.hh:100
TTAMachine
Definition: Assembler.hh:48
TTAMachine::TemplateSlot::width
int width() const
TTAMachine::TemplateSlot::destination_
ImmediateUnit * destination_
Destination unit.
Definition: TemplateSlot.hh:110
TTAMachine::ImmediateSlot
Definition: ImmediateSlot.hh:44
TTAMachine::TemplateSlot::OSKEY_DESTINATION
static const std::string OSKEY_DESTINATION
ObjectState attribute key for destination.
Definition: TemplateSlot.hh:85
TTAMachine::ImmediateUnit
Definition: ImmediateUnit.hh:50