torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BitAssemblerExample.cpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL: https://svn.code.sf.net/p/torc-isi/code/branches/staging/1.0/src/torc/examples/ArchitectureExample.cpp $
3 // $Id: ArchitectureExample.cpp 12 2011-10-13 15:44:09Z 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 BitAssemblerExample.cpp
17 /// \brief Example to show usage of bitassembler classes.
18 /// \author Ritesh Kumar Soni
19 
22 #include "torc/Physical.hpp"
24 
25 int main(int argc, char **argv) {
26 
27  if(argc != 2) {
28  std::cerr << "Usage: " << argv[0] << " <XDL file path>" << std::endl;
29  return -1;
30  }
31 
32  // Open the XDL file and check if it opens successfully
33  std::string xdlFilePath(argv[1]);
34  std::fstream xdlFileStream(xdlFilePath.c_str());
35  if(!xdlFileStream.good()) {
36  std::cout << "Could not open file " << xdlFilePath << std::endl;
37  return -1;
38  }
39 
40  // Initialize the DirectoryTree class
41  torc::common::DirectoryTree directoryTree(argv[0]);
42 
43  // Import the XDL file
45  importer(xdlFileStream, "XdlDesignExample");
46  // Get the design pointer
47  torc::physical::DesignSharedPtr designPtr = importer.getDesignPtr();
48 
49  torc::architecture::DDB ddb(designPtr->getDevice());
50 
51  boost::filesystem::path customBitFile = xdlFilePath;
52  customBitFile.replace_extension(".custombit");
53 
54  boost::filesystem::path baseBitstreamPath = xdlFilePath;
55  baseBitstreamPath.replace_extension(".bit");
56  // Create bitstream assembler object
59  assemblerPtr->generateBitstream(designPtr, customBitFile);
60 }
Device database, including complete wiring and logic support.
Definition: DDB.hpp:42
DesignSharedPtr getDesignPtr(void)
Returns a shared pointer for the design.
Header for the DirectoryTree class.
static AssemblerSharedPtr newAssemblerPtr(torc::physical::DesignSharedPtr xdlDesignPtr, torc::architecture::DDB &inDB)
Base class for Xdl to bitstream conversion. This class is abstract but still contains lot of architec...
std::string string
int main(int argc, char **argv)
Main torc::physical namespace header.
Encapsulation of filesystem paths that are used by the library.
boost::filesystem::path path
boost::shared_ptr< Design > DesignSharedPtr
Shared pointer encapsulation of a Design.
Importer from XDL format into a physical design.
boost::shared_ptr< Assembler > AssemblerSharedPtr
Typedef for shared pointer of Assembler class.
Definition: Assembler.hpp:345