OpenASIP  2.0
Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
InputPSocketResource Class Reference

#include <InputPSocketResource.hh>

Inheritance diagram for InputPSocketResource:
Inheritance graph
Collaboration diagram for InputPSocketResource:
Collaboration graph

Public Member Functions

virtual ~InputPSocketResource ()
 
 InputPSocketResource (const std::string &name, unsigned int initiationInterval=0)
 
virtual bool isInputPSocketResource () const override
 
virtual bool canAssign (const int cycle, const MoveNode &node) const override
 
virtual bool operator< (const SchedulingResource &other) const override
 
- Public Member Functions inherited from PSocketResource
virtual ~PSocketResource ()
 
 PSocketResource (const std::string &name, unsigned int initiationInterval=0)
 
virtual bool isInUse (const int cycle) const override
 
virtual bool isAvailable (const int cycle) const override
 
virtual void assign (const int cycle, MoveNode &node) override
 
virtual void unassign (const int cycle, MoveNode &node) override
 
void clear () override
 
- Public Member Functions inherited from SchedulingResource
virtual ~SchedulingResource ()
 
 SchedulingResource (const std::string &name, const unsigned int ii=0)
 
virtual int relatedResourceGroupCount () const
 
virtual int dependentResourceGroupCount () const
 
int relatedResourceCount (const int group) const
 
int dependentResourceCount (const int group) const
 
virtual void addToRelatedGroup (const int group, SchedulingResource &resource)
 
virtual void addToDependentGroup (const int group, SchedulingResource &resource)
 
virtual SchedulingResourcerelatedResource (const int group, const int index) const
 
virtual SchedulingResourcedependentResource (const int group, const int index) const
 
virtual bool hasRelatedResource (const SchedulingResource &sResource) const
 
virtual bool hasDependentResource (const SchedulingResource &sResource) const
 
virtual const std::string & name () const
 
virtual int useCount () const
 
virtual void increaseUseCount ()
 
virtual void decreaseUseCount ()
 
virtual bool isOutputPSocketResource () const
 
virtual bool isShortImmPSocketResource () const
 
virtual bool isInputFUResource () const
 
virtual bool isOutputFUResource () const
 
virtual bool isExecutionPipelineResource () const
 
virtual bool isBusResource () const
 
virtual bool isSegmentResource () const
 
virtual bool isIUResource () const
 
virtual bool isITemplateResource () const
 
int instructionIndex (int cycle) const
 
void setInitiationInterval (unsigned int ii)
 
int initiationInterval () const
 
virtual void setMaxCycle (unsigned int)
 

Protected Member Functions

virtual bool validateDependentGroups () override
 
virtual bool validateRelatedGroups () override
 

Private Member Functions

 InputPSocketResource (const InputPSocketResource &)
 
InputPSocketResourceoperator= (const InputPSocketResource &)
 

Additional Inherited Members

- Protected Types inherited from PSocketResource
typedef std::map< int, std::set< MoveNode * > > ResourceRecordType
 
- Protected Attributes inherited from PSocketResource
ResourceRecordType resourceRecord_
 
- Protected Attributes inherited from SchedulingResource
int initiationInterval_
 

Detailed Description

An interface for scheduling resources of Resource Model The derived class InputPSocketResource

Definition at line 47 of file InputPSocketResource.hh.

Constructor & Destructor Documentation

◆ ~InputPSocketResource()

InputPSocketResource::~InputPSocketResource ( )
virtual

Empty destructor

Definition at line 50 of file InputPSocketResource.cc.

50 {}

◆ InputPSocketResource() [1/2]

InputPSocketResource::InputPSocketResource ( const std::string &  name,
unsigned int  initiationInterval = 0 
)

Constructor defining resource name

Parameters
nameName of resource

Definition at line 44 of file InputPSocketResource.cc.

◆ InputPSocketResource() [2/2]

InputPSocketResource::InputPSocketResource ( const InputPSocketResource )
private

Member Function Documentation

◆ canAssign()

bool InputPSocketResource::canAssign ( const int  cycle,
const MoveNode node 
) const
overridevirtual

Return true if resource can be assigned for given resource in given cycle.

Parameters
cycleCycle to test
nodeMoveNode to test
Returns
true if node can be assigned to cycle

Reimplemented from PSocketResource.

Definition at line 102 of file InputPSocketResource.cc.

103  {
104 
105  ResourceRecordType::const_iterator iter = resourceRecord_.find(cycle);
106  if (iter != resourceRecord_.end()) {
107  std::set<MoveNode*> movesInCycle = iter->second;
108  for (std::set<MoveNode*>::iterator it = movesInCycle.begin();
109  it != movesInCycle.end(); it++) {
110 #ifdef NO_OVERCOMMIT
111  return false;
112 #else
113  MoveNode* mn = *it;
114  if (node.move().isUnconditional() ||
115  mn->move().isUnconditional()) {
116  return false;
117  }
118  if (!node.move().guard().guard().isOpposite(
119  mn->move().guard().guard())) {
120  return false;
121  }
122 #endif
123  }
124  }
125  return true;
126 }

References TTAProgram::MoveGuard::guard(), TTAProgram::Move::guard(), TTAMachine::Guard::isOpposite(), TTAProgram::Move::isUnconditional(), MoveNode::move(), and PSocketResource::resourceRecord_.

Referenced by InputFUResource::canAssign().

Here is the call graph for this function:

