OpenASIP  2.0
IUBroker.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 IUBroker.hh
26  *
27  * Declaration of IUBroker class.
28  *
29  * @author Ari Mets�halme 2006 (ari.metsahalme-no.spam-tut.fi)
30  * @author Vladimir Guzma 2007 (vladimir.guzma-no.spam-tut.fi)
31  * @note rating: red
32  */
33 
34 #ifndef TTA_IU_BROKER_HH
35 #define TTA_IU_BROKER_HH
36 
37 #include "ResourceBroker.hh"
38 #include "IUResource.hh"
39 
40 namespace TTAMachine {
41  class Machine;
42  class MachinePart;
43 }
44 
45 namespace TTAProgram {
46  class Terminal;
47 }
48 
49 class MoveNode;
50 class ResourceMapper;
51 class SchedulingResource;
53 
54 /**
55  * Immediate unit broker.
56  */
57 class IUBroker : public ResourceBroker {
58 public:
59  IUBroker(std::string);
60  IUBroker(std::string, SimpleResourceManager*, unsigned int initiationInterval = 0);
61  virtual ~IUBroker();
62 
63  bool isAnyResourceAvailable(int useCycle, const MoveNode& node,
64  const TTAMachine::Bus* bus,
65  const TTAMachine::FunctionUnit* srcFU,
66  const TTAMachine::FunctionUnit* dstFU,
67  int immWriteCycle,
68  const TTAMachine::ImmediateUnit* immu,
69  int immRegIndex) const override;
71  int cycle,
72  const MoveNode& node,
73  const TTAMachine::Bus* bus,
74  const TTAMachine::FunctionUnit* srcFU,
75  const TTAMachine::FunctionUnit* dstFU,
76  int immWriteCycle,
77  const TTAMachine::ImmediateUnit* immu,
78  int immRegIndex) const override;
79 
81  int,
82  const MoveNode&,
83  const TTAMachine::Bus* bus,
84  const TTAMachine::FunctionUnit* srcFU,
85  const TTAMachine::FunctionUnit* dstFU,
86  int immWriteCycle,
87  const TTAMachine::ImmediateUnit* immu,
88  int immRegIndex) const override;
89 
90  virtual void assign(int, MoveNode&, SchedulingResource&,
91  int immWriteCycle,
92  int immRegIndex) override;
93 
94  virtual void unassign(MoveNode& node) override;
95 
96  virtual int earliestCycle(int cycle, const MoveNode& node,
97  const TTAMachine::Bus* bus,
98  const TTAMachine::FunctionUnit* srcFU,
99  const TTAMachine::FunctionUnit* dstFU,
100  int immWriteCycle,
101  const TTAMachine::ImmediateUnit* immu,
102  int immRegIndex) const override;
103  virtual int latestCycle(int cycle, const MoveNode& node,
104  const TTAMachine::Bus* bus,
105  const TTAMachine::FunctionUnit* srcFU,
106  const TTAMachine::FunctionUnit* dstFU,
107  int immWriteCycle,
108  const TTAMachine::ImmediateUnit* immu,
109  int immRegIndex) const override;
110  virtual bool isAlreadyAssigned(
111  int cycle, const MoveNode& node,
112  const TTAMachine::Bus* preassignedBus) const override;
113  virtual bool isApplicable(
114  const MoveNode& node, const TTAMachine::Bus* preassignedBus)
115  const override;
116  virtual void buildResources(const TTAMachine::Machine& target) override;
117  virtual void setupResourceLinks(const ResourceMapper& mapper) override;
118 
119  virtual bool isIUBroker() const override;
120  virtual std::shared_ptr<TTAProgram::TerminalImmediate>
121  immediateValue(const MoveNode& node) const;
122  virtual int immediateWriteCycle(const MoveNode& node) const;
123 
124  void clearOldResources();
125 private:
126  /// Target machine.
128  /// Functor for sorting result of allAvailable by register width.
129  struct less_width {
131  return x->width() < y->width();
132  }
133  };
134  // Pointer to resource manager, needed to get information about
135  // immediate from IUBroker
137 };
138 
139 #endif
TTAProgram
Definition: Estimator.hh:65
IUBroker::~IUBroker
virtual ~IUBroker()
Definition: IUBroker.cc:81
IUBroker::clearOldResources
void clearOldResources()
Definition: IUBroker.cc:598
IUBroker::isAlreadyAssigned
virtual bool isAlreadyAssigned(int cycle, const MoveNode &node, const TTAMachine::Bus *preassignedBus) const override
Definition: IUBroker.cc:394
IUBroker::target_
const TTAMachine::Machine * target_
Target machine.
Definition: IUBroker.hh:127
IUBroker::isIUBroker
virtual bool isIUBroker() const override
Definition: IUBroker.cc:543
TTAMachine::Bus
Definition: Bus.hh:53
IUBroker::isApplicable
virtual bool isApplicable(const MoveNode &node, const TTAMachine::Bus *preassignedBus) const override
Definition: IUBroker.cc:422
IUBroker::allAvailableResources
virtual SchedulingResourceSet allAvailableResources(int, const MoveNode &, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcFU, const TTAMachine::FunctionUnit *dstFU, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex) const override
Definition: IUBroker.cc:149
IUBroker::assign
virtual void assign(int, MoveNode &, SchedulingResource &, int immWriteCycle, int immRegIndex) override
Definition: IUBroker.cc:233
ResourceBroker
Definition: ResourceBroker.hh:61
MoveNode
Definition: MoveNode.hh:65
SchedulingResourceSet
Definition: SchedulingResource.hh:161
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
IUResource::width
int width() const
Definition: IUResource.cc:576
IUResource.hh
IUBroker::earliestCycle
virtual int earliestCycle(int cycle, const MoveNode &node, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcFU, const TTAMachine::FunctionUnit *dstFU, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex) const override
Definition: IUBroker.cc:347
SchedulingResource
Definition: SchedulingResource.hh:52
IUBroker::less_width::operator()
bool operator()(IUResource *x, IUResource *y)
Definition: IUBroker.hh:130
IUBroker::isAnyResourceAvailable
bool isAnyResourceAvailable(int useCycle, const MoveNode &node, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcFU, const TTAMachine::FunctionUnit *dstFU, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex) const override
Definition: IUBroker.cc:97
IUBroker::IUBroker
IUBroker(std::string)
Definition: IUBroker.cc:63
IUBroker::rm_
SimpleResourceManager * rm_
Definition: IUBroker.hh:136
IUBroker::latestCycle
virtual int latestCycle(int cycle, const MoveNode &node, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcFU, const TTAMachine::FunctionUnit *dstFU, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex) const override
Definition: IUBroker.cc:370
IUBroker::availableResource
virtual SchedulingResource & availableResource(int cycle, const MoveNode &node, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcFU, const TTAMachine::FunctionUnit *dstFU, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex) const override
Definition: IUBroker.cc:122
IUResource
Definition: IUResource.hh:56
ResourceBroker.hh
IUBroker::unassign
virtual void unassign(MoveNode &node) override
Definition: IUBroker.cc:321
ResourceMapper
Definition: ResourceMapper.hh:51
IUBroker::immediateValue
virtual std::shared_ptr< TTAProgram::TerminalImmediate > immediateValue(const MoveNode &node) const
Definition: IUBroker.cc:555
SimpleResourceManager
Definition: SimpleResourceManager.hh:58
IUBroker::setupResourceLinks
virtual void setupResourceLinks(const ResourceMapper &mapper) override
Definition: IUBroker.cc:484
TTAMachine
Definition: Assembler.hh:48
IUBroker::buildResources
virtual void buildResources(const TTAMachine::Machine &target) override
Definition: IUBroker.cc:453
IUBroker::immediateWriteCycle
virtual int immediateWriteCycle(const MoveNode &node) const
Definition: IUBroker.cc:578
IUBroker::less_width
Functor for sorting result of allAvailable by register width.
Definition: IUBroker.hh:129
IUBroker
Definition: IUBroker.hh:57
TTAMachine::Machine
Definition: Machine.hh:73
TTAMachine::ImmediateUnit
Definition: ImmediateUnit.hh:50