Unpack function that takes Instance iterators as input.
292 std::vector<torc::physical::InstanceSharedPtr> oldInstances;
293 std::vector<torc::physical::InstanceSharedPtr> newInstances;
294 std::vector<torc::physical::InstanceSharedPtr>::iterator instIt;
303 CandidateNet::const_iterator it1;
306 NameToElementPtrMap::const_iterator it;
308 ElementPtrToInstancePtrMap::const_iterator elementToInstanceMapit;
309 std::vector<std::string> instanceInputPins;
310 std::vector<std::string> instanceOutputPins;
311 std::vector<std::string> usedPower;
312 std::vector<std::string> usedGround;
316 PrimitiveStructuresSharedPtrMap::const_iterator pos;
321 const PrimitiveStructure& primitiveStructure = *(pos->second);
323 = primitiveStructure.getPrimitiveDefPtr();
325 if(primitiveDefPtr == 0)
return;
338 Instance::InstancePinSharedPtrConstIterator ipp
339 = instancePtr->pinsBegin();
340 Instance::InstancePinSharedPtrConstIterator ipe
341 = instancePtr->pinsEnd();
347 const std::string& pinName = instancePinPtr->getPinName();
348 netPtr = instancePinPtr->getParentWeakPtr().lock();
354 if(static_cast<boost::int32_t>(pinIndex) < 0)
continue;
355 const PrimitivePin& primitivePin = primitivePins[pinIndex];
357 inputPins.push_back(instancePinPtr);
359 outputPins.push_back(instancePinPtr);
364 InstancePinSharedPtrVector::const_iterator ipp2;
365 InstancePinSharedPtrVector::const_iterator ipe2;
367 ipp2 = inputPins.
begin();
368 ipe2 = inputPins.end();
369 while(ipp2 != ipe2) {
371 instanceInputPins.push_back(instancePinPtr->getPinName());
375 ipp2 = outputPins.begin();
376 ipe2 = outputPins.end();
377 while(ipp2 != ipe2) {
379 instanceOutputPins.push_back(instancePinPtr->getPinName());
380 std::cout <<
" found OUTPUT " << instancePinPtr
381 ->getPinName() << std::endl;
382 std::string outPinName = instancePinPtr->getPinName();
385 = primitiveStructure.mTerminals.find(outPinName)
389 usedElements, instanceInputPins,
390 elementPinsForNet, outNetSourcePin,
391 newInstances, elementToInstanceMap);
394 for(it1 = elementPinsForNet.begin();
395 it1 != elementPinsForNet.end(); it1++){
404 if(primitiveStructure.mTerminals
406 != primitiveStructure.mTerminals.end()) {
408 terminals.push_back(sourcePinPtr);
411 for(PrimitiveElementPinPtrVector::const_iterator iter
412 = it1->second.begin(); iter
413 != it1->second.end(); iter++){
419 if(primitiveStructure.mTerminals.find(sinkPinPtr
421 != primitiveStructure.mTerminals.end()){
422 terminals.push_back(sinkPinPtr);
432 if(terminals.size() > 1){
434 +
":" + drivingElementName +
":"
437 for(std::vector<const PrimitiveElementPin*>
438 ::const_iterator iter
440 iter != terminals.end(); iter++){
441 Instance::InstancePinSharedPtrConstIterator
443 ->findPin(torc::physical
444 ::PinName(sourcePinPtr
449 ->getParentWeakPtr().lock();
451 ::InstancePinSharedPtrIterator
456 net->addSource(*netSourceIter);
459 ::InstancePinSharedPtrIterator
464 net->addSink(*netSinkIter);
471 }
else if(terminals.size() == 1){
472 Instance::InstancePinSharedPtrConstIterator pin
475 (terminals.front()->getName()));
477 net = pinPtr->getParentWeakPtr().lock();
483 std::cout <<
"Adding a new net" << std::endl;
485 +
":" + drivingElementName +
":"
492 if(primitiveStructure.mTerminals.find(sourcePinPtr
495 != primitiveStructure.mTerminals.end()) {
496 Instance::InstancePinSharedPtrConstIterator pin1
503 net->removeSink(pin1Ptr);
506 = elementToInstanceMap.find(sourcePinPtr
507 ->getElementPtr())->second;
513 net->addSource(instanceSourcePin);
519 ::const_iterator iter = sinkVector.begin();
520 iter != sinkVector.end(); iter++){
521 if(primitiveStructure.mTerminals.find((*iter)
522 ->getElementPtr()->getName())
523 != primitiveStructure.mTerminals.end()) {
524 Instance::InstancePinSharedPtrConstIterator
527 ((*iter)->getName()));
530 net->removeSource(pin2Ptr);
536 = elementToInstanceMap.find((*iter)
537 ->getElementPtr())->second;
544 net->addSink(instanceSinkPin);
550 oldInstances.push_back(instancePtr);
557 std::cout <<
"-------------------- NEW INSTANCES -------------------" << std::endl;
558 for(instIt = newInstances.begin(); instIt != newInstances.end(); instIt++){
561 std::cout <<
" " << newInstance.
getName() << std::endl;
564 std::cout <<
"-------------------- OLD INSTANCES -------------------" << std::endl;
565 for(instIt = oldInstances.begin(); instIt != oldInstances.end(); instIt++){
568 std::cout <<
" " << oldInstance.
getName() << std::endl;
bool isOutput(void) const
Returns true if this pin is a primitive output.
InstancePinSharedPtrConstIterator sourcesEnd(void) const
Returns the end constant iterator for source instance pins.
bool findNextElement(const PrimitiveStructure &inPrimitiveStructure, const torc::architecture::PrimitiveElement &element, torc::physical::InstanceSharedPtr &inInstancePtr, NameToElementPtrMap &inUsedElements, std::vector< std::string > inInstanceInputPins, CandidateNet &inElementPinsForNet, const torc::architecture::PrimitiveElementPin *&outNetSourcePin, std::vector< torc::physical::InstanceSharedPtr > &outNewInstances, ElementPtrToInstancePtrMap &elementToInstanceMap)
Function to find the next element.
const string & getType(void) const
Returns the logic type for this instance.
Encapsulation of a site pin name.
Encapsulation of primitive site definition, with associated connections, elements, and pins.
static NetSharedPtr newNetPtr(const string &inName, ENetType inNetType=eNetTypeNormal)
Create and return a new Net share pointer.
std::vector< InstancePinSharedPtr > InstancePinSharedPtrVector
Vector of InstancePin shared pointers.
std::map< const torc::architecture::PrimitiveElement *, torc::physical::InstanceSharedPtr > ElementPtrToInstancePtrMap
Map of Primitive Element Pointer to Instance Shared Pointer.
bool isInput(void) const
Returns true if this pin is a primitive input.
Encapsulation of a pin index in an unsigned 32-bit integer.
PinIndex findPinIndexByName(const std::string &inName) const
Returns the pin index corresponding to the given pin name, or PinIndex::undefined() if the pin name d...
boost::shared_ptr< class InstancePin > InstancePinSharedPtr
Shared pointer encapsulation of an InstancePin.
const string & getName(void) const
Returns the pin name.
const string & getName(void) const
Returns the name of the element.
std::map< const torc::architecture::PrimitiveElementPin *, PrimitiveElementPinPtrVector > CandidateNet
Map of Candidate Nets.
std::vector< InstancePinSharedPtr > InstancePinSharedPtrVector
Vector of InstancePin shared pointers.
Physical design instance.
boost::shared_ptr< Net > NetSharedPtr
const PrimitiveElement * getElementPtr(void) const
Returns a pointer to the primitive element that owns this pin.
std::map< std::string, const PrimitiveStructure::PrimitiveElement * > NameToElementPtrMap
Map of Primitive Element Name to Primitive Element.
const string & getName(void) const
Returns the object name.
boost::shared_ptr< Net > NetSharedPtr
Shared pointer encapsulation of a Net.
PrimitivePinArray & getPins(void)
Returns a non-constant array of element pins. This function should only be used by the Sites class d...
boost::shared_ptr< Instance > InstanceSharedPtr
Shared pointer encapsulation of an Instance.
Encapsulation of a primitive pin's name and flags. Primitive pins are logic site inputs or outputs...
Encapsulation of a primitive site element. Primitive elements are subcomponents of logic primitive s...
Encapsulation of a primitive element pin's name, flags, and element pointer. Primitive element pins ...
PrimitiveStructuresSharedPtrMap mPrimitiveStructures
T * begin(void)
Returns the non-constant begin iterator.
DesignSharedPtr mDesignPtr
static InstancePinSharedPtr newInstancePinPtr(InstanceSharedPtr inInstancePtr, const string &inPinName)
Construct and return a new InstancePin shared pointer.
std::vector< const PrimitiveElementPin * > PrimitiveElementPinPtrVector
Vector of constant PrimitiveElementPin pointers.
boost::shared_ptr< InstancePin > InstancePinSharedPtr
Shared pointer encapsulation of an InstancePin.