torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Devices.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 Devices class.
18 
19 #ifndef TORC_COMMON_DEVICES_HPP
20 #define TORC_COMMON_DEVICES_HPP
21 
23 #include <boost/algorithm/string.hpp>
24 #include <string>
25 #include <vector>
26 #include <map>
27 
28 namespace torc {
29 namespace common {
30 
31  /// \brief Enumeration of all supported devices.
32  enum EDevice {
34  // Spartan3E
35  // Spartan3E
37  // Spartan6
38  // Spartan6 LX
41  // Spartan6 LXT
43  // Virtex
44  // Virtex
46  // VirtexE
47  // VirtexE
50  // VirtexEM
52  // Virtex2
53  // Virtex2
56  // Virtex2P
57  // Virtex2P
59  // Virtex2P X
61  // Virtex4
62  // Virtex4 FX
64  // Virtex4 LX
67  // Virtex4 SX
69  // Virtex5
70  // Virtex5 FXT
72  // Virtex5 LX
74  // Virtex5 LXT
77  // Virtex5 SXT
79  // Virtex5 TXT
81  // Virtex6
82  // Virtex6 CXT
84  // Virtex6 HXT
86  // Virtex6 LXT
89  // Virtex6 SXT
91  // The 7-Series families have been very volatile:
92  // Artix7:
93  // xc7a8, xc7a15, xc7a30t, xc7a50t were removed from ISE 14.1
94  // xc7a350t was removed from ISE 14.3
95  // Virtex7:
96  // xc7vh290t, xc7vh580t, xc7vh870t were added to ISE 14.1
97  // xc7vh290t, xc7v1500t were removed from ISE 14.3
98  // Artix7
99  // Artix7 T
101  // Kintex7
102  // Kintex7 T
104  // Virtex7
105  // Virtex7 T
107  // Virtex7 HT
109  // Virtex7 XT
111  // Zynq7000
112  // Zynq7000
114  // end
116  };
117 
118  /// \brief Vector of device names.
119  typedef std::vector<std::string> DeviceVector;
120 
121  /// \brief Map of device names.
122  typedef std::map<std::string, enum EDevice> DeviceNameMap;
123 
124  /// \brief Encapsulation of filesystem paths that are used by the library.
125  class Devices {
126  protected:
127  // typedefs
128  /// \brief Imported name.
130  // members
131  /// \brief Virtex devices.
133  /// \brief VirtexE devices.
135  /// \brief Virtex2 devices.
137  /// \brief Virtex2P devices.
139  /// \brief Virtex4 devices.
141  /// \brief Virtex5 devices.
143  /// \brief Virtex6 devices.
145  /// \brief Virtex6L devices.
147  /// \brief Virtex7 devices.
149  /// \brief Kintex7 devices.
151  /// \brief Artix7 devices.
153  /// \brief Zynq7000 devices.
155  /// \brief Spartan3E devices.
157  /// \brief Spartan6 devices.
159  /// \brief All supported devices.
161  /// \brief Unit test device subset.
163  /// \brief Device names.
165  /// \brief Device name to enum map.
167  /// \brief Static instance of this class.
169  // functions
170  /// \brief Add the specified devices to the list of all devices.
171  void addToSupportedDevices(const DeviceVector& inDeviceVector) {
172  mSupportedDevices.insert(mSupportedDevices.end(), inDeviceVector.begin(),
173  inDeviceVector.end());
174  }
175  public:
176  // constructors
177  /// Default constructor.
178  Devices(void);
179  // static accessors
180  /// \brief Returns the Virtex devices.
181  static const DeviceVector& getVirtexDevices(void) { return sDevices.mVirtexDevices; }
182  /// \brief Returns the VirtexE devices.
183  static const DeviceVector& getVirtexEDevices(void) { return sDevices.mVirtexEDevices; }
184  /// \brief Returns the Virtex2 devices.
185  static const DeviceVector& getVirtex2Devices(void) { return sDevices.mVirtex2Devices; }
186  /// \brief Returns the Virtex2P devices.
188  /// \brief Returns the Virtex4 devices.
189  static const DeviceVector& getVirtex4Devices(void) { return sDevices.mVirtex4Devices; }
190  /// \brief Returns the Virtex5 devices.
191  static const DeviceVector& getVirtex5Devices(void) { return sDevices.mVirtex5Devices; }
192  /// \brief Returns the Virtex6 devices.
193  static const DeviceVector& getVirtex6Devices(void) { return sDevices.mVirtex6Devices; }
194  /// \brief Returns the Virtex7 devices.
195  static const DeviceVector& getVirtex7Devices(void) { return sDevices.mVirtex7Devices; }
196  /// \brief Returns the Virtex7L devices.
197  static const DeviceVector& getKintex7Devices(void) { return sDevices.mKintex7Devices; }
198  /// \brief Returns the Artix7 devices.
199  static const DeviceVector& getArtix7Devices(void) { return sDevices.mArtix7Devices; }
200  /// \brief Returns the Zynq7000 devices.
202  /// \brief Returns the Spartan3E devices.
204  /// \brief Returns the Spartan6 devices.
206  /// \brief Returns all devices.
208  /// \brief Returns a subset of devices for unit tests.
210  /// \brief Returns all devices.
211  static const DeviceVector& getDeviceNames(void) { return sDevices.mDeviceNames; }
212  /// \brief Returns the device map.
213  static const DeviceNameMap& getDeviceNameMap(void) { return sDevices.mDeviceNameMap; }
214  // accessors
215  /// \brief Returns the device enumeration corresponding to the given device name.
216  static EDevice getDeviceEnum(const string& inName) {
217  DeviceDesignator designator(inName);
218  std::string name = designator.getDeviceName();
219  const DeviceNameMap& deviceNameMap = getDeviceNameMap();
220  DeviceNameMap::const_iterator p = deviceNameMap.find(name);
221  DeviceNameMap::const_iterator e = deviceNameMap.end();
222  if(p == e) return eDeviceInvalid;
223  return p->second;
224  }
225  /// \brief Returns the device name corresponding to the given enumeration constant.
226  static const string& getDeviceName(EDevice inEnum) {
227  //if(inEnum >= eDeviceCount) return 0;
228  return getDeviceNames()[inEnum];
229  }
230  };
231 
232 } // namespace common
233 } // namespace torc
234 
235 #endif // TORC_COMMON_DEVICES_HPP
static const DeviceVector & getVirtex2PDevices(void)
Returns the Virtex2P devices.
Definition: Devices.hpp:187
static EDevice getDeviceEnum(const string &inName)
Returns the device enumeration corresponding to the given device name.
Definition: Devices.hpp:216
static const DeviceVector & getVirtexEDevices(void)
Returns the VirtexE devices.
Definition: Devices.hpp:183
Encapsulation of a device designator and its constituent elements.
static const DeviceVector & getSpartan6Devices(void)
Returns the Spartan6 devices.
Definition: Devices.hpp:205
static const DeviceVector & getArtix7Devices(void)
Returns the Artix7 devices.
Definition: Devices.hpp:199
EDevice
Enumeration of all supported devices.
Definition: Devices.hpp:32
Devices(void)
Default constructor.
Definition: Devices.cpp:86
Encapsulation of filesystem paths that are used by the library.
Definition: Devices.hpp:125
Header for the DeviceDesignator class.
static Devices sDevices
Static instance of this class.
Definition: Devices.hpp:168
DeviceVector mVirtex6LDevices
Virtex6L devices.
Definition: Devices.hpp:146
DeviceVector mSpartan3EDevices
Spartan3E devices.
Definition: Devices.hpp:156
std::string string
static const DeviceVector & getSupportedDevices(void)
Returns all devices.
Definition: Devices.hpp:207
static const DeviceVector & getVirtex2Devices(void)
Returns the Virtex2 devices.
Definition: Devices.hpp:185
DeviceVector mDeviceNames
Device names.
Definition: Devices.hpp:164
DeviceVector mUnitTestDevices
Unit test device subset.
Definition: Devices.hpp:162
static const DeviceVector & getVirtex5Devices(void)
Returns the Virtex5 devices.
Definition: Devices.hpp:191
static const DeviceVector & getZynq7000Devices(void)
Returns the Zynq7000 devices.
Definition: Devices.hpp:201
static const DeviceVector & getVirtex6Devices(void)
Returns the Virtex6 devices.
Definition: Devices.hpp:193
std::map< std::string, enum EDevice > DeviceNameMap
Map of device names.
Definition: Devices.hpp:122
static const DeviceVector & getSpartan3EDevices(void)
Returns the Spartan3E devices.
Definition: Devices.hpp:203
DeviceVector mVirtex2Devices
Virtex2 devices.
Definition: Devices.hpp:136
static const DeviceVector & getVirtex4Devices(void)
Returns the Virtex4 devices.
Definition: Devices.hpp:189
DeviceVector mVirtex2PDevices
Virtex2P devices.
Definition: Devices.hpp:138
DeviceVector mZynq7000Devices
Zynq7000 devices.
Definition: Devices.hpp:154
DeviceVector mVirtex4Devices
Virtex4 devices.
Definition: Devices.hpp:140
void addToSupportedDevices(const DeviceVector &inDeviceVector)
Add the specified devices to the list of all devices.
Definition: Devices.hpp:171
DeviceVector mVirtexDevices
Virtex devices.
Definition: Devices.hpp:132
DeviceVector mVirtex7Devices
Virtex7 devices.
Definition: Devices.hpp:148
DeviceVector mSupportedDevices
All supported devices.
Definition: Devices.hpp:160
DeviceVector mVirtexEDevices
VirtexE devices.
Definition: Devices.hpp:134
static const DeviceVector & getDeviceNames(void)
Returns all devices.
Definition: Devices.hpp:211
DeviceNameMap mDeviceNameMap
Device name to enum map.
Definition: Devices.hpp:166
const string & getDeviceName(void) const
Returns the device name.
std::string string
Imported name.
Definition: Devices.hpp:129
DeviceVector mArtix7Devices
Artix7 devices.
Definition: Devices.hpp:152
static const DeviceVector & getVirtexDevices(void)
Returns the Virtex devices.
Definition: Devices.hpp:181
std::vector< std::string > DeviceVector
Vector of device names.
Definition: Devices.hpp:119
static const DeviceVector & getVirtex7Devices(void)
Returns the Virtex7 devices.
Definition: Devices.hpp:195
static const DeviceNameMap & getDeviceNameMap(void)
Returns the device map.
Definition: Devices.hpp:213
DeviceVector mVirtex6Devices
Virtex6 devices.
Definition: Devices.hpp:144
static const DeviceVector & getUnitTestDevices(void)
Returns a subset of devices for unit tests.
Definition: Devices.hpp:209
DeviceVector mVirtex5Devices
Virtex5 devices.
Definition: Devices.hpp:142
DeviceVector mKintex7Devices
Kintex7 devices.
Definition: Devices.hpp:150
DeviceVector mSpartan6Devices
Spartan6 devices.
Definition: Devices.hpp:158
static const DeviceVector & getKintex7Devices(void)
Returns the Virtex7L devices.
Definition: Devices.hpp:197
static const string & getDeviceName(EDevice inEnum)
Returns the device name corresponding to the given enumeration constant.
Definition: Devices.hpp:226