OpenASIP 2.2
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
InputFUResource Class Reference

#include <InputFUResource.hh>

Inheritance diagram for InputFUResource:
Inheritance graph
Collaboration diagram for InputFUResource:
Collaboration graph

Public Member Functions

virtual ~InputFUResource ()
 
 InputFUResource (const std::string &name, int opCount, int nopSlotWeight, unsigned int initiationInterval=0)
 
virtual bool canAssign (const int cycle, const MoveNode &node) const override
 
virtual void assign (const int cycle, MoveNode &node) override
 
virtual bool isAvailable (const int cycle) const override
 
virtual bool isInUse (const int cycle) const override
 
virtual void unassign (const int cycle, MoveNode &node) override
 
virtual bool canAssign (const int cycle, const MoveNode &node, const InputPSocketResource &pSocket, const bool triggers=false) const
 
virtual bool isInputFUResource () const override
 
- Public Member Functions inherited from FUResource
 FUResource (const std::string &name, int operationCount, int nopSlotWeight, unsigned int initiationInterval=0)
 
virtual ~FUResource ()
 
virtual bool operator< (const SchedulingResource &other) const 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 isInputPSocketResource () const
 
virtual bool isOutputPSocketResource () const
 
virtual bool isShortImmPSocketResource () 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 clear ()
 
virtual void setMaxCycle (unsigned int)
 

Protected Member Functions

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

Private Member Functions

 InputFUResource (const InputFUResource &)
 
InputFUResourceoperator= (const InputFUResource &)
 

Additional Inherited Members

- Protected Attributes inherited from SchedulingResource
int initiationInterval_
 

Detailed Description

An interface for scheduling resources of Resource Model. The derived class InputFUResource.

Definition at line 49 of file InputFUResource.hh.

Constructor & Destructor Documentation

◆ ~InputFUResource()

InputFUResource::~InputFUResource ( )
virtual

Empty destructor

Definition at line 61 of file InputFUResource.cc.

61 {
62}

◆ InputFUResource() [1/2]

InputFUResource::InputFUResource ( const std::string &  name,
int  opCount,
int  nopSlotWeight,
unsigned int  initiationInterval = 0 
)

Constructor defining name of resource.

Parameters
nameName of resource

Definition at line 52 of file InputFUResource.cc.

54 :
55 FUResource(name, opCount, nopSlotWeight, initiationInterval) {
56}
virtual const std::string & name() const

◆ InputFUResource() [2/2]

InputFUResource::InputFUResource ( const InputFUResource )
private

Member Function Documentation

◆ assign()

void InputFUResource::assign ( const int  cycle,
MoveNode node 
)
overridevirtual

Assign resource to given node for given cycle as a side effect, assign also execution pipeline for triggering moves.

Parameters
cycleCycle to assign
nodeMoveNode assigned
pSocketInputPSocket used for writting operand
Exceptions
Incase the assignment is impossible, should have been tested with canAssing first.

Reimplemented from FUResource.

Definition at line 86 of file InputFUResource.cc.

88 {
89
90 for (int i = 0; i < dependentResourceGroupCount(); i++) {
91 for (int j = 0, count = dependentResourceCount(i); j < count; j++) {
95 dynamic_cast<ExecutionPipelineResource*>(res);
96 epRes->assignDestination(cycle, node);
98 return;
99 }
100 }
101 }
102 abortWithError("InputFUResource has no execution pipeline registered!");
103}
#define abortWithError(message)
virtual void assignDestination(const int cycle, MoveNode &node)
virtual void increaseUseCount()
virtual SchedulingResource & dependentResource(const int group, const int index) const
int dependentResourceCount(const int group) const
virtual bool isExecutionPipelineResource() const
virtual int dependentResourceGroupCount() const

References abortWithError, ExecutionPipelineResource::assignDestination(), SchedulingResource::dependentResource(), SchedulingResource::dependentResourceCount(), SchedulingResource::dependentResourceGroupCount(), SchedulingResource::increaseUseCount(), and SchedulingResource::isExecutionPipelineResource().

Referenced by InputFUBroker::assign().

Here is the call graph for this function:

◆ canAssign() [1/2]

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

Not to be used, aborts!

