OpenASIP  2.0
NullInstructionTemplate.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 NullInstructionTemplate.hh
26  *
27  * Declaration of NullInstructionTemplate class.
28  *
29  * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30  * @note rating: yellow
31  */
32 
33 #ifndef TTA_NULL_INSTRUCTION_TEMPLATE_HH
34 #define TTA_NULL_INSTRUCTION_TEMPLATE_HH
35 
36 #include "InstructionTemplate.hh"
37 
38 namespace TTAMachine {
39 
40 /**
41  * A singleton class which represents a null InstructionTemplate.
42  *
43  * All the methods abort the program.
44  */
46 public:
48 
49  virtual TCEString name() const;
50  virtual void setName(const std::string& name);
51 
52  virtual void addSlot(
53  const std::string& slotName, int width, ImmediateUnit& dstUnit);
54  virtual void removeSlot(const std::string& slotName);
55  virtual void removeSlots(const ImmediateUnit& dstUnit);
56 
57  virtual int slotCount() const;
58  virtual TemplateSlot* slot(int index) const;
59 
60  virtual bool usesSlot(const std::string& slotName) const;
61  virtual bool destinationUsesSlot(
62  const std::string& slotName,
63  const ImmediateUnit& dstUnit) const;
64  virtual int numberOfDestinations() const;
65  virtual bool isOneOfDestinations(const ImmediateUnit& dstUnit) const;
66  virtual ImmediateUnit* destinationOfSlot(const std::string& slotName) const;
67 
68  virtual int numberOfSlots(const ImmediateUnit& dstUnit) const;
69  virtual std::string slotOfDestination(
70  const ImmediateUnit& dstUnit, int index) const;
71 
72  virtual int supportedWidth() const;
73  virtual int supportedWidth(const ImmediateUnit& dstUnit) const;
74  virtual int supportedWidth(const std::string& slotName) const;
75 
76  virtual bool isEmpty() const;
77 
78  virtual void setMachine(Machine& machine);
79  virtual void unsetMachine();
80  virtual Machine* machine() const;
81 
82  virtual void ensureRegistration(const Component& component) const;
83  virtual bool isRegistered() const;
84 
85  virtual ObjectState* saveState() const;
86  virtual void loadState(const ObjectState* state);
87 
88 private:
90  virtual ~NullInstructionTemplate();
91 
92  /// The only instance of NullInstructionTemplate.
94  /// Machine to which the null instruction template is registered.
95  static Machine machine_;
96 };
97 }
98 
99 #endif
TTAMachine::NullInstructionTemplate::saveState
virtual ObjectState * saveState() const
Definition: NullInstructionTemplate.cc:335
TTAMachine::NullInstructionTemplate
Definition: NullInstructionTemplate.hh:45
TTAMachine::NullInstructionTemplate::loadState
virtual void loadState(const ObjectState *state)
Definition: NullInstructionTemplate.cc:347
TTAMachine::NullInstructionTemplate::isEmpty
virtual bool isEmpty() const
Definition: NullInstructionTemplate.cc:271
ObjectState
Definition: ObjectState.hh:59
TTAMachine::NullInstructionTemplate::ensureRegistration
virtual void ensureRegistration(const Component &component) const
Definition: NullInstructionTemplate.cc:314
TTAMachine::NullInstructionTemplate::instance_
static NullInstructionTemplate instance_
The only instance of NullInstructionTemplate.
Definition: NullInstructionTemplate.hh:93
TTAMachine::NullInstructionTemplate::addSlot
virtual void addSlot(const std::string &slotName, int width, ImmediateUnit &dstUnit)
Definition: NullInstructionTemplate.cc:98
TTAMachine::InstructionTemplate
Definition: InstructionTemplate.hh:49
TTAMachine::NullInstructionTemplate::NullInstructionTemplate
NullInstructionTemplate()
Definition: NullInstructionTemplate.cc:44
TTAMachine::NullInstructionTemplate::removeSlot
virtual void removeSlot(const std::string &slotName)
Definition: NullInstructionTemplate.cc:106
TTAMachine::NullInstructionTemplate::numberOfSlots
virtual int numberOfSlots(const ImmediateUnit &dstUnit) const
Definition: NullInstructionTemplate.cc:212
TTAMachine::NullInstructionTemplate::slotCount
virtual int slotCount() const
Definition: NullInstructionTemplate.cc:127
TTAMachine::NullInstructionTemplate::unsetMachine
virtual void unsetMachine()
Definition: NullInstructionTemplate.cc:291
InstructionTemplate.hh
TTAMachine::TemplateSlot
Definition: TemplateSlot.hh:55
TTAMachine::NullInstructionTemplate::removeSlots
virtual void removeSlots(const ImmediateUnit &dstUnit)
Definition: NullInstructionTemplate.cc:117
TTAMachine::Component
Definition: MachinePart.hh:90
TTAMachine::NullInstructionTemplate::supportedWidth
virtual int supportedWidth() const
Definition: NullInstructionTemplate.cc:235
TTAMachine::NullInstructionTemplate::isRegistered
virtual bool isRegistered() const
Definition: NullInstructionTemplate.cc:324
TTAMachine::NullInstructionTemplate::destinationUsesSlot
virtual bool destinationUsesSlot(const std::string &slotName, const ImmediateUnit &dstUnit) const
Definition: NullInstructionTemplate.cc:162
TTAMachine::NullInstructionTemplate::slot
virtual TemplateSlot * slot(int index) const
Definition: NullInstructionTemplate.cc:138
TTAMachine::NullInstructionTemplate::destinationOfSlot
virtual ImmediateUnit * destinationOfSlot(const std::string &slotName) const
Definition: NullInstructionTemplate.cc:201
TTAMachine::NullInstructionTemplate::machine_
static Machine machine_
Machine to which the null instruction template is registered.
Definition: NullInstructionTemplate.hh:95
TTAMachine::NullInstructionTemplate::instance
static NullInstructionTemplate & instance()
Definition: NullInstructionTemplate.cc:62
TTAMachine::NullInstructionTemplate::usesSlot
virtual bool usesSlot(const std::string &slotName) const
Definition: NullInstructionTemplate.cc:150
TTAMachine::NullInstructionTemplate::isOneOfDestinations
virtual bool isOneOfDestinations(const ImmediateUnit &dstUnit) const
Definition: NullInstructionTemplate.cc:189
TCEString
Definition: TCEString.hh:53
TTAMachine::NullInstructionTemplate::numberOfDestinations
virtual int numberOfDestinations() const
Definition: NullInstructionTemplate.cc:177
TTAMachine::NullInstructionTemplate::slotOfDestination
virtual std::string slotOfDestination(const ImmediateUnit &dstUnit, int index) const
Definition: NullInstructionTemplate.cc:224
TTAMachine::NullInstructionTemplate::setMachine
virtual void setMachine(Machine &machine)
Definition: NullInstructionTemplate.cc:283
TTAMachine
Definition: Assembler.hh:48
TTAMachine::NullInstructionTemplate::name
virtual TCEString name() const
Definition: NullInstructionTemplate.cc:73
TTAMachine::NullInstructionTemplate::machine
virtual Machine * machine() const
Definition: NullInstructionTemplate.cc:302
TTAMachine::NullInstructionTemplate::~NullInstructionTemplate
virtual ~NullInstructionTemplate()
Definition: NullInstructionTemplate.cc:52
TTAMachine::NullInstructionTemplate::setName
virtual void setName(const std::string &name)
Definition: NullInstructionTemplate.cc:86
TTAMachine::Machine
Definition: Machine.hh:73
TTAMachine::ImmediateUnit
Definition: ImmediateUnit.hh:50