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

#include <OutputPSocketBroker.hh>

Inheritance diagram for OutputPSocketBroker:
Inheritance graph
Collaboration diagram for OutputPSocketBroker:
Collaboration graph

Public Member Functions

 OutputPSocketBroker (std::string name, ResourceBroker &ofb, SimpleResourceManager *, unsigned int initiationInterval=0)
 
virtual ~OutputPSocketBroker ()
 
bool isAnyResourceAvailable (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
 
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 override
 
virtual void assign (int cycle, MoveNode &node, SchedulingResource &res, int immWriteCycle, int immRegIndex) override
 
virtual void unassign (MoveNode &node) override
 
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
 
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
 
virtual bool isAlreadyAssigned (int cycle, const MoveNode &node, const TTAMachine::Bus *preassignedBus) const override
 
virtual bool isApplicable (const MoveNode &node, const TTAMachine::Bus *b) const override
 
virtual void buildResources (const TTAMachine::Machine &target) override
 
virtual void setupResourceLinks (const ResourceMapper &mapper) override
 
void setBusBroker (ResourceBroker &sb)
 
- Public Member Functions inherited from ResourceBroker
 ResourceBroker (std::string, unsigned int initiationInterval=0)
 
virtual ~ResourceBroker ()
 
virtual SchedulingResourceavailableResource (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
 
virtual bool isAvailable (SchedulingResource &des, const MoveNode &node, int cycle, const TTAMachine::Bus *bus, const TTAMachine::FunctionUnit *srcFU, const TTAMachine::FunctionUnit *dstFU, int immWriteCycle, const TTAMachine::ImmediateUnit *immu, int immRegIndex) const
 
SchedulingResourceresourceOf (const TTAMachine::MachinePart &mp) const
 
virtual const TTAMachine::MachinePartmachinePartOf (const SchedulingResource &r) const
 
bool hasResourceOf (const TTAMachine::MachinePart &mp) const
 
bool hasResource (const SchedulingResource &r) const
 
int resourceCount () const
 
virtual bool isBusBroker () const
 
virtual bool isITemplateBroker () const
 
virtual bool isIUBroker () const
 
virtual bool isExecutionPipelineBroker () const
 
void validateResources () const
 
virtual std::string brokerName () const
 
void resources (ResourceSet &contents)
 
virtual void setInitiationInterval (unsigned int cycles)
 
virtual void clear ()
 
virtual void setMaxCycle (unsigned int)
 

Private Attributes

ResourceBrokeroutputFUBroker_
 
ResourceBrokerbusBroker_
 
SimpleResourceManagerrm_
 

Additional Inherited Members

- Public Types inherited from ResourceBroker
typedef std::set< SchedulingResource * > ResourceSet
 
- Protected Types inherited from ResourceBroker
typedef std::map< const TTAMachine::MachinePart *, SchedulingResource *, TTAMachine::MachinePart::ComparatorResourceMap
 
typedef std::map< const MoveNode *, SchedulingResource *, MoveNode::ComparatorMoveResMap
 
- Protected Member Functions inherited from ResourceBroker
void setResourceMapper (const ResourceMapper &mapper)
 
const ResourceMapperresourceMapper () const
 
unsigned int instructionIndex (unsigned int) const
 
void addResource (const TTAMachine::MachinePart &mp, SchedulingResource *res)
 
- Protected Attributes inherited from ResourceBroker
unsigned int initiationInterval_
 
ResourceMap resMap_
 
const ResourceMapperresourceMapper_
 
MoveResMap assignedResources_
 
std::string brokerName_
 

Detailed Description

Output p-socket broker.

Definition at line 51 of file OutputPSocketBroker.hh.

Constructor & Destructor Documentation

◆ OutputPSocketBroker()

OutputPSocketBroker::OutputPSocketBroker ( std::string  name,
ResourceBroker fub,
SimpleResourceManager rm,
unsigned int  initiationInterval = 0 
)

Constructor.

Parameters
namename for this broker.
fubreference to OutputFUBroker of this resource manager.
initiationIntervalinitiationinterval when doing loop scheduling.

Definition at line 57 of file OutputPSocketBroker.cc.

61 :
62 ResourceBroker(name, initiationInterval),
63 outputFUBroker_(fub), busBroker_(NULL), rm_(rm) {
64}
SimpleResourceManager * rm_
ResourceBroker * busBroker_
ResourceBroker & outputFUBroker_

◆ ~OutputPSocketBroker()

OutputPSocketBroker::~OutputPSocketBroker ( )
virtual

Destructor.

Definition at line 69 of file OutputPSocketBroker.cc.

69 {
70}

Member Function Documentation

◆ allAvailableResources()

SchedulingResourceSet OutputPSocketBroker::allAvailableResources ( int  cycle,
const MoveNode node,
const TTAMachine::Bus preassignedBus,
const TTAMachine::FunctionUnit srcFU,
const TTAMachine::FunctionUnit dstFU,
int  immWriteCycle,
const TTAMachine::ImmediateUnit immu,
int  immRegIndex 
) const
overridevirtual

Return all resources managed by this broker that can be assigned to the given node in the given cycle.

Parameters
cycleCycle.
nodeNode.
Returns
All resources managed by this broker that can be assigned to the given node in the given cycle.

Reimplemented from ResourceBroker.

Definition at line 82 of file OutputPSocketBroker.cc.

89 {
90
91 cycle = instructionIndex(cycle);
92 if (!isApplicable(node, preassignedBus)) {
93 string msg = "Broker not capable of assigning resources to node!";
94 throw ModuleRunTimeError(__FILE__, __LINE__, __func__, msg);
95 }
96
97 TTAProgram::Move& move = const_cast<MoveNode&>(node).move();
98
99 SchedulingResourceSet resourceSet;
100
101 if (move.source().isFUPort()) {
102 // psocket is implicit by fubroker choice of FU
103 Socket& outputSocket = *move.source().port().outputSocket();
104 SchedulingResource* res = resourceOf(outputSocket);
105 if (res->canAssign(cycle,node)) {
106 resourceSet.insert(*res);
107 }
108 return resourceSet;
109 }
110 if (move.source().isGPR()) {
111 // assign psocket for reading rf
112 const RegisterFile& rf = move.source().registerFile();
113 for (int i = 0; i < rf.portCount(); i++) {
114 Port& port = *rf.port(i);
115 Socket* outputSocket = port.outputSocket();
116
117 if (outputSocket != NULL) {
118 SchedulingResource* res = resourceOf(*outputSocket);
119 if (res->canAssign(cycle, node)) {
120 resourceSet.insert(*res);
121 }
122 }
123 }
124 return resourceSet;
125 }
126 if (move.source().isImmediateRegister()) {
127 // assign psocket for reading IU
128 const ImmediateUnit& iu = move.source().immediateUnit();
129 for (int i = 0; i < iu.portCount(); i++) {
130 Port& port = *iu.port(i);
131 Socket* outputSocket = port.outputSocket();
132 if (outputSocket != NULL) {
133 SchedulingResource* res = resourceOf(*outputSocket);
134 if (res->canAssign(cycle, node)) {
135 resourceSet.insert(*res);
136 }
137 }
138 }
139 }
140 return resourceSet;
141}
#define __func__
virtual bool isApplicable(const MoveNode &node, const TTAMachine::Bus *b) const override
SchedulingResource * resourceOf(const TTAMachine::MachinePart &mp) const
unsigned int instructionIndex(unsigned int) const
void insert(SchedulingResource &resource)
virtual bool canAssign(const int cycle, const MoveNode &node) const =0
virtual RFPort * port(const std::string &name) const
virtual Socket * outputSocket() const
Definition Port.cc:281
virtual int portCount() const
Definition Unit.cc:135
Terminal & source() const
Definition Move.cc:302
virtual bool isGPR() const
Definition Terminal.cc:107
virtual bool isImmediateRegister() const
Definition Terminal.cc:97
virtual const TTAMachine::Port & port() const
Definition Terminal.cc:378
virtual const TTAMachine::ImmediateUnit & immediateUnit() const
Definition Terminal.cc:240
virtual const TTAMachine::RegisterFile & registerFile() const
Definition Terminal.cc:225
virtual bool isFUPort() const
Definition Terminal.cc:118

References __func__, SchedulingResource::canAssign(), TTAProgram::Terminal::immediateUnit(), SchedulingResourceSet::insert(), ResourceBroker::instructionIndex(), isApplicable(), TTAProgram::Terminal::isFUPort(), TTAProgram::Terminal::isGPR(), TTAProgram::Terminal::isImmediateRegister(), TTAMachine::Port::outputSocket(), TTAProgram::Terminal::port(), TTAMachine::BaseRegisterFile::port(), TTAMachine::Unit::portCount(), TTAProgram::Terminal::registerFile(), ResourceBroker::resourceOf(), and TTAProgram::Move::source().

Here is the call graph for this function:

◆ assign()

void OutputPSocketBroker::assign ( int  cycle,
MoveNode node,
SchedulingResource res,
int  immWriteCycle,
int  immRegIndex 
)
overridevirtual

Mark given resource as in use for the given node, and assign the corresponding machine part (if applicable) to the node's move.

If the node is already assigned to given resource, this method does nothing.

Parameters
cycleCycle.
nodeNode to assign.
resResource representing Output PSocket
Exceptions
WrongSubclassIf this broker does not recognise the given type of resource.
InvalidParametersIf he given resource cannot be assigned to given node or no corresponding machine part is found.

Implements ResourceBroker.

Definition at line 237 of file OutputPSocketBroker.cc.

241 {
242
243 cycle = instructionIndex(cycle);
244 if (!hasResource(res)) {
245 string msg = "Broker does not contain given resource.";
246 throw InvalidData(__FILE__, __LINE__, __func__, msg);
247 }
248
249 TTAProgram::Move& move = node.move();
250
251 if (move.source().isGPR() || move.source().isImmediateRegister()) {
252
253 Port* port = NULL;
254 const Socket& socket =
255 static_cast<const Socket&>(machinePartOf(res));
256 for (int i = 0; i < socket.portCount(); i++) {
257 if (socket.port(i)->outputSocket() == &socket) {
258 if ((move.source().isGPR() &&
259 socket.port(i)->parentUnit() !=
260 &move.source().registerFile()) ||
261 (move.source().isImmediateRegister() &&
262 socket.port(i)->parentUnit() !=
263 &move.source().immediateUnit()))
264 continue;
265 port = socket.port(i);
266 break;
267 }
268 }
269 if (port == NULL) {
270 throw InvalidData(
271 __FILE__, __LINE__, __func__,
272 "Broker can not find necesary Port!");
273 }
275 *port, move.source().index());
276 move.setSource(newSrc);
277 }
278 res.assign(cycle, node);
279 assignedResources_.insert(
280 std::pair<const MoveNode*, SchedulingResource*>(&node, &res));
281}
TTAProgram::Move & move()
MoveResMap assignedResources_
bool hasResource(const SchedulingResource &r) const
virtual const TTAMachine::MachinePart & machinePartOf(const SchedulingResource &r) const
virtual void assign(const int cycle, MoveNode &node)=0
Unit * parentUnit() const
Port * port(int index) const
Definition Socket.cc:266
int portCount() const
void setSource(Terminal *src)
Definition Move.cc:312
virtual int index() const
Definition Terminal.cc:274

References __func__, SchedulingResource::assign(), ResourceBroker::assignedResources_, ResourceBroker::hasResource(), TTAProgram::Terminal::immediateUnit(), TTAProgram::Terminal::index(), ResourceBroker::instructionIndex(), TTAProgram::Terminal::isGPR(), TTAProgram::Terminal::isImmediateRegister(), ResourceBroker::machinePartOf(), MoveNode::move(), TTAMachine::Port::outputSocket(), TTAMachine::Port::parentUnit(), TTAMachine::Socket::port(), TTAMachine::Socket::portCount(), TTAProgram::Terminal::registerFile(), TTAProgram::Move::setSource(), and TTAProgram::Move::source().

Here is the call graph for this function:

◆ buildResources()

void OutputPSocketBroker::buildResources ( const TTAMachine::Machine target)
overridevirtual

Build all resource objects of the controlled type required to model scheduling resources of the given target processor.

This method cannot set up the resource links (dependent and related resources) of the constructed resource objects.

Parameters
targetTarget machine.

Implements ResourceBroker.

Definition at line 429 of file OutputPSocketBroker.cc.

429 {
430
432
433 for (int i = 0; i < navi.count(); i++) {
434 Socket* socket = navi.item(i);
435 if (socket->direction() == Socket::OUTPUT) {
436 OutputPSocketResource* opsResource =
438 ResourceBroker::addResource(*socket, opsResource);
439 }
440 }
441}
void addResource(const TTAMachine::MachinePart &mp, SchedulingResource *res)
unsigned int initiationInterval_
virtual TCEString name() const
ComponentType * item(int index) const
virtual SocketNavigator socketNavigator() const
Definition Machine.cc:368
@ OUTPUT
Data goes from port to bus.
Definition Socket.hh:60
Direction direction() const

References ResourceBroker::addResource(), TTAMachine::Machine::Navigator< ComponentType >::count(), TTAMachine::Socket::direction(), ResourceBroker::initiationInterval_, TTAMachine::Machine::Navigator< ComponentType >::item(), TTAMachine::Component::name(), TTAMachine::Socket::OUTPUT, and TTAMachine::Machine::socketNavigator().

Here is the call graph for this function:

◆ earliestCycle()

int OutputPSocketBroker::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
overridevirtual

Return the earliest cycle, starting from given cycle, where a resource of the type managed by this broker can be assigned to the given node.

Parameters
cycleCycle.
nodeNode.
Returns
The earliest cycle, starting from given cycle, where a resource of the type managed by this broker can be assigned to the given node.

Implements ResourceBroker.

Definition at line 316 of file OutputPSocketBroker.cc.

321 {
322 abortWithError("Not implemented.");
323 return -1;
324}
#define abortWithError(message)

References abortWithError.

◆ isAlreadyAssigned()

bool OutputPSocketBroker::isAlreadyAssigned ( int  cycle,
const MoveNode node,
const TTAMachine::Bus preassignedBus 
) const
overridevirtual

Return true if the given node is already assigned a resource of the type managed by this broker, and the assignment appears valid (that is, the broker has marked that resource as in use in the given cycle).

Parameters
cycleCycle.
nodeNode.
Returns
True if the given node is already assigned a resource of the type managed by this broker, and the assignment appears valid (that is, the broker has marked that resource as in use in the given cycle).

Implements ResourceBroker.

Definition at line 362 of file OutputPSocketBroker.cc.

364 {
365 cycle = instructionIndex(cycle);
366 if (node.isSourceConstant() &&
367 node.move().hasAnnotations(
369 return true;
370 }
371 if (node.isSourceConstant() && rm_ &&
372 !rm_->canTransportImmediate(node, preassignedBus)) {
373 return true;
374 }
375 Terminal& src = const_cast<MoveNode&>(node).move().source();
376 if (src.isFUPort() || src.isGPR() || src.isImmediateRegister()) {
377 const Port& port = src.port();
378 if (port.outputSocket() == NULL)
379 return false;
381 if (res != NULL && res->isInUse(cycle) &&
383 return true;
384 }
385 }
386 return false;
387}
static bool containsKey(const MapType &aMap, const KeyType &aKey)
bool isSourceConstant() const
Definition MoveNode.cc:238
virtual bool isInUse(const int cycle) const =0
virtual bool canTransportImmediate(const MoveNode &node, const TTAMachine::Bus *preAssignedBus=NULL) const
bool hasAnnotations(ProgramAnnotation::Id id=ProgramAnnotation::ANN_UNDEF_ID) const

References TTAProgram::ProgramAnnotation::ANN_REQUIRES_LIMM, ResourceBroker::assignedResources_, SimpleResourceManager::canTransportImmediate(), MapTools::containsKey(), TTAProgram::AnnotatedInstructionElement::hasAnnotations(), ResourceBroker::instructionIndex(), TTAProgram::Terminal::isFUPort(), TTAProgram::Terminal::isGPR(), TTAProgram::Terminal::isImmediateRegister(), SchedulingResource::isInUse(), MoveNode::isSourceConstant(), MoveNode::move(), TTAMachine::Port::outputSocket(), TTAProgram::Terminal::port(), ResourceBroker::resourceOf(), and rm_.

Here is the call graph for this function:

◆ isAnyResourceAvailable()

bool OutputPSocketBroker::isAnyResourceAvailable ( int  cycle,
const MoveNode node,
const TTAMachine::Bus preassignedBus,
const TTAMachine::FunctionUnit srcFU,
const TTAMachine::FunctionUnit dstFU,
int  immWriteCycle,
const TTAMachine::ImmediateUnit immu,
int  immRegIndex 
) const
overridevirtual

Return true if one of the resources managed by this broker is suitable for the request contained in the node and can be assigned to it in given cycle.

Parameters
cycleCycle.
nodeNode.
Returns
True if one of the resources managed by this broker is suitable for the request contained in the node and can be assigned to it in given cycle.

Reimplemented from ResourceBroker.

Definition at line 155 of file OutputPSocketBroker.cc.

160 {
161
162 cycle = instructionIndex(cycle);
163 if (!isApplicable(node, preassignedBus)) {
164 string msg = "Broker not capable of assigning resources to node!";
165 throw ModuleRunTimeError(__FILE__, __LINE__, __func__, msg);
166 }
167
168 TTAProgram::Move& move = const_cast<MoveNode&>(node).move();
169
170 SchedulingResourceSet resourceSet;
171
172 if (move.source().isFUPort()) {
173 // psocket is implicit by fubroker choice of FU
174 Socket& outputSocket = *move.source().port().outputSocket();
175 SchedulingResource* res = resourceOf(outputSocket);
176 if (res->canAssign(cycle,node)) {
177 return true;
178 } else {
179 return false;
180 }
181 }
182 if (move.source().isGPR()) {
183 // assign psocket for reading rf
184 const RegisterFile& rf = move.source().registerFile();
185 for (int i = 0; i < rf.portCount(); i++) {
186 Port& port = *rf.port(i);
187 Socket* outputSocket = port.outputSocket();
188
189 if (outputSocket != NULL) {
190 SchedulingResource* res = resourceOf(*outputSocket);
191 if (res->canAssign(cycle, node)) {
192 return true;
193 }
194 }
195 }
196 return false;
197 }
198 if (move.source().isImmediateRegister()) {
199 // assign psocket for reading IU
200 const ImmediateUnit& iu = move.source().immediateUnit();
201 for (int i = 0; i < iu.portCount(); i++) {
202 Port& port = *iu.port(i);
203 Socket* outputSocket = port.outputSocket();
204 if (outputSocket != NULL) {
205 SchedulingResource* res = resourceOf(*outputSocket);
206 if (res->canAssign(cycle, node)) {
207 return true;
208 }
209 }
210 }
211 return false;
212 }
213 return false;
214}

References __func__, SchedulingResource::canAssign(), TTAProgram::Terminal::immediateUnit(), ResourceBroker::instructionIndex(), isApplicable(), TTAProgram::Terminal::isFUPort(), TTAProgram::Terminal::isGPR(), TTAProgram::Terminal::isImmediateRegister(), TTAMachine::Port::outputSocket(), TTAProgram::Terminal::port(), TTAMachine::BaseRegisterFile::port(), TTAMachine::Unit::portCount(), TTAProgram::Terminal::registerFile(), ResourceBroker::resourceOf(), and TTAProgram::Move::source().

Here is the call graph for this function:

◆ isApplicable()

bool OutputPSocketBroker::isApplicable ( const MoveNode node,
const TTAMachine::Bus preassignedBus 
) const
overridevirtual

Return true if the given node needs a resource of the type managed by this broker, false otherwise.

Parameters
nodeNode.
Returns
True if the given node needs a resource of the type managed by this broker, false otherwise.

Implements ResourceBroker.

Definition at line 398 of file OutputPSocketBroker.cc.

399 {
400 if (!node.isMove()) {
401 return false;
402 }
403 Move& move = const_cast<MoveNode&>(node).move();
404 // If node is annotated, it will be converted to LIMM
405 // and so we will need to assign output PScoket
406 if (node.isSourceConstant() && node.move().hasAnnotations(
408 return true;
409 }
410 if (node.isSourceConstant() &&
411 rm_ && !rm_->canTransportImmediate(node, preassignedBus)) {
412 return true;
413 }
414 return (move.source().isFUPort() ||
415 move.source().isGPR() ||
416 move.source().isImmediateRegister());
417}
bool isMove() const

References TTAProgram::ProgramAnnotation::ANN_REQUIRES_LIMM, SimpleResourceManager::canTransportImmediate(), TTAProgram::AnnotatedInstructionElement::hasAnnotations(), TTAProgram::Terminal::isFUPort(), TTAProgram::Terminal::isGPR(), TTAProgram::Terminal::isImmediateRegister(), MoveNode::isMove(), MoveNode::isSourceConstant(), MoveNode::move(), rm_, and TTAProgram::Move::source().

Referenced by allAvailableResources(), and isAnyResourceAvailable().

Here is the call graph for this function:

◆ latestCycle()

int OutputPSocketBroker::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
overridevirtual

Return the latest cycle, starting from given cycle, where a resource of the type managed by this broker can be assigned to the given node.

Parameters
cycleCycle.
nodeNode.
Returns
The latest cycle, starting from given cycle, where a resource of the type managed by this broker can be assigned to the given node.

Implements ResourceBroker.

Definition at line 338 of file OutputPSocketBroker.cc.

343 {
344 abortWithError("Not implemented.");
345 return -1;
346}

References abortWithError.

◆ setBusBroker()

void OutputPSocketBroker::setBusBroker ( ResourceBroker sb)

Gives reference to segmentbroker to this broker.

Cannot be given in constructor because SegmentBroker is created later.

Definition at line 511 of file OutputPSocketBroker.cc.

511 {
512 busBroker_ = &sb;
513}

References busBroker_.

Referenced by SimpleResourceManager::buildResourceModel().

◆ setupResourceLinks()

void OutputPSocketBroker::setupResourceLinks ( const ResourceMapper mapper)
overridevirtual

Complete resource initialisation by creating the references to other resources due to a dependency or a relation. Use the given resource mapper to lookup dependent and related resources using machine parts as keys.

Parameters
mapperResource mapper.

Implements ResourceBroker.

Definition at line 452 of file OutputPSocketBroker.cc.

452 {
453
454 setResourceMapper(mapper);
455
456 for (ResourceMap::iterator resIter = resMap_.begin();
457 resIter != resMap_.end(); resIter++) {
458
459 const Socket* socket =
460 static_cast<const Socket*>((*resIter).first);
461
462 SchedulingResource* socketResource = (*resIter).second;
463
464 for (int i = 0; i < socket->portCount(); i++) {
465 Port* port = socket->port(i);
466 Unit* unit = port->parentUnit();
467 if (dynamic_cast<FunctionUnit*>(unit) != NULL) {
468
469 SchedulingResource& relRes =
471 socketResource->addToRelatedGroup(0, relRes);
472 } else if (dynamic_cast<ImmediateUnit*>(unit) != NULL) {
473 try {
474 SchedulingResource& relRes = mapper.resourceOf(*unit);
475 socketResource->addToRelatedGroup(1, relRes);
476 } catch (const KeyNotFound& e) {
477 std::string msg = "OutputPSocketBroker: finding ";
478 msg += " resource for IU ";
479 msg += " failed with error: ";
480 msg += e.errorMessageStack();
481 throw KeyNotFound(
482 __FILE__, __LINE__, __func__, msg);
483 }
484 }
485 }
486
487 for (int i = 0; i < socket->segmentCount(); i++) {
488 try {
489 Segment* segment = socket->segment(i);
490 Bus* bus = segment->parentBus();
491 SchedulingResource& relRes =
492 *busBroker_->resourceOf(*bus);
493 socketResource->addToRelatedGroup(2, relRes);
494 } catch (const KeyNotFound& e) {
495 std::string msg = "OutputPSocketBroker: finding ";
496 msg += " resource for Segment ";
497 msg += " failed with error: ";
498 msg += e.errorMessageStack();
499 throw KeyNotFound(
500 __FILE__, __LINE__, __func__, msg);
501 }
502 }
503 }
504}
std::string errorMessageStack(bool messagesOnly=false) const
Definition Exception.cc:138
void setResourceMapper(const ResourceMapper &mapper)
ResourceMap resMap_
SchedulingResource & resourceOf(const TTAMachine::MachinePart &mp, int index=0) const
virtual void addToRelatedGroup(const int group, SchedulingResource &resource)
Bus * parentBus() const
Segment * segment(int index) const
Definition Socket.cc:401
int segmentCount() const

References __func__, SchedulingResource::addToRelatedGroup(), busBroker_, Exception::errorMessageStack(), outputFUBroker_, TTAMachine::Segment::parentBus(), TTAMachine::Port::parentUnit(), TTAMachine::Socket::port(), TTAMachine::Socket::portCount(), ResourceBroker::resMap_, ResourceBroker::resourceOf(), ResourceMapper::resourceOf(), TTAMachine::Socket::segment(), TTAMachine::Socket::segmentCount(), and ResourceBroker::setResourceMapper().

Here is the call graph for this function:

◆ unassign()

void OutputPSocketBroker::unassign ( MoveNode node)
overridevirtual

Free the resource type managed by this broker and unassign it from given node.

If this broker is not applicable to the given node, or the node is not assigned a resource of the managed type, this method does nothing.

Parameters
nodeNode.

Implements ResourceBroker.

Definition at line 294 of file OutputPSocketBroker.cc.

294 {
296 SchedulingResource* res =
298 assignedResources_,&node);
299 res->unassign(node.cycle(), node);
300 assignedResources_.erase(&node);
301 }
302}
static KeyType keyForValue(const MapType &aMap, const ValueType &aValue)
int cycle() const
Definition MoveNode.cc:421
virtual void unassign(const int cycle, MoveNode &node)=0

References ResourceBroker::assignedResources_, MapTools::containsKey(), MoveNode::cycle(), MapTools::keyForValue(), and SchedulingResource::unassign().

Here is the call graph for this function:

Member Data Documentation

◆ busBroker_

ResourceBroker* OutputPSocketBroker::busBroker_
private

Definition at line 105 of file OutputPSocketBroker.hh.

Referenced by setBusBroker(), and setupResourceLinks().

◆ outputFUBroker_

ResourceBroker& OutputPSocketBroker::outputFUBroker_
private

Definition at line 104 of file OutputPSocketBroker.hh.

Referenced by setupResourceLinks().

◆ rm_

SimpleResourceManager* OutputPSocketBroker::rm_
private

Definition at line 108 of file OutputPSocketBroker.hh.

Referenced by isAlreadyAssigned(), and isApplicable().


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