OpenASIP  2.0
ExecutionPipelineBroker.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 ExecutionPipelineBroker.hh
26  *
27  * Declaration of ExecutionPipelineBroker 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_EXECUTION_PIPELINE_BROKER_HH
35 #define TTA_EXECUTION_PIPELINE_BROKER_HH
36 
37 #include "ResourceBroker.hh"
38 
39 namespace TTAMachine {
40  class Machine;
41  class MachinePart;
42  class FunctionUnit;
43 }
44 
45 class MoveNode;
46 class ResourceMapper;
47 class SchedulingResource;
49 
50 /**
51  * Execution pipeline broker.
52  */
54 public:
55  ExecutionPipelineBroker(std::string, unsigned int initiationInterval = 0);
56  virtual ~ExecutionPipelineBroker();
57 
58  virtual void assign(int cycle, MoveNode& node, SchedulingResource& res,
59  int immWriteCycle,
60  int immRegIndex) override;
61 
62  virtual void unassign(MoveNode& node) override;
63 
64  virtual int earliestCycle(int cycle, const MoveNode& node,
65  const TTAMachine::Bus* bus,
66  const TTAMachine::FunctionUnit* srcFU,
67  const TTAMachine::FunctionUnit* dstFU,
68  int immWriteCycle,
69  const TTAMachine::ImmediateUnit* immu,
70  int immRegIndex) const override;
71  virtual int latestCycle(int cycle, const MoveNode& node,
72  const TTAMachine::Bus* bus,
73  const TTAMachine::FunctionUnit* srcFU,
74  const TTAMachine::FunctionUnit* dstFU,
75  int immWriteCycle,
76  const TTAMachine::ImmediateUnit* immu,
77  int immRegIndex) const override;
78  virtual bool isAlreadyAssigned(
79  int cycle, const MoveNode& node,
80  const TTAMachine::Bus* preassignedBus) const override;
81  virtual bool isApplicable(
82  const MoveNode& node, const TTAMachine::Bus*) const override;
83  virtual void buildResources(const TTAMachine::Machine& target) override;
84  virtual void setupResourceLinks(const ResourceMapper& mapper) override;
85  virtual int highestKnownCycle() const;
86  virtual bool isExecutionPipelineBroker() const override;
87  virtual void setInitiationInterval(unsigned int cycles) override;
88  virtual int longestLatency() const { return longestLatency_; }
89  virtual void setMaxCycle(unsigned int maxCycle) override;
90  void setDDG(const DataDependenceGraph* ddg);
91 private:
92  bool isMoveTrigger(const MoveNode& node) const;
93  bool isLoopBypass(const MoveNode& node) const;
94 
95  /// Map to link FU's and pipelines.
96  typedef std::map<SchedulingResource*, const TTAMachine::FunctionUnit*>
98  int latestFromSource(
99  int, const MoveNode&, const TTAMachine::FunctionUnit* srcFU) const;
101  int, const MoveNode&, const TTAMachine::FunctionUnit* dstFU) const;
102  int earliestFromSource(
103  int, const MoveNode&, const TTAMachine::FunctionUnit* srcFU) const;
105  int, const MoveNode&, const TTAMachine::FunctionUnit* dstFU) const;
106 
107  /// FU's and their corresponding pipeline resources.
109  /// Longest latency of all operations of all the FUs
112 };
113 
114 #endif
ExecutionPipelineBroker::isApplicable
virtual bool isApplicable(const MoveNode &node, const TTAMachine::Bus *) const override
Definition: ExecutionPipelineBroker.cc:240
ExecutionPipelineBroker::~ExecutionPipelineBroker
virtual ~ExecutionPipelineBroker()
Definition: ExecutionPipelineBroker.cc:85
ExecutionPipelineBroker::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: ExecutionPipelineBroker.cc:193
ExecutionPipelineBroker::longestLatency_
int longestLatency_
Longest latency of all operations of all the FUs.
Definition: ExecutionPipelineBroker.hh:110
ExecutionPipelineBroker::highestKnownCycle
virtual int highestKnownCycle() const
Definition: ExecutionPipelineBroker.cc:366
ExecutionPipelineBroker::buildResources
virtual void buildResources(const TTAMachine::Machine &target) override
Definition: ExecutionPipelineBroker.cc:255
ExecutionPipelineBroker::latestFromDestination
int latestFromDestination(int, const MoveNode &, const TTAMachine::FunctionUnit *dstFU) const
Definition: ExecutionPipelineBroker.cc:538
TTAMachine::Bus
Definition: Bus.hh:53
ExecutionPipelineBroker::assign
virtual void assign(int cycle, MoveNode &node, SchedulingResource &res, int immWriteCycle, int immRegIndex) override
Definition: ExecutionPipelineBroker.cc:102
ExecutionPipelineBroker::earliestFromSource
int earliestFromSource(int, const MoveNode &, const TTAMachine::FunctionUnit *srcFU) const
Definition: ExecutionPipelineBroker.cc:600
ExecutionPipelineBroker::ExecutionPipelineBroker
ExecutionPipelineBroker(std::string, unsigned int initiationInterval=0)
Definition: ExecutionPipelineBroker.cc:62
ResourceBroker
Definition: ResourceBroker.hh:61
MoveNode
Definition: MoveNode.hh:65
ExecutionPipelineBroker::ddg_
const DataDependenceGraph * ddg_
Definition: ExecutionPipelineBroker.hh:111
ExecutionPipelineBroker::setMaxCycle
virtual void setMaxCycle(unsigned int maxCycle) override
Definition: ExecutionPipelineBroker.cc:74
TTAMachine::FunctionUnit
Definition: FunctionUnit.hh:55
ExecutionPipelineBroker::isAlreadyAssigned
virtual bool isAlreadyAssigned(int cycle, const MoveNode &node, const TTAMachine::Bus *preassignedBus) const override
Definition: ExecutionPipelineBroker.cc:222
ExecutionPipelineBroker::longestLatency
virtual int longestLatency() const
Definition: ExecutionPipelineBroker.hh:88
ExecutionPipelineBroker::isLoopBypass
bool isLoopBypass(const MoveNode &node) const
Definition: ExecutionPipelineBroker.cc:399
SchedulingResource
Definition: SchedulingResource.hh:52
ExecutionPipelineBroker::isMoveTrigger
bool isMoveTrigger(const MoveNode &node) const
Definition: ExecutionPipelineBroker.cc:664
ExecutionPipelineBroker::unassign
virtual void unassign(MoveNode &node) override
Definition: ExecutionPipelineBroker.cc:118
ExecutionPipelineBroker::latestFromSource
int latestFromSource(int, const MoveNode &, const TTAMachine::FunctionUnit *srcFU) const
Definition: ExecutionPipelineBroker.cc:425
ExecutionPipelineBroker::fuPipelineMap_
FUPipelineMap fuPipelineMap_
FU's and their corresponding pipeline resources.
Definition: ExecutionPipelineBroker.hh:108
ExecutionPipelineBroker::isExecutionPipelineBroker
virtual bool isExecutionPipelineBroker() const override
Definition: ExecutionPipelineBroker.cc:378
ResourceBroker.hh
ExecutionPipelineBroker::setInitiationInterval
virtual void setInitiationInterval(unsigned int cycles) override
Definition: ExecutionPipelineBroker.cc:388
ExecutionPipelineBroker::setupResourceLinks
virtual void setupResourceLinks(const ResourceMapper &mapper) override
Definition: ExecutionPipelineBroker.cc:291
DataDependenceGraph
Definition: DataDependenceGraph.hh:67
ResourceMapper
Definition: ResourceMapper.hh:51
ExecutionPipelineBroker::setDDG
void setDDG(const DataDependenceGraph *ddg)
Definition: ExecutionPipelineBroker.cc:806
ExecutionPipelineBroker::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: ExecutionPipelineBroker.cc:137
TTAMachine
Definition: Assembler.hh:48
ExecutionPipelineBroker::earliestFromDestination
int earliestFromDestination(int, const MoveNode &, const TTAMachine::FunctionUnit *dstFU) const
Definition: ExecutionPipelineBroker.cc:719
ExecutionPipelineBroker
Definition: ExecutionPipelineBroker.hh:53
ExecutionPipelineBroker::FUPipelineMap
std::map< SchedulingResource *, const TTAMachine::FunctionUnit * > FUPipelineMap
Map to link FU's and pipelines.
Definition: ExecutionPipelineBroker.hh:97
TTAMachine::Machine
Definition: Machine.hh:73
TTAMachine::ImmediateUnit
Definition: ImmediateUnit.hh:50