Skip to content

Commit adc9788

Browse files
committed
working on mac compatibility changes
rename synth_quicklogic to synth_quicklogic_f4pga to not conflict with yosys internal update gha to just use vendored surelog deps build and install flatbuffers install orderedmultidict for surelog fix surelog build on mac Add test assets to gitignore add specific version of surelog
1 parent 7c89a55 commit adc9788

File tree

65 files changed

+457
-458
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+457
-458
lines changed

.github/workflows/build-and-test.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,33 +28,34 @@ fi
2828

2929
start_section Building
3030

31-
if [ "$PLUGIN_NAME" == "xdc" ] || [ "$PLUGIN_NAME" == "sdc" ]; then
32-
make design_introspection.so -j`nproc`
33-
make install_design_introspection -j`nproc`
34-
fi
31+
if [ "$PLUGIN_NAME" == "xdc" ] || [ "$PLUGIN_NAME" == "sdc" ]; then
32+
make design_introspection.so -j$NPROC
33+
sudo make install_design_introspection -j$NPROC
34+
fi
3535

3636
export CXXFLAGS=-Werror
37-
make ${PLUGIN_NAME}.so -j`nproc`
37+
make ${PLUGIN_NAME}.so -j$NPROC
38+
3839
unset CXXFLAGS
3940

4041
end_section
4142

4243
##########################################################################
4344

4445
start_section Installing
45-
make install_${PLUGIN_NAME} -j`nproc`
46+
sudo make install_${PLUGIN_NAME} -j$NPROC
4647
end_section
4748

4849
##########################################################################
4950

5051
start_section Testing
51-
make test_${PLUGIN_NAME} -j`nproc`
52+
make test_${PLUGIN_NAME} -j$NPROC
5253
end_section
5354

5455
##########################################################################
5556

5657
start_section Cleanup
57-
make clean_${PLUGIN_NAME} -j`nproc`
58+
make clean_${PLUGIN_NAME} -j$NPROC
5859
end_section
5960

6061
##########################################################################

.github/workflows/ci.yml

Lines changed: 61 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ on: [push, pull_request]
2121
jobs:
2222

2323
Run-tests:
24-
runs-on: ubuntu-20.04
25-
24+
runs-on: ${{ matrix.os }}
2625
strategy:
2726
fail-fast: false
2827
matrix:
28+
os: [ubuntu-20.04, macos-11]
2929
plugin:
3030
- fasm
3131
- xdc
@@ -39,40 +39,87 @@ jobs:
3939

4040
steps:
4141

42-
- uses: actions/checkout@v2
42+
- uses: actions/checkout@v4
4343
with:
4444
submodules: recursive
4545

46-
- uses: actions/setup-python@v2
46+
- uses: actions/setup-python@v4
47+
with:
48+
python-version: '3.9'
4749

