torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Package.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 Package class.
18 
19 #ifndef TORC_ARCHITECTURE_PACKAGE_HPP
20 #define TORC_ARCHITECTURE_PACKAGE_HPP
21 
25 #include <map>
26 
27 namespace torc {
28 namespace architecture {
29 
30  namespace architecture { class PackageUnitTest; }
31 
32  /// \brief Encapsulation of a physical device package and its pins.
33  class Package {
34  protected:
35  // friends
36  /// \brief The Sites class has access to our internals.
37  friend class Sites;
38  /// \brief Our unit test class has access to our internals.
40  // types
41  typedef std::string string; ///< \brief Imported type name.
42  typedef xilinx::PadIndex PadIndex; ///< \brief Imported type name.
43  /// \brief A map from pad names to pad indexes.
44  typedef std::map<std::string, PadIndex> PadNameToPadIndexMap;
45  // members
46  /// \brief The package name.
47  string mName;
48  /// \brief The array of pads for this package.
50  /// \brief The map from pad names to corresponding map indexes.
52  // constructors
53  /// \brief Protected constructor
54  Package(const string& inName) : mName(inName), mPads() {}
55  // accessors
56  /// \brief Returns a non-constant array of package pads
57  PadArray& getPads(void) { return mPads; }
58  public:
59  // constructors
60  /// \brief Null constructor.
61  Package(void) : mName(), mPads() {}
62  // accessors
63  /// \brief Returns the package name.
64  const string& getName(void) const { return mName; }
65  /// \brief Returns a constant array of package pads
66  const PadArray& getPads(void) const { return mPads; }
67  // functions
68  /// \brief Returns the pad index corresponding to the given pad name.
69  PadIndex findPadIndexByName(const string& inName) const {
70  PadNameToPadIndexMap::const_iterator p = mPadNameToPadIndex.find(inName);
71  return (p == mPadNameToPadIndex.end()) ? PadIndex(-1) : p->second;
72  }
73  };
74 
75 } // namespace architecture
76 } // namespace torc
77 
78 #endif // TORC_ARCHITECTURE_PACKAGE_HPP
Encapsulation of a physical device package and its pins.
Definition: Package.hpp:33
PadNameToPadIndexMap mPadNameToPadIndex
The map from pad names to corresponding map indexes.
Definition: Package.hpp:51
string mName
The package name.
Definition: Package.hpp:47
std::map< std::string, PadIndex > PadNameToPadIndexMap
A map from pad names to pad indexes.
Definition: Package.hpp:44
const string & getName(void) const
Returns the package name.
Definition: Package.hpp:64
friend class torc::architecture::architecture::PackageUnitTest
Our unit test class has access to our internals.
Definition: Package.hpp:39
PadArray mPads
The array of pads for this package.
Definition: Package.hpp:49
std::string string
Site type and population data for the family and the device.
Definition: Sites.hpp:45
Header for the Pad class.
const PadArray & getPads(void) const
Returns a constant array of package pads.
Definition: Package.hpp:66
std::string string
Imported type name.
Definition: Package.hpp:41
xilinx::PadIndex PadIndex
Imported type name.
Definition: Package.hpp:42
Header for the Array class.
PadIndex findPadIndexByName(const string &inName) const
Returns the pad index corresponding to the given pad name.
Definition: Package.hpp:69
PadArray & getPads(void)
Returns a non-constant array of package pads.
Definition: Package.hpp:57
Package(void)
Null constructor.
Definition: Package.hpp:61
Package(const string &inName)
Protected constructor.
Definition: Package.hpp:54
Encapsulation of a pad index in an unsigned 32-bit integer.
Device database types for Xilinx architectures.