diff options
Diffstat (limited to 'kernel/yosys.cc')
-rw-r--r-- | kernel/yosys.cc | 45 |
1 files changed, 38 insertions, 7 deletions
diff --git a/kernel/yosys.cc b/kernel/yosys.cc index eba1aef1..08fee974 100644 --- a/kernel/yosys.cc +++ b/kernel/yosys.cc @@ -37,11 +37,13 @@ # include <unistd.h> # include <dirent.h> # include <sys/stat.h> +# include <glob.h> #else # include <unistd.h> # include <dirent.h> # include <sys/types.h> # include <sys/stat.h> +# include <glob.h> #endif #include <limits.h> @@ -104,7 +106,7 @@ void yosys_banner() log(" | |\n"); log(" | yosys -- Yosys Open SYnthesis Suite |\n"); log(" | |\n"); - log(" | Copyright (C) 2012 - 2015 Clifford Wolf <clifford@clifford.at> |\n"); + log(" | Copyright (C) 2012 - 2016 Clifford Wolf <clifford@clifford.at> |\n"); log(" | |\n"); log(" | Permission to use, copy, modify, and/or distribute this software for any |\n"); log(" | purpose with or without fee is hereby granted, provided that the above |\n"); @@ -547,6 +549,29 @@ const char *create_prompt(RTLIL::Design *design, int recursion_counter) return buffer; } +std::vector<std::string> glob_filename(const std::string &filename_pattern) +{ + std::vector<std::string> results; + +#ifdef _WIN32 + results.push_back(filename_pattern); +#else + glob_t globbuf; + + int err = glob(filename_pattern.c_str(), 0, NULL, &globbuf); + + if(err == 0) { + for (size_t i = 0; i < globbuf.gl_pathc; i++) + results.push_back(globbuf.gl_pathv[i]); + globfree(&globbuf); + } else { + results.push_back(filename_pattern); + } +#endif + + return results; +} + void rewrite_filename(std::string &filename) { if (filename.substr(0, 1) == "\"" && filename.substr(GetSize(filename)-1) == "\"") @@ -622,7 +647,7 @@ struct TclPass : public Pass { } TclPass; #endif -#if defined(__linux__) +#if defined(__linux__) || defined(__CYGWIN__) std::string proc_self_dirname() { char path[PATH_MAX]; @@ -687,7 +712,7 @@ std::string proc_share_dirname() std::string proc_share_dirname() { std::string proc_self_path = proc_self_dirname(); -# ifdef _WIN32 +# if defined(_WIN32) && !defined(YOSYS_WIN32_UNIX_DIR) std::string proc_share_path = proc_self_path + "share\\"; if (check_file_exists(proc_share_path, true)) return proc_share_path; @@ -701,6 +726,11 @@ std::string proc_share_dirname() proc_share_path = proc_self_path + "../share/yosys/"; if (check_file_exists(proc_share_path, true)) return proc_share_path; +# ifdef YOSYS_DATDIR + proc_share_path = YOSYS_DATDIR "/"; + if (check_file_exists(proc_share_path, true)) + return proc_share_path; +# endif # endif log_error("proc_share_dirname: unable to determine share/ directory!\n"); } @@ -758,6 +788,8 @@ void run_frontend(std::string filename, std::string command, std::string *backen command = "verilog"; else if (filename.size() > 2 && filename.substr(filename.size()-3) == ".sv") command = "verilog -sv"; + else if (filename.size() > 2 && filename.substr(filename.size()-4) == ".vhd") + command = "vhdl"; else if (filename.size() > 4 && filename.substr(filename.size()-5) == ".blif") command = "blif"; else if (filename.size() > 3 && filename.substr(filename.size()-3) == ".il") @@ -1093,8 +1125,8 @@ struct HistoryPass : public Pass { } HistoryPass; #endif -struct ScriptPass : public Pass { - ScriptPass() : Pass("script", "execute commands from script file") { } +struct ScriptCmdPass : public Pass { + ScriptCmdPass() : Pass("script", "execute commands from script file") { } virtual void help() { log("\n"); log(" script <filename> [<from_label>:<to_label>]\n"); @@ -1120,7 +1152,6 @@ struct ScriptPass : public Pass { else extra_args(args, 2, design, false); } -} ScriptPass; +} ScriptCmdPass; YOSYS_NAMESPACE_END - |