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 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) 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", }: