Skip to content

Commit

Permalink
Build Synlig as standalone binary (#2538)
Browse files Browse the repository at this point in the history
Synlig is no longer a yosys plugin, it is a standalone tool now, it uses
yosys as a framework for synthesis.

It is still possible to build synlig as a plugin, but it might be
removed in the future.

Requires: #2539
  • Loading branch information
tgorochowik authored Sep 5, 2024
2 parents 25fb5f5 + e363afe commit 13705ab
Show file tree
Hide file tree
Showing 57 changed files with 1,908 additions and 1,173 deletions.
297 changes: 136 additions & 161 deletions .ci.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/scripts/format_sources.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash

find frontends third_party/yosys_mod \
find third_party/yosys_mod src/ \
-name "*.h" -o -name "*.cc" \
| xargs clang-format -i
20 changes: 11 additions & 9 deletions .github/scripts/run_group_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,28 @@ for test_case in "${test_cases[@]}"; do
# Used only for current test
ASAN_OPTIONS+=":log_path=${test_out_dir}/asan"

# libfakedlclose.so has to be used with yosys to prevent
# systemverilog.so from being unloaded by yosys as part of cleanup
# before termination. ASAN needs it to be in memory to correctly
# symbolize function addresses.
if [ "$BUILD_TYPE" == "'plugin'" ]; then
BINARY="${REPO_DIR}/out/current/bin/yosys -Q"
else
BINARY="${REPO_DIR}/out/current/bin/synlig -Q"
fi
make -C $REPO_DIR/tests \
-j $(nproc) \
--no-print-directory \
YOSYS_BIN:="LD_PRELOAD=${REPO_DIR}/out/current/lib/libfakedlclose.so ${REPO_DIR}/out/current/bin/yosys -Q" \
SYNLIG_BIN:="$BINARY" \
BUILD_TYPE=$BUILD_TYPE \
ENABLE_READLINE=0 \
PRETTY=0 \
PARSER=$PARSER \
TEST=$test_case \
$TARGET > "${test_out_dir}/yosys.log"
$TARGET > "${test_out_dir}/synlig.log"
)
(( $? == 0 )) && test_ok=1 || test_ok=0

sed -i -n \
-e "s#${REPO_DIR}/##g" \
-E -e '/1. Executing (Verilog with )?UHDM frontend./,$ {/^End of script/d; /^Time spent/d; p}' \
"${test_out_dir}/yosys.log"
"${test_out_dir}/synlig.log"

# ASAN log contains PID in the name. There should be only one log, but even
# assuming more processes were spawned, we can quite safely concatenate
Expand Down Expand Up @@ -119,8 +121,8 @@ for test_case in "${test_cases[@]}"; do
fi

if (( $test_ok == 0 )); then
printf '\x1b[0;39;1;3mUp to last 50 lines of yosys log:\x1b[0m\n'
tail -n 50 ${test_out_dir}/yosys.log
printf '\x1b[0;39;1;3mUp to last 50 lines of synlig log:\x1b[0m\n'
tail -n 50 ${test_out_dir}/synlig.log
global_status=1
fi

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/bsg-test-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ jobs:
- name: Download binaries
uses: actions/download-artifact@v2
with:
name: binaries
name: binaries-plugin

# See https://github.com/actions/upload-artifact/issues/38
- name: Extract
run: tar -xf binaries.tar
run: tar -xf binaries-plugin.tar

- name: Generate and diff tests
run: |
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,6 @@ jobs:
third_party/{surelog,yosys} \
;
- name: Apply Debian patch
if: ${{ matrix.debian-patch }}
run: |
git -C third_party/yosys apply ../yosys_mod/yosys_debian.patch
- name: Setup cache
uses: actions/cache@v2
with:
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/formal-verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,26 @@ jobs:
- name: Download binaries
uses: actions/download-artifact@v2
with:
name: binaries
name: binaries-release

# See https://github.com/actions/upload-artifact/issues/38
- name: Extract
run: tar -xf binaries.tar
- name: Extract binaries
run: tar -xf binaries-release.tar

- name: Download sv2v
- name: Download tools
uses: actions/download-artifact@v2
with:
name: sv2v
path: out/current/bin/
name: tools

- name: Extract tools
run: tar -xf tools.tar

