From 5e0bc3fd9f951229afa1b71d9f5b115899094bd4 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 12 Nov 2025 11:26:46 +0100 Subject: [PATCH 1/3] Build pyosys on CI --- .github/workflows/test-verific.yml | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/.github/workflows/test-verific.yml b/.github/workflows/test-verific.yml index 503d6c31b..6619e1124 100644 --- a/.github/workflows/test-verific.yml +++ b/.github/workflows/test-verific.yml @@ -83,3 +83,42 @@ jobs: shell: bash run: | make -j$procs unit-test ENABLE_LTO=1 ENABLE_LIBYOSYS=1 + + test-pyosys: + needs: pre-job + if: ${{ needs.pre-job.outputs.should_skip != 'true' && github.repository == 'YosysHQ/Yosys' }} + runs-on: [self-hosted, linux, x64, fast] + steps: + - name: Checkout Yosys + uses: actions/checkout@v4 + with: + persist-credentials: false + submodules: true + - name: Install UV + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + - name: Runtime environment + run: | + echo "procs=$(nproc)" >> $GITHUB_ENV + echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH + + - name: Build pyosys + run: | + make config-clang + echo "ENABLE_VERIFIC := 1" >> Makefile.conf + echo "ENABLE_VERIFIC_EDIF := 1" >> Makefile.conf + echo "ENABLE_VERIFIC_LIBERTY := 1" >> Makefile.conf + echo "ENABLE_VERIFIC_YOSYSHQ_EXTENSIONS := 1" >> Makefile.conf + echo "ENABLE_CCACHE := 1" >> Makefile.conf + echo "ENABLE_PYOSYS := 1" >> Makefile.conf + echo "PYTHON_DESTDIR := /usr/lib/python3/site-packages" >> Makefile.conf + make -j$procs + + - name: Install pyosys + run: | + make install DESTDIR=${GITHUB_WORKSPACE}/.local PREFIX= + + - name: Run pyosys tests + run: | + export PYTHONPATH=${GITHUB_WORKSPACE}/.local/usr/lib/python3/site-packages:$PYTHONPATH + python3 tests/pyosys/run_tests.py From 10b49f3a916a924b6ef31aeac0d5a31289c2d54a Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 12 Nov 2025 13:47:47 +0100 Subject: [PATCH 2/3] Update generator to reflect IdString changes --- pyosys/generator.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pyosys/generator.py b/pyosys/generator.py index f89819504..c0ccdac5a 100644 --- a/pyosys/generator.py +++ b/pyosys/generator.py @@ -168,9 +168,8 @@ pyosys_headers = [ "global_negative_id_prefix_storage_", "global_refcount_storage_", "global_free_idx_list_", - "last_created_idx_ptr_", - "last_created_idx_", "builtin_ff_cell_types", + "substrings", } ), ), @@ -455,7 +454,7 @@ class PyosysWrapperGenerator(object): ) -> str: is_method = isinstance(function, Method) function_return_type = function.return_type.format() - if class_basename == "Const" and function_return_type in { + if class_basename in {"Const","IdString"} and function_return_type in { "iterator", "const_iterator", }: From 40bbb847667ea11236b03a5825bbcb51a5e986e8 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 12 Nov 2025 13:53:40 +0100 Subject: [PATCH 3/3] Enable pyosys install in out of tree builds --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d9cf6e998..937cc42bf 100644 --- a/Makefile +++ b/Makefile @@ -1040,7 +1040,7 @@ ifeq ($(ENABLE_LIBYOSYS),1) if [ -n "$(STRIP)" ]; then $(INSTALL_SUDO) $(STRIP) -S $(DESTDIR)$(LIBDIR)/libyosys.so; fi ifeq ($(ENABLE_PYOSYS),1) $(INSTALL_SUDO) mkdir -p $(DESTDIR)$(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys - $(INSTALL_SUDO) cp pyosys/__init__.py $(DESTDIR)$(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys/__init__.py + $(INSTALL_SUDO) cp $(YOSYS_SRC)/pyosys/__init__.py $(DESTDIR)$(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys/__init__.py $(INSTALL_SUDO) cp libyosys.so $(DESTDIR)$(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys/libyosys.so $(INSTALL_SUDO) cp -r share $(DESTDIR)$(PYTHON_DESTDIR)/$(subst -,_,$(PROGRAM_PREFIX))pyosys ifeq ($(ENABLE_ABC),1)