torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LibGenFactory.hpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL: https://svn.east.isi.edu/torc/trunk/src/torc/bitstream/assembler/lut/parser.yy $
3 // $Id: parser.yy 1303 2013-02-25 23:18:16Z nsteiner $
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 Factory.h
17 /// \brief Returns appropriate bitstream assembler object
18 // \author Ritesh Kumar Soni
19 
20 #ifndef TORC_BITSTREAM_ASSEMBLER_ASSEMBLERFACTORY_HPP
21 #define TORC_BITSTREAM_ASSEMBLER_ASSEMBLERFACTORY_HPP
22 
24 #include "AssemblerLibGen.hpp"
25 #include "Virtex5LibGen.hpp"
26 #include "Virtex7LibGen.hpp"
27 #include <boost/algorithm/string.hpp>
28 #include <boost/smart_ptr.hpp>
29 
30 namespace torc {
31 namespace bitstream {
32 
33  typedef boost::shared_ptr<AssemblerLibGen> AssemblerLibGenSharedPtr;
37 
38  /// \brief Helper class for bitstreams.
39  class LibGenFactory {
40  public:
41  static AssemblerLibGenSharedPtr newLibGenPtr(string inFamily, path inXdlGenerationFolder) {
42  AssemblerLibGenSharedPtr libGenPtr;
43  path harnessFolder("torc/bitstream/assembler/build/harness");
44  // instantiate the appropriate bitstream
45  if(boost::iequals(inFamily, "virtex5")) {
46  libGenPtr = AssemblerLibGenSharedPtr(new Virtex5LibGen("xc5vlx110t", harnessFolder, inXdlGenerationFolder));
47  } else if( boost::iequals(inFamily, "virtex7") || boost::iequals(inFamily, "artix7") ||
48  boost::iequals(inFamily, "kintex7") || boost::iequals(inFamily, "zynq7") ) {
49  libGenPtr = AssemblerLibGenSharedPtr(new Virtex7LibGen("xc7a100t", harnessFolder, inXdlGenerationFolder));
50  } else {
51  std::cout << "WARNING: Unsupported device" << std::endl;
52  }
53  return libGenPtr;
54  }
55  };
56 
57 } // namespace bitstream
58 } // namespace torc
59 
60 #endif // TORC_BITSTREAM_ASSEMBLER_ASSEMBLERFACTORY_HPP
Encapsulation of a device designator and its constituent elements.
torc::common::DeviceDesignator DeviceDesignator
Helper class for bitstreams.
boost::shared_ptr< AssemblerLibGen > AssemblerLibGenSharedPtr
std::string string
Header for the Bitstream class.
boost::filesystem::path path
static AssemblerLibGenSharedPtr newLibGenPtr(string inFamily, path inXdlGenerationFolder)