OpenASIP  2.0
Public Member Functions | Private Attributes | List of all members
PendingAssignment Class Reference

#include <PendingAssignment.hh>

Collaboration diagram for PendingAssignment:
Collaboration graph

Public Member Functions

 PendingAssignment (ResourceBroker &broker)
 
virtual ~PendingAssignment ()
 
ResourceBrokerbroker ()
 
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)
 
bool isAssignmentPossible ()
 
void tryNext ()
 
void undoAssignment ()
 
void forget ()
 
void clear ()
 
SchedulingResourceresource (int index)
 
int lastTriedAssignment () const
 

Private Attributes

ResourceBrokerbroker_
 Corresponding resource broker. More...
 
int cycle_
 
MoveNodenode_
 
const TTAMachine::Busbus_
 
const TTAMachine::FunctionUnitsrcFU_
 
const TTAMachine::FunctionUnitdstFU_
 
int immWriteCycle_
 
bool assignmentTried_
 
SchedulingResourceSet availableResources_
 
int lastTriedAssignment_
 
const TTAMachine::ImmediateUnitimmu_
 
int immRegIndex_
 

Detailed Description

Definition at line 48 of file PendingAssignment.hh.

Constructor & Destructor Documentation

◆ PendingAssignment()

PendingAssignment::PendingAssignment ( ResourceBroker broker)

Constructor.

Definition at line 44 of file PendingAssignment.cc.

44  :
45  broker_(broker), cycle_(-1), node_(NULL), assignmentTried_(false),
47 }

◆ ~PendingAssignment()

PendingAssignment::~PendingAssignment ( )
virtual

Destructor.

Definition at line 52 of file PendingAssignment.cc.

52  {
53 }

Member Function Documentation

◆ broker()

ResourceBroker & PendingAssignment::broker ( )

Return the broker of this pending assignment.

Returns
The broker of this pending assignment.

Definition at line 61 of file PendingAssignment.cc.

61  {
62  return broker_;
63 }

References broker_.

Referenced by AssignmentPlan::backtrack(), AssignmentPlan::isTestedAssignmentPossible(), and AssignmentPlan::tryNextAssignment().

◆ clear()

void PendingAssignment::clear ( )

Clears the pending assignment.

Does not unassign anything.

Definition at line 177 of file PendingAssignment.cc.

177  {
178  cycle_ = -1;
179  node_ = NULL;
180  immu_ = NULL;
181  immWriteCycle_ = -1;
182  immRegIndex_ = -1;
183 
184  assignmentTried_ = false;
187  bus_ = NULL;
188 }

References assignmentTried_, availableResources_, bus_, SchedulingResourceSet::clear(), cycle_, immRegIndex_, immu_, immWriteCycle_, lastTriedAssignment_, and node_.

Here is the call graph for this function:

◆ forget()

void PendingAssignment::forget ( )

Clear out the record of the possible resource assignments of the current broker that have been already tried.

If one of the possible resources is still assigned to the node, unassign it.

Definition at line 164 of file PendingAssignment.cc.

164  {
167  }
169 }

References broker_, bus_, cycle_, ResourceBroker::isAlreadyAssigned(), lastTriedAssignment_, node_, and ResourceBroker::unassign().

Referenced by AssignmentPlan::backtrack().

Here is the call graph for this function:

◆ isAssignmentPossible()

bool PendingAssignment::isAssignmentPossible ( )

Return true if, for the currently applied assignments, there exists at least one tentative assignment which has not been tried yet.

Returns
True if, for the currently applied assignments, there exists at least one tentative assignment which has not been tried yet.

Definition at line 99 of file PendingAssignment.cc.

99  {
100  if (lastTriedAssignment_ == -1) {
103  immRegIndex_);
104  // Sorts candidate set of resources by their use count or name if
105  // the use counts are identical
107  }
109 }

References ResourceBroker::allAvailableResources(), availableResources_, broker_, bus_, SchedulingResourceSet::count(), cycle_, dstFU_, immRegIndex_, immu_, immWriteCycle_, lastTriedAssignment_, node_, SchedulingResourceSet::sort(), and srcFU_.