Use version with third InputPSocket operand!

Reimplemented from FUResource.

Definition at line 70 of file InputFUResource.cc.

70 {
71 abortWithError("Wrong method. Use canAssign with PSocket!");
72 return false;
73}

References abortWithError.

Referenced by InputFUBroker::allAvailableResources().

◆ canAssign() [2/2]

bool InputFUResource::canAssign ( const int  cycle,
const MoveNode node,
const InputPSocketResource pSocket,
const bool  triggers = false 
) const
virtual

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

Parameters
cycleCycle to test
nodeMoveNode to test
pSocketInputPSocket used for writting operand
Returns
true if node can be assigned to cycle
Exceptions
Internalerror, PSocket is not conencted to FU or ExecutionPipeline

Definition at line 144 of file InputFUResource.cc.

148 {
149
150 if (!hasDependentResource(pSocket)) {
151 std::string msg = "InputPSocket ";
152 msg += pSocket.name();
153 msg += " is not connected to ";
154 msg += name();
155 msg += "!";
156 throw ModuleRunTimeError(__FILE__, __LINE__, __func__, msg);
157 return false;
158 }
159
160 if (!pSocket.canAssign(cycle, node)) {
161 debugLogRM("cannot assign pSocket");
162 return false;
163 }
164
165 for (int i = 0; i < dependentResourceGroupCount(); i++) {
166 for (int j = 0, count = dependentResourceCount(i); j < count; j++) {
168 if (depRes.isExecutionPipelineResource()) {
170 static_cast<ExecutionPipelineResource*>(&depRes);
171 if (!(epRes->canAssignDestination(cycle, node, triggers))) {
172 debugLogRM("cannot assign execution pipeline resource");
173 return false;
174 } else {
175 return true;
176 }
177 }
178 }
179 }
180 debugLogRM("could not find a depedent resource I could assign");
181 return false;
182}
#define __func__
#define debugLogRM(__X)
virtual bool canAssignDestination(const int cycle, const MoveNode &node, const bool triggering=false) const
virtual bool canAssign(const int cycle, const MoveNode &node) const override
virtual bool hasDependentResource(const SchedulingResource &sResource) const

References __func__, InputPSocketResource::canAssign(), ExecutionPipelineResource::canAssignDestination(), debugLogRM, SchedulingResource::dependentResource(), SchedulingResource::dependentResourceCount(), SchedulingResource::dependentResourceGroupCount(), SchedulingResource::hasDependentResource(), SchedulingResource::isExecutionPipelineResource(), and SchedulingResource::name().

Here is the call graph for this function:

◆ isAvailable()

bool InputFUResource::isAvailable ( const int  cycle) const
overridevirtual

Test if resource InputFUResource is available.

Not all the PSocket are inUse and there is some operation possible for triggering moves.

Parameters
cycleCycle which to test
Returns
True if FUResource is available in cycle

Reimplemented from FUResource.

Definition at line 194 of file InputFUResource.cc.

194 {
195 // Test availability of PSockets using parent class
196 if (!FUResource::isAvailable(cycle)) {
197 return false;
198 }
199 for (int i = 0; i < dependentResourceGroupCount(); i++) {
200 for (int j = 0, count = dependentResourceCount(i); j < count; j++) {
202 dependentResource(i, j).isAvailable(cycle)) {
203 return true;
204 }
205 }
206 }
207 return false;
208}
virtual bool isAvailable(const int cycle) const override
Definition FUResource.cc:80
virtual bool isAvailable(const int cycle) const =0

References SchedulingResource::dependentResource(), SchedulingResource::dependentResourceCount(), SchedulingResource::dependentResourceGroupCount(), SchedulingResource::isAvailable(), FUResource::isAvailable(), and SchedulingResource::isExecutionPipelineResource().

Referenced by InputFUBroker::allAvailableResources().

Here is the call graph for this function:

◆ isInputFUResource()

bool InputFUResource::isInputFUResource ( ) const
overridevirtual

Allways return true

Returns
true

Reimplemented from SchedulingResource.

Definition at line 242 of file InputFUResource.cc.

242 {
243 return true;
244}

◆ isInUse()

bool InputFUResource::isInUse ( const int  cycle) const
overridevirtual

