OpenASIP 2.2
Loading...
Searching...
No Matches
InstructionTemplate.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 InstructionTemplate.hh
26 *
27 * Declaration of class InstructionTemplate.
28 *
29 * @author Lasse Laasonen 2003 (lasse.laasonen-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#ifndef TTA_INSTRUCTION_TEMPLATE_HH
34#define TTA_INSTRUCTION_TEMPLATE_HH
35
36#include <string>
37#include <vector>
38
39#include "MachinePart.hh"
40#include "Exception.hh"
41
42namespace TTAMachine {
43
44class Bus;
45class Machine;
46class ImmediateUnit;
47class TemplateSlot;
48
50public:
51 InstructionTemplate(const std::string& name, Machine& owner);
52 InstructionTemplate(const ObjectState* state, Machine& owner);
53 virtual ~InstructionTemplate();
54
55 virtual void setName(const std::string& name);
56 virtual void addSlot(
57 const std::string& slotName, int width, ImmediateUnit& dstUnit);
58
59 virtual void removeSlot(const std::string& slotName);
60 virtual void removeSlots(const ImmediateUnit& dstUnit);
61
62 virtual int slotCount() const;
63 virtual TemplateSlot* slot(int index) const;
64 TemplateSlot* templateSlot(const std::string& slotName) const;
65
66 virtual bool usesSlot(const std::string& slotName) const;
67 virtual bool destinationUsesSlot(
68 const std::string& slotName, const ImmediateUnit& dstUnit) const;
69 virtual int numberOfDestinations() const;
70 virtual bool isOneOfDestinations(const ImmediateUnit& dstUnit) const;
71 virtual ImmediateUnit* destinationOfSlot(const std::string& slotName) const;
72
73 virtual int numberOfSlots(const ImmediateUnit& dstUnit) const;
74 virtual std::string slotOfDestination(
75 const ImmediateUnit& dstUnit, int index) const;
76
77 virtual int supportedWidth() const;
78 virtual int supportedWidth(const ImmediateUnit& dstUnit) const;
79 virtual int supportedWidth(const std::string& slotName) const;
80
81 virtual bool isEmpty() const;
82
83 virtual void setMachine(Machine& machine);
84 virtual void unsetMachine();
85
86 virtual ObjectState* saveState() const;
87 virtual void loadState(const ObjectState* state);
88
89 /// ObjectState name for instruction template.
90 static const std::string OSNAME_INSTRUCTION_TEMPLATE;
91
92private:
93 /// Container for TemplateSlots.
94 typedef std::vector<TemplateSlot*> SlotTable;
95
96 void deleteAllSlots();
97 /// Contains all the slots of the instruction template.
99};
100}
101
102#endif
virtual Machine * machine() const
virtual TCEString name() const
virtual bool usesSlot(const std::string &slotName) const
virtual ImmediateUnit * destinationOfSlot(const std::string &slotName) const
SlotTable slots_
Contains all the slots of the instruction template.
virtual void addSlot(const std::string &slotName, int width, ImmediateUnit &dstUnit)
virtual bool isOneOfDestinations(const ImmediateUnit &dstUnit) const
virtual void removeSlot(const std::string &slotName)
virtual void setName(const std::string &name)
virtual void loadState(const ObjectState *state)
virtual bool destinationUsesSlot(const std::string &slotName, const ImmediateUnit &dstUnit) const
virtual TemplateSlot * slot(int index) const
virtual int numberOfSlots(const ImmediateUnit &dstUnit) const
virtual std::string slotOfDestination(const ImmediateUnit &dstUnit, int index) const
TemplateSlot * templateSlot(const std::string &slotName) const
virtual void removeSlots(const ImmediateUnit &dstUnit)
static const std::string OSNAME_INSTRUCTION_TEMPLATE
ObjectState name for instruction template.
std::vector< TemplateSlot * > SlotTable
Container for TemplateSlots.
virtual ObjectState * saveState() const
virtual void setMachine(Machine &machine)