diff options
author | Archie <ac11018@ic.ac.uk> | 2022-08-21 17:18:20 -0500 |
---|---|---|
committer | Archie <ac11018@ic.ac.uk> | 2022-08-21 17:18:20 -0500 |
commit | db73f3c26b2768f93c7573b7c7d74b1cc7a0756d (patch) | |
tree | 81696fd98770e519aea96fe3a6e40bcc3b3a4360 /kernel/yosys.cc | |
parent | e7e8e3b0f65ea1ebfcf04bffd0d9ba90f8e0d7fe (diff) | |
parent | 029c2785e810fda0ccc5abbb6057af760f2fc6f3 (diff) | |
download | yosys-db73f3c26b2768f93c7573b7c7d74b1cc7a0756d.tar.gz yosys-db73f3c26b2768f93c7573b7c7d74b1cc7a0756d.tar.bz2 yosys-db73f3c26b2768f93c7573b7c7d74b1cc7a0756d.zip |
Merge branch 'master' of https://github.com/ALGCDG/yosys
Diffstat (limited to 'kernel/yosys.cc')
-rw-r--r-- | kernel/yosys.cc | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/kernel/yosys.cc b/kernel/yosys.cc index 64d2b4def..a56a066fe 100644 --- a/kernel/yosys.cc +++ b/kernel/yosys.cc @@ -534,11 +534,6 @@ std::string escape_filename_spaces(const std::string& filename) return out; } -int GetSize(RTLIL::Wire *wire) -{ - return wire->width; -} - bool already_setup = false; void yosys_setup() @@ -774,6 +769,10 @@ struct TclPass : public Pass { log("If any arguments are specified, these arguments are provided to the script via\n"); log("the standard $argc and $argv variables.\n"); log("\n"); + log("Note, tcl will not recieve the output of any yosys command. If the output\n"); + log("of the tcl commands are needed, use the yosys command 'tee' to redirect yosys's\n"); + log("output to a temporary file.\n"); + log("\n"); } void execute(std::vector<std::string> args, RTLIL::Design *) override { if (args.size() < 2) @@ -867,6 +866,35 @@ std::string proc_self_dirname() { return "/"; } +#elif defined(__OpenBSD__) +char yosys_path[PATH_MAX]; +char *yosys_argv0; + +std::string proc_self_dirname(void) +{ + char buf[PATH_MAX + 1] = "", *path, *p; + // if case argv[0] contains a valid path, return it + if (strlen(yosys_path) > 0) { + p = strrchr(yosys_path, '/'); + snprintf(buf, sizeof buf, "%*s/", (int)(yosys_path - p), yosys_path); + return buf; + } + // if argv[0] does not, reconstruct the path out of $PATH + path = strdup(getenv("PATH")); + if (!path) + log_error("getenv(\"PATH\") failed: %s\n", strerror(errno)); + for (p = strtok(path, ":"); p; p = strtok(NULL, ":")) { + snprintf(buf, sizeof buf, "%s/%s", p, yosys_argv0); + if (access(buf, X_OK) == 0) { + *(strrchr(buf, '/') + 1) = '\0'; + free(path); + return buf; + } + } + free(path); + log_error("Can't determine yosys executable path\n."); + return NULL; +} #else #error "Don't know how to determine process executable base path!" #endif |