00001 // Torc - Copyright 2011 University of Southern California. All Rights Reserved. 00002 // $HeadURL: https://svn.east.isi.edu/torc/trunk/src/torc/physical/Pip.hpp $ 00003 // $Id: Pip.hpp 380 2011-02-23 04:05:26Z 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 Header for the Pip class. 00018 00019 #ifndef TORC_PHYSICAL_PIP_HPP 00020 #define TORC_PHYSICAL_PIP_HPP 00021 00022 #include "torc/physical/Progeny.hpp" 00023 #include "torc/physical/Routethrough.hpp" 00024 #include <string> 00025 #include <vector> 00026 #include <boost/smart_ptr.hpp> 00027 00028 namespace torc { 00029 namespace physical { 00030 00031 /// \brief Physical design programmable interconnect point. 00032 /// \details This class represents a pip (programmable interconnect point) on a physical design 00033 // net. 00034 class Pip : public Progeny<class Net> { 00035 // friends 00036 /// \brief The Factory class has direct access to our internals. 00037 friend class Factory; 00038 protected: 00039 // types 00040 /// \brief Imported type name. 00041 typedef std::string string; 00042 // members 00043 /// \brief The containing tile for this pip. 00044 TileName mTileName; 00045 /// \brief The source wire for this pip. 00046 WireName mSourceWireName; 00047 /// \brief The sink wire for this pip. 00048 WireName mSinkWireName; 00049 /// \brief The connection directionality for this pip. See EPipDirection. 00050 EPipDirection mDirection; 00051 /// \brief The routethrough shared pointer. 00052 RoutethroughSharedPtr mRoutethroughPtr; 00053 /// \brief String representation of pip directions. 00054 static const char* sPipDirectionStrings[]; 00055 // constructors 00056 /// \brief Protected constructor. 00057 /// \param inTileName The containing tile. 00058 /// \param inSourceWireName The source wire. 00059 /// \param inSinkWireName The sink wire. 00060 /// \param inPipDirection The pip directionality. See EPipDirection. 00061 /// \param inRoutethroughPtr The routethrough shared pointer. 00062 Pip(const string& inTileName, const string& inSourceWireName, const string& inSinkWireName, 00063 EPipDirection inPipDirection, RoutethroughSharedPtr inRoutethroughPtr) 00064 : mTileName(inTileName), mSourceWireName(inSourceWireName), 00065 mSinkWireName(inSinkWireName), mDirection(inPipDirection), 00066 mRoutethroughPtr(inRoutethroughPtr) {} 00067 public: 00068 // static 00069 /// \brief Returns the pip directionality as a string. 00070 static const char* getDirectionString(EPipDirection inPipDirection); 00071 // accessors 00072 /// \brief Returns the pip tile. 00073 const TileName& getTileName(void) const { return mTileName; } 00074 /// \brief Returns the pip source wire. 00075 const WireName& getSourceWireName(void) const { return mSourceWireName; } 00076 /// \brief Returns the pip sink wire. 00077 const WireName& getSinkWireName(void) const { return mSinkWireName; } 00078 /// \brief Returns the pip directionality. 00079 EPipDirection getDirection(void) const { return mDirection; } 00080 /// \brief Returns the pip directionality as a string. 00081 const char* getDirectionString(void) const; 00082 /// \brief Returns the pip's routethrough pointer. 00083 RoutethroughSharedPtr getRoutethroughPtr(void) const { return mRoutethroughPtr; } 00084 // tests 00085 /// \brief Indicates whether or not the pip has an associated routethrough 00086 bool isRoutethrough(void) const { return mRoutethroughPtr.get() != 0; } 00087 // operators 00088 /// \brief Equality operator. 00089 bool operator ==(const Pip& rhs) const 00090 { return mTileName == rhs.mTileName && mSourceWireName == rhs.mSourceWireName 00091 && mSinkWireName == rhs.mSinkWireName && mDirection == rhs.mDirection; } 00092 }; 00093 00094 /// \brief Vector of pips. 00095 typedef std::vector<Pip> PipVector; 00096 00097 /// \brief Shared pointer encapsulation of a Pip. 00098 typedef boost::shared_ptr<Pip> PipSharedPtr; 00099 00100 /// \brief Weak pointer encapsulation of a Pip. 00101 typedef boost::weak_ptr<Pip> PipWeakPtr; 00102 00103 /// \brief Vector of Pip shared pointers. 00104 typedef std::vector<PipSharedPtr> PipSharedPtrVector; 00105 00106 } // namespace physical 00107 } // namespace torc 00108 00109 #endif // TORC_PHYSICAL_PIP_HPP