48-
- name: Install
50+
- name: Install Ubuntu Dependencies
4951
run: |
5052
sudo apt-get update
5153
sudo apt-get install git g++-9 build-essential bison flex \
5254
libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot \
5355
pkg-config libboost-system-dev libboost-python-dev \
54-
libboost-filesystem-dev zlib1g-dev clang-format-8 cmake
56+
libboost-filesystem-dev zlib1g-dev clang-format-8 cmake \
57+
nlohmann-json3-dev iverilog
58+
if: ${{ runner.os != 'macOS'}}
59+
60+
- name: Setup homebrew cache
61+
uses: actions/cache@v3
62+
with:
63+
path: |
64+
~/Library/Caches/Homebrew/boost--*
65+
~/Library/Caches/Homebrew/downloads/*--boost-*
66+
key: brew-${{ hashFiles('cpp/perspective/CMakeLists.txt') }}
67+
restore-keys: brew-
68+
if: ${{ runner.os == 'macOS' }}
69+
70+
- name: Install Mac Dependencies
71+
run: |
72+
brew install bison boost ccache cmake flex graphviz icarus-verilog make nlohmann-json
73+
sudo ln -s /usr/local/bin/gmake /usr/local/bin/make
74+
env:
75+
HOMEBREW_NO_AUTO_UPDATE: "1"
76+
if: ${{ runner.os == 'macOS'}}
5577

5678
- name: Format
5779
run: source .github/workflows/format-check.sh
5880
env:
5981
OS: ${{ runner.os }}
82+
if: ${{ runner.os != 'macOS'}}
6083

6184
- name: ccache
6285
uses: hendrikmuhs/ccache-action@v1
86+
with:
87+
key: ccache-${{ matrix.os }}-${{ matrix.plugin }}
6388

64-
- name: Install Yosys
89+
- name: Install yosys
6590
run: |
66-
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
67-
source .github/workflows/setup.sh
68-
env:
69-
OS: ${{ runner.os }}
91+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
92+
set -ex
93+
94+
git clone https://github.com/YosysHQ/yosys.git --branch yosys-0.17
95+
pushd yosys
96+
make CONFIG=gcc -j`nproc` && sudo make CONFIG=gcc install
97+
if: ${{ runner.os != 'macOS' }}
98+
99+
- name: Install yosys
100+
run: |
101+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
102+
set -ex
103+
104+
git clone https://github.com/YosysHQ/yosys.git --branch yosys-0.17
105+
pushd yosys
106+
make -j`nproc` && sudo make install
107+
if: ${{ runner.os == 'macOS' }}
108+
109+
- name: Install Googletest
110+
run: |
111+
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
112+
set -ex
113+
114+
git clone --branch release-1.8.1 https://github.com/google/googletest.git
115+
pushd googletest
116+
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 . && cmake --build build && sudo cmake --install build
117+
popd
70118
71119
- name: Build and test plugins
72120
run: |
73121
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
74-
source env/conda/bin/activate yosys-plugins
75-
source .github/workflows/build-and-test.sh
122+
.github/workflows/build-and-test.sh
76123
env:
77124
OS: ${{ runner.os }}
78125
PLUGIN_NAME: ${{ matrix.plugin }}
@@ -85,7 +132,7 @@ jobs:
85132
contents: write
86133

87134
steps:
88-
- uses: actions/checkout@v2
135+
- uses: actions/checkout@v4
89136
with:
90137
fetch-depth: 0
91138
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/common.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ fi
2626
# Parallel builds!
2727
MAKEFLAGS="-j 2"
2828

29+
export UNAME=`uname`
30+
if [ "$UNAME" == "Darwin" ]; then
31+
export NPROC=`sysctl -n hw.physicalcpu`
32+
else
33+
export NPROC=`nproc`
34+
fi
35+
2936
function action_fold() {
3037
if [ "$1" = "start" ]; then
3138
echo "::group::$2"

.github/workflows/format-check.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ source .github/workflows/common.sh
2222
##########################################################################
2323

2424
start_section Formatting
25-
make format -j`nproc`
25+
make format -j$NPROC
2626
test $(git status --porcelain | wc -l) -eq 0 || { git diff; false; }
2727
end_section
2828

.github/workflows/licensing.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,11 @@ jobs:
2525
Checks:
2626
runs-on: ubuntu-latest
2727
steps:
28-
- uses: actions/checkout@v2
28+
- uses: actions/checkout@v4
2929

3030
- uses: SymbiFlow/actions/checks@main
3131
with:
3232
exclude_license: |
3333
./design_introspection-plugin/tests/selection_to_tcl_list/selection_to_tcl_list.v
3434
./third_party/minilitex_ddr_arty/minilitex_ddr_arty.v
3535
./third_party/VexRiscv_Lite/VexRiscv_Lite.v
36-
third_party: |
37-
./third_party/googletest/

.github/workflows/setup.sh

Lines changed: 0 additions & 69 deletions
This file was deleted.

.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,14 @@
44
*.swp
55
*.log
66
/*/build
7+
pmgen.py
8+
9+
10+
# Test assets
11+
*/tests/*/ok
12+
*/tests/*/*.eblif
13+
*/tests/*/*.json
14+
*/tests/*/*.sdc
15+
*/tests/*/*.test
16+
*/tests/*/tmp
17+
*/tests/*/*.txt

.gitmodules

Lines changed: 0 additions & 6 deletions
This file was deleted.

Makefile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,14 @@ PLUGINS_TEST := $(foreach plugin,$(PLUGIN_LIST),test_$(plugin))
3434
all: plugins
3535

3636
TOP_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
37-
REQUIREMENTS_FILE ?= requirements.txt
38-
ENVIRONMENT_FILE ?= environment.yml
3937

40-
-include third_party/make-env/conda.mk
38+
UNAME := $(shell uname)
39+
ifeq ($(UNAME), Linux)
40+
NPROC = $(shell nproc)
41+
endif
42+
ifeq ($(UNAME), Darwin)
43+
NPROC = $(shell sysctl -n hw.physicalcpu)
44+
endif
4145

4246
define install_plugin =
4347
.PHONY: $(1).so
@@ -60,7 +64,7 @@ endef
6064
$(foreach plugin,$(PLUGIN_LIST),$(eval $(call install_plugin,$(plugin))))
6165

6266
pmgen.py:
63-
wget -nc -O $@ https://raw.githubusercontent.com/YosysHQ/yosys/master/passes/pmgen/pmgen.py
67+
wget -nc -O $@ https://raw.githubusercontent.com/YosysHQ/yosys/yosys-0.17/passes/pmgen/pmgen.py
6468

6569
.PHONY: plugins
6670
plugins: $(PLUGINS)
@@ -81,7 +85,7 @@ clean:: plugins_clean
8185
CLANG_FORMAT ?= clang-format-8
8286
.PHONY: format
8387
format:
84-
find . \( -name "*.h" -o -name "*.cc" \) -and -not -path '*/third_party/*' -print0 | xargs -0 -P $$(nproc) ${CLANG_FORMAT} -style=file -i
88+
find . \( -name "*.h" -o -name "*.cc" \) -and -not -path '*/third_party/*' -print0 | xargs -0 -P ${NPROC} ${CLANG_FORMAT} -style=file -i
8589

8690
VERIBLE_FORMAT ?= verible-verilog-format
8791
.PHONY: format-verilog

Makefile_plugin.common

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ TOP_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
4646

4747
_MAKEFILES := $(abspath $(filter-out %.d,$(MAKEFILE_LIST)))
4848

49+
UNAME := $(shell uname)
50+
4951
# Either find yosys in system and use its path or use the given path
5052
YOSYS_PATH ?= $(realpath $(dir $(shell command -v yosys))/..)
5153

@@ -61,6 +63,10 @@ LDFLAGS := $(shell $(YOSYS_CONFIG) --ldflags) $(LDFLAGS)
6163
LDLIBS := $(shell $(YOSYS_CONFIG) --ldlibs) $(LDLIBS)
6264
EXTRA_FLAGS ?=
6365

66+
ifeq ($(shell uname), Linux)
67+
EXTRA_FLAGS := $(EXTRA_FLAGS) -MMD
68+
endif
69+
6470
YOSYS_DATA_DIR = $(DESTDIR)$(shell $(YOSYS_CONFIG) --datdir)
6571
YOSYS_PLUGINS_DIR = $(YOSYS_DATA_DIR)/plugins
6672

@@ -93,7 +99,7 @@ endef
9399
$(foreach source,$(SOURCES),$(eval $(value _process-single-source-file)))
94100

95101
$(_ALL_OBJECTS): $(_MAKEFILES)
96-
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(EXTRA_FLAGS) -MMD -c -o $@ $(TARGET_SOURCES)
102+
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(EXTRA_FLAGS) -c -o $@ $(TARGET_SOURCES)
97103

98104
# Objects list for the purpose of adding extra dependencies after inclusion.
99105
# Example use: `$(OBJECTS): $(BUILD_DIR)/some-file.h`
@@ -126,7 +132,8 @@ endif
126132
# Installation
127133

128134
$(YOSYS_PLUGINS_DIR)/$(NAME).so: $(SO_LIB) | $(YOSYS_PLUGINS_DIR)
129-
install -D $(SO_LIB) $@
135+
mkdir -p $(YOSYS_PLUGINS_DIR)
136+
install $(SO_LIB) $@
130137

131138
.PHONY: install_plugin
132139
install_plugin: $(YOSYS_PLUGINS_DIR)/$(NAME).so

0 commit comments

Comments
 (0)