- /* if connTo is owned by a functional block
- or by a group block that is within this, add the block to the fifo.
- */
- if (connTo->getOwner()->isFunctionalBlock()) {
- fifo.append(connTo->getOwner());
+
+ AbstractBlock* block1 = connTo->getOwner();
+ cout << "testing if " << qPrintable(block1->getName()) << " has all connected inputs connected to already processed blocks" << endl;
+ bool addIt = true;
+ int maxLevel = 0;
+
+ foreach(AbstractInterface* iface, block1->getControlInputs()) {
+ //cout << qPrintable(iface->getName()) << " of " << qPrintable(iface->getOwner()->getName()) << " connected to " << endl;
+ ConnectedInterface* connFrom = ((ConnectedInterface*)iface)->getConnectedFrom();
+ //cout << qPrintable(connFrom->getName()) << " of " << qPrintable(connFrom->getOwner()->getName()) << endl;
+
+ if ((connFrom != NULL) && (connFrom->getOwner()->getPatternComputed() == false)) {
+ addIt = false;
+ break;
+ }
+ else {
+ if (connFrom->getOwner()->getTraversalLevel() > maxLevel) maxLevel = connFrom->getOwner()->getTraversalLevel();
+ }
+ }
+
+ if (addIt) {
+ cout << "adding " << qPrintable(block1->getName()) << " to the FIFO" << endl;
+ block1->setTraversalLevel(maxLevel+1); // level 0 = first blocks to be evaluated
+ fifo.append(block1);