OpenASIP  2.0
BusBroker.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 BusBroker.hh
26  *
27  * Declaration of BusBroker class.
28  *
29  * @author Ari Mets�halme 2006 (ari.metsahalme-no.spam-tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_BUS_BROKER_HH
34 #define TTA_BUS_BROKER_HH
35 
36 #include "ResourceBroker.hh"
37 
38 #include <list>
39 
40 namespace TTAMachine {
41  class Machine;
42  class MachinePart;
43 }
44 
45 namespace TTAProgram {
46  class TerminalImmediate;
47 }
48 
49 class MoveNode;
50 class ResourceMapper;
51 class SchedulingResource;
52 class BusResource;
54 class ControlFlowGraph;
55 class BasicBlockNode;
56 
57 /**
58  * Bus broker.
59  */
60 class BusBroker : public ResourceBroker {
61 public:
62  BusBroker(
63  std::string name,
64  ResourceBroker& ipBroker,
65  ResourceBroker& opBroker,
66  const TTAMachine::Machine& mach,
67  unsigned int initiationInterval = 0);
68  virtual ~BusBroker();
69 
70  virtual bool isAnyResourceAvailable(int cycle, const MoveNode& node,
71  const TTAMachine::Bus* bus,
72  const TTAMachine::FunctionUnit* srcFU,
73  const TTAMachine::FunctionUnit* dstFU,
74  int immWriteCycle,
75  const TTAMachine::ImmediateUnit* immu,
76  int immRegIndex)
77  const override;
79  int cycle,
80  const MoveNode& node, const TTAMachine::Bus* bus,
81  const TTAMachine::FunctionUnit* srcFU,
82  const TTAMachine::FunctionUnit* dstFU,
83  int immWriteCycle,
84  const TTAMachine::ImmediateUnit* immu,
85  int immRegIndex) const override;
87  int cycle, const MoveNode& node, const TTAMachine::Bus* bus,
88  const TTAMachine::FunctionUnit* srcFU,
89  const TTAMachine::FunctionUnit* dstFU,
90  int immWriteCycle,
91  const TTAMachine::ImmediateUnit* immu,
92  int immRegIndex) const override;
93  virtual bool isAvailable(
94  SchedulingResource& des, const MoveNode& node, int cycle,
95  const TTAMachine::Bus* bus,
96  const TTAMachine::FunctionUnit* srcFU,
97  const TTAMachine::FunctionUnit* dstFU,
98  int immWriteCycle,
99  const TTAMachine::ImmediateUnit* immu,
100  int immRegIndex) const override;
101  virtual void assign(int cycle, MoveNode& node, SchedulingResource& res,
102  int immWriteCycle,
103  int immRegIndex) override;
104  virtual void unassign(MoveNode& node);
105 
106  virtual int earliestCycle(int cycle, const MoveNode& node,
107  const TTAMachine::Bus* bus,
108  const TTAMachine::FunctionUnit* srcFU,
109  const TTAMachine::FunctionUnit* dstFU,
110  int immWriteCycle,
111  const TTAMachine::ImmediateUnit* immu,
112  int immRegIndex) const override;
113  virtual int latestCycle(int cycle, const MoveNode& node,
114  const TTAMachine::Bus* bus,
115  const TTAMachine::FunctionUnit* srcFU,
116  const TTAMachine::FunctionUnit* dstFU,
117  int immWriteCycle,
118  const TTAMachine::ImmediateUnit* immu,
119  int immRegIndex) const override;
120  virtual bool isAlreadyAssigned(
121  int cycle, const MoveNode& node,
122  const TTAMachine::Bus* preassignedBus) const override;
123  virtual bool isApplicable(
124  const MoveNode& node, const TTAMachine::Bus*) const override;
125  virtual void buildResources(const TTAMachine::Machine& target);
126  virtual void setupResourceLinks(const ResourceMapper& mapper);
127 
128  virtual bool isBusBroker() const;
129 
130  virtual bool canTransportImmediate(
131  const MoveNode& node, const TTAMachine::Bus* preAssigndBus) const;
132  virtual bool isInUse(int cycle, const MoveNode& node) const;
133  virtual bool hasGuard(const MoveNode& node) const;
134  void clear() override;
135  void setCFG(const ControlFlowGraph* cfg) { cfg_ = cfg; }
136  void setBBN(const BasicBlockNode* bbn) { bbn_ = bbn; }
137 private:
138  bool jumpToBBN(const MoveNode& mn, BasicBlockNode& bbn) const;
139  bool canPerformSIMMJump(const MoveNode& mn, ShortImmPSocketResource& immRes) const;
140 
141  virtual bool canTransportImmediate(
142  const MoveNode& node,
143  ShortImmPSocketResource& immRes) const;
145  BusResource& busRes) const;
146  std::list<SchedulingResource*> shortImmPSocketResources_;
147  std::map<const MoveNode*, bool> busPreassigned_;
150  bool hasLimm_;
154 };
155 
156 #endif
TTAProgram
Definition: Estimator.hh:65
BusBroker::setupResourceLinks
virtual void setupResourceLinks(const ResourceMapper &mapper)
Definition: BusBroker.cc:688
BusBroker::isBusBroker
virtual bool isBusBroker() const
Definition: BusBroker.cc:743
BusBroker::BusBroker
BusBroker(std::string name, ResourceBroker &ipBroker, ResourceBroker &opBroker, const TTAMachine::Machine &mach, unsigned int initiationInterval=0)
Definition: BusBroker.cc:73
BusBroker::clear
void clear() override
Definition: BusBroker.cc:889
TTAMachine::Bus
Definition: Bus.hh:53
BusBroker::shortImmPSocketResources_
std::list< SchedulingResource * > shortImmPSocketResources_
Definition: BusBroker.hh:146
BusBroker::hasLimm_
bool hasLimm_
Definition: BusBroker.hh:150
BusBroker::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: BusBroker.cc:550
ResourceBroker
Definition: ResourceBroker.hh:61
BusBroker::findImmResource
virtual ShortImmPSocketResource & findImmResource(BusResource &busRes) const
Definition: BusBroker.cc:846
MoveNode
Definition: MoveNode.hh:65
BusBroker::hasGuard
virtual bool hasGuard(const MoveNode &node) const
Definition: BusBroker.cc:868
BusBroker::busPreassigned_
std::map< const MoveNode *, bool > busPreassigned_
Definition: BusBroker.hh:147
SchedulingResourceSet
Definition: SchedulingResource.hh:161
BusBroker::isAnyResourceAvailable
virtual bool isAnyResourceAvailable(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: BusBroker.cc:106
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
BusBroker
Definition: BusBroker.hh:60
BusBroker::isAvailable
virtual bool isAvailable(SchedulingResource &des, const MoveNode &node, int cycle, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcFU, const TTAMachine::FunctionUnit *dstFU, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex) const override
Definition: BusBroker.cc:332
ShortImmPSocketResource
Definition: ShortImmPSocketResource.hh:43
BusBroker::allAvailableResources
virtual SchedulingResourceSet allAvailableResources(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: BusBroker.cc:178
SchedulingResource
Definition: SchedulingResource.hh:52
BusBroker::bbn_
const BasicBlockNode * bbn_
Definition: BusBroker.hh:153
BusBroker::setBBN
void setBBN(const BasicBlockNode *bbn)
Definition: BusBroker.hh:136
BusBroker::~BusBroker
virtual ~BusBroker()
Definition: BusBroker.cc:86
BasicBlockNode
Definition: BasicBlockNode.hh:64
BusBroker::outputPSocketBroker_
ResourceBroker & outputPSocketBroker_
Definition: BusBroker.hh:149
BusBroker::isApplicable
virtual bool isApplicable(const MoveNode &node, const TTAMachine::Bus *) const override
Definition: BusBroker.cc:632
BusBroker::mach_
const TTAMachine::Machine * mach_
Definition: BusBroker.hh:151
BusResource
Definition: BusResource.hh:46
BusBroker::unassign
virtual void unassign(MoveNode &node)
Definition: BusBroker.cc:522
ResourceBroker.hh
BusBroker::jumpToBBN
bool jumpToBBN(const MoveNode &mn, BasicBlockNode &bbn) const
BusBroker::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: BusBroker.cc:141
BusBroker::canTransportImmediate
virtual bool canTransportImmediate(const MoveNode &node, const TTAMachine::Bus *preAssigndBus) const
Definition: BusBroker.cc:756
ResourceMapper
Definition: ResourceMapper.hh:51
BusBroker::canPerformSIMMJump
bool canPerformSIMMJump(const MoveNode &mn, ShortImmPSocketResource &immRes) const
Definition: BusBroker.cc:801
BusBroker::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: BusBroker.cc:571
BusBroker::setCFG
void setCFG(const ControlFlowGraph *cfg)
Definition: BusBroker.hh:135
BusBroker::assign
virtual void assign(int cycle, MoveNode &node, SchedulingResource &res, int immWriteCycle, int immRegIndex) override
Definition: BusBroker.cc:474
BusBroker::cfg_
const ControlFlowGraph * cfg_
Definition: BusBroker.hh:152
TTAMachine
Definition: Assembler.hh:48
BusBroker::isInUse
virtual bool isInUse(int cycle, const MoveNode &node) const
Definition: BusBroker.cc:612
BusBroker::isAlreadyAssigned
virtual bool isAlreadyAssigned(int cycle, const MoveNode &node, const TTAMachine::Bus *preassignedBus) const override
Definition: BusBroker.cc:594
ControlFlowGraph
Definition: ControlFlowGraph.hh:100
TTAMachine::Machine
Definition: Machine.hh:73
BusBroker::buildResources
virtual void buildResources(const TTAMachine::Machine &target)
Definition: BusBroker.cc:646
TTAMachine::ImmediateUnit
Definition: ImmediateUnit.hh:50
BusBroker::inputPSocketBroker_
ResourceBroker & inputPSocketBroker_
Definition: BusBroker.hh:148