torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PrimitiveElement.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 PrimitiveElement class.
18 
19 #ifndef TORC_ARCHITECTURE_PRIMITIVEELEMENT_HPP
20 #define TORC_ARCHITECTURE_PRIMITIVEELEMENT_HPP
21 
25 #include <boost/cstdint.hpp>
26 #include <map>
27 #include <set>
28 
29 namespace torc {
30 namespace architecture {
31 
32  namespace architecture { class PrimitiveElementUnitTest; }
33 
34  /// \brief Encapsulation of a primitive site element.
35  /// \detail Primitive elements are subcomponents of logic primitive sites.
37  public:
38  // types
39  /// \brief A set of configuration values.
40  typedef std::set<std::string> StringSet;
41  protected:
42  // friends
43  /// \brief The Sites class has access to our internals.
44  friend class Sites;
45  /// \brief Our unit test class has access to our internals.
47  // types
48  typedef xilinx::PinIndex PinIndex; ///< \brief Imported type name.
49  typedef std::string string; ///< \brief Imported type name.
50  /// \brief Map of pin names to pin indexes for a primitive element.
51  typedef std::map<std::string, PinIndex> PinNameToPinIndexMap;
52  // members
53  /// \brief The element name.
54  string mName;
55  /// \brief The array of pins.
57  /// \brief The set of allowable configuration values.
59  /// \brief A flag indicating whether or not this element is a BEL (Basic ELement).
60  bool mIsBel;
61  /// \brief The map of pin names to pin indexes.
63  // accessors
64  /// \brief Returns a non-constant array of element pins.
65  /// \detail This function should only be used by the Sites class during database
66  /// iniialization.
68  public:
69  // constructors
70  /// \brief Null constructor.
71  /// \detail This constructor should only be used by containers.
73  // functions
74  /// \brief Returns the pin index corresponding to the given pin name, or
75  /// PinIndex::undefined() if the pin name does not exist.
76  /// \parameter inName The pin name to find.
77  PinIndex findPinIndexByName(const string& inName) const {
78  PinNameToPinIndexMap::const_iterator p = mPinNameToPinIndex.find(inName);
79  return (p == mPinNameToPinIndex.end())
80  ? PinIndex(PinIndex::undefined()) : p->second;
81  }
82  // accessors
83  /// \brief Returns the name of the element.
84  const string& getName(void) const { return mName; }
85  /// \brief Returns a constant array of element pins.
86  const PrimitiveElementPinArray& getPins(void) const { return mPins; }
87  /// \brief Returns the set of allowable configuration values.
88  const StringSet& getCfgs(void) const { return mCfgs; }
89  /// \brief Returns true if this element is a BEL (Basic ELement).
90  bool isBel(void) const { return mIsBel; }
91  };
92 
93  /// \brief Array of constant PrimitiveElement objects.
95 
96 } // namespace architecture
97 } // namespace torc
98 
99 #endif // TORC_ARCHITECTURE_PRIMITIVEELEMENT_HPP
PrimitiveElementPinArray mPins
The array of pins.
xilinx::PinIndex PinIndex
Imported type name.
PinNameToPinIndexMap mPinNameToPinIndex
The map of pin names to pin indexes.
PinIndex findPinIndexByName(const string &inName) const
Returns the pin index corresponding to the given pin name, or PinIndex::undefined() if the pin name d...
std::string string
Imported type name.
const PrimitiveElementPinArray & getPins(void) const
Returns a constant array of element pins.
Encapsulation of a pin index in an unsigned 32-bit integer.
bool isBel(void) const
Returns true if this element is a BEL (Basic ELement).
std::string string
const string & getName(void) const
Returns the name of the element.
PrimitiveElementPinArray & getPins(void)
Returns a non-constant array of element pins. This function should only be used by the Sites class d...
StringSet mCfgs
The set of allowable configuration values.
Site type and population data for the family and the device.
Definition: Sites.hpp:45
PrimitiveElement(void)
Null constructor. This constructor should only be used by containers.
Array< const PrimitiveElement > PrimitiveElementArray
Array of constant PrimitiveElement objects.
std::map< std::string, PinIndex > PinNameToPinIndexMap
Map of pin names to pin indexes for a primitive element.
Encapsulation of a primitive site element. Primitive elements are subcomponents of logic primitive s...
Header for the Array class.
std::set< std::string > StringSet
A set of configuration values.
const StringSet & getCfgs(void) const
Returns the set of allowable configuration values.
friend class torc::architecture::architecture::PrimitiveElementUnitTest
Our unit test class has access to our internals.
Header for the PrimitiveElementPin class.
bool mIsBel
A flag indicating whether or not this element is a BEL (Basic ELement).
Device database types for Xilinx architectures.