Test if resource InputFUResource is used in given cycle.

True if some of InputPSockets are already used or there is operation already in execution pipeline.

Parameters
cycleCycle which to test
Returns
True if InputFUResource is already used in cycle

Reimplemented from FUResource.

Definition at line 220 of file InputFUResource.cc.

220 {
221 // Test isInUse of PSockets using parent class
222 if (FUResource::isInUse(cycle)) {
223 return true;
224 }
225 for (int i = 0; i < dependentResourceGroupCount(); i++) {
226 for (int j = 0, count = dependentResourceCount(i); j < count; j++) {
228 dependentResource(i, j).isInUse(cycle)) {
229 return true;
230 }
231 }
232 }
233 return false;
234}
virtual bool isInUse(const int cycle) const override
Definition FUResource.cc:62
virtual bool isInUse(const int cycle) const =0

References SchedulingResource::dependentResource(), SchedulingResource::dependentResourceCount(), SchedulingResource::dependentResourceGroupCount(), SchedulingResource::isExecutionPipelineResource(), SchedulingResource::isInUse(), and FUResource::isInUse().

Here is the call graph for this function:

◆ operator=()

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

◆ unassign()

void InputFUResource::unassign ( const int  cycle,
MoveNode node 
)
overridevirtual

Unassign resource from given node for given cycle, for triggering moves also unassign execution pipeline.

Parameters
cycleCycle to remove assignment from
nodeMoveNode to remove assignment from
pSocketInputPSocket used for writting operand
Exceptions
Incase PSocket is not connected to FU

Reimplemented from FUResource.

Definition at line 115 of file InputFUResource.cc.

117 {
118
119 for (int i = 0; i < dependentResourceGroupCount(); i++) {
120 for (int j = 0, count = dependentResourceCount(i); j < count; j++) {
124 dynamic_cast<ExecutionPipelineResource*>(res);
125 epRes->unassignDestination(cycle, node);
127 return;
128 }
129 }
130 }
131 abortWithError("InputFUResource has no execution pipeline registered!");
132}
virtual void unassignDestination(const int cycle, MoveNode &node)
virtual void decreaseUseCount()

References abortWithError, SchedulingResource::decreaseUseCount(), SchedulingResource::dependentResource(), SchedulingResource::dependentResourceCount(), SchedulingResource::dependentResourceGroupCount(), SchedulingResource::isExecutionPipelineResource(), and ExecutionPipelineResource::unassignDestination().

Referenced by InputFUBroker::unassign().

Here is the call graph for this function:

◆ validateDependentGroups()

bool InputFUResource::validateDependentGroups ( )
overrideprotectedvirtual

Tests if all referred resource in dependent groups are of proper types.

Returns
true If all resources in dependent groups are input or output PSockets or executionPipeline

Reimplemented from SchedulingResource.

Definition at line 254 of file InputFUResource.cc.

254 {
255 for (int i = 0; i < dependentResourceGroupCount(); i++) {
256 for (int j = 0, count = dependentResourceCount(i); j < count; j++) {
260 return false;
261 }
262 }
263 }
264 return true;
265}
virtual bool isInputPSocketResource() const
virtual bool isOutputPSocketResource() const

References SchedulingResource::dependentResource(), SchedulingResource::dependentResourceCount(), SchedulingResource::dependentResourceGroupCount(), SchedulingResource::isExecutionPipelineResource(), SchedulingResource::isInputPSocketResource(), and SchedulingResource::isOutputPSocketResource().

Here is the call graph for this function:

◆ validateRelatedGroups()

bool InputFUResource::validateRelatedGroups ( )
overrideprotectedvirtual

Tests if related resource groups are empty.

Returns
true If all related resource groups are empty

Reimplemented from SchedulingResource.

Definition at line 274 of file InputFUResource.cc.

274 {
275 for (int i = 0; i < relatedResourceGroupCount(); i++) {
276 if (relatedResourceCount(i) > 0) {
277 return false;
278 }
279 }
280 return true;
281}
int relatedResourceCount(const int group) const
virtual int relatedResourceGroupCount() const

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

Here is the call graph for this function:

The documentation for this class was generated from the following files: