torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
architecture/PrimitivePin.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 PrimitivePin class.
18 
19 #ifndef TORC_ARCHITECTURE_PRIMITIVEPIN_HPP
20 #define TORC_ARCHITECTURE_PRIMITIVEPIN_HPP
21 
24 #include <string>
25 
26 namespace torc {
27 namespace architecture {
28 
29  namespace architecture { class PrimitivePinUnitTest; }
30 
31  /// \bried Encapsulation of pin directionality.
32  /// \detail These direction enumerations are obtained from the database build code, and are
33  /// used by the PrimitivePin and PrimitivElementPin classes.
34  class PinDirection {
35  public:
36  // enumerations
39  };
40 
41  /// \brief Encapsulation of a primitive pin's name and flags.
42  /// \detail Primitive pins are logic site inputs or outputs.
43  class PrimitivePin : public PinDirection {
44  protected:
45  // friends
46  /// \brief The Sites class has access to our internals.
47  friend class Sites;
48  /// \brief Our unit test class has access to our internals.
50  // types
51  typedef xilinx::PinFlags PinFlags; ///< \brief Imported type name.
52  typedef std::string string; ///< \brief Imported type name.
53  // members
54  /// \brief The pin name.
55  string mName;
56  /// \brief The pin direction flags.
57  /// \see PinDirection.
59  // constructors
60  /// \brief Protected constructor.
61  /// \parameter inName The pin name.
62  /// \parameter inFlags The pin direction flags.
63  PrimitivePin(const string& inName, PinFlags inFlags) : mName(inName), mFlags(inFlags)
64  {}
65  public:
66  // accessors
67  /// \brief Returns the pin name.
68  const string& getName(void) const { return mName; }
69  /// \brief Returns the pin direction flags.
70  PinFlags getFlags(void) const { return mFlags; }
71  /// \brief Null constructor.
72  /// \detail This constructor should only be used by containers.
73  PrimitivePin(void) : mName(), mFlags() {};
74  /// \brief Returns true if this pin is a primitive input.
75  bool isInput(void) const { return (mFlags & ePinDirectionInput) != 0; }
76  /// \brief Returns true if this pin is a primitive output.
77  bool isOutput(void) const { return (mFlags & ePinDirectionOutput) != 0; }
78  };
79 
80  /// \brief Array of constant PrimitivePin objects.
82 
83 } // namespace architecture
84 } // namespace torc
85 
86 #endif // TORC_ARCHITECTURE_PRIMITIVEPIN_HPP
bool isOutput(void) const
Returns true if this pin is a primitive output.
std::string string
Imported type name.
PinFlags getFlags(void) const
Returns the pin direction flags.
xilinx::PinFlags PinFlags
Imported type name.
bool isInput(void) const
Returns true if this pin is a primitive input.
const string & getName(void) const
Returns the pin name.
std::string string
friend class torc::architecture::architecture::PrimitivePinUnitTest
Our unit test class has access to our internals.
PrimitivePin(const string &inName, PinFlags inFlags)
Protected constructor. inName The pin name. inFlags The pin direction flags.
PinFlags mFlags
The pin direction flags.
Site type and population data for the family and the device.
Definition: Sites.hpp:45
Array< const PrimitivePin > PrimitivePinArray
Array of constant PrimitivePin objects.
Encapsulation of pin attribute flags in an unsigned 16-bit integer.
Encapsulation of a primitive pin's name and flags. Primitive pins are logic site inputs or outputs...
PrimitivePin(void)
Null constructor. This constructor should only be used by containers.
Header for the Array class.
Device database types for Xilinx architectures.