torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PrimitiveElementPin.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 PrimitiveElementPin class.
18 
19 #ifndef TORC_ARCHITECTURE_PRIMITIVEELEMENTPIN_HPP
20 #define TORC_ARCHITECTURE_PRIMITIVEELEMENTPIN_HPP
21 
25 #include <boost/shared_ptr.hpp>
26 #include <string>
27 #include <vector>
28 
29 namespace torc {
30 namespace architecture {
31 
32  namespace architecture { class PrimitiveElementPinUnitTest; }
33 
34  // forward declarations
35  class PrimitiveElement;
37  typedef boost::shared_ptr<const PrimitiveConn> PrimitiveConnSharedPtr;
38 
39  /// \brief Encapsulation of a primitive element pin's name, flags, and element pointer.
40  /// \detail Primitive element pins are sub-site inputs or outputs.
42  protected:
43  // friends
44  /// \brief The Sites class has access to our internals.
45  friend class Sites;
46  /// \brief Our unit test class has access to our internals.
48  // types
49  typedef xilinx::PinFlags PinFlags; ///< \brief Imported type name.
50  typedef std::string string; ///< \brief Imported type name.
51  // members
52  /// \brief The primitive element that owns this pin.
54  /// \brief The pin name.
55  string mName;
56  /// \brief The pin direction flags.
57  /// \see PinDirection.
59  /// \brief The primitive connection that includes this pin.
61  // constructors
62  /// \brief Protected constructor.
63  /// \parameter inElementPtr The primitive element that owns this pin.
64  /// \parameter inName The pin name.
65  /// \parameter inFlags The pin direction flags.
66  PrimitiveElementPin(const PrimitiveElement* inElementPtr, const std::string& inName,
67  PinFlags inFlags) : mElementPtr(inElementPtr), mName(inName), mFlags(inFlags) {}
68  public:
69  // accessors
70  /// \brief Returns a pointer to the primitive element that owns this pin.
71  const PrimitiveElement* getElementPtr(void) const { return mElementPtr; }
72  /// \brief Returns the pin name.
73  const string& getName(void) const { return mName; }
74  /// \brief Returns the pin direction flags.
75  PinFlags getFlags(void) const { return mFlags; }
76  /// \brief Returns the primitive connection that includes this pin.
78  /// \brief Null constructor.
79  /// \detail This constructor should only be used by containers.
81  /// \brief Returns true if this pin is a primitive input.
82  bool isInput(void) const { return (mFlags & ePinDirectionInput) != 0; }
83  /// \brief Returns true if this pin is a primitive output.
84  bool isOutput(void) const { return (mFlags & ePinDirectionOutput) != 0; }
85  };
86 
87  /// \brief Array of constant PrimitiveElementPin objects.
89 
90  /// \brief Vector of constant PrimitiveElementPin pointers.
91  typedef std::vector<const PrimitiveElementPin*> PrimitiveElementPinPtrVector;
92 
93 } // namespace architecture
94 } // namespace torc
95 
96 #endif // TORC_ARCHITECTURE_PRIMITIVEELEMENTPIN_HPP
bool isOutput(void) const
Returns true if this pin is a primitive output.
PrimitiveElementPin(void)
Null constructor. This constructor should only be used by containers.
const PrimitiveElement * mElementPtr
The primitive element that owns this pin.
const PrimitiveConnSharedPtr getPrimitiveConn(void) const
Returns the primitive connection that includes this pin.
std::string string
Imported type name.
PinFlags getFlags(void) const
Returns the pin direction flags.
const PrimitiveConnSharedPtr mPrimitiveConn
The primitive connection that includes this pin.
PinFlags mFlags
The pin direction flags.
const string & getName(void) const
Returns the pin name.
std::string string
bool isInput(void) const
Returns true if this pin is a primitive input.
Site type and population data for the family and the device.
Definition: Sites.hpp:45
Encapsulation of a PrimitiveDef internal connection. This class is analogous to a permanent net with...
const PrimitiveElement * getElementPtr(void) const
Returns a pointer to the primitive element that owns this pin.
Array< const PrimitiveElementPin > PrimitiveElementPinArray
Array of constant PrimitiveElementPin objects.
xilinx::PinFlags PinFlags
Imported type name.
Header for the PrimitivePin class.
Encapsulation of pin attribute flags in an unsigned 16-bit integer.
boost::shared_ptr< const PrimitiveConn > PrimitiveConnSharedPtr
PrimitiveElementPin(const PrimitiveElement *inElementPtr, const std::string &inName, PinFlags inFlags)
Protected constructor. inElementPtr The primitive element that owns this pin. inName The pin name...
Encapsulation of a primitive site element. Primitive elements are subcomponents of logic primitive s...
Header for the Array class.
Encapsulation of a primitive element pin's name, flags, and element pointer. Primitive element pins ...
std::vector< const PrimitiveElementPin * > PrimitiveElementPinPtrVector
Vector of constant PrimitiveElementPin pointers.
friend class torc::architecture::architecture::PrimitiveElementPinUnitTest
Our unit test class has access to our internals.
Device database types for Xilinx architectures.