From 5f2456ac03ee82e45fdda6369dbd0f6c8209cee6 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 5 Jun 2026 09:18:00 +0200 Subject: [PATCH 1/6] WASI now support filesystem --- frontends/verific/verific.cc | 4 ---- frontends/verilog/verilog_frontend.cc | 6 ------ 2 files changed, 10 deletions(-) diff --git a/frontends/verific/verific.cc b/frontends/verific/verific.cc index f3e49142e..20a23ef8f 100644 --- a/frontends/verific/verific.cc +++ b/frontends/verific/verific.cc @@ -4621,11 +4621,7 @@ struct ReadPass : public Pass { if (use_verific) { args[0] = "verific"; } else { -#if !defined(__wasm) args[0] = "read_verilog_file_list"; -#else - cmd_error(args, 1, "Command files are not supported on this platform.\n"); -#endif } Pass::call(design, args); return; diff --git a/frontends/verilog/verilog_frontend.cc b/frontends/verilog/verilog_frontend.cc index 29a739f81..2c35b42d5 100644 --- a/frontends/verilog/verilog_frontend.cc +++ b/frontends/verilog/verilog_frontend.cc @@ -26,9 +26,7 @@ * */ -#if !defined(__wasm) #include -#endif #include "verilog_frontend.h" #include "verilog_lexer.h" @@ -709,8 +707,6 @@ struct VerilogDefines : public Pass { } } VerilogDefines; -#if !defined(__wasm) - static void parse_file_list(const std::string &file_list_path, RTLIL::Design *design, bool relative_to_file_list_path) { std::ifstream flist(file_list_path); @@ -790,6 +786,4 @@ struct VerilogFileList : public Pass { } } VerilogFilelist; -#endif - YOSYS_NAMESPACE_END From 4b5fb15579520cdf74fffdcdf27242d383ad9d9c Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 5 Jun 2026 09:18:05 +0200 Subject: [PATCH 2/6] use env for bash --- libs/fst/00_UPDATE.sh | 2 +- libs/minisat/00_UPDATE.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/fst/00_UPDATE.sh b/libs/fst/00_UPDATE.sh index 91dcd84ff..4fa604b9a 100755 --- a/libs/fst/00_UPDATE.sh +++ b/libs/fst/00_UPDATE.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash mv config.h config.h.bak rm -f *.txt *.cc *.h diff --git a/libs/minisat/00_UPDATE.sh b/libs/minisat/00_UPDATE.sh index 6f3eadfe7..44b652f84 100755 --- a/libs/minisat/00_UPDATE.sh +++ b/libs/minisat/00_UPDATE.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash rm -f LICENSE *.cc *.h git clone --depth 1 https://github.com/niklasso/minisat minisat_upstream From d4ac3b1e7d0c457285cbbcb71a1ec2a3c0997c87 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 5 Jun 2026 09:24:19 +0200 Subject: [PATCH 3/6] No need for script when CMake is used --- misc/create_vcxsrc.sh | 71 ------------------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 misc/create_vcxsrc.sh diff --git a/misc/create_vcxsrc.sh b/misc/create_vcxsrc.sh deleted file mode 100644 index dccc31fac..000000000 --- a/misc/create_vcxsrc.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env bash - -set -ex -vcxsrc="$1" -yosysver="$2" - -rm -rf YosysVS-Tpl-v2.zip YosysVS -wget https://github.com/YosysHQ/yosys/releases/download/resources/YosysVS-Tpl-v2.zip -wget https://github.com/YosysHQ/yosys/releases/download/resources/zlib-1.2.11.tar.gz - -unzip YosysVS-Tpl-v2.zip -rm -f YosysVS-Tpl-v2.zip -tar xvfz zlib-1.2.11.tar.gz - -mv YosysVS "$vcxsrc" -mkdir -p "$vcxsrc"/yosys -mkdir -p "$vcxsrc"/yosys/libs/zlib -mv zlib-1.2.11/* "$vcxsrc"/yosys/libs/zlib/. -rm -rf zlib-1.2.11 -pushd "$vcxsrc"/yosys -ls libs/zlib/*.c | sed 's,.*:,,; s,//*,/,g; s,/[^/]*/\.\./,/,g; y, \\,\n\n,;' | grep '^[^/]' >> ../../srcfiles.txt - -if [ -f "/usr/include/FlexLexer.h" ] ; then - mkdir -p libs/flex - cp /usr/include/FlexLexer.h libs/flex/FlexLexer.h - ls libs/flex/*.h >> ../../srcfiles.txt -fi -sed -i '\#libs/../kernel/yosys.h#d' ../../srcfiles.txt - -popd -{ - n=$(grep -B999 '' "$vcxsrc"/YosysVS/YosysVS.vcxproj | wc -l) - head -n$n "$vcxsrc"/YosysVS/YosysVS.vcxproj - egrep '\.(h|hh|hpp|inc)$' srcfiles.txt | sed 's,.*,,' - egrep -v '\.(h|hh|hpp|inc)$' srcfiles.txt | sed 's,.*,,' - tail -n +$((n+1)) "$vcxsrc"/YosysVS/YosysVS.vcxproj -} > "$vcxsrc"/YosysVS/YosysVS.vcxproj.new - -sed -i 's,,\n stdcpp20\n /Zc:__cplusplus %(AdditionalOptions),g' "$vcxsrc"/YosysVS/YosysVS.vcxproj.new -sed -i 's,,YOSYS_ENABLE_THREADS;,g' "$vcxsrc"/YosysVS/YosysVS.vcxproj.new -if [ -f "/usr/include/FlexLexer.h" ] ; then - sed -i 's,,;..\\yosys\\libs\\flex,g' "$vcxsrc"/YosysVS/YosysVS.vcxproj.new -fi -mv "$vcxsrc"/YosysVS/YosysVS.vcxproj.new "$vcxsrc"/YosysVS/YosysVS.vcxproj - -mkdir -p "$vcxsrc"/yosys -tar -cf - -T srcfiles.txt | tar -xf - -C "$vcxsrc"/yosys -cp -r share "$vcxsrc"/ - -cat > "$vcxsrc"/readme-git.txt << EOT -Want to use a git working copy for the yosys source code? -Open "Git Bash" in this directory and run: - - mv yosys yosys.bak - git clone https://github.com/YosysHQ/yosys.git yosys - cd yosys - git checkout -B main $(git rev-parse HEAD | cut -c1-10) - unzip ../genfiles.zip -EOT - -cat > "$vcxsrc"/readme-abc.txt << EOT -Yosys is using "ABC" for gate-level optimizations and technology -mapping. Download yosys-win32-mxebin-$yosysver.zip and copy the -following files from it into this directory: - - pthreadVC2.dll - yosys-abc.exe -EOT - -sed -i 's/$/\r/; s/\r\r*/\r/g;' "$vcxsrc"/YosysVS/YosysVS.vcxproj "$vcxsrc"/readme-git.txt "$vcxsrc"/readme-abc.txt - From 102f0081940d0438834e20f9b8b946ad4c0b9db5 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 5 Jun 2026 10:03:27 +0200 Subject: [PATCH 4/6] Remove EMSCRIPTEN leftovers --- frontends/ast/ast.cc | 4 --- kernel/driver.cc | 71 -------------------------------------------- kernel/log.cc | 12 ++------ kernel/yosys.cc | 4 +-- passes/cmds/exec.cc | 2 -- 5 files changed, 4 insertions(+), 89 deletions(-) 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); From 6a2ed9075fc7b3d212289a32eac7f72469c48205 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 5 Jun 2026 10:14:13 +0200 Subject: [PATCH 5/6] Removed YosysJS related files --- misc/yosysjs/demo01.html | 197 ------------------------ misc/yosysjs/demo02.html | 103 ------------- misc/yosysjs/demo03.html | 103 ------------- misc/yosysjs/yosysjs.js | 312 --------------------------------------- misc/yosysjs/yosyswrk.js | 63 -------- 5 files changed, 778 deletions(-) delete mode 100644 misc/yosysjs/demo01.html delete mode 100644 misc/yosysjs/demo02.html delete mode 100644 misc/yosysjs/demo03.html delete mode 100644 misc/yosysjs/yosysjs.js delete mode 100644 misc/yosysjs/yosyswrk.js diff --git a/misc/yosysjs/demo01.html b/misc/yosysjs/demo01.html deleted file mode 100644 index 3f9f737e9..000000000 --- a/misc/yosysjs/demo01.html +++ /dev/null @@ -1,197 +0,0 @@ - - YosysJS Example Application #01 - - -

YosysJS Example Application #01

-
[ load example ]
- -
-

Loading...
- - - diff --git a/misc/yosysjs/demo02.html b/misc/yosysjs/demo02.html deleted file mode 100644 index 9191db98d..000000000 --- a/misc/yosysjs/demo02.html +++ /dev/null @@ -1,103 +0,0 @@ - - YosysJS Example Application #02 - - - -

YosysJS Example Application #02

-

- - - -

- - - - diff --git a/misc/yosysjs/demo03.html b/misc/yosysjs/demo03.html deleted file mode 100644 index c2ca40ef5..000000000 --- a/misc/yosysjs/demo03.html +++ /dev/null @@ -1,103 +0,0 @@ - -YosysJS Example Application #02 - - - - - - -

-

YosysJS Example Application #03

- Your mission: Create a behavioral Verilog model for the following circuit: -

-

- - diff --git a/misc/yosysjs/yosysjs.js b/misc/yosysjs/yosysjs.js deleted file mode 100644 index ea98c9b51..000000000 --- a/misc/yosysjs/yosysjs.js +++ /dev/null @@ -1,312 +0,0 @@ -var YosysJS = new function() { - this.script_element = document.currentScript; - this.viz_element = undefined; - this.viz_ready = true; - - this.url_prefix = this.script_element.src.replace(/[^/]+$/, '') - - this.load_viz = function() { - if (this.viz_element) - return; - - this.viz_element = document.createElement('iframe') - this.viz_element.style.display = 'none' - document.body.appendChild(this.viz_element); - - this.viz_element.contentWindow.document.open(); - this.viz_element.contentWindow.document.write('