00001 // Torc - Copyright 2011 University of Southern California. All Rights Reserved. 00002 // $HeadURL: https://torc-isi.svn.sourceforge.net/svnroot/torc-isi/branches/staging/0.9/src/torc/packer/Virtex2PrimitiveStructure.cpp $ 00003 // $Id: Virtex2PrimitiveStructure.cpp 10 2011-10-12 18:40:16Z nsteiner $ 00004 00005 // This program is free software: you can redistribute it and/or modify it under the terms of the 00006 // GNU General Public License as published by the Free Software Foundation, either version 3 of the 00007 // License, or (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 00010 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 00011 // the GNU General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License along with this program. If 00014 // not, see <http://www.gnu.org/licenses/>. 00015 00016 /// \file 00017 /// \brief Source for the Virtex2PrimitiveStructure class. 00018 00019 #include "torc/packer/Virtex2PrimitiveStructure.hpp" 00020 #include <iostream> 00021 00022 namespace torc { 00023 namespace packer { 00024 00025 using namespace torc::architecture; 00026 /// \brief The type name of slice primitives 00027 const std::string cSliceTypeName = "SLICE"; 00028 /// \brief The name of the BYINVOUTUSED slice element 00029 const std::string cByInvOutUsedElementName = "BYINVOUTUSED"; 00030 00031 void Virtex2PrimitiveStructure::initialize(void) { 00032 // look up the SLICE BYINVOUTUSED element 00033 if(mPrimitiveDefPtr->getName() == cSliceTypeName) { 00034 // look for the BYINVOUTUSED element 00035 const PrimitiveElementArray& elements = mPrimitiveDefPtr->getElements(); 00036 PrimitiveElementArray::const_iterator ep = elements.begin(); 00037 PrimitiveElementArray::const_iterator ee = elements.end(); 00038 while(ep < ee) { 00039 const PrimitiveElement& element = *ep++; 00040 if(element.getName() != cByInvOutUsedElementName) continue; 00041 // look for the one and only input pin, and add it to the inverted inputs set 00042 PrimitiveElementPinArray elementPins = element.getPins(); 00043 PrimitiveElementPinArray::const_iterator pp = elementPins.begin(); 00044 PrimitiveElementPinArray::const_iterator pe = elementPins.end(); 00045 while(pp < pe) { if(pp->isInput()) mInvertedInputs.insert(&*pp); pp++; } 00046 } 00047 } 00048 00049 // oops: I need to structure things differently, because the base class has already invoked this 00050 // // proceed with the base class functionality 00051 // PrimitiveStructure::initialize(); 00052 } 00053 00054 } // namespace architecture 00055 } // namespace torc