Skip to content

Commit

Permalink
Add YosysHQ/abc as a submodule located in abc
Browse files Browse the repository at this point in the history
  • Loading branch information
RCoeurjoly committed Apr 1, 2024
1 parent 7b28ece commit 4368804
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 62 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/emcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ jobs:
steps:
- uses: mymindstorm/setup-emsdk@v14
- uses: actions/checkout@v4
with:
submodules: true
- name: Build
run: |
make config-emcc
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ jobs:
- name: Checkout Yosys
uses: actions/checkout@v4

with:
submodules: true
- name: Get iverilog
shell: bash
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ jobs:
- name: Checkout Yosys
uses: actions/checkout@v4

with:
submodules: true
- name: Get iverilog
shell: bash
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/vs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/wasi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ __pycache__
/coverage.info
/coverage_html
/Makefile.conf
/abc
/viz.js
/yosys
/yosys.exe
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "abc"]
path = abc
url = https://github.com/YosysHQ/abc
76 changes: 20 additions & 56 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,6 @@ OBJS = kernel/version_$(GIT_REV).o
bumpversion:
sed -i "/^YOSYS_VER := / s/+[0-9][0-9]*$$/+`git log --oneline 0033808.. | 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 = 0cd90d0
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 = <abc-command> to use an external ABC instance
Expand Down Expand Up @@ -216,7 +207,7 @@ ABC_ARCHFLAGS += "-DABC_NO_RLIMIT"
endif

ifeq ($(CONFIG),clang)
CXX ?= clang++
CXX = clang++
CXXFLAGS += -std=$(CXXSTD) -Os
ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H $(ABC_ARCHFLAGS)"

Expand All @@ -238,7 +229,7 @@ endif
endif

else ifeq ($(CONFIG),gcc)
CXX ?= g++
CXX = g++
CXXFLAGS += -std=$(CXXSTD) -Os
ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H $(ABC_ARCHFLAGS)"

Expand All @@ -254,17 +245,17 @@ ABCMKARGS += "ABC_USE_NO_PTHREADS=1"
endif

else ifeq ($(CONFIG),afl-gcc)
CXX ?= AFL_QUIET=1 AFL_HARDEN=1 afl-gcc
CXX = AFL_QUIET=1 AFL_HARDEN=1 afl-gcc
CXXFLAGS += -std=$(CXXSTD) -Os
ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H"

else ifeq ($(CONFIG),cygwin)
CXX ?= g++
CXX = g++
CXXFLAGS += -std=gnu++11 -Os
ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H"

else ifeq ($(CONFIG),emcc)
CXX ?= emcc
CXX = emcc
CXXFLAGS := -std=$(CXXSTD) $(filter-out -fPIC -ggdb,$(CXXFLAGS))
ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H -DABC_MEMALIGN=8"
EMCC_CXXFLAGS := -Os -Wno-warn-absolute-paths
Expand Down Expand Up @@ -304,12 +295,12 @@ yosys.html: misc/yosys.html

else ifeq ($(CONFIG),wasi)
ifeq ($(WASI_SDK),)
CXX ?= clang++
CXX = clang++
AR = llvm-ar
RANLIB = llvm-ranlib
WASIFLAGS := -target wasm32-wasi --sysroot $(WASI_SYSROOT) $(WASIFLAGS)
else
CXX ?= $(WASI_SDK)/bin/clang++
CXX = $(WASI_SDK)/bin/clang++
AR = $(WASI_SDK)/bin/ar
RANLIB = $(WASI_SDK)/bin/ranlib
WASIFLAGS := --sysroot $(WASI_SDK)/share/wasi-sysroot $(WASIFLAGS)
Expand All @@ -331,7 +322,7 @@ endif

else ifeq ($(CONFIG),mxe)
PKG_CONFIG = /usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-pkg-config
CXX ?= /usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-g++
CXX = /usr/local/src/mxe/usr/bin/i686-w64-mingw32.static-g++
CXXFLAGS += -std=$(CXXSTD) -Os -D_POSIX_SOURCE -DYOSYS_MXE_HACKS -Wno-attributes
CXXFLAGS := $(filter-out -fPIC,$(CXXFLAGS))
LINKFLAGS := $(filter-out -rdynamic,$(LINKFLAGS)) -s
Expand All @@ -342,7 +333,7 @@ ABCMKARGS += LIBS="lib/x86/pthreadVC2.lib -s" LINKFLAGS="-Wl,--allow-multiple-de
EXE = .exe

else ifeq ($(CONFIG),msys2-32)
CXX ?= i686-w64-mingw32-g++
CXX = i686-w64-mingw32-g++
CXXFLAGS += -std=$(CXXSTD) -Os -D_POSIX_SOURCE -DYOSYS_WIN32_UNIX_DIR
CXXFLAGS := $(filter-out -fPIC,$(CXXFLAGS))
LINKFLAGS := $(filter-out -rdynamic,$(LINKFLAGS)) -s
Expand All @@ -352,7 +343,7 @@ ABCMKARGS += LIBS="-lpthread -lshlwapi -s" ABC_USE_NO_READLINE=0 CC="i686-w64-mi
EXE = .exe

else ifeq ($(CONFIG),msys2-64)
CXX ?= x86_64-w64-mingw32-g++
CXX = x86_64-w64-mingw32-g++
CXXFLAGS += -std=$(CXXSTD) -Os -D_POSIX_SOURCE -DYOSYS_WIN32_UNIX_DIR
CXXFLAGS := $(filter-out -fPIC,$(CXXFLAGS))
LINKFLAGS := $(filter-out -rdynamic,$(LINKFLAGS)) -s
Expand Down Expand Up @@ -788,41 +779,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/*)

$(YOSYS_SRC)/abc/abc$(EXE) $(YOSYS_SRC)/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) $(MAKE) -C $(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): $(YOSYS_SRC)/abc/abc$(EXE)
$(P) cp $(YOSYS_SRC)/abc/abc$(EXE) $(PROGRAM_PREFIX)yosys-abc$(EXE)

$(PROGRAM_PREFIX)yosys-libabc.a: $(YOSYS_SRC)/abc/libabc.a
$(P) cp $(YOSYS_SRC)/abc/libabc.a $(PROGRAM_PREFIX)yosys-libabc.a

ifneq ($(SEED),)
SEEDOPT="-S $(SEED)"
Expand Down Expand Up @@ -1129,9 +1096,6 @@ echo-yosys-ver:
echo-git-rev:
@echo "$(GIT_REV)"

echo-abc-rev:
@echo "$(ABCREV)"

echo-cxx:
@echo "$(CXX)"

Expand Down

0 comments on commit 4368804

Please sign in to comment.