Go to the documentation of this file.
78 unsigned int initiationInterval) :
79 ResourceBroker(name, initiationInterval), inputPSocketBroker_(ipBroker),
80 outputPSocketBroker_(opBroker), hasLimm_(
false), mach_(&mach) {
112 int immRegIndex)
const {
117 cycle, node, bus, srcFU, dstFU, immWriteCycle, immu, immRegIndex);
118 return allAvailableBuses.
count() > 0;
147 int immRegIndex)
const {
153 if (allAvailableBuses.
count() == 0) {
154 string msg =
"No available resource found.";
160 return allAvailableBuses.
resource(0);
203 if (inputSocket == NULL) {
205 string port = dstPort->
name();
207 "Tried to find bus for a move to '" + unit +
"." + port +
208 "' which has no connections to an input socket. "
209 "Check operation bindings!";
219 std::string msg =
"BusBroker: finding ";
220 msg +=
" resource for Socket ";
221 msg +=
" failed with error: ";
233 ResourceMap::const_iterator resIter =
resMap_.begin();
234 while (resIter !=
resMap_.end()) {
239 if (busRes == NULL) {
242 "Bus broker has other then Bus Resource registered!");
246 if (preassignedBus == NULL || busRes == preassignedBus) {
248 busRes->
canAssign(cycle, node, immRes, *iPSocket)) {
249 candidates.
insert(*busRes);
259 if (outputSocket == NULL) {
261 string port = srcPort->
name();
263 "Tried to find bus for a move from '" + unit +
"." + port +
264 "' which has no connections to an output socket! Check "
265 "operation bindings!";
275 std::string msg =
"BusBroker: finding ";
276 msg +=
" resource for Socket ";
277 msg +=
" failed with error: ";
283 ResourceMap::const_iterator resIter =
resMap_.begin();
284 while (resIter !=
resMap_.end()) {
287 if (preassignedBus == NULL ||
288 busRes == preassignedBus) {
289 if (busRes->
canAssign(cycle, node, *oPSocket, *iPSocket)) {
290 candidates.
insert(*busRes);
299 for (
int i = 0; i < candidates.
count(); i++) {
306 "Bus Resource is missing bus in MOM!");
309 bool guardFound =
false;
310 for (
int j = 0; j < aBus->
guardCount(); j++) {
312 if (busGuard->
isEqual(guard)) {
319 candidates.
remove(busResource);
340 if (bus != NULL &&
resourceOf(*bus) != &res) {
349 if (inputSocket == NULL) {
351 string port = dstPort->
name();
353 "Tried to find bus for a move to '" + unit +
"." + port +
354 "' which has no connections to an input socket. "
355 "Check operation bindings!";
365 std::string msg =
"BusBroker: finding ";
366 msg +=
" resource for Socket ";
367 msg +=
" failed with error: ";
381 if (busRes == NULL) {
384 "Wrong type of resource for the broker given!");
389 busRes->
canAssign(cycle, node, immRes, *iPSocket)) {
395 if (outputSocket == NULL) {
397 string port = srcPort->
name();
399 "Tried to find bus for a move from '" + unit +
"." + port +
400 "' which has no connections to an output socket! Check "
401 "operation bindings!";
411 std::string msg =
"BusBroker: finding ";
412 msg +=
" resource for Socket ";
413 msg +=
" failed with error: ";
421 if (busRes == NULL) {
424 "Wrong type of resource for the broker given!");
427 if (!busRes->
canAssign(cycle, node, *oPSocket, *iPSocket)) {
439 "Bus Resource is missing bus in MOM!");
442 bool guardFound =
false;
443 for (
int j = 0; j < aBus->
guardCount(); j++) {
445 if (busGuard->
isEqual(guard)) {
488 "preassigned bus which is different than selected bus?");
502 busRes.
assign(cycle,node);
504 string msg =
"Broker does not contain given resource.";
508 std::pair<const MoveNode*, SchedulingResource*>(&node, &busRes));
526 const Bus& bus = move.
bus();
614 const Bus& bus =
const_cast<MoveNode&
>(node).move().bus();
652 std::map<const Bus*,int> limmSlotCounts;
653 std::map<const Bus*,int> nopSlotCounts;
657 for (
int i = 0; i < itn.
count(); i++) {
659 for (
int j = 0; j < it->
slotCount(); j++) {
662 limmSlotCounts[itSlot->
bus()]++;
667 for (
int i = 0; i < navi.
count(); i++) {
672 bus->
name(), bus->
width(),limmSlotCounts[bus],
673 nopSlotCounts[bus], bus->guardCount(),
692 for (ResourceMap::iterator resIter =
resMap_.begin();
693 resIter !=
resMap_.end(); resIter++) {
695 const Bus* bus =
dynamic_cast<const Bus*
>((*resIter).first);
699 "Bus broker has other then Bus Resource registered!");
720 if (relRes == NULL) {
723 if (relRes != NULL) {
726 std::string msg =
"BusBroker: finding ";
727 msg +=
" resource for Socket ";
758 ResourceMap::const_iterator resIter =
resMap_.begin();
759 while (resIter !=
resMap_.end()) {
762 const Bus* aBus =
static_cast<const Bus*
>(resIter->first);
763 if (preassignedBus != NULL && aBus != preassignedBus) {
768 bool guardOK =
false;
776 for (
int j = 0; j < aBus->
guardCount(); j++) {
778 if (busGuard->
isEqual(guard)) {
871 ResourceMap::const_iterator resIter =
resMap_.begin();
872 while (resIter !=
resMap_.end()) {
877 for (
int j = 0; j < aBus->
guardCount(); j++) {
879 if (busGuard->
isEqual(guard)) {
891 for (std::list<SchedulingResource*>::iterator i =
int immediateWidth() const
virtual bool canAssign(const int cycle, const MoveNode &node) const override
static int requiredImmediateWidth(bool signExtension, const TTAProgram::TerminalImmediate &source, const TTAMachine::Machine &mach)
static bool busConnectedToDestination(const TTAMachine::Bus &bus, const MoveNode &moveNode)
virtual Socket * inputSocket() const
virtual void setupResourceLinks(const ResourceMapper &mapper)
virtual bool isBusBroker() const
unsigned int initiationInterval_
virtual TCEString name() const
BusBroker(std::string name, ResourceBroker &ipBroker, ResourceBroker &opBroker, const TTAMachine::Machine &mach, unsigned int initiationInterval=0)
virtual void assign(const int cycle, MoveNode &node) override
TTAMachine::Bus & universalBus() const
bool isUnconditional() const
virtual bool isEqual(const Guard &guard) const =0
std::list< SchedulingResource * > shortImmPSocketResources_
Terminal & destination() const
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 ShortImmPSocketResource & findImmResource(BusResource &busRes) const
static UniversalMachine & instance()
bool hasResource(const SchedulingResource &r) const
const TTAMachine::Bus & bus() const
void setGuard(MoveGuard *guard)
MoveResMap assignedResources_
virtual Segment * segment(int index) const
void addResource(const TTAMachine::MachinePart &mp, SchedulingResource *res)
bool hasResourceOf(const TTAMachine::MachinePart &mp) const
virtual int slotCount() const
virtual bool hasGuard(const MoveNode &node) const
std::map< const MoveNode *, bool > busPreassigned_
#define assert(condition)
virtual 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
int connectionCount() 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 override
void setResourceMapper(const ResourceMapper &mapper)
virtual SchedulingResource & relatedResource(const int group, const int index) const
#define abortWithError(message)
virtual void addToRelatedGroup(const int group, SchedulingResource &resource)
virtual bool isInUse(const int cycle) 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
int immediateWidth() const
virtual ImmediateUnitNavigator immediateUnitNavigator() const
MoveGuard & guard() const
ImmediateUnit * destination() const
std::string errorMessageStack(bool messagesOnly=false) const
SchedulingResource * resourceOf(const TTAMachine::MachinePart &mp) const
ResourceBroker & outputPSocketBroker_
virtual bool isApplicable(const MoveNode &node, const TTAMachine::Bus *) const override
const TTAMachine::Machine * mach_
const Connection & connection(const Socket &socket) const
Guard * guard(int index) const
virtual void unassign(MoveNode &node)
int relatedResourceCount(const int group) const
TTAProgram::Move & move()
void remove(SchedulingResource &resource)
find Finds info of the inner loops in the false
virtual SchedulingResource & availableResource(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 std::string name() const
virtual bool canTransportImmediate(const MoveNode &node, const TTAMachine::Bus *preAssigndBus) const
virtual BusNavigator busNavigator() const
unsigned int instructionIndex(unsigned int) const
virtual Socket * outputSocket() const
bool canPerformSIMMJump(const MoveNode &mn, ShortImmPSocketResource &immRes) const
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
Terminal & source() const
virtual void assign(int cycle, MoveNode &node, SchedulingResource &res, int immWriteCycle, int immRegIndex) override
virtual const TTAMachine::MachinePart & machinePartOf(const SchedulingResource &r) const
virtual const TTAMachine::Port & port() const
ComponentType * item(int index) const
SchedulingResource & resource(int index) const
const TTAMachine::Guard & guard() const
virtual void unassign(const int cycle, MoveNode &node) override
virtual bool isShortImmPSocketResource() const
virtual bool isImmediate() const
virtual bool isInUse(int cycle, const MoveNode &node) const
virtual InstructionTemplateNavigator instructionTemplateNavigator() const
virtual bool isAlreadyAssigned(int cycle, const MoveNode &node, const TTAMachine::Bus *preassignedBus) const override
void insert(SchedulingResource &resource)
void setBus(const TTAMachine::Bus &bus)
virtual int segmentCount() const
virtual TemplateSlot * slot(int index) const
virtual void buildResources(const TTAMachine::Machine &target)
Unit * parentUnit() const
ResourceBroker & inputPSocketBroker_