Here is the call graph for this function:

◆ lastTriedAssignment()

int PendingAssignment::lastTriedAssignment ( ) const
inline

Definition at line 68 of file PendingAssignment.hh.

68 { return lastTriedAssignment_; }

References lastTriedAssignment_.

Referenced by AssignmentPlan::isTestedAssignmentPossible().

◆ resource()

SchedulingResource& PendingAssignment::resource ( int  index)
inline

Definition at line 66 of file PendingAssignment.hh.

66  {
67  return availableResources_.resource(index); }

References availableResources_, and SchedulingResourceSet::resource().

Referenced by AssignmentPlan::isTestedAssignmentPossible().

Here is the call graph for this function:

◆ setRequest()

void PendingAssignment::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 
)

Record the input node to which resources have to be assigned or allocated, and the cycle in which the node should be placed.

Parameters
cycleCycle.
nodeNode.

Definition at line 73 of file PendingAssignment.cc.

79  {
80  cycle_ = cycle;
81  node_ = &node;
82  bus_ = bus;
83  srcFU_ = srcFU;
84  dstFU_ = dstFU;
85  immWriteCycle_ = immWriteCycle;
86  immu_ = immu;
87  immRegIndex_ = immRegIndex;
89 }

References bus_, cycle_, dstFU_, immRegIndex_, immu_, immWriteCycle_, lastTriedAssignment_, node_, and srcFU_.

◆ tryNext()

void PendingAssignment::tryNext ( )

Try to assign the next possible assignment found by current broker.

Exceptions
ModuleRunTimeErrorIf this PendingAssignment has run out of possible assignments.

Definition at line 119 of file PendingAssignment.cc.

119  {
120 
122 
123  if (availableResources_.count() == 0 ||
125  string msg = "Ran out of possible assignments!";
126  throw ModuleRunTimeError(__FILE__, __LINE__, __func__, msg);
127  }
128 
129  broker_.assign(
132  assignmentTried_ = true;
133 }

References __func__, ResourceBroker::assign(), assignmentTried_, availableResources_, broker_, SchedulingResourceSet::count(), cycle_, immRegIndex_, immWriteCycle_, lastTriedAssignment_, node_, and SchedulingResourceSet::resource().

Referenced by AssignmentPlan::tryNextAssignment().

Here is the call graph for this function:

◆ undoAssignment()

void PendingAssignment::undoAssignment ( )

Unassign the resource of this pending assignment currently assigned to the node.

Last tried assignment is remembered.

Exceptions
ModuleRunTimeErrorIf no resource in the set of resources of this pending assignment is currently assigned to the node.

Definition at line 146 of file PendingAssignment.cc.

146  {
149  } else {
150  string msg = "No resource in the set of resources of this pending"
151  "assignment was assigned to the given node!";
152  throw ModuleRunTimeError(__FILE__, __LINE__, __func__, msg);
153  }
154 }

References __func__, broker_, bus_, cycle_, ResourceBroker::isAlreadyAssigned(), node_, and ResourceBroker::unassign().

Referenced by AssignmentPlan::backtrack(), and AssignmentPlan::tryNextAssignment().

Here is the call graph for this function:

Member Data Documentation

◆ assignmentTried_

bool PendingAssignment::assignmentTried_
private

Definition at line 78 of file PendingAssignment.hh.

Referenced by clear(), and tryNext().

◆ availableResources_

SchedulingResourceSet PendingAssignment::availableResources_
private

Definition at line 79 of file PendingAssignment.hh.

Referenced by clear(), isAssignmentPossible(), resource(), and tryNext().

◆ broker_

ResourceBroker& PendingAssignment::broker_
private

Corresponding resource broker.

Definition at line 71 of file PendingAssignment.hh.

Referenced by broker(), forget(), isAssignmentPossible(), tryNext(), and undoAssignment().

◆ bus_

