torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Site.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 Site class.
18 
19 #ifndef TORC_ARCHITECTURE_SITE_HPP
20 #define TORC_ARCHITECTURE_SITE_HPP
21 
25 
26 namespace torc {
27 namespace architecture {
28 
29  /// \brief Encapsulation of a device logic site.
30  class Site {
31  protected:
32  // friends
33  /// \brief The Sites class has access to our internals.
34  friend class Sites;
35  // types
36  typedef std::string string; ///< \brief Imported type name.
37  typedef xilinx::PinIndex PinIndex; ///< \brief Imported type name.
38  typedef xilinx::TileIndex TileIndex; ///< \brief Imported type name.
39  typedef xilinx::WireIndex WireIndex; ///< \brief Imported type name.
40  typedef xilinx::SiteFlags SiteFlags; ///< \brief Imported type name.
41  public:
42  // types
43  /// \brief Array of constant wire indexes.
45  protected:
46  // members
47  /// \brief The logic site name.
48  string mName;
49  /// \brief Pointer to the associated primitive definition.
51  /// \brief The index of the containing tile.
53  /// \brief The flags associated with this site.
55  /// \brief The pin to wire map for this site.
57  // constructors
58  /// \brief Protected constructor.
59  Site(const string& inName, const PrimitiveDef& inPrimitiveDef,
60  TileIndex inTileIndex, SiteFlags inFlags, const WireIndexArray& inPinMap)
61  : mName(inName), mPrimitiveDefPtr(&inPrimitiveDef), mTileIndex(inTileIndex),
62  mFlags(inFlags), mPinMapPtr(&inPinMap) {
63  }
64  public:
65  // constructors
66  /// \brief Null constructor (for use in containers only).
68  // functions
69  /// \brief Returns the Tilewire associated with the specified pin name.
70  const Tilewire getPinTilewire(const std::string& inName) const {
71  if(mPrimitiveDefPtr == 0) return Tilewire::sInvalid;
72  PinIndex pinIndex = mPrimitiveDefPtr->findPinIndexByName(inName);
73  if(pinIndex.isUndefined()) return Tilewire::sInvalid;
74  if(mPinMapPtr == 0) return Tilewire::sInvalid;
75  return Tilewire(mTileIndex, (*mPinMapPtr)[pinIndex]);
76  }
77  // accessors
78  /// \brief Returns the site name.
79  const string& getName(void) const { return mName; }
80  /// \brief Returns a pointer to the associated primitive definition.
81  const PrimitiveDef* getPrimitiveDefPtr(void) const { return mPrimitiveDefPtr; }
82  /// \brief Returns the index of the containing tile.
83  TileIndex getTileIndex(void) const { return mTileIndex; }
84  /// \brief Returns the flags associated with this site.
85  SiteFlags getFlags(void) const { return mFlags; }
86  /// \brief Returns the pin to wire map for this site.
87  const WireIndexArray* getPinMapPtr(void) const { return mPinMapPtr; }
88  };
89 
90 } // namespace architecture
91 } // namespace torc
92 
93 #endif // TORC_ARCHITECTURE_SITE_HPP
Array< const WireIndex > WireIndexArray
Array of constant wire indexes.
Definition: Site.hpp:44
Encapsulation of a tile index in an unsigned 32-bit integer.
xilinx::TileIndex TileIndex
Imported type name.
Definition: Site.hpp:38
const PrimitiveDef * mPrimitiveDefPtr
Pointer to the associated primitive definition.
Definition: Site.hpp:50
const PrimitiveDef * getPrimitiveDefPtr(void) const
Returns a pointer to the associated primitive definition.
Definition: Site.hpp:81
TileIndex mTileIndex
The index of the containing tile.
Definition: Site.hpp:52
SiteFlags mFlags
The flags associated with this site.
Definition: Site.hpp:54
Encapsulation of primitive site definition, with associated connections, elements, and pins.
Site(const string &inName, const PrimitiveDef &inPrimitiveDef, TileIndex inTileIndex, SiteFlags inFlags, const WireIndexArray &inPinMap)
Protected constructor.
Definition: Site.hpp:59
std::string string
Imported type name.
Definition: Site.hpp:36
const Tilewire getPinTilewire(const std::string &inName) const
Returns the Tilewire associated with the specified pin name.
Definition: Site.hpp:70
xilinx::SiteFlags SiteFlags
Imported type name.
Definition: Site.hpp:40
Encapsulation of a pin index in an unsigned 32-bit integer.
Encapsulation of a wire index in an unsigned 16-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...
std::string string
SiteFlags getFlags(void) const
Returns the flags associated with this site.
Definition: Site.hpp:85
Encapsulation of a device logic site.
Definition: Site.hpp:30
Site type and population data for the family and the device.
Definition: Sites.hpp:45
Encapsulation of a device tile and wire pair.
Definition: Tilewire.hpp:39
const string & getName(void) const
Returns the site name.
Definition: Site.hpp:79
Header for the PrimitiveDef class.
TileIndex getTileIndex(void) const
Returns the index of the containing tile.
Definition: Site.hpp:83
xilinx::PinIndex PinIndex
Imported type name.
Definition: Site.hpp:37
Header for the Tilewire class.
Encapsulation of site attribute flags in an unsigned 16-bit integer.
static const Tilewire sInvalid
Definition: Tilewire.hpp:93
Site(void)
Null constructor (for use in containers only).
Definition: Site.hpp:67
const WireIndexArray * getPinMapPtr(void) const
Returns the pin to wire map for this site.
Definition: Site.hpp:87
const WireIndexArray * mPinMapPtr
The pin to wire map for this site.
Definition: Site.hpp:56
xilinx::WireIndex WireIndex
Imported type name.
Definition: Site.hpp:39
string mName
The logic site name.
Definition: Site.hpp:48
Encapsulation of a static array.
Definition: Array.hpp:39
Device database types for Xilinx architectures.