OpenASIP 2.2
Loading...
Searching...
No Matches
AssignmentPlan.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 AssignmentPlan.hh
26 *
27 * Declaration of AssignmentPlan class.
28 *
29 * @author Ari Metsähalme 2006 (ari.metsahalme-no.spam-tut.fi)
30 * @note rating: red
31 */
32
33#ifndef TTA_ASSIGNMENT_PLAN_HH
34#define TTA_ASSIGNMENT_PLAN_HH
35
36#include <vector>
37#include "Exception.hh"
38
39class ResourceBroker;
41class MoveNode;
43
44namespace TTAMachine {
45 class Bus;
46 class FunctionUnit;
47 class ImmediateUnit;
48}
49
50/**
51 * Keeps the order in which single resource-specific brokers are
52 * invoked to perform their bit of the allocation or assignment. Also
53 * records the current state of tentative and potential assignments
54 * for each type of resource.
55 */
57public:
59 virtual ~AssignmentPlan();
60
62 void setRequest(
63 int cycle, MoveNode& node, const TTAMachine::Bus* bus,
64 const TTAMachine::FunctionUnit* srcFU,
65 const TTAMachine::FunctionUnit* dstFU,
66 int immWriteCycle,
67 const TTAMachine::ImmediateUnit* immu,
68 int immRegIndex);
73 void advance();
74 void backtrack();
75 void tryNextAssignment();
77 void resetAssignments();
78 void resetAssignments(MoveNode& node);
79
80 int brokerCount() const;
81 ResourceBroker& broker(int index) const;
82 void clear();
83
84 bool tryCachedAssignment(MoveNode& node, int cycle,
85 const TTAMachine::Bus* bus,
86 const TTAMachine::FunctionUnit* srcFU,
87 const TTAMachine::FunctionUnit* dstFU,
88 int immWriteCycle,
89 const TTAMachine::ImmediateUnit* immu,
90 int immRegIndex);
91 void clearCache();
92private:
93
100
101 /// Sequence of pending assignments.
102 std::vector<PendingAssignment*> assignments_;
103 /// Sequence of applicable pending assignments.
104 std::vector<PendingAssignment*> applicableAssignments_;
105 /// Sequence of resource brokers.
106 std::vector<ResourceBroker*> brokers_;
107 /// Move of current resource assignment request.
109 /// Cycle in which current node should be placed.
111 /// Current broker.
113 /// True if a valid resource of current broker has been assigned.
115
116 /// cache.
117 std::vector<std::pair<ResourceBroker*, SchedulingResource*> >
121};
122
123#endif
void setRequest(int cycle, MoveNode &node, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcFU, const TTAMachine::FunctionUnit *dstFU, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex)
const TTAMachine::Bus * bus_
MoveNode * node_
Move of current resource assignment request.
MoveNode * lastTriedNode_
bool isTestedAssignmentPossible()
std::vector< ResourceBroker * > brokers_
Sequence of resource brokers.
std::vector< PendingAssignment * > applicableAssignments_
Sequence of applicable pending assignments.
ResourceBroker & lastBroker()
std::vector< std::pair< ResourceBroker *, SchedulingResource * > > lastTestedWorkingAssignment_
cache.
ResourceBroker & nextBroker(ResourceBroker &pos)
bool tryCachedAssignment(MoveNode &node, int cycle, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcFU, const TTAMachine::FunctionUnit *dstFU, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex)
void insertBroker(ResourceBroker &broker)
ResourceBroker & firstBroker()
ResourceBroker & currentBroker()
const TTAMachine::ImmediateUnit * immu_
int brokerCount() const
virtual ~AssignmentPlan()
const TTAMachine::FunctionUnit * srcFU_
int cycle_
Cycle in which current node should be placed.
std::vector< PendingAssignment * > assignments_
Sequence of pending assignments.
const TTAMachine::FunctionUnit * dstFU_
bool resourceFound_
True if a valid resource of current broker has been assigned.
int currentBroker_
Current broker.
ResourceBroker & broker(int index) const