◆ isInputPSocketResource()

bool InputPSocketResource::isInputPSocketResource ( ) const
overridevirtual

Allways return true

Returns
true

Reimplemented from SchedulingResource.

Definition at line 57 of file InputPSocketResource.cc.

57  {
58  return true;
59 }

◆ operator<()

bool InputPSocketResource::operator< ( const SchedulingResource other) const
overridevirtual

Comparison operator.

Favours sockets which have less connections.

Reimplemented from SchedulingResource.

Definition at line 134 of file InputPSocketResource.cc.

134  {
135  const InputPSocketResource *ipsr =
136  dynamic_cast<const InputPSocketResource*>(&other);
137  if (ipsr == NULL) {
138  return false;
139  }
140 
141  // favour sockets which have connections to busses with fewest connections
142  // calculate the connections..
143  int connCount = 0;
144  int connCount2 = 0;
145 
146  for (int i = 0; i < relatedResourceCount(1); i++) {
148  connCount += r.relatedResourceCount(0);
149  }
150 
151  for (int i = 0; i < other.relatedResourceCount(1); i++) {
152  SchedulingResource& r = other.relatedResource(1,i);
153  connCount2 += r.relatedResourceCount(0);
154  }
155 
156  // then the comparison.
157  if (connCount < connCount2) {
158  return true;
159  }
160 
161  if (connCount > connCount2) {
162  return false;
163  }
164 
165 
166  // favour sockets with less buses.
167  if (relatedResourceCount(1) < ipsr->relatedResourceCount(1)) {
168  return true;
169  }
170  if (relatedResourceCount(1) > ipsr->relatedResourceCount(1)) {
171  return false;
172  }
173 
174  // then use the default use count, name comparison,
175  // but in opposite direction, facouring already used
176  return other.SchedulingResource::operator<(*this);
177 }

References SchedulingResource::relatedResource(), and SchedulingResource::relatedResourceCount().

Here is the call graph for this function:

◆ operator=()

InputPSocketResource& InputPSocketResource::operator= ( const InputPSocketResource )
private

◆ validateDependentGroups()

bool InputPSocketResource::validateDependentGroups ( )
overrideprotectedvirtual

Tests if all referred resources in dependent groups are of proper types

Returns
true Allways true, dep. groups are empty

Reimplemented from SchedulingResource.

Definition at line 67 of file InputPSocketResource.cc.

67  {
68  for (int i = 0; i < dependentResourceGroupCount(); i++) {
69  if (dependentResourceCount(i) > 0) {
70  return false;
71  }
72  }
73  return true;
74 }

References SchedulingResource::dependentResourceCount(), and SchedulingResource::dependentResourceGroupCount().

Here is the call graph for this function:

◆ validateRelatedGroups()

bool InputPSocketResource::validateRelatedGroups ( )
overrideprotectedvirtual

Tests if all referred resources in related groups are of proper types

Returns
true If all resources in related groups are Segment or InputFU resources

Reimplemented from SchedulingResource.

Definition at line 83 of file InputPSocketResource.cc.

83  {
84  for (int i = 0; i < relatedResourceGroupCount(); i++) {
85  for (int j = 0, count = relatedResourceCount(i); j < count; j++) {
86  if (!(relatedResource(i, j).isInputFUResource() ||
88  return false;
89  }
90  }
91  return true;
92 }

References SchedulingResource::isBusResource(), SchedulingResource::isInputFUResource(), SchedulingResource::relatedResource(), SchedulingResource::relatedResourceCount(), and SchedulingResource::relatedResourceGroupCount().

Here is the call graph for this function:

The documentation for this class was generated from the following files:
SchedulingResource::dependentResourceGroupCount
virtual int dependentResourceGroupCount() const
Definition: SchedulingResource.cc:71
TTAProgram::Move::isUnconditional
bool isUnconditional() const
Definition: Move.cc:154
MoveNode
Definition: MoveNode.hh:65
SchedulingResource::dependentResourceCount
int dependentResourceCount(const int group) const
InputPSocketResource
Definition: InputPSocketResource.hh:47
SchedulingResource::relatedResource
virtual SchedulingResource & relatedResource(const int group, const int index) const
Definition: SchedulingResource.cc:120
SchedulingResource::isBusResource
virtual bool isBusResource() const
SchedulingResource
Definition: SchedulingResource.hh:52
TTAProgram::Move::guard
MoveGuard & guard() const
Definition: Move.cc:345
PSocketResource::PSocketResource
PSocketResource(const std::string &name, unsigned int initiationInterval=0)
Definition: PSocketResource.cc:46
SchedulingResource::isInputFUResource
virtual bool isInputFUResource() const
SchedulingResource::initiationInterval
int initiationInterval() const
Definition: SchedulingResource.cc:385
SchedulingResource::relatedResourceCount
int relatedResourceCount(const int group) const
TTAMachine::Guard::isOpposite
virtual bool isOpposite(const Guard &guard) const =0
MoveNode::move
TTAProgram::Move & move()
SchedulingResource::name
virtual const std::string & name() const
TTAProgram::MoveGuard::guard
const TTAMachine::Guard & guard() const
Definition: MoveGuard.cc:86
SchedulingResource::relatedResourceGroupCount
virtual int relatedResourceGroupCount() const
Definition: SchedulingResource.cc:61
PSocketResource::resourceRecord_
ResourceRecordType resourceRecord_
Definition: PSocketResource.hh:63