summaryrefslogtreecommitdiff
path: root/frontends/verilog/verilog_frontend.cc
diff options
context:
space:
mode:
authorJohann Glaser <Johann.Glaser@gmx.at>2013-08-20 15:48:16 +0200
committerJohann Glaser <Johann.Glaser@gmx.at>2013-08-20 15:48:16 +0200
commita99c22415783f5c829be5fd2ba77246b15a2734b (patch)
tree27eef28e2a9c52c42fb08425b3a1a9dc96874034 /frontends/verilog/verilog_frontend.cc
parent6c4cbc03c2bad021c78da85f97bea1ef7c8caea0 (diff)
Added support for include directories with the new '-I' argument of the
'read_verilog' command
Diffstat (limited to 'frontends/verilog/verilog_frontend.cc')
-rw-r--r--frontends/verilog/verilog_frontend.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/frontends/verilog/verilog_frontend.cc b/frontends/verilog/verilog_frontend.cc
index 9c6a5b64..fb2b57ad 100644
--- a/frontends/verilog/verilog_frontend.cc
+++ b/frontends/verilog/verilog_frontend.cc
@@ -100,6 +100,10 @@ struct VerilogFrontend : public Frontend {
log(" define the preprocessor symbol 'name' and set its optional value\n");
log(" 'definition'\n");
log("\n");
+ log(" -Idir\n");
+ log(" add 'dir' to the directories which are used when searching include\n");
+ log(" files\n");
+ log("\n");
}
virtual void execute(FILE *&f, std::string filename, std::vector<std::string> args, RTLIL::Design *design)
{
@@ -114,6 +118,7 @@ struct VerilogFrontend : public Frontend {
bool flag_lib = false;
bool flag_noopt = false;
std::map<std::string, std::string> defines_map;
+ std::list<std::string> include_dirs;
frontend_verilog_yydebug = false;
log_header("Executing Verilog-2005 frontend.\n");
@@ -175,6 +180,10 @@ struct VerilogFrontend : public Frontend {
defines_map[name] = value;
continue;
}
+ if (arg.compare(0,2,"-I") == 0) {
+ include_dirs.push_back(arg.substr(2,std::string::npos));
+ continue;
+ }
break;
}
extra_args(f, filename, args, argidx);
@@ -191,7 +200,7 @@ struct VerilogFrontend : public Frontend {
std::string code_after_preproc;
if (!flag_nopp) {
- code_after_preproc = frontend_verilog_preproc(f, filename, defines_map);
+ code_after_preproc = frontend_verilog_preproc(f, filename, defines_map, include_dirs);
if (flag_ppdump)
log("-- Verilog code after preprocessor --\n%s-- END OF DUMP --\n", code_after_preproc.c_str());
fp = fmemopen((void*)code_after_preproc.c_str(), code_after_preproc.size(), "r");