- name: Build eqy and sby
run: |
./tests/scripts/run_formal.sh --name $TEST_SUITE_NAME build_dependencies
- name: Test
run: |
chmod +x out/current/bin/sv2v
source .github/scripts/common.sh
./tests/scripts/run_formal.sh --name $TEST_SUITE_NAME run
Expand Down
40 changes: 20 additions & 20 deletions .github/workflows/large-designs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ jobs:
- name: Download binaries
uses: actions/download-artifact@v2
with:
name: binaries
name: binaries-release

# See https://github.com/actions/upload-artifact/issues/38
- name: Extract
run: tar -xf binaries.tar
run: tar -xf binaries-release.tar

- name: Build & Test
run: |
Expand Down Expand Up @@ -89,11 +89,11 @@ jobs:
- name: Download binaries
uses: actions/download-artifact@v2
with:
name: binaries
name: binaries-plugin

# See https://github.com/actions/upload-artifact/issues/38
- name: Extract
run: tar -xf binaries.tar
run: tar -xf binaries-plugin.tar

- name: Setup build environment & Build & Test
run: |
Expand Down Expand Up @@ -143,11 +143,11 @@ jobs:
- name: Download binaries
uses: actions/download-artifact@v2
with:
name: binaries
name: binaries-release

# See https://github.com/actions/upload-artifact/issues/38
- name: Extract
run: tar -xf binaries.tar
run: tar -xf binaries-release.tar

- name: Build & Test
run: |
Expand All @@ -157,18 +157,18 @@ jobs:
- name: Generate AST
run: |
FILE_NAME=tests/build/lowrisc_systems_top_earlgrey_nexysvideo_0.1/synth-vivado/yosys.log
FILE_NAME=tests/build/lowrisc_systems_top_earlgrey_nexysvideo_0.1/synth-vivado/synlig.log
start=$(grep -n "AST_MODULE" $FILE_NAME |cut -f1 -d:|head -n 1)
end=$(grep -n "AST_" $FILE_NAME |cut -f1 -d:|tail -n 1)
sed -n $start,"$end"p $FILE_NAME > yosys.ast
sed -n $start,"$end"p $FILE_NAME > synlig.ast
- name: Upload AST
uses: actions/upload-artifact@v2
if: ${{github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')}}
with:
name: opentitan-yosys.ast
path: yosys.ast
name: opentitan-synlig.ast
path: synlig.ast

# # Uncomment when first job on master will pass
# - name: Download binaries
Expand Down Expand Up @@ -227,11 +227,11 @@ jobs:
- name: Download binaries
uses: actions/download-artifact@v2
with:
name: binaries
name: binaries-release

# See https://github.com/actions/upload-artifact/issues/38
- name: Extract
run: tar -xf binaries.tar
run: tar -xf binaries-release.tar

- name: Build & Test
run: |
Expand Down Expand Up @@ -295,11 +295,11 @@ jobs:
- name: Download binaries
uses: actions/download-artifact@v2
with:
name: binaries
name: binaries-release

# See https://github.com/actions/upload-artifact/issues/38
- name: Extract
run: tar -xf binaries.tar
run: tar -xf binaries-release.tar

- name: Create venv & Parse OpenTitan components & Make summary
run: |
Expand Down Expand Up @@ -354,11 +354,11 @@ jobs:
- name: Download binaries
uses: actions/download-artifact@v2
with:
name: binaries
name: binaries-release

# See https://github.com/actions/upload-artifact/issues/38
- name: Extract
run: tar -xf binaries.tar
run: tar -xf binaries-release.tar

- name: Build & Test
run: |
Expand Down Expand Up @@ -408,11 +408,11 @@ jobs:
- name: Download binaries
uses: actions/download-artifact@v2
with:
name: binaries
name: binaries-release

# See https://github.com/actions/upload-artifact/issues/38
- name: Extract
run: tar -xf binaries.tar
run: tar -xf binaries-release.tar

- name: Build & Test
run: |
Expand Down Expand Up @@ -462,11 +462,11 @@ jobs:
- name: Download binaries
uses: actions/download-artifact@v2
with:
name: binaries
name: binaries-release

# See https://github.com/actions/upload-artifact/issues/38
- name: Extract
run: tar -xf binaries.tar
run: tar -xf binaries-release.tar

- name: Build & Test
run: |
Expand Down
Loading

0 comments on commit 13705ab

Please sign in to comment.