diff --git a/frontends/ast/ast.cc b/frontends/ast/ast.cc index f5a601c3a..7e7c7e615 100644 --- a/frontends/ast/ast.cc +++ b/frontends/ast/ast.cc @@ -1079,11 +1079,7 @@ RTLIL::Const AstNode::realAsConst(int width) { double v = round(realvalue); RTLIL::Const result; -#ifdef EMSCRIPTEN - if (!isfinite(v)) { -#else if (!std::isfinite(v)) { -#endif result = std::vector(width, RTLIL::State::Sx); } else { bool is_negative = v < 0; diff --git a/kernel/driver.cc b/kernel/driver.cc index 73b687f80..2a4ad1295 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -70,75 +70,6 @@ namespace py = pybind11; USING_YOSYS_NAMESPACE -#ifdef EMSCRIPTEN -# include -# include -# include - -extern "C" int main(int, char**); -extern "C" void run(const char*); -extern "C" const char *errmsg(); -extern "C" const char *prompt(); - -int main(int argc, char **argv) -{ - EM_ASM( - if (ENVIRONMENT_IS_NODE) - { - FS.mkdir('/hostcwd'); - FS.mount(NODEFS, { root: '.' }, '/hostcwd'); - FS.mkdir('/hostfs'); - FS.mount(NODEFS, { root: '/' }, '/hostfs'); - } - ); - - mkdir("/work", 0777); - chdir("/work"); - log_files.push_back(stdout); - log_error_stderr = true; - yosys_banner(); - yosys_setup(); -#ifdef YOSYS_ENABLE_PYTHON - py::object sys = py::module_::import("sys"); - sys.attr("path").attr("append")(proc_self_dirname()); - sys.attr("path").attr("append")(proc_share_dirname()); -#endif - - if (argc == 2) - { - // Run the first argument as a script file - run_frontend(argv[1], "script"); - } -} - -void run(const char *command) -{ - int selSize = GetSize(yosys_get_design()->selection_stack); - try { - log_last_error = "Internal error (see JavaScript console for details)"; - run_pass(command); - log_last_error = ""; - } catch (...) { - while (GetSize(yosys_get_design()->selection_stack) > selSize) - yosys_get_design()->pop_selection(); - throw; - } -} - -const char *errmsg() -{ - return log_last_error.c_str(); -} - -const char *prompt() -{ - const char *p = create_prompt(yosys_get_design(), 0); - while (*p == '\n') p++; - return p; -} - -#else /* EMSCRIPTEN */ - #if defined(YOSYS_ENABLE_READLINE) || defined(YOSYS_ENABLE_EDITLINE) int yosys_history_offset = 0; std::string yosys_history_file; @@ -781,5 +712,3 @@ int main(int argc, char **argv) return 0; } - -#endif /* EMSCRIPTEN */ diff --git a/kernel/log.cc b/kernel/log.cc index 2121143a2..2f5a6350b 100644 --- a/kernel/log.cc +++ b/kernel/log.cc @@ -335,9 +335,6 @@ void log_suppressed() { [[noreturn]] static void log_error_with_prefix(std::string_view prefix, std::string str) { -#ifdef EMSCRIPTEN - auto backup_log_files = log_files; -#endif int bak_log_make_debug = log_make_debug; log_make_debug = 0; log_suppressed(); @@ -378,10 +375,7 @@ static void log_error_with_prefix(std::string_view prefix, std::string str) if (e && atoi(e)) abort(); -#ifdef EMSCRIPTEN - log_files = backup_log_files; - throw 0; -#elif defined(_MSC_VER) +#if defined(_MSC_VER) _exit(1); #else _Exit(1); @@ -679,9 +673,7 @@ void log_check_expected() log_warn_regexes.clear(); log("Expected %s pattern '%s' found !!!\n", kind, pattern); yosys_shutdown(); - #ifdef EMSCRIPTEN - throw 0; - #elif defined(_MSC_VER) + #if defined(_MSC_VER) _exit(0); #else _Exit(0); diff --git a/kernel/yosys.cc b/kernel/yosys.cc index 1a0da4774..167052340 100644 --- a/kernel/yosys.cc +++ b/kernel/yosys.cc @@ -550,7 +550,7 @@ std::string proc_self_dirname() shortpath[--i] = 0; return shortpath; } -#elif defined(EMSCRIPTEN) || defined(__wasm) +#elif defined(__wasm) std::string proc_self_dirname() { return "/"; @@ -588,7 +588,7 @@ std::string proc_self_dirname(void) #error "Don't know how to determine process executable base path!" #endif -#if defined(EMSCRIPTEN) || defined(__wasm) +#if defined(__wasm) void init_share_dirname() { yosys_share_dirname = "/share/"; diff --git a/passes/cmds/exec.cc b/passes/cmds/exec.cc index ea82ff908..f7a5bf8f7 100644 --- a/passes/cmds/exec.cc +++ b/passes/cmds/exec.cc @@ -158,7 +158,6 @@ struct ExecPass : public Pass { int status = 0; int retval = 0; -#ifndef EMSCRIPTEN FILE *f = popen(cmd.c_str(), "r"); if (f == nullptr) log_cmd_error("errno %d after popen() returned NULL.\n", errno); @@ -183,7 +182,6 @@ struct ExecPass : public Pass { } } status = pclose(f); -#endif if(WIFEXITED(status)) { retval = WEXITSTATUS(status);