OpenASIP  2.0
ResourceManager.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 ResourceManager.hh
26  *
27  * Declaration of ResourceManager class.
28  *
29  * @author Ari Metsähalme 2006 (ari.metsahalme-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_RESOURCE_MANAGER_HH
34 #define TTA_RESOURCE_MANAGER_HH
35 
36 namespace TTAMachine {
37  class Machine;
38  class FunctionUnit;
39  class Bus;
40  class ImmediateUnit;
41 }
42 
43 namespace TTAProgram {
44  class Instruction;
45 }
46 
47 class MoveNode;
48 class MoveNodeSet;
49 
50 /**
51  * Base interface for resource managers.
52  */
54 public:
56  virtual ~ResourceManager();
57 
58  virtual bool canAssign(
59  int cycle, MoveNode& node,
60  const TTAMachine::Bus* bus = nullptr,
61  const TTAMachine::FunctionUnit* srcFU = nullptr,
62  const TTAMachine::FunctionUnit* dstFU = nullptr,
63  int immWriteCycle = -1,
64  const TTAMachine::ImmediateUnit* immu = nullptr,
65  int immRegIndex = -1) const = 0;
66  virtual void assign(
67  int cycle, MoveNode& node,
68  const TTAMachine::Bus* bus = nullptr,
69  const TTAMachine::FunctionUnit* srcFU = nullptr,
70  const TTAMachine::FunctionUnit* dstFU = nullptr,
71  int immWriteCycle = -1,
72  const TTAMachine::ImmediateUnit* immu = nullptr,
73  int immRegIndex = -1) = 0;
74  virtual void unassign(MoveNode& node) = 0;
75  virtual int earliestCycle(
76  MoveNode& node,
77  const TTAMachine::Bus* bus = nullptr,
78  const TTAMachine::FunctionUnit* srcFU = nullptr,
79  const TTAMachine::FunctionUnit* dstFU = nullptr,
80  int immWriteCycle = -1,
81  const TTAMachine::ImmediateUnit* immu = nullptr,
82  int immRegIndex = -1) const = 0;
83  virtual int earliestCycle(
84  int cycle, MoveNode& node,
85  const TTAMachine::Bus* bus = nullptr,
86  const TTAMachine::FunctionUnit* srcFU = nullptr,
87  const TTAMachine::FunctionUnit* dstFU = nullptr,
88  int immWriteCycle = -1,
89  const TTAMachine::ImmediateUnit* immu = nullptr,
90  int immRegIndex = -1) const = 0;
91  virtual int latestCycle(
92  MoveNode& node,
93  const TTAMachine::Bus* bus = nullptr,
94  const TTAMachine::FunctionUnit* srcFU = nullptr,
95  const TTAMachine::FunctionUnit* dstFU = nullptr,
96  int immWriteCycle = -1,
97  const TTAMachine::ImmediateUnit* immu = nullptr,
98  int immRegIndex = -1) const = 0;
99  virtual int latestCycle(
100  int cycle, MoveNode& node,
101  const TTAMachine::Bus* bus = nullptr,
102  const TTAMachine::FunctionUnit* srcFU = nullptr,
103  const TTAMachine::FunctionUnit* dstFU = nullptr,
104  int immWriteCycle = -1,
105  const TTAMachine::ImmediateUnit* immu = nullptr,
106  int immRegIndex = -1) const = 0;
107  virtual bool supportsExternalAssignments() const = 0;
108  virtual int largestCycle() const = 0;
109  virtual int smallestCycle() const = 0;
110  const TTAMachine::Machine& machine() const;
111  virtual TTAProgram::Instruction* instruction(int cycle) const =0;
112 private:
113  /// Target machine.
115 };
116 
117 // #define DEBUG_RM
118 
119 #ifdef DEBUG_RM
120 #include "Application.hh"
121 #define debugLogRM(__X) debugLog(__X)
122 #else
123 #define debugLogRM(__X)
124 #endif
125 
126 #endif
TTAProgram
Definition: Estimator.hh:65
ResourceManager::ResourceManager
ResourceManager(const TTAMachine::Machine &machine)
Definition: ResourceManager.cc:40
ResourceManager::latestCycle
virtual int latestCycle(MoveNode &node, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, int immWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1) const =0
ResourceManager::unassign
virtual void unassign(MoveNode &node)=0
TTAProgram::Instruction
Definition: Instruction.hh:57
TTAMachine::Bus
Definition: Bus.hh:53
MoveNode
Definition: MoveNode.hh:65
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
ResourceManager::supportsExternalAssignments
virtual bool supportsExternalAssignments() const =0
ResourceManager::instruction
virtual TTAProgram::Instruction * instruction(int cycle) const =0
ResourceManager::~ResourceManager
virtual ~ResourceManager()
Definition: ResourceManager.cc:47
ResourceManager::largestCycle
virtual int largestCycle() const =0
Application.hh
ResourceManager
Definition: ResourceManager.hh:53
ResourceManager::canAssign
virtual bool canAssign(int cycle, MoveNode &node, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, int immWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1) const =0
MoveNodeSet
Definition: MoveNodeSet.hh:41
ResourceManager::machine
const TTAMachine::Machine & machine() const
Definition: ResourceManager.cc:56
ResourceManager::assign
virtual void assign(int cycle, MoveNode &node, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, int immWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1)=0
ResourceManager::machine_
const TTAMachine::Machine * machine_
Target machine.
Definition: ResourceManager.hh:114
ResourceManager::smallestCycle
virtual int smallestCycle() const =0
TTAMachine
Definition: Assembler.hh:48
ResourceManager::earliestCycle
virtual int earliestCycle(MoveNode &node, const TTAMachine::Bus *bus=nullptr, const TTAMachine::FunctionUnit *srcFU=nullptr, const TTAMachine::FunctionUnit *dstFU=nullptr, int immWriteCycle=-1, const TTAMachine::ImmediateUnit *immu=nullptr, int immRegIndex=-1) const =0
TTAMachine::Machine
Definition: Machine.hh:73
TTAMachine::ImmediateUnit
Definition: ImmediateUnit.hh:50