3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-06-06 09:00:54 +00:00

Remove EMSCRIPTEN leftovers

This commit is contained in:
Miodrag Milanovic 2026-06-05 10:03:27 +02:00
parent d4ac3b1e7d
commit 102f008194
5 changed files with 4 additions and 89 deletions

View file

@ -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<RTLIL::State>(width, RTLIL::State::Sx);
} else {
bool is_negative = v < 0;

View file

@ -70,75 +70,6 @@ namespace py = pybind11;
USING_YOSYS_NAMESPACE
#ifdef EMSCRIPTEN
# include <sys/stat.h>
# include <sys/types.h>
# include <emscripten.h>
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 */

View file

@ -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);

View file

@ -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/";

View file

@ -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);