21 #include "torc/externals/verilator/src/V3Ast.h"
22 #include "torc/externals/verilator/src/V3File.h"
23 #include "torc/externals/verilator/src/V3Graph.h"
24 #include "torc/externals/verilator/src/V3LinkCells.h"
25 #include "torc/externals/verilator/src/V3Parse.h"
26 #include "torc/externals/verilator/src/V3PreShell.h"
29 #include <boost/foreach.hpp>
30 #include <boost/tokenizer.hpp>
40 AstNetlist* V3Global::makeNetlist() {
41 AstNetlist* newp =
new AstNetlist();
46 void V3Global::checkTree() {
51 void V3Global::clear() {
52 if (m_rootp) m_rootp->deleteTree(); m_rootp=NULL;
56 void V3Global::readFiles() {
58 V3InFilter filter(
v3Global.opt.pipeFilter());
59 V3Parse parser(
v3Global.rootp(), &filter);
62 for(V3StringList::const_iterator it =
v3Global.opt.vFiles().begin();
63 it !=
v3Global.opt.vFiles().end(); ++it) {
64 string filename = *it;
65 parser.parseFile(
new FileLine(
"COMMAND_LINE",0), filename,
false,
66 "Cannot find file containing module: ");
71 for(V3StringSet::const_iterator it =
v3Global.opt.libraryFiles().begin();
72 it !=
v3Global.opt.libraryFiles().end(); ++it) {
73 string filename = *it;
74 parser.parseFile(
new FileLine(
"COMMAND_LINE",0), filename,
true,
75 "Cannot find file containing library module: ");
80 V3Error::abortIfErrors();
83 if(!
v3Global.opt.preprocOnly()) V3LinkCells::link(
v3Global.rootp(), &filter);
106 + inFilename.string()
108 +
"-Itorc/externals/verilator/include "
114 boost::char_separator<char> sep(
" ");
115 boost::tokenizer< boost::char_separator<char> > tokens(input, sep);
116 typedef boost::token_iterator_generator< boost::char_separator<char> >::type Iterator;
117 Iterator p = boost::make_token_iterator<string>(input.begin(), input.end(), sep);
118 Iterator e = boost::make_token_iterator<string>(input.end(), input.end(), sep);
119 while(p != e) { *p++; argc++; }
124 BOOST_FOREACH(
const string& t, tokens) { argv[argc++] = strdup(t.c_str()); }
128 ios::sync_with_stdio();
131 V3PreShell::boot(env);
135 string argString = V3Options::argString(argc-1, argv+1);
136 v3Global.opt.parseOpts(
new FileLine(
"COMMAND_LINE",0), argc-1, argv+1);
139 v3fatal(
"verilator: Need --cc, --sc, --sp, --cdc, --lint-only or --E option");
142 while(argc) { free(argv[--argc]); }
145 V3Options::getenvSYSTEMC();
146 V3Options::getenvSYSTEMC_ARCH();
147 V3Options::getenvSYSTEMC_INCLUDE();
148 V3Options::getenvSYSTEMC_LIBDIR();
149 V3Options::getenvSYSTEMPERL();
150 V3Options::getenvSYSTEMPERL_INCLUDE();
152 V3Error::abortIfErrors();
154 V3File::addSrcDepend(
v3Global.opt.bin());
163 ios::sync_with_stdio(
false);
167 mRootPtr = objectFactoryPtr->newRootPtr(
"WORK");
171 v3Global.rootp()->accept(verilogImporterVisitor);
174 string outFileName =
"output.edf";
175 fstream edifExport(outFileName.c_str(), ios_base::out);
Main torc::generic namespace header.
VerilogImporter(void)
Construct the parser importer context.
bool operator()(const boost::filesystem::path &inFilename, const std::string &inArguments=std::string())
Import Verilog from a file.
Header for the VerilogImporter class.
boost::shared_ptr< ObjectFactory > ObjectFactorySharedPtr
Header for the VerilogImporterVisitor class.
boost::filesystem::path path
AST visitor to convert structural Verilog into a generic design.
V3Global v3Global
Global variables for Verilator.