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/architecture/XdlImporter.cpp $ 00003 // $Id: XdlImporter.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 XdlImporter class. 00018 00019 #include "torc/architecture/XdlImporter.hpp" 00020 #include "torc/common/DeviceDesignator.hpp" 00021 00022 namespace torc { 00023 namespace architecture { 00024 00025 void XdlImporter::initializeDatabase(void) { 00026 torc::common::DeviceDesignator deviceDesignator(mDesignDevice + mDesignPackage 00027 + mDesignSpeedGrade); 00028 mDDBPtr = new DDB(deviceDesignator); 00029 } 00030 00031 void XdlImporter::bind(torc::physical::InstancePinSharedPtr& inInstancePin) { 00032 if(!mDDBPtr) return; 00033 INSTANCE_PIN_PHYSICAL_TO_ARCHITECTURE(inInstancePin)->updateTilewire(*mDDBPtr); 00034 } 00035 00036 void XdlImporter::bind(torc::physical::Pip& inPip, EPipType inPipType) { 00037 if(!mDDBPtr) return; 00038 /// \todo Add routethrough usage support. 00039 if(inPipType == ePipTypeRoutethrough) return; // we don't support routethroughs yet 00040 torc::physical::TileName tileName = inPip.getTileName(); 00041 torc::physical::WireName sourceWireName = inPip.getSourceWireName(); 00042 torc::physical::WireName sinkWireName = inPip.getSinkWireName(); 00043 // the pip directions defined in the XDL seem not to follow XDLRC conventions 00044 switch(inPip.getDirection()) { 00045 case torc::physical::ePipBidirectionalUnbuffered: 00046 //std::cerr << inPip.getDirectionString() << std::endl; 00047 case torc::physical::ePipBidirectionalUnidirectionallyBuffered: 00048 //std::cerr << inPip.getDirectionString() << std::endl; 00049 case torc::physical::ePipBidirectionalBidirectionallyBuffered: 00050 //std::cerr << inPip.getDirectionString() << std::endl; 00051 try { 00052 mDDBPtr->useArc(mDDBPtr->tilePipToArc(tileName, sinkWireName, sourceWireName)); 00053 } catch(InvalidArcException& iae) { 00054 std::cerr << "WARNING: Arc " << iae.mArc << " is invalid." << std::endl; 00055 } 00056 // fall through to include opposite direction arc 00057 case torc::physical::ePipUnidirectionalBuffered: 00058 //std::cerr << inPip.getDirectionString() << std::endl; 00059 try { 00060 mDDBPtr->useArc(mDDBPtr->tilePipToArc(tileName, sourceWireName, sinkWireName)); 00061 } catch(InvalidArcException& iae) { 00062 std::cerr << "WARNING: Arc " << iae.mArc << " is invalid." << std::endl; 00063 } 00064 default: 00065 break; 00066 } 00067 } 00068 00069 } // namespace architecture 00070 } // namespace torc