torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
AssemblerFactory.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 "Assembler.hpp"
25 #include "Virtex5Assembler.hpp"
26 #include "Virtex7Assembler.hpp"
27 #include <boost/smart_ptr.hpp>
28 
29 namespace torc {
30 namespace bitstream {
31 
32  typedef boost::shared_ptr<Assembler> AssemblerSharedPtr;
34 
35  /// \brief Helper class for bitstreams.
37  public:
39  AssemblerSharedPtr assemblerPtr;
40 
41  // read the header and determine the device family
42  DeviceDesignator designator(xdlDesignPtr->getDevice());
43 
44  // instantiate the appropriate bitstream
45  switch(designator.getFamily()) {
47  assemblerPtr = AssemblerSharedPtr(new Virtex5Assembler(inDB)); break;
52  assemblerPtr = AssemblerSharedPtr(new Virtex7Assembler(inDB)); break;
58  default:
59  std::cerr << "Device " << xdlDesignPtr->getDevice() << " not supported." << std::endl;
60  return assemblerPtr;
61  }
62  return assemblerPtr;
63  }
64  };
65 
66 } // namespace bitstream
67 } // namespace torc
68 
69 #endif // TORC_BITSTREAM_ASSEMBLER_ASSEMBLERFACTORY_HPP
Encapsulation of a device designator and its constituent elements.
torc::common::DeviceDesignator DeviceDesignator
Device database, including complete wiring and logic support.
Definition: DDB.hpp:42
static AssemblerSharedPtr newAssemblerPtr(torc::physical::DesignSharedPtr xdlDesignPtr, torc::architecture::DDB &inDB)
Helper class for bitstreams.
Base class for Xdl to bitstream conversion. This class is abstract but still contains lot of architec...
Header for the Bitstream class.
boost::shared_ptr< Design > DesignSharedPtr
Shared pointer encapsulation of a Design.
boost::shared_ptr< Assembler > AssemblerSharedPtr
Typedef for shared pointer of Assembler class.
Definition: Assembler.hpp:345