diff options
author | Aman Goel <amangoel@umich.edu> | 2018-07-04 15:14:58 -0400 |
---|---|---|
committer | Aman Goel <amangoel@umich.edu> | 2018-07-04 15:14:58 -0400 |
commit | f0b1ec3e9758582bc0215e646c331e45a4e2a824 (patch) | |
tree | 2847b1045fbf06420cfdce3ccf8bae1346d8c5b3 /passes/techmap/abc.cc | |
parent | 6e63df6dd08fe424f46039d26f9f238ac1cb4494 (diff) | |
parent | 4d343fc1cdafe469484846051680ca0b1f948549 (diff) | |
download | yosys-f0b1ec3e9758582bc0215e646c331e45a4e2a824.tar.gz yosys-f0b1ec3e9758582bc0215e646c331e45a4e2a824.tar.bz2 yosys-f0b1ec3e9758582bc0215e646c331e45a4e2a824.zip |
Merge branch 'YosysHQ-master'
Diffstat (limited to 'passes/techmap/abc.cc')
-rw-r--r-- | passes/techmap/abc.cc | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/passes/techmap/abc.cc b/passes/techmap/abc.cc index 009ba6b97..18868c6d7 100644 --- a/passes/techmap/abc.cc +++ b/passes/techmap/abc.cc @@ -60,6 +60,10 @@ #include "frontends/blif/blifparse.h" +#ifdef YOSYS_LINK_ABC +extern "C" int Abc_RealMain(int argc, char *argv[]); +#endif + USING_YOSYS_NAMESPACE PRIVATE_NAMESPACE_BEGIN @@ -546,11 +550,13 @@ std::string replace_tempdir(std::string text, std::string tempdir_name, bool sho } std::string selfdir_name = proc_self_dirname(); - while (1) { - size_t pos = text.find(selfdir_name); - if (pos == std::string::npos) - break; - text = text.substr(0, pos) + "<yosys-exe-dir>/" + text.substr(pos + GetSize(selfdir_name)); + if (selfdir_name != "/") { + while (1) { + size_t pos = text.find(selfdir_name); + if (pos == std::string::npos) + break; + text = text.substr(0, pos) + "<yosys-exe-dir>/" + text.substr(pos + GetSize(selfdir_name)); + } } return text; @@ -943,8 +949,24 @@ void abc_module(RTLIL::Design *design, RTLIL::Module *current_module, std::strin buffer = stringf("%s -s -f %s/abc.script 2>&1", exe_file.c_str(), tempdir_name.c_str()); log("Running ABC command: %s\n", replace_tempdir(buffer, tempdir_name, show_tempdir).c_str()); +#ifndef YOSYS_LINK_ABC abc_output_filter filt(tempdir_name, show_tempdir); int ret = run_command(buffer, std::bind(&abc_output_filter::next_line, filt, std::placeholders::_1)); +#else + // These needs to be mutable, supposedly due to getopt + char *abc_argv[5]; + string tmp_script_name = stringf("%s/abc.script", tempdir_name.c_str()); + abc_argv[0] = strdup(exe_file.c_str()); + abc_argv[1] = strdup("-s"); + abc_argv[2] = strdup("-f"); + abc_argv[3] = strdup(tmp_script_name.c_str()); + abc_argv[4] = 0; + int ret = Abc_RealMain(4, abc_argv); + free(abc_argv[0]); + free(abc_argv[1]); + free(abc_argv[2]); + free(abc_argv[3]); +#endif if (ret != 0) log_error("ABC: execution of command \"%s\" failed: return code %d.\n", buffer.c_str(), ret); |