const TTAMachine::Bus* PendingAssignment::bus_
private

Definition at line 74 of file PendingAssignment.hh.

Referenced by clear(), forget(), isAssignmentPossible(), setRequest(), and undoAssignment().

◆ cycle_

int PendingAssignment::cycle_
private

◆ dstFU_

const TTAMachine::FunctionUnit* PendingAssignment::dstFU_
private

Definition at line 76 of file PendingAssignment.hh.

Referenced by isAssignmentPossible(), and setRequest().

◆ immRegIndex_

int PendingAssignment::immRegIndex_
private

Definition at line 82 of file PendingAssignment.hh.

Referenced by clear(), isAssignmentPossible(), setRequest(), and tryNext().

◆ immu_

const TTAMachine::ImmediateUnit* PendingAssignment::immu_
private

Definition at line 81 of file PendingAssignment.hh.

Referenced by clear(), isAssignmentPossible(), and setRequest().

◆ immWriteCycle_

int PendingAssignment::immWriteCycle_
private

Definition at line 77 of file PendingAssignment.hh.

Referenced by clear(), isAssignmentPossible(), setRequest(), and tryNext().

◆ lastTriedAssignment_

int PendingAssignment::lastTriedAssignment_
private

◆ node_

MoveNode* PendingAssignment::node_
private

◆ srcFU_

const TTAMachine::FunctionUnit* PendingAssignment::srcFU_
private

Definition at line 75 of file PendingAssignment.hh.

Referenced by isAssignmentPossible(), and setRequest().


The documentation for this class was generated from the following files:
ResourceBroker::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
Definition: ResourceBroker.cc:143
ResourceBroker::isAlreadyAssigned
virtual bool isAlreadyAssigned(int cycle, const MoveNode &node, const TTAMachine::Bus *preassignedBus) const =0
PendingAssignment::assignmentTried_
bool assignmentTried_
Definition: PendingAssignment.hh:78
ResourceBroker::assign
virtual void assign(int cycle, MoveNode &node, SchedulingResource &res, int immWriteCycle, int immRegIndex)=0
PendingAssignment::node_
MoveNode * node_
Definition: PendingAssignment.hh:73
PendingAssignment::availableResources_
SchedulingResourceSet availableResources_
Definition: PendingAssignment.hh:79
PendingAssignment::broker
ResourceBroker & broker()
Definition: PendingAssignment.cc:61
SchedulingResourceSet::clear
void clear()
Definition: SchedulingResource.cc:336
PendingAssignment::lastTriedAssignment_
int lastTriedAssignment_
Definition: PendingAssignment.hh:80
__func__
#define __func__
Definition: Application.hh:67
ModuleRunTimeError
Definition: Exception.hh:1043
PendingAssignment::srcFU_
const TTAMachine::FunctionUnit * srcFU_
Definition: PendingAssignment.hh:75
PendingAssignment::immu_
const TTAMachine::ImmediateUnit * immu_
Definition: PendingAssignment.hh:81
PendingAssignment::immRegIndex_
int immRegIndex_
Definition: PendingAssignment.hh:82
SchedulingResourceSet::count
int count() const
Definition: SchedulingResource.cc:251
ResourceBroker::unassign
virtual void unassign(MoveNode &node)=0
PendingAssignment::bus_
const TTAMachine::Bus * bus_
Definition: PendingAssignment.hh:74
PendingAssignment::cycle_
int cycle_
Definition: PendingAssignment.hh:72
SchedulingResourceSet::resource
SchedulingResource & resource(int index) const
Definition: SchedulingResource.cc:263
PendingAssignment::dstFU_
const TTAMachine::FunctionUnit * dstFU_
Definition: PendingAssignment.hh:76
PendingAssignment::broker_
ResourceBroker & broker_
Corresponding resource broker.
Definition: PendingAssignment.hh:71
PendingAssignment::immWriteCycle_
int immWriteCycle_
Definition: PendingAssignment.hh:77
SchedulingResourceSet::sort
void sort()
Definition: SchedulingResource.cc:328