mirror of https://github.com/YosysHQ/yosys.git
Look for yosys-abc and yosys-svgviewer where the main exe is
This commit is contained in:
parent
6c8a424872
commit
bf59a28f80
|
@ -22,6 +22,7 @@
|
|||
#include <readline/history.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <libgen.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "kernel/rtlil.h"
|
||||
|
@ -343,6 +344,22 @@ struct TclPass : public Pass {
|
|||
} TclPass;
|
||||
#endif
|
||||
|
||||
std::string rewrite_yosys_exe(std::string exe)
|
||||
{
|
||||
char buffer[1024];
|
||||
ssize_t buflen = readlink("/proc/self/exe", buffer, sizeof(buffer)-1);
|
||||
|
||||
if (buflen < 0)
|
||||
return exe;
|
||||
|
||||
buffer[buflen] = 0;
|
||||
std::string newexe = stringf("%s/%s", dirname(buffer), exe.c_str());
|
||||
if (access(newexe.c_str(), X_OK) == 0)
|
||||
return newexe;
|
||||
|
||||
return exe;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
std::string frontend_command = "auto";
|
||||
|
|
|
@ -32,6 +32,9 @@ extern Tcl_Interp *yosys_get_tcl_interp();
|
|||
extern RTLIL::Design *yosys_get_tcl_design();
|
||||
#endif
|
||||
|
||||
// implemented in driver.cc
|
||||
std::string rewrite_yosys_exe(std::string exe);
|
||||
|
||||
struct Pass
|
||||
{
|
||||
std::string pass_name, short_help;
|
||||
|
@ -83,7 +86,7 @@ struct Backend : Pass
|
|||
static void backend_call(RTLIL::Design *design, FILE *f, std::string filename, std::vector<std::string> args);
|
||||
};
|
||||
|
||||
// implemented in kernel/select.cc
|
||||
// implemented in passes/cmds/select.cc
|
||||
extern void handle_extra_select_args(Pass *pass, std::vector<std::string> args, size_t argidx, size_t args_size, RTLIL::Design *design);
|
||||
|
||||
namespace REGISTER_INTERN {
|
||||
|
|
|
@ -665,7 +665,7 @@ struct AbcPass : public Pass {
|
|||
log_header("Executing ABC pass (technology mapping using ABC).\n");
|
||||
log_push();
|
||||
|
||||
std::string exe_file = "yosys-abc";
|
||||
std::string exe_file = rewrite_yosys_exe("yosys-abc");
|
||||
std::string script_file, liberty_file;
|
||||
bool cleanup = true;
|
||||
|
||||
|
|
|
@ -672,7 +672,7 @@ struct ShowPass : public Pass {
|
|||
log_cmd_error("Shell command failed!\n");
|
||||
} else
|
||||
if (format.empty()) {
|
||||
cmd = stringf("fuser -s '%s' || yosys-svgviewer '%s' &", out_file.c_str(), out_file.c_str());
|
||||
cmd = stringf("fuser -s '%s' || '%s' '%s' &", out_file.c_str(), rewrite_yosys_exe("yosys-svgviewer").c_str(), out_file.c_str());
|
||||
log("Exec: %s\n", cmd.c_str());
|
||||
if (system(cmd.c_str()) != 0)
|
||||
log_cmd_error("Shell command failed!\n");
|
||||
|
|
Loading…
Reference in New Issue