torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
VerilogExample.cpp
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 Example program to read in a structural Verilog file and write it back out.
18 
19 #include "torc/Generic.hpp"
20 #include <fstream>
21 
22 /// \brief Standard main() function.
23 int main(int argc, char* argv[]) {
24 
25  // import the XDL design
26  if(argc < 2) return 0;
27  std::string inFileName(argv[1]);
29  //importer(inFileName); // if no other parameters are required
30  importer(inFileName, "-v cp65npksdst.v"); // if a cell library or other parameters are required
31 
32  // look up the design (and do something with it ...)
33  torc::generic::RootSharedPtr rootPtr = importer.getRootPtr();
34 
35  torc::generic::VerilogExporter exporter(rootPtr);
36  exporter(boost::filesystem::path("output.v"));
37 
38  return 0;
39 }
Importer from structural verilog format into a generic design.
Main torc::generic namespace header.
std::string string
boost::filesystem::path path
int main(int argc, char *argv[])
Standard main() function.
Exporter from a generic netlist into structural verilog.
RootSharedPtr getRootPtr(void)
Returns a shared pointer for the root.
boost::shared_ptr< Root > RootSharedPtr