diff --git a/.cirrus.yml b/.cirrus.yml deleted file mode 100644 index 86edee59..00000000 --- a/.cirrus.yml +++ /dev/null @@ -1,18 +0,0 @@ -task: - name: build-test-ubuntu2004 - container: - cpu: 5 - memory: 20 - dockerfile: .cirrus/Dockerfile.ubuntu20.04 - - submodule_script: git submodule sync --recursive && git submodule update --init --recursive - build_script: mkdir build && cd build && cmake .. -DARCH='ecp5;generic;gowin;ice40;machxo2;nexus' -DOXIDE_INSTALL_PREFIX=$HOME/.cargo -DBUILD_TESTS=on -DBUILD_GUI=on -DWERROR=on && make -j3 - test_generic_script: cd build && ./nextpnr-generic-test - flow_test_generic_script: export NPNR=$(pwd)/build/nextpnr-generic && cd tests/generic/flow && ./run.sh - test_ice40_script: cd build && ./nextpnr-ice40-test - smoketest_ice40_script: export NEXTPNR=$(pwd)/build/nextpnr-ice40 && cd ice40/smoketest/attosoc && ./smoketest.sh - test_ecp5_script: cd build && ./nextpnr-ecp5-test - smoketest_generic_script: export NEXTPNR=$(pwd)/build/nextpnr-generic && cd generic/examples && ./simple.sh && ./simtest.sh - regressiontest_ice40_script: make -j $(nproc) -C tests/ice40/regressions NPNR=$(pwd)/build/nextpnr-ice40 - regressiontest_ecp5_script: make -j $(nproc) -C tests/ecp5/regressions NPNR=$(pwd)/build/nextpnr-ecp5 - archcheck_script: BUILD_DIR=$(pwd)/build ./.cirrus/archcheck.sh diff --git a/.cirrus/Dockerfile.ubuntu20.04 b/.cirrus/Dockerfile.ubuntu20.04 deleted file mode 100644 index 35ea18bd..00000000 --- a/.cirrus/Dockerfile.ubuntu20.04 +++ /dev/null @@ -1,68 +0,0 @@ -FROM ubuntu:focal-20201106 - -ENV DEBIAN_FRONTEND=noninteractive - -RUN set -e -x ;\ - apt-get -y update ;\ - apt-get -y upgrade ;\ - apt-get -y install \ - build-essential autoconf cmake clang bison wget flex gperf \ - libreadline-dev gawk tcl-dev libffi-dev graphviz xdot python3-dev \ - libboost-all-dev qt5-default git libftdi-dev pkg-config libeigen3-dev \ - zlib1g-dev curl python3-pip libcapnp-dev capnproto - - -RUN set -e -x ;\ - mkdir -p /usr/local/src ;\ - cd /usr/local/src ;\ - git clone --recursive https://github.com/steveicarus/iverilog.git ;\ - cd iverilog ;\ - git reset --hard 84b4ebee0cfcda28a242d89a07020cd70b1d3e7f ;\ - sh autoconf.sh ;\ - ./configure ;\ - make -j $(nproc) ;\ - make install ;\ - rm -rf /usr/local/src/iverilog - -RUN set -e -x ;\ - mkdir -p /usr/local/src ;\ - cd /usr/local/src ;\ - git clone --recursive https://github.com/YosysHQ/icestorm.git ;\ - cd icestorm ;\ - git reset --hard 9f66f9ce16941c6417813cb87653c735a78b53ae ;\ - make -j $(nproc) ;\ - make install - -RUN set -e -x ;\ - mkdir -p /usr/local/src ;\ - cd /usr/local/src ;\ - git clone --recursive https://github.com/YosysHQ/yosys.git ;\ - cd yosys ;\ - git reset --hard cd8b2ed4e6f9447c94d801de7db7ae6ce0976d57 ;\ - make -j $(nproc) ;\ - make install ;\ - rm -rf /usr/local/src/yosys - -RUN set -e -x ;\ - mkdir -p /usr/local/src ;\ - cd /usr/local/src ;\ - git clone --recursive https://github.com/YosysHQ/prjtrellis.git ;\ - cd prjtrellis ;\ - git reset --hard 26f917d6052e084df30211ae3a78c8a165121e09 ;\ - cd libtrellis ;\ - cmake . ;\ - make -j $(nproc) ;\ - make install - -RUN set -e -x ;\ - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ;\ - mkdir -p /usr/local/src ;\ - cd /usr/local/src ;\ - git clone --recursive https://github.com/gatecat/prjoxide.git ;\ - cd prjoxide ;\ - git reset --hard 318331f8b30c2e2a31cc41d51f104b671e180a8a ;\ - cd libprjoxide ;\ - PATH=$PATH:$HOME/.cargo/bin cargo install --path prjoxide - -RUN set -e -x ;\ - pip3 install apycula==0.2a4 diff --git a/.cirrus/archcheck.sh b/.cirrus/archcheck.sh deleted file mode 100755 index 6ff6c043..00000000 --- a/.cirrus/archcheck.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash -set -ex -echo "Running archcheck!" -${BUILD_DIR}/nextpnr-ice40 --hx8k --package ct256 --test -${BUILD_DIR}/nextpnr-ice40 --up5k --package sg48 --test -${BUILD_DIR}/nextpnr-ecp5 --um5g-25k --package CABGA381 --test -${BUILD_DIR}/nextpnr-nexus --device LIFCL-40-9BG400CES --test -${BUILD_DIR}/nextpnr-gowin --device GW1N-UV4LQ144C6/I5 --test diff --git a/.github/ci/build_common.sh b/.github/ci/build_common.sh new file mode 100644 index 00000000..2a2d8447 --- /dev/null +++ b/.github/ci/build_common.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +# Install latest Yosys +function build_yosys { + PREFIX=`pwd`/.yosys + YOSYS_PATH=${DEPS_PATH}/yosys + mkdir -p ${YOSYS_PATH} + git clone --recursive https://github.com/YosysHQ/yosys ${YOSYS_PATH} + pushd ${YOSYS_PATH} + git reset --hard ${YOSYS_REVISION} + make -j`nproc` PREFIX=$PREFIX + make install PREFIX=$PREFIX + popd +} + +function build_icestorm { + PREFIX=`pwd`/.icestorm + ICESTORM_PATH=${DEPS_PATH}/icestorm + mkdir -p ${ICESTORM_PATH} + git clone --recursive https://github.com/YosysHQ/icestorm ${ICESTORM_PATH} + pushd ${ICESTORM_PATH} + git reset --hard ${ICESTORM_REVISION} + make -j`nproc` PREFIX=${PREFIX} + make install PREFIX=${PREFIX} + popd +} + +function build_trellis { + PREFIX=`pwd`/.trellis + TRELLIS_PATH=${DEPS_PATH}/prjtrellis + mkdir -p ${TRELLIS_PATH} + git clone --recursive https://github.com/YosysHQ/prjtrellis ${TRELLIS_PATH} + pushd ${TRELLIS_PATH} + git reset --hard ${TRELLIS_REVISION} + mkdir -p libtrellis/build + pushd libtrellis/build + cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} .. + make -j`nproc` + make install + popd + popd +} + +function build_prjoxide { + PREFIX=`pwd`/.prjoxide + PRJOXIDE_PATH=${DEPS_PATH}/prjoxide + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ;\ + mkdir -p ${PRJOXIDE_PATH} + git clone --recursive https://github.com/gatecat/prjoxide ${PRJOXIDE_PATH} + pushd ${PRJOXIDE_PATH} + git reset --hard ${PRJOXIDE_REVISION} + cd libprjoxide + PATH=$PATH:$HOME/.cargo/bin cargo install --root $PREFIX --path prjoxide + popd +} diff --git a/.github/ci/build_ecp5.sh b/.github/ci/build_ecp5.sh new file mode 100644 index 00000000..2d09a6f6 --- /dev/null +++ b/.github/ci/build_ecp5.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +function get_dependencies { + : +} + +function build_nextpnr { + mkdir build + pushd build + cmake .. -DARCH=ecp5 -DTRELLIS_INSTALL_PREFIX=${GITHUB_WORKSPACE}/.trellis -DWERROR=on -DBUILD_GUI=on -DUSE_IPO=off + make nextpnr-ecp5 -j`nproc` + popd +} + +function run_tests { + export PATH=${GITHUB_WORKSPACE}/.trellis/bin:${GITHUB_WORKSPACE}/.yosys/bin:$PATH + make -j $(nproc) -C tests/ecp5/regressions NPNR=$(pwd)/build/nextpnr-ecp5 +} + +function run_archcheck { + pushd build + ./nextpnr-ecp5 --um5g-25k --package CABGA381 --test + popd +} diff --git a/.github/ci/build_generic.sh b/.github/ci/build_generic.sh new file mode 100644 index 00000000..49a73d3a --- /dev/null +++ b/.github/ci/build_generic.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +function get_dependencies { + : +} + +function build_nextpnr { + mkdir build + pushd build + cmake .. -DARCH=generic -DWERROR=on + make nextpnr-generic -j`nproc` + popd +} + +function run_tests { + export PATH=${GITHUB_WORKSPACE}/.yosys/bin:$PATH + ( export NPNR=$(pwd)/build/nextpnr-generic && cd tests/generic/flow && ./run.sh ) +} + +function run_archcheck { + pushd build + # TODO + # ./nextpnr-generic --uarch example --test + popd +} diff --git a/.github/ci/build_gowin.sh b/.github/ci/build_gowin.sh new file mode 100644 index 00000000..430cd2b0 --- /dev/null +++ b/.github/ci/build_gowin.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +function get_dependencies { + pip3 install apycula==${APYCULA_REVISION} +} + +function build_nextpnr { + mkdir build + pushd build + cmake .. -DARCH=gowin -DWERROR=on -DBUILD_GUI=on -DUSE_IPO=off + make nextpnr-gowin -j`nproc` + popd +} + +function run_tests { + : +} + +function run_archcheck { + pushd build + ./nextpnr-gowin --device GW1N-UV4LQ144C6/I5 --test + popd +} diff --git a/.github/ci/build_ice40.sh b/.github/ci/build_ice40.sh new file mode 100644 index 00000000..ea9234cc --- /dev/null +++ b/.github/ci/build_ice40.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +function get_dependencies { + : +} + +function build_nextpnr { + mkdir build + pushd build + cmake .. -DARCH=ice40 -DICESTORM_INSTALL_PREFIX=${GITHUB_WORKSPACE}/.icestorm -DWERROR=on -DBUILD_TESTS=on -DBUILD_GUI=on + make nextpnr-ice40 nextpnr-ice40-test -j`nproc` + popd +} + +function run_tests { + export PATH=${GITHUB_WORKSPACE}/.yosys/bin:${GITHUB_WORKSPACE}/.icestorm/bin:$PATH + (cd build && ./nextpnr-ice40-test) + (export NEXTPNR=$(pwd)/build/nextpnr-ice40 && cd ice40/smoketest/attosoc && ./smoketest.sh) + make -j $(nproc) -C tests/ice40/regressions NPNR=$(pwd)/build/nextpnr-ice40 +} + +function run_archcheck { + pushd build + ./nextpnr-ice40 --hx8k --package ct256 --test + ./nextpnr-ice40 --up5k --package sg48 --test + popd +} diff --git a/.github/ci/build_machxo2.sh b/.github/ci/build_machxo2.sh new file mode 100644 index 00000000..c81a538b --- /dev/null +++ b/.github/ci/build_machxo2.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +function get_dependencies { + : +} + +function build_nextpnr { + mkdir build + pushd build + cmake .. -DARCH=machxo2 -DTRELLIS_INSTALL_PREFIX=${GITHUB_WORKSPACE}/.trellis -DWERROR=on -DUSE_IPO=off + make nextpnr-machxo2 -j`nproc` + popd +} + +function run_tests { + : +} + +function run_archcheck { + : +} diff --git a/.github/ci/build_mistral.sh b/.github/ci/build_mistral.sh index 3c809b0e..807c6206 100644 --- a/.github/ci/build_mistral.sh +++ b/.github/ci/build_mistral.sh @@ -1,5 +1,7 @@ #!/bin/bash +export MISTRAL_PATH=${DEPS_PATH}/mistral + function get_dependencies { # Fetch mistral mkdir -p ${MISTRAL_PATH} @@ -17,6 +19,10 @@ function build_nextpnr { popd } +function run_tests { + : +} + function run_archcheck { pushd build ./nextpnr-mistral --device 5CEBA2F17A7 --test diff --git a/.github/ci/build_nexus.sh b/.github/ci/build_nexus.sh new file mode 100644 index 00000000..e8acd9b6 --- /dev/null +++ b/.github/ci/build_nexus.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +function get_dependencies { + : +} + +function build_nextpnr { + mkdir build + pushd build + cmake .. -DARCH=nexus -DOXIDE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/.prjoxide + make nextpnr-nexus -j`nproc` + popd +} + +function run_tests { + : +} + +function run_archcheck { + pushd build + ./nextpnr-nexus --device LIFCL-40-9BG400CES --test + popd +} diff --git a/.github/workflows/arch_ci.yml b/.github/workflows/arch_ci.yml new file mode 100644 index 00000000..5bf83630 --- /dev/null +++ b/.github/workflows/arch_ci.yml @@ -0,0 +1,95 @@ +# CI for everything other than the sui generis FPGA interchange arrangements + +name: Arch CI tests + +on: [push, pull_request] + +jobs: + Build-nextpnr: + strategy: + fail-fast: false + matrix: + arch: [mistral, ice40, ecp5, generic, nexus, machxo2, gowin] + runs-on: ubuntu-latest + env: + DEPS_PATH: ${{ github.workspace }}/deps + YOSYS_REVISION: bd7ee79486d4e8788f36de8c25a3fb2df451d682 + ICESTORM_REVISION: 9f66f9ce16941c6417813cb87653c735a78b53ae + TRELLIS_REVISION: 48486ebd1e03e4ac42c96299e881adf9d43bc241 + PRJOXIDE_REVISION: c3fb1526cf4a2165e15b74f4a994d153c7695fe4 + MISTRAL_REVISION: ebfc0dd2cc7d6d2159b641a397c88554840e93c9 + APYCULA_REVISION: 0.2a4 + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + + - uses: actions/setup-python@v2 + + - name: Install + run: | + sudo apt-get update + sudo apt-get install git make cmake libboost-all-dev python3-dev libeigen3-dev tcl-dev lzma-dev libftdi-dev clang bison flex swig qt5-default iverilog + + - name: Cache yosys installation + uses: actions/cache@v2 + id: cache-yosys + with: + path: .yosys + key: cache-yosys-${{ env.YOSYS_REVISION }}-r2 + + - name: Build yosys + run: | + source ./.github/ci/build_common.sh + build_yosys + if: steps.cache-yosys.outputs.cache-hit != 'true' + + - name: Cache icestorm installation + uses: actions/cache@v2 + id: cache-icestorm + with: + path: .icestorm + key: cache-icestorm-${{ env.ICESTORM_REVISION }} + if: matrix.arch == 'ice40' + + - name: Build icestorm + run: | + source ./.github/ci/build_common.sh + build_icestorm + if: matrix.arch == 'ice40' && steps.cache-icestorm.outputs.cache-hit != 'true' + + - name: Cache trellis installation + uses: actions/cache@v2 + id: cache-trellis + with: + path: .trellis + key: cache-trellis-${{ env.TRELLIS_REVISION }} + if: matrix.arch == 'ecp5' || matrix.arch == 'machxo2' + + - name: Build trellis + run: | + source ./.github/ci/build_common.sh + build_trellis + if: (matrix.arch == 'ecp5' || matrix.arch == 'machxo2') && steps.cache-trellis.outputs.cache-hit != 'true' + + - name: Cache prjoxide installation + uses: actions/cache@v2 + id: cache-prjoxide + with: + path: .prjoxide + key: cache-prjoxide-${{ env.PRJOXIDE_REVISION }} + if: matrix.arch == 'nexus' + + - name: Build prjoxide + run: | + source ./.github/ci/build_common.sh + build_prjoxide + if: matrix.arch == 'nexus' && steps.cache-prjoxide.outputs.cache-hit != 'true' + + - name: Execute build nextpnr + run: | + source ./.github/ci/build_${{ matrix.arch }}.sh + get_dependencies + build_nextpnr + run_tests + run_archcheck diff --git a/.github/workflows/mistral_ci.yml b/.github/workflows/mistral_ci.yml deleted file mode 100644 index b0bbfb52..00000000 --- a/.github/workflows/mistral_ci.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Mistral CI tests - -on: [push, pull_request] - -jobs: - Build-nextpnr: - runs-on: ubuntu-latest - steps: - - - uses: actions/checkout@v2 - with: - submodules: recursive - - - uses: actions/setup-python@v2 - - - name: Install - run: | - sudo apt-get update - sudo apt-get install git make cmake libboost-all-dev python3-dev libeigen3-dev tcl-dev lzma-dev clang bison flex swig - - - name: Execute build nextpnr - env: - MISTRAL_PATH: ${{ github.workspace }}/deps/mistral - MISTRAL_REVISION: ebfc0dd2cc7d6d2159b641a397c88554840e93c9 - run: | - source ./.github/ci/build_mistral.sh - get_dependencies - build_nextpnr - run_archcheck diff --git a/CMakeLists.txt b/CMakeLists.txt index 89bdb360..3120cf40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -134,7 +134,7 @@ if (MSVC) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /W4 /wd4100 /wd4244 /wd4125 /wd4800 /wd4456 /wd4458 /wd4305 /wd4459 /wd4121 /wd4996 /wd4127") else() # N.B. the -Wno-array-bounds is to work around a false positive in GCC 9 - set(WARN_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-array-bounds") + set(WARN_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-array-bounds -Wno-format-truncation") if (WERROR) set(WARN_FLAGS "${WARN_FLAGS} -Werror") endif() diff --git a/ice40/smoketest/attosoc/smoketest.sh b/ice40/smoketest/attosoc/smoketest.sh index 05408ab1..65823461 100755 --- a/ice40/smoketest/attosoc/smoketest.sh +++ b/ice40/smoketest/attosoc/smoketest.sh @@ -4,6 +4,6 @@ yosys -q -p 'synth_ice40 -json attosoc.json -top attosoc' attosoc.v picorv32.v $NEXTPNR --hx8k --json attosoc.json --pcf attosoc.pcf --asc attosoc.asc --freq 50 icetime -tmd hx8k -c 50 attosoc.asc icebox_vlog -L -l -p attosoc.pcf -c -n attosoc attosoc.asc > attosoc_pnr.v -iverilog -o attosoc_pnr_tb attosoc_pnr.v attosoc_tb.v `yosys-config --datdir/ice40/cells_sim.v` +iverilog -DNO_ICE40_DEFAULT_ASSIGNMENTS -o attosoc_pnr_tb attosoc_pnr.v attosoc_tb.v `yosys-config --datdir/ice40/cells_sim.v` vvp attosoc_pnr_tb diff output.txt golden.txt diff --git a/tests b/tests index ccc61e5e..00c55a9e 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit ccc61e5ec7cc04410462ec3196ad467354787afb +Subproject commit 00c55a9eb9ea2e062b51fe0d64741412b185d95d