torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PrimitiveDef.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 PrimitiveDef class.
18 
19 #ifndef TORC_ARCHITECTURE_PRIMITIVEDEF_HPP
20 #define TORC_ARCHITECTURE_PRIMITIVEDEF_HPP
21 
24 
25 namespace torc {
26 namespace architecture {
27 
28  /// \brief Encapsulation of primitive site definition, with associated connections, elements,
29  /// and pins.
30  class PrimitiveDef {
31  protected:
32  // friends
33  friend class Sites;
34  // types
35  typedef xilinx::PinIndex PinIndex; ///< \brief Imported type name.
36  typedef std::string string; ///< \brief Imported type name.
37  /// \brief Map of pin names to pin indexes for a primitive element.
38  typedef std::map<std::string, PinIndex> PinNameToPinIndexMap;
39  // elements
40  /// \brief The primitive name.
42  /// \brief The primitive pins.
44  /// \brief The primitive elements.
46  /// \brief The primitive internal connections.
48  /// \brief The map of pin names to pin indexes.
50  // functions
51  /// \brief Returns a non-constant array of element pins.
52  /// \detail This function should only be used by the Sites class during database
53  /// iniialization.
54  PrimitivePinArray& getPins(void) { return mPins; }
55  public:
56  // constructors
57  /// \brief Null constructor.
58  /// \detail This constructor should only be used by containers.
60  // functions
61  /// \brief Returns the pin index corresponding to the given pin name, or
62  /// PinIndex::undefined() if the pin name does not exist.
63  /// \parameter inName The pin name to find.
64  PinIndex findPinIndexByName(const std::string& inName) const {
65  PinNameToPinIndexMap::const_iterator p = mPinNameToPinIndex.find(inName);
66  return (p == mPinNameToPinIndex.end())
67  ? PinIndex(PinIndex::undefined()) : p->second;
68  }
69  // accessors
70  /// \brief Returns the name of the primitive.
71  const string& getName(void) const { return mName; }
72  /// \brief Returns a constant array of primitive pins.
73  const PrimitivePinArray& getPins(void) const { return mPins; }
74  /// \brief Returns a constant array of primitive elements.
75  const PrimitiveElementArray& getElements(void) const { return mElements; }
76  /// \brief Returns a constant array of primitive connection shared pointers.
78  };
79 
80 } // namespace architecture
81 } // namespace torc
82 
83 #endif // TORC_ARCHITECTURE_PRIMITIVEDEF_HPP
PinNameToPinIndexMap mPinNameToPinIndex
The map of pin names to pin indexes.
Header for the PrimitiveElement class.
Encapsulation of primitive site definition, with associated connections, elements, and pins.
std::string mName
The primitive name.
PrimitiveElementArray mElements
The primitive elements.
Encapsulation of a pin index in an unsigned 32-bit integer.
PinIndex findPinIndexByName(const std::string &inName) const
Returns the pin index corresponding to the given pin name, or PinIndex::undefined() if the pin name d...
const PrimitivePinArray & getPins(void) const
Returns a constant array of primitive pins.
std::string string
const PrimitiveConnSharedPtrArray & getConnections(void) const
Returns a constant array of primitive connection shared pointers.
Site type and population data for the family and the device.
Definition: Sites.hpp:45
PrimitiveConnSharedPtrArray mConnections
The primitive internal connections.
Header for the PrimitiveConn class.
PrimitivePinArray & getPins(void)
Returns a non-constant array of element pins. This function should only be used by the Sites class d...
std::string string
Imported type name.
xilinx::PinIndex PinIndex
Imported type name.
const PrimitiveElementArray & getElements(void) const
Returns a constant array of primitive elements.
PrimitivePinArray mPins
The primitive pins.
PrimitiveDef(void)
Null constructor. This constructor should only be used by containers.
std::map< std::string, PinIndex > PinNameToPinIndexMap
Map of pin names to pin indexes for a primitive element.
const string & getName(void) const
Returns the name of the primitive.