From 09b9aa83c9ec7c1e7cf64ae267d5947c4b962b9a Mon Sep 17 00:00:00 2001 From: Roland Coeurjoly Date: Fri, 12 Apr 2024 07:08:18 +0200 Subject: [PATCH 01/18] Add YosysHQ/abc as a submodule located in abc --- .github/workflows/codeql.yml | 3 +- .github/workflows/emcc.yml | 2 ++ .github/workflows/test-docs.yml | 3 +- .github/workflows/test-linux.yml | 3 +- .github/workflows/test-macos.yml | 3 +- .github/workflows/test-verific.yml | 2 +- .github/workflows/version.yml | 1 + .github/workflows/vs.yml | 6 ++-- .github/workflows/wasi.yml | 2 ++ .gitignore | 2 +- .gitmodules | 3 ++ Makefile | 56 ++++++------------------------ abc | 1 + 13 files changed, 33 insertions(+), 54 deletions(-) create mode 100644 .gitmodules create mode 160000 abc diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 4a77d223429..24ae7c89883 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -15,7 +15,8 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - + with: + submodules: true - name: Initialize CodeQL uses: github/codeql-action/init@v3 with: diff --git a/.github/workflows/emcc.yml b/.github/workflows/emcc.yml index 7c6409c1be2..b883cfa0a8a 100644 --- a/.github/workflows/emcc.yml +++ b/.github/workflows/emcc.yml @@ -8,6 +8,8 @@ jobs: steps: - uses: mymindstorm/setup-emsdk@v14 - uses: actions/checkout@v4 + with: + submodules: true - name: Build run: | make config-emcc diff --git a/.github/workflows/test-docs.yml b/.github/workflows/test-docs.yml index 00e5309bfbe..f6bcd33eb1b 100644 --- a/.github/workflows/test-docs.yml +++ b/.github/workflows/test-docs.yml @@ -29,7 +29,8 @@ jobs: - name: Checkout Yosys uses: actions/checkout@v3 - + with: + submodules: true - name: Build yosys shell: bash run: | diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index c4441a8843e..a75873d8995 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -80,7 +80,8 @@ jobs: - name: Checkout Yosys uses: actions/checkout@v4 - + with: + submodules: true - name: Get iverilog shell: bash run: | diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index 8ca658c3951..37b66df9bec 100644 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -36,7 +36,8 @@ jobs: - name: Checkout Yosys uses: actions/checkout@v4 - + with: + submodules: true - name: Get iverilog shell: bash run: | diff --git a/.github/workflows/test-verific.yml b/.github/workflows/test-verific.yml index b4383eba462..ef7fa3829d8 100644 --- a/.github/workflows/test-verific.yml +++ b/.github/workflows/test-verific.yml @@ -10,7 +10,7 @@ jobs: uses: actions/checkout@v4 with: persist-credentials: false - + submodules: true - name: Runtime environment run: | echo "procs=$(nproc)" >> $GITHUB_ENV diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index 47a7fe1a39f..f73c68bdf12 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -13,6 +13,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + submodules: true - name: Take last commit id: log run: echo "message=$(git log --no-merges -1 --oneline)" >> $GITHUB_OUTPUT diff --git a/.github/workflows/vs.yml b/.github/workflows/vs.yml index 799c5f259f4..0647cff1a34 100644 --- a/.github/workflows/vs.yml +++ b/.github/workflows/vs.yml @@ -7,17 +7,19 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + submodules: true - name: Build run: make vcxsrc YOSYS_VER=latest - uses: actions/upload-artifact@v4 with: name: vcxsrc path: yosys-win32-vcxsrc-latest.zip - + build: runs-on: windows-2019 needs: yosys-vcxsrc - steps: + steps: - uses: actions/download-artifact@v4 with: name: vcxsrc diff --git a/.github/workflows/wasi.yml b/.github/workflows/wasi.yml index d6d200d92c2..d65a9622799 100644 --- a/.github/workflows/wasi.yml +++ b/.github/workflows/wasi.yml @@ -7,6 +7,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + submodules: true - name: Build run: | WASI_SDK=wasi-sdk-19.0 diff --git a/.gitignore b/.gitignore index 6e4ffea4203..b4797d63884 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,6 @@ __pycache__ /coverage.info /coverage_html /Makefile.conf -/abc /viz.js /yosys /yosys.exe @@ -46,3 +45,4 @@ __pycache__ /tests/unit/bintest/ /tests/unit/objtest/ /tests/ystests +/build diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000000..d88d4b1e5e9 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "abc"] + path = abc + url = https://github.com/YosysHQ/abc diff --git a/Makefile b/Makefile index 55c6a3f02b0..5986539b6b9 100644 --- a/Makefile +++ b/Makefile @@ -160,15 +160,6 @@ OBJS = kernel/version_$(GIT_REV).o bumpversion: sed -i "/^YOSYS_VER := / s/+[0-9][0-9]*$$/+`git log --oneline c1ad377.. | wc -l`/;" Makefile -# set 'ABCREV = default' to use abc/ as it is -# -# Note: If you do ABC development, make sure that 'abc' in this directory -# is just a symlink to your actual ABC working directory, as 'make mrproper' -# will remove the 'abc' directory and you do not want to accidentally -# delete your work on ABC.. -ABCREV = 237d813 -ABCPULL = 1 -ABCURL ?= https://github.com/YosysHQ/abc ABCMKARGS = CC="$(CXX)" CXX="$(CXX)" ABC_USE_LIBSTDCXX=1 ABC_USE_NAMESPACE=abc VERBOSE=$(Q) # set ABCEXTERNAL = to use an external ABC instance @@ -789,41 +780,17 @@ $(PROGRAM_PREFIX)yosys-config: misc/yosys-config.in -e 's#@BINDIR@#$(strip $(BINDIR))#;' -e 's#@DATDIR@#$(strip $(DATDIR))#;' < $< > $(PROGRAM_PREFIX)yosys-config $(Q) chmod +x $(PROGRAM_PREFIX)yosys-config -abc/abc-$(ABCREV)$(EXE) abc/libabc-$(ABCREV).a: +ABC_SOURCES := $(wildcard $(YOSYS_SRC)/abc/*) + +abc/abc$(EXE) abc/libabc.a: $(ABC_SOURCES) $(P) -ifneq ($(ABCREV),default) - $(Q) if test -d abc/.hg; then \ - echo 'REEBE: NOP qverpgbel vf n ut jbexvat pbcl! Erzbir nop/ naq er-eha "znxr".' | tr 'A-Za-z' 'N-ZA-Mn-za-m'; false; \ - fi - $(Q) if test -d abc && test -d abc/.git && ! git -C abc diff-index --quiet HEAD; then \ - echo 'REEBE: NOP pbagnvaf ybpny zbqvsvpngvbaf! Frg NOPERI=qrsnhyg va Lbflf Znxrsvyr!' | tr 'A-Za-z' 'N-ZA-Mn-za-m'; false; \ - fi - $(Q) if test -d abc && ! test -d abc/.git && ! test "`cat abc/.gitcommit | cut -c1-7`" = "$(ABCREV)"; then \ - echo 'REEBE: Qbjaybnqrq NOP irefvbaf qbrf abg zngpu! Qbjaybnq sebz:' | tr 'A-Za-z' 'N-ZA-Mn-za-m'; echo $(ABCURL)/archive/$(ABCREV).tar.gz; false; \ - fi -# set a variable so the test fails if git fails to run - when comparing outputs directly, empty string would match empty string - $(Q) if test -d abc && ! test -d abc/.git && test "`cat abc/.gitcommit | cut -c1-7`" = "$(ABCREV)"; then \ - echo "Compiling local copy of ABC"; \ - elif ! (cd abc 2> /dev/null && rev="`git rev-parse $(ABCREV)`" && test "`git rev-parse HEAD`" = "$$rev"); then \ - test $(ABCPULL) -ne 0 || { echo 'REEBE: NOP abg hc gb qngr naq NOPCHYY frg gb 0 va Znxrsvyr!' | tr 'A-Za-z' 'N-ZA-Mn-za-m'; exit 1; }; \ - echo "Pulling ABC from $(ABCURL):"; set -x; \ - test -d abc || git clone $(ABCURL) abc; \ - cd abc && $(MAKE) DEP= clean && git fetch $(ABCURL) && git checkout $(ABCREV); \ - fi -endif - $(Q) rm -f abc/abc-[0-9a-f]* - $(Q) $(MAKE) -C abc $(S) $(ABCMKARGS) $(if $(filter %.a,$@),PROG="abc-$(ABCREV)",PROG="abc-$(ABCREV)$(EXE)") MSG_PREFIX="$(eval P_OFFSET = 5)$(call P_SHOW)$(eval P_OFFSET = 10) ABC: " $(if $(filter %.a,$@),libabc-$(ABCREV).a) - -ifeq ($(ABCREV),default) -.PHONY: abc/abc-$(ABCREV)$(EXE) -.PHONY: abc/libabc-$(ABCREV).a -endif - -$(PROGRAM_PREFIX)yosys-abc$(EXE): abc/abc-$(ABCREV)$(EXE) - $(P) cp abc/abc-$(ABCREV)$(EXE) $(PROGRAM_PREFIX)yosys-abc$(EXE) - -$(PROGRAM_PREFIX)yosys-libabc.a: abc/libabc-$(ABCREV).a - $(P) cp abc/libabc-$(ABCREV).a $(PROGRAM_PREFIX)yosys-libabc.a + $(Q) mkdir -p abc && $(MAKE) -C $(PROGRAM_PREFIX)abc -f "$(realpath $(YOSYS_SRC)/abc/Makefile)" ABCSRC="$(realpath $(YOSYS_SRC)/abc/)" $(S) $(ABCMKARGS) $(if $(filter %.a,$@),PROG="abc",PROG="abc$(EXE)") MSG_PREFIX="$(eval P_OFFSET = 5)$(call P_SHOW)$(eval P_OFFSET = 10) ABC: " $(if $(filter %.a,$@),libabc.a) + +$(PROGRAM_PREFIX)yosys-abc$(EXE): abc/abc$(EXE) + $(P) cp abc/abc$(EXE) $(PROGRAM_PREFIX)yosys-abc$(EXE) + +$(PROGRAM_PREFIX)yosys-libabc.a: abc/libabc.a + $(P) cp abc/libabc.a $(PROGRAM_PREFIX)yosys-libabc.a ifneq ($(SEED),) SEEDOPT="-S $(SEED)" @@ -1141,9 +1108,6 @@ echo-yosys-ver: echo-git-rev: @echo "$(GIT_REV)" -echo-abc-rev: - @echo "$(ABCREV)" - echo-cxx: @echo "$(CXX)" diff --git a/abc b/abc new file mode 160000 index 00000000000..237d81397fc --- /dev/null +++ b/abc @@ -0,0 +1 @@ +Subproject commit 237d81397fcc85dd3894bf1a449d2955cd3df02d From 67d4c8bba664f98b4ada2770c648376d92714f35 Mon Sep 17 00:00:00 2001 From: Roland Coeurjoly Date: Fri, 12 Apr 2024 07:24:45 +0200 Subject: [PATCH 02/18] Use $< to refer to the first prerequisite listed in the rule --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5986539b6b9..2188c52e112 100644 --- a/Makefile +++ b/Makefile @@ -787,10 +787,10 @@ abc/abc$(EXE) abc/libabc.a: $(ABC_SOURCES) $(Q) mkdir -p abc && $(MAKE) -C $(PROGRAM_PREFIX)abc -f "$(realpath $(YOSYS_SRC)/abc/Makefile)" ABCSRC="$(realpath $(YOSYS_SRC)/abc/)" $(S) $(ABCMKARGS) $(if $(filter %.a,$@),PROG="abc",PROG="abc$(EXE)") MSG_PREFIX="$(eval P_OFFSET = 5)$(call P_SHOW)$(eval P_OFFSET = 10) ABC: " $(if $(filter %.a,$@),libabc.a) $(PROGRAM_PREFIX)yosys-abc$(EXE): abc/abc$(EXE) - $(P) cp abc/abc$(EXE) $(PROGRAM_PREFIX)yosys-abc$(EXE) + $(P) cp $< $(PROGRAM_PREFIX)yosys-abc$(EXE) $(PROGRAM_PREFIX)yosys-libabc.a: abc/libabc.a - $(P) cp abc/libabc.a $(PROGRAM_PREFIX)yosys-libabc.a + $(P) cp $< $(PROGRAM_PREFIX)yosys-libabc.a ifneq ($(SEED),) SEEDOPT="-S $(SEED)" From fdbe8714c9337e8125470c9d4bc28e9b141e3997 Mon Sep 17 00:00:00 2001 From: Roland Coeurjoly Date: Fri, 12 Apr 2024 14:29:05 +0200 Subject: [PATCH 03/18] Check that abc is checkout out as a git repo --- Makefile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2188c52e112..e7a1248c46c 100644 --- a/Makefile +++ b/Makefile @@ -780,9 +780,20 @@ $(PROGRAM_PREFIX)yosys-config: misc/yosys-config.in -e 's#@BINDIR@#$(strip $(BINDIR))#;' -e 's#@DATDIR@#$(strip $(DATDIR))#;' < $< > $(PROGRAM_PREFIX)yosys-config $(Q) chmod +x $(PROGRAM_PREFIX)yosys-config +.PHONY: check-git-abc + +check-git-abc: + @if [ -f "$(YOSYS_SRC)/abc/.git" ]; then \ + echo "abc/.git exists"; \ + exit 0; \ + else \ + echo "abc/.git does not exist. Please execute git submodule update --init"; \ + exit 1; \ + fi + ABC_SOURCES := $(wildcard $(YOSYS_SRC)/abc/*) -abc/abc$(EXE) abc/libabc.a: $(ABC_SOURCES) +abc/abc$(EXE) abc/libabc.a: $(ABC_SOURCES) check-git-abc $(P) $(Q) mkdir -p abc && $(MAKE) -C $(PROGRAM_PREFIX)abc -f "$(realpath $(YOSYS_SRC)/abc/Makefile)" ABCSRC="$(realpath $(YOSYS_SRC)/abc/)" $(S) $(ABCMKARGS) $(if $(filter %.a,$@),PROG="abc",PROG="abc$(EXE)") MSG_PREFIX="$(eval P_OFFSET = 5)$(call P_SHOW)$(eval P_OFFSET = 10) ABC: " $(if $(filter %.a,$@),libabc.a) From 6d181c29ce05323fe1515e3dea7cb43ed8167773 Mon Sep 17 00:00:00 2001 From: Roland Coeurjoly Date: Sun, 14 Apr 2024 19:56:07 +0200 Subject: [PATCH 04/18] Checking different cases for abc --- Makefile | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index e7a1248c46c..46778b6d53a 100644 --- a/Makefile +++ b/Makefile @@ -783,12 +783,24 @@ $(PROGRAM_PREFIX)yosys-config: misc/yosys-config.in .PHONY: check-git-abc check-git-abc: - @if [ -f "$(YOSYS_SRC)/abc/.git" ]; then \ - echo "abc/.git exists"; \ - exit 0; \ - else \ - echo "abc/.git does not exist. Please execute git submodule update --init"; \ + @if [ ! -d "$(YOSYS_SRC)/abc" ]; then \ + echo "Error: The 'abc' directory does not exist."; \ + echo "Initialize the submodule: Run 'git submodule update --init' to set up 'abc' as a submodule."; \ + exit 1; \ + elif git -C "$(YOSYS_SRC)" submodule status abc 2>/dev/null | grep -q '^ '; then \ + echo "'abc' is a git submodule. Continuing."; \ + exit 0; \ + elif [ -f "$(YOSYS_SRC)/abc/.gitcommit" ] && grep -q '\$$Format:%h\$$' "$(YOSYS_SRC)/abc/.gitcommit"; then \ + echo "Error: 'abc' is not configured as a git submodule."; \ + echo "To resolve this:"; \ + echo "1. Back up your changes: Save any modifications from the 'abc' directory to another location."; \ + echo "2. Remove the existing 'abc' directory: Delete the 'abc' directory and all its contents."; \ + echo "3. Initialize the submodule: Run 'git submodule update --init' to set up 'abc' as a submodule."; \ + echo "4. Reapply your changes: Move your saved changes back to the 'abc' directory, if necessary."; \ exit 1; \ + else \ + echo "'abc' comes from a tarball. Continuing."; \ + exit 0; \ fi ABC_SOURCES := $(wildcard $(YOSYS_SRC)/abc/*) From a2c1b268d9fa664fcd08723cdb673ce9ea87e786 Mon Sep 17 00:00:00 2001 From: Ethan Mahintorabi Date: Wed, 8 May 2024 01:00:06 +0000 Subject: [PATCH 05/18] frontend: Fixes verific import around range order Test Case ``` module packed_dimensions_range_ordering ( input wire [0:4-1] in, output wire [4-1:0] out ); assign out = in; endmodule : packed_dimensions_range_ordering module instanciates_packed_dimensions_range_ordering ( input wire [4-1:0] in, output wire [4-1:0] out ); packed_dimensions_range_ordering U0 ( .in (in), .out(out) ); endmodule : instanciates_packed_dimensions_range_ordering ``` ``` // with verific, does not pass formal module instanciates_packed_dimensions_range_ordering(in, out); input [3:0] in; wire [3:0] in; output [3:0] out; wire [3:0] out; assign out = { in[0], in[1], in[2], in[3] }; endmodule // with surelog, passes formal module instanciates_packed_dimensions_range_ordering(in, out); input [3:0] in; wire [3:0] in; output [3:0] out; wire [3:0] out; assign out = in; endmodule ``` Signed-off-by: Ethan Mahintorabi --- frontends/verific/verific.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/frontends/verific/verific.cc b/frontends/verific/verific.cc index 81e79f7497f..6203013bf68 100644 --- a/frontends/verific/verific.cc +++ b/frontends/verific/verific.cc @@ -2156,8 +2156,16 @@ void VerificImporter::import_netlist(RTLIL::Design *design, Netlist *nl, std::ma int port_offset = 0; if (pr->GetPort()->Bus()) { port_name = pr->GetPort()->Bus()->Name(); - port_offset = pr->GetPort()->Bus()->IndexOf(pr->GetPort()) - - min(pr->GetPort()->Bus()->LeftIndex(), pr->GetPort()->Bus()->RightIndex()); + int msb = pr->GetPort()->Bus()->LeftIndex(); + int lsb = pr->GetPort()->Bus()->RightIndex(); + int index_of_port = pr->GetPort()->Bus()->IndexOf(pr->GetPort()); + port_offset = index_of_port - min(msb, lsb); + // In cases where the msb order is flipped we need to make sure + // that the indicies match LSB = 0 order to match the std::vector + // to SigSpec LSB = 0 precondition. + if (lsb > msb) { + port_offset = abs(port_offset - lsb); + } } IdString port_name_id = RTLIL::escape_id(port_name); auto &sigvec = cell_port_conns[port_name_id]; From c039da2ec167e2ef825357b09e6f7713c4a476df Mon Sep 17 00:00:00 2001 From: Ethan Mahintorabi Date: Wed, 8 May 2024 01:09:52 +0000 Subject: [PATCH 06/18] renames variables for more code clairty Signed-off-by: Ethan Mahintorabi --- frontends/verific/verific.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontends/verific/verific.cc b/frontends/verific/verific.cc index 6203013bf68..a18f9fc877b 100644 --- a/frontends/verific/verific.cc +++ b/frontends/verific/verific.cc @@ -2156,15 +2156,15 @@ void VerificImporter::import_netlist(RTLIL::Design *design, Netlist *nl, std::ma int port_offset = 0; if (pr->GetPort()->Bus()) { port_name = pr->GetPort()->Bus()->Name(); - int msb = pr->GetPort()->Bus()->LeftIndex(); - int lsb = pr->GetPort()->Bus()->RightIndex(); + int msb_index = pr->GetPort()->Bus()->LeftIndex(); + int lsb_index = pr->GetPort()->Bus()->RightIndex(); int index_of_port = pr->GetPort()->Bus()->IndexOf(pr->GetPort()); - port_offset = index_of_port - min(msb, lsb); + port_offset = index_of_port - min(msb_index, lsb_index); // In cases where the msb order is flipped we need to make sure // that the indicies match LSB = 0 order to match the std::vector // to SigSpec LSB = 0 precondition. - if (lsb > msb) { - port_offset = abs(port_offset - lsb); + if (lsb_index > msb_index) { + port_offset = abs(port_offset - lsb_index); } } IdString port_name_id = RTLIL::escape_id(port_name); From f806987d582be36605163d04f107452a4157ee0b Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 8 May 2024 12:00:18 +0200 Subject: [PATCH 07/18] Add PR template --- .github/PULL_REQUEST_TEMPLATE.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000000..82daf609d36 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,5 @@ +_What are the reasons/motivation for this change?_ + +_Explain how this is achieved._ + +_If applicable, please suggest to reviewers how they can test the change._ From 82a4a87c97e8755e915bade43cf4f8010787ac42 Mon Sep 17 00:00:00 2001 From: Ethan Mahintorabi Date: Wed, 8 May 2024 20:28:37 +0000 Subject: [PATCH 08/18] Fixes error with vector indicies of the form [2:7] [-12:7] Make sure that we correctly adjust the value to align it to a zero indexed list with lsb = 0 Signed-off-by: Ethan Mahintorabi --- frontends/verific/verific.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontends/verific/verific.cc b/frontends/verific/verific.cc index a18f9fc877b..b4b0664d341 100644 --- a/frontends/verific/verific.cc +++ b/frontends/verific/verific.cc @@ -2164,7 +2164,7 @@ void VerificImporter::import_netlist(RTLIL::Design *design, Netlist *nl, std::ma // that the indicies match LSB = 0 order to match the std::vector // to SigSpec LSB = 0 precondition. if (lsb_index > msb_index) { - port_offset = abs(port_offset - lsb_index); + port_offset = abs(port_offset - (lsb_index - min(msb_index, lsb_index))); } } IdString port_name_id = RTLIL::escape_id(port_name); From 699049b218e7cb99799ff78b6af4c3363f1e5b4b Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 9 May 2024 09:26:12 +1200 Subject: [PATCH 09/18] ci: Combine extra build flow yml Currently only vs.yml and wasi.yml since emscripten is on the chopping block. Use fkirc/skip-duplicate-actions to skip duplicate action runs. --- .github/workflows/extra-builds.yml | 79 ++++++++++++++++++++++++++++++ .github/workflows/vs.yml | 33 ------------- .github/workflows/wasi.yml | 32 ------------ 3 files changed, 79 insertions(+), 65 deletions(-) create mode 100644 .github/workflows/extra-builds.yml delete mode 100644 .github/workflows/vs.yml delete mode 100644 .github/workflows/wasi.yml diff --git a/.github/workflows/extra-builds.yml b/.github/workflows/extra-builds.yml new file mode 100644 index 00000000000..64a4da16778 --- /dev/null +++ b/.github/workflows/extra-builds.yml @@ -0,0 +1,79 @@ +name: Test extra build flows + +on: [push, pull_request] + +jobs: + pre_job: + runs-on: ubuntu-latest + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@v5 + with: + paths_ignore: '["**/README.md", "docs/**", "guidelines/**"]' + # cancel previous builds if a new commit is pushed + cancel_others: 'true' + + vs-prep: + name: Prepare Visual Studio build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - name: Build + run: make vcxsrc YOSYS_VER=latest + - uses: actions/upload-artifact@v4 + with: + name: vcxsrc + path: yosys-win32-vcxsrc-latest.zip + + vs-build: + name: Visual Studio build + runs-on: windows-2019 + needs: yosys-vcxsrc, pre_job + if: needs.pre_job.outputs.should_skip != 'true' + steps: + - uses: actions/download-artifact@v4 + with: + name: vcxsrc + path: . + - name: unzip + run: unzip yosys-win32-vcxsrc-latest.zip + - name: setup-msbuild + uses: microsoft/setup-msbuild@v1 + - name: MSBuild + working-directory: yosys-win32-vcxsrc-latest + run: msbuild YosysVS.sln /p:PlatformToolset=v142 /p:Configuration=Release /p:WindowsTargetPlatformVersion=10.0.17763.0 + + wasi-build: + name: WASI build + needs: pre_job + if: needs.pre_job.outputs.should_skip != 'true' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - name: Build + run: | + WASI_SDK=wasi-sdk-19.0 + WASI_SDK_URL=https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-19/wasi-sdk-19.0-linux.tar.gz + if ! [ -d ${WASI_SDK} ]; then curl -L ${WASI_SDK_URL} | tar xzf -; fi + + mkdir -p build + cat > build/Makefile.conf < build/Makefile.conf < Date: Thu, 9 May 2024 09:26:17 +1200 Subject: [PATCH 10/18] extra-builds.yml: Fix prereq list --- .github/workflows/extra-builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/extra-builds.yml b/.github/workflows/extra-builds.yml index 64a4da16778..3623193130d 100644 --- a/.github/workflows/extra-builds.yml +++ b/.github/workflows/extra-builds.yml @@ -32,7 +32,7 @@ jobs: vs-build: name: Visual Studio build runs-on: windows-2019 - needs: yosys-vcxsrc, pre_job + needs: [vs-prep, pre_job] if: needs.pre_job.outputs.should_skip != 'true' steps: - uses: actions/download-artifact@v4 From 174c7ebf1729cc54c7d57e6ee20eaf6b4eb55fb9 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 9 May 2024 09:26:18 +1200 Subject: [PATCH 11/18] extra-builds.yml: Add concurrent_skipping --- .github/workflows/extra-builds.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/extra-builds.yml b/.github/workflows/extra-builds.yml index 3623193130d..cc2998e40b1 100644 --- a/.github/workflows/extra-builds.yml +++ b/.github/workflows/extra-builds.yml @@ -14,6 +14,8 @@ jobs: paths_ignore: '["**/README.md", "docs/**", "guidelines/**"]' # cancel previous builds if a new commit is pushed cancel_others: 'true' + # only run on push *or* pull_request, not both + concurrent_skipping: 'same_content_newer' vs-prep: name: Prepare Visual Studio build From cdce505f82335eeff6a002ee2276ee8771b5d425 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 9 May 2024 09:26:18 +1200 Subject: [PATCH 12/18] ci: Add skip check to other actions --- .github/workflows/test-docs.yml | 15 +++++++++++++++ .github/workflows/test-linux.yml | 16 ++++++++++++++++ .github/workflows/test-macos.yml | 16 ++++++++++++++++ 3 files changed, 47 insertions(+) diff --git a/.github/workflows/test-docs.yml b/.github/workflows/test-docs.yml index f6bcd33eb1b..16de7735663 100644 --- a/.github/workflows/test-docs.yml +++ b/.github/workflows/test-docs.yml @@ -6,7 +6,22 @@ on: - main jobs: + pre_job: + runs-on: ubuntu-latest + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@v5 + with: + # cancel previous builds if a new commit is pushed + cancel_others: 'true' + # only run on push *or* pull_request, not both + concurrent_skipping: 'same_content_newer' + test-docs: + needs: pre_job + if: needs.pre_job.outputs.should_skip != 'true' runs-on: ubuntu-latest steps: - name: Install Dependencies diff --git a/.github/workflows/test-linux.yml b/.github/workflows/test-linux.yml index a75873d8995..911b3b66e4d 100644 --- a/.github/workflows/test-linux.yml +++ b/.github/workflows/test-linux.yml @@ -3,7 +3,23 @@ name: Build and run tests (Linux) on: [push, pull_request] jobs: + pre_job: + runs-on: ubuntu-latest + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@v5 + with: + paths_ignore: '["**/README.md", "docs/**", "guidelines/**"]' + # cancel previous builds if a new commit is pushed + cancel_others: 'true' + # only run on push *or* pull_request, not both + concurrent_skipping: 'same_content_newer' + test-linux: + needs: pre_job + if: needs.pre_job.outputs.should_skip != 'true' runs-on: ${{ matrix.os.id }} strategy: matrix: diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index 37b66df9bec..cbba8adbd66 100644 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -3,7 +3,23 @@ name: Build and run tests (macOS) on: [push, pull_request] jobs: + pre_job: + runs-on: ubuntu-latest + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@v5 + with: + paths_ignore: '["**/README.md", "docs/**", "guidelines/**"]' + # cancel previous builds if a new commit is pushed + cancel_others: 'true' + # only run on push *or* pull_request, not both + concurrent_skipping: 'same_content_newer' + test-macos: + needs: pre_job + if: needs.pre_job.outputs.should_skip != 'true' runs-on: ${{ matrix.os.id }} strategy: matrix: From a9eca9072ea4f00a568eaf26817a9e5da1a655f5 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 9 May 2024 09:26:43 +1200 Subject: [PATCH 13/18] ci: Drop emcc --- .github/workflows/emcc.yml | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 .github/workflows/emcc.yml diff --git a/.github/workflows/emcc.yml b/.github/workflows/emcc.yml deleted file mode 100644 index b883cfa0a8a..00000000000 --- a/.github/workflows/emcc.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Emscripten Build - -on: [push, pull_request] - -jobs: - emcc: - runs-on: ubuntu-latest - steps: - - uses: mymindstorm/setup-emsdk@v14 - - uses: actions/checkout@v4 - with: - submodules: true - - name: Build - run: | - make config-emcc - make YOSYS_VER=latest - - uses: actions/upload-artifact@v4 - with: - name: yosysjs - path: yosysjs-latest.zip From 878ac021793829e997e8ccdbd09c93e8c89f132a Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 9 May 2024 09:39:27 +1200 Subject: [PATCH 14/18] ci: Add skip check to test-verific --- .github/workflows/test-verific.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/test-verific.yml b/.github/workflows/test-verific.yml index ef7fa3829d8..54d9487acfb 100644 --- a/.github/workflows/test-verific.yml +++ b/.github/workflows/test-verific.yml @@ -3,7 +3,25 @@ name: Build and run tests with Verific (Linux) on: [push, pull_request] jobs: + pre_job: + runs-on: ubuntu-latest + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@v5 + with: + paths_ignore: '["**/README.md"]' + # don't cancel previous builds + cancel_others: 'true' + # only run on push *or* pull_request, not both + concurrent_skipping: 'same_content_newer' + # we have special actions when running on main, so this should be off + skip_after_successful_duplicate: 'false' + test-verific: + needs: pre_job + if: needs.pre_job.outputs.should_skip != 'true' runs-on: [self-hosted, linux, x64] steps: - name: Checkout Yosys From 10686cd2df240002769da2f9d7ce32755b98d119 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 9 May 2024 00:16:31 +0000 Subject: [PATCH 15/18] Bump version --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 46778b6d53a..3f1941c478b 100644 --- a/Makefile +++ b/Makefile @@ -142,7 +142,7 @@ LIBS += -lrt endif endif -YOSYS_VER := 0.41+0 +YOSYS_VER := 0.41+8 # Note: We arrange for .gitcommit to contain the (short) commit hash in # tarballs generated with git-archive(1) using .gitattributes. The git repo From 6df1337d71a7c91f4512777dfdc507a4c3a29a2d Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 9 May 2024 18:16:05 +1200 Subject: [PATCH 16/18] ci: Update to Node.JS 20 --- .github/workflows/extra-builds.yml | 2 +- .github/workflows/test-docs.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/extra-builds.yml b/.github/workflows/extra-builds.yml index cc2998e40b1..4c4d12dfbe6 100644 --- a/.github/workflows/extra-builds.yml +++ b/.github/workflows/extra-builds.yml @@ -44,7 +44,7 @@ jobs: - name: unzip run: unzip yosys-win32-vcxsrc-latest.zip - name: setup-msbuild - uses: microsoft/setup-msbuild@v1 + uses: microsoft/setup-msbuild@v2 - name: MSBuild working-directory: yosys-win32-vcxsrc-latest run: msbuild YosysVS.sln /p:PlatformToolset=v142 /p:Configuration=Release /p:WindowsTargetPlatformVersion=10.0.17763.0 diff --git a/.github/workflows/test-docs.yml b/.github/workflows/test-docs.yml index 16de7735663..7b3906c52ca 100644 --- a/.github/workflows/test-docs.yml +++ b/.github/workflows/test-docs.yml @@ -43,7 +43,7 @@ jobs: echo "procs=$(nproc)" >> $GITHUB_ENV - name: Checkout Yosys - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: submodules: true - name: Build yosys From b9b1da826072d0bfe14b538eb7792f312831ddbe Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Thu, 9 May 2024 18:17:04 +1200 Subject: [PATCH 17/18] extra-builds.yml: Add skip check to vs-prep --- .github/workflows/extra-builds.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/extra-builds.yml b/.github/workflows/extra-builds.yml index 4c4d12dfbe6..260394a3ffe 100644 --- a/.github/workflows/extra-builds.yml +++ b/.github/workflows/extra-builds.yml @@ -20,6 +20,8 @@ jobs: vs-prep: name: Prepare Visual Studio build runs-on: ubuntu-latest + needs: [pre_job] + if: needs.pre_job.outputs.should_skip != 'true' steps: - uses: actions/checkout@v4 with: From 93148a87df3f2097a262ffe7c5b2a55b014b0e83 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Thu, 9 May 2024 09:22:48 +0200 Subject: [PATCH 18/18] Modify abc directory content check --- Makefile | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 3f1941c478b..507d46f230d 100644 --- a/Makefile +++ b/Makefile @@ -784,23 +784,26 @@ $(PROGRAM_PREFIX)yosys-config: misc/yosys-config.in check-git-abc: @if [ ! -d "$(YOSYS_SRC)/abc" ]; then \ - echo "Error: The 'abc' directory does not exist."; \ - echo "Initialize the submodule: Run 'git submodule update --init' to set up 'abc' as a submodule."; \ - exit 1; \ + echo "Error: The 'abc' directory does not exist."; \ + echo "Initialize the submodule: Run 'git submodule update --init' to set up 'abc' as a submodule."; \ + exit 1; \ elif git -C "$(YOSYS_SRC)" submodule status abc 2>/dev/null | grep -q '^ '; then \ - echo "'abc' is a git submodule. Continuing."; \ - exit 0; \ + echo "'abc' is a git submodule. Continuing."; \ + exit 0; \ + elif [ -f "$(YOSYS_SRC)/abc/.gitcommit" ] && ! grep -q '\$$Format:%h\$$' "$(YOSYS_SRC)/abc/.gitcommit"; then \ + echo "'abc' comes from a tarball. Continuing."; \ + exit 0; \ elif [ -f "$(YOSYS_SRC)/abc/.gitcommit" ] && grep -q '\$$Format:%h\$$' "$(YOSYS_SRC)/abc/.gitcommit"; then \ - echo "Error: 'abc' is not configured as a git submodule."; \ - echo "To resolve this:"; \ - echo "1. Back up your changes: Save any modifications from the 'abc' directory to another location."; \ - echo "2. Remove the existing 'abc' directory: Delete the 'abc' directory and all its contents."; \ - echo "3. Initialize the submodule: Run 'git submodule update --init' to set up 'abc' as a submodule."; \ - echo "4. Reapply your changes: Move your saved changes back to the 'abc' directory, if necessary."; \ - exit 1; \ + echo "Error: 'abc' is not configured as a git submodule."; \ + echo "To resolve this:"; \ + echo "1. Back up your changes: Save any modifications from the 'abc' directory to another location."; \ + echo "2. Remove the existing 'abc' directory: Delete the 'abc' directory and all its contents."; \ + echo "3. Initialize the submodule: Run 'git submodule update --init' to set up 'abc' as a submodule."; \ + echo "4. Reapply your changes: Move your saved changes back to the 'abc' directory, if necessary."; \ + exit 1; \ else \ - echo "'abc' comes from a tarball. Continuing."; \ - exit 0; \ + echo "Initialize the submodule: Run 'git submodule update --init' to set up 'abc' as a submodule."; \ + exit 1; \ fi ABC_SOURCES := $(wildcard $(YOSYS_SRC)/abc/*)