torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Pip.hpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL$
3 // $Id$
4 
5 // This program is free software: you can redistribute it and/or modify it under the terms of the
6 // GNU General Public License as published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 // the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program. If
14 // not, see <http://www.gnu.org/licenses/>.
15 
16 /// \file
17 /// \brief Header for the Pip class.
18 
19 #ifndef TORC_PHYSICAL_PIP_HPP
20 #define TORC_PHYSICAL_PIP_HPP
21 
24 #include <string>
25 #include <vector>
26 #include <boost/smart_ptr.hpp>
27 
28 namespace torc {
29 namespace physical {
30 
31  /// \brief Physical design programmable interconnect point.
32  /// \details This class represents a pip (programmable interconnect point) on a physical design
33  // net.
34  class Pip : public Progeny<class Net> {
35  // friends
36  /// \brief The Factory class has direct access to our internals.
37  friend class Factory;
38  protected:
39  // types
40  /// \brief Imported type name.
42  // members
43  /// \brief The containing tile for this pip.
45  /// \brief The source wire for this pip.
47  /// \brief The sink wire for this pip.
49  /// \brief The connection directionality for this pip. See EPipDirection.
51  /// \brief The routethrough shared pointer.
53  /// \brief String representation of pip directions.
54  static const char* sPipDirectionStrings[];
55  // constructors
56  /// \brief Protected constructor.
57  /// \param inTileName The containing tile.
58  /// \param inSourceWireName The source wire.
59  /// \param inSinkWireName The sink wire.
60  /// \param inPipDirection The pip directionality. See EPipDirection.
61  /// \param inRoutethroughPtr The routethrough shared pointer.
62  Pip(const string& inTileName, const string& inSourceWireName, const string& inSinkWireName,
63  EPipDirection inPipDirection, RoutethroughSharedPtr inRoutethroughPtr)
64  : mTileName(inTileName), mSourceWireName(inSourceWireName),
65  mSinkWireName(inSinkWireName), mDirection(inPipDirection),
66  mRoutethroughPtr(inRoutethroughPtr) {}
67  public:
68  // static
69  /// \brief Returns the pip directionality as a string.
70  static const char* getDirectionString(EPipDirection inPipDirection);
71  // accessors
72  /// \brief Returns the pip tile.
73  const TileName& getTileName(void) const { return mTileName; }
74  /// \brief Returns the pip source wire.
75  const WireName& getSourceWireName(void) const { return mSourceWireName; }
76  /// \brief Returns the pip sink wire.
77  const WireName& getSinkWireName(void) const { return mSinkWireName; }
78  /// \brief Returns the pip directionality.
79  EPipDirection getDirection(void) const { return mDirection; }
80  /// \brief Returns the pip directionality as a string.
81  const char* getDirectionString(void) const;
82  /// \brief Returns the pip's routethrough pointer.
84  // tests
85  /// \brief Indicates whether or not the pip has an associated routethrough
86  bool isRoutethrough(void) const { return mRoutethroughPtr.get() != 0; }
87  // operators
88  /// \brief Equality operator.
89  bool operator ==(const Pip& rhs) const
90  { return mTileName == rhs.mTileName && mSourceWireName == rhs.mSourceWireName
91  && mSinkWireName == rhs.mSinkWireName && mDirection == rhs.mDirection; }
92  };
93 
94  /// \brief Vector of pips.
95  typedef std::vector<Pip> PipVector;
96 
97  /// \brief Shared pointer encapsulation of a Pip.
98  typedef boost::shared_ptr<Pip> PipSharedPtr;
99 
100  /// \brief Weak pointer encapsulation of a Pip.
101  typedef boost::weak_ptr<Pip> PipWeakPtr;
102 
103  /// \brief Vector of Pip shared pointers.
104  typedef std::vector<PipSharedPtr> PipSharedPtrVector;
105 
106 } // namespace physical
107 } // namespace torc
108 
109 #endif // TORC_PHYSICAL_PIP_HPP
Pip(const string &inTileName, const string &inSourceWireName, const string &inSinkWireName, EPipDirection inPipDirection, RoutethroughSharedPtr inRoutethroughPtr)
Protected constructor.
Definition: Pip.hpp:62
Encapsulation of a wire name.
bool operator==(const Pip &rhs) const
Equality operator.
Definition: Pip.hpp:89
boost::weak_ptr< Pip > PipWeakPtr
Weak pointer encapsulation of a Pip.
Definition: Pip.hpp:101
Encapsulation of a tile name.
Header for the Routethrough class.
const char * getDirectionString(void) const
Returns the pip directionality as a string.
Definition: Pip.cpp:32
std::string string
const WireName & getSinkWireName(void) const
Returns the pip sink wire.
Definition: Pip.hpp:77
RoutethroughSharedPtr mRoutethroughPtr
The routethrough shared pointer.
Definition: Pip.hpp:52
RoutethroughSharedPtr getRoutethroughPtr(void) const
Returns the pip's routethrough pointer.
Definition: Pip.hpp:83
EPipDirection mDirection
The connection directionality for this pip. See EPipDirection.
Definition: Pip.hpp:50
static const char * sPipDirectionStrings[]
String representation of pip directions.
Definition: Pip.hpp:54
Factory class for physical netlist elements.
boost::shared_ptr< Pip > PipSharedPtr
Shared pointer encapsulation of a Pip.
Definition: Pip.hpp:98
WireName mSourceWireName
The source wire for this pip.
Definition: Pip.hpp:46
Concept for any object that may have a parent.
Definition: Progeny.hpp:29
Header for the Progeny class.
const TileName & getTileName(void) const
Returns the pip tile.
Definition: Pip.hpp:73
EPipDirection getDirection(void) const
Returns the pip directionality.
Definition: Pip.hpp:79
Physical design programmable interconnect point.
Definition: Pip.hpp:34
const WireName & getSourceWireName(void) const
Returns the pip source wire.
Definition: Pip.hpp:75
boost::shared_ptr< Routethrough > RoutethroughSharedPtr
Shared pointer encapsulation of a Routethrough.
TileName mTileName
The containing tile for this pip.
Definition: Pip.hpp:44
std::string string
Imported type name.
Definition: Pip.hpp:41
EPipDirection
Enumeration of pip directionality.
std::vector< PipSharedPtr > PipSharedPtrVector
Vector of Pip shared pointers.
Definition: Pip.hpp:104
bool isRoutethrough(void) const
Indicates whether or not the pip has an associated routethrough.
Definition: Pip.hpp:86
std::vector< Pip > PipVector
Vector of pips.
Definition: Pip.hpp:95
WireName mSinkWireName
The sink wire for this pip.
Definition: Pip.hpp:48