00001 // Torc - Copyright 2011 University of Southern California. All Rights Reserved. 00002 // $HeadURL: https://svn.east.isi.edu/torc/trunk/src/torc/architecture/OutputStreamHelpers.cpp $ 00003 // $Id: OutputStreamHelpers.cpp 477 2011-06-05 02:15:29Z 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 torc::architecture output stream helpers. 00018 00019 #include "torc/architecture/OutputStreamHelpers.hpp" 00020 #include "torc/architecture/DDB.hpp" 00021 #include "torc/architecture/DDBStreamHelper.hpp" 00022 #include "torc/architecture/Tiles.hpp" 00023 #include "torc/architecture/Tilewire.hpp" 00024 #include "torc/architecture/Arc.hpp" 00025 00026 namespace torc { 00027 namespace architecture { 00028 00029 using namespace torc::architecture::xilinx; 00030 00031 std::ostream& operator <<(std::ostream& os, const Tilewire& rhs) { 00032 const DDB* ddbPtr = DDBStreamHelper::getDDBPtr(os); 00033 if(ddbPtr) { 00034 // the database is available: look up the extended tilewire information 00035 os << ExtendedWireInfo(*ddbPtr, rhs); 00036 } else { 00037 // the database is not available: write out the basic tilewire information 00038 os << rhs.getWireIndex() << "@" << rhs.getTileIndex(); 00039 } 00040 return os; 00041 } 00042 00043 std::ostream& operator <<(std::ostream& os, const ExtendedWireInfo& rhs) { 00044 // handle uninitialized wire info 00045 if(rhs.mTileIndex.isUndefined()) return os << "[UNINITIALIZED]"; 00046 00047 // handle regular wire info 00048 return os << rhs.mWireName << "@[" << rhs.mTileRow << "," << rhs.mTileCol << "] " 00049 << rhs.mTileTypeName << " \"" << rhs.mTileName << "\" (" << rhs.mWireIndex << "@" 00050 << rhs.mTileIndex << ")" 00051 << (WireInfo::isHidden(rhs.mWireFlags) ? " HIDDEN" : "") 00052 << (WireInfo::isInput(rhs.mWireFlags) ? " INPUT" : "") 00053 << (WireInfo::isOutput(rhs.mWireFlags) ? " OUTPUT" : "") 00054 << (WireInfo::isRemote(rhs.mWireFlags) ? " REMOTE" : "") 00055 << (WireInfo::isRemoteNodeCapable(rhs.mWireFlags) ? " REMOTE_NODE_CAPABLE" : "") 00056 << (WireInfo::isRemoteArcCapable(rhs.mWireFlags) ? " REMOTE_ARC_CAPABLE" : "") 00057 ; 00058 } 00059 00060 std::ostream& operator <<(std::ostream& os, const Arc& rhs) { 00061 return os << rhs.getSourceTilewire() << " >> " << rhs.getSinkTilewire(); 00062 } 00063 00064 } // namespace architecture 00065 } // namespace torc