diff --git a/.github/travis/common.sh b/.github/scripts/common.sh similarity index 66% rename from .github/travis/common.sh rename to .github/scripts/common.sh index b827736..0439687 100644 --- a/.github/travis/common.sh +++ b/.github/scripts/common.sh @@ -9,22 +9,11 @@ NC='\033[0m' # No Color SPACER="echo -e ${GRAY} - ${NC}" -export -f travis_nanoseconds -export -f travis_fold -export -f travis_time_start -export -f travis_time_finish -export -f travis_wait -export -f travis_jigger - function start_section() { - travis_fold start "$1" - travis_time_start echo -e "${PURPLE}${1}${NC}: $2${NC}" echo -e "${GRAY}-------------------------------------------------------------------${NC}" } function end_section() { echo -e "${GRAY}-------------------------------------------------------------------${NC}" - travis_time_finish - travis_fold end "$1" } diff --git a/.github/travis/git-check.sh b/.github/scripts/git-check.sh similarity index 94% rename from .github/travis/git-check.sh rename to .github/scripts/git-check.sh index b88c2db..654eaf9 100755 --- a/.github/travis/git-check.sh +++ b/.github/scripts/git-check.sh @@ -1,6 +1,6 @@ set -e -source .github/travis/common.sh +source .github/scripts/common.sh # Output any changes in the repository # ------------------------------------------------------------------------ diff --git a/.github/scripts/tuttest_exec.sh b/.github/scripts/tuttest_exec.sh new file mode 100644 index 0000000..efc0410 --- /dev/null +++ b/.github/scripts/tuttest_exec.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +function tuttest_exec () { + echo " ==================================================================== " 1>&2 + echo " CMD : tuttest $@ " 1>&2 + echo " OUTPUT: " 1>&2 + echo "" 1>&2 + echo "$(tuttest $@)" 1>&2 + echo " -------------------------------------------------------------------- " 1>&2 + echo "" 1>&2 + + tuttest "$@" +} diff --git a/.github/workflows/tuttest.yml b/.github/workflows/tuttest.yml new file mode 100644 index 0000000..c3a0bc1 --- /dev/null +++ b/.github/workflows/tuttest.yml @@ -0,0 +1,88 @@ +name: tuttest +on: [push, pull_request] + +jobs: + examples: + runs-on: ubuntu-18.04 + strategy: + fail-fast: false + matrix: + include: + - {toolchain: "eos-s3", os: "ubuntu", os-version: "xenial", example: "eos-s3-counter"} + - {toolchain: "eos-s3", os: "ubuntu", os-version: "bionic", example: "eos-s3-counter"} + - {toolchain: "eos-s3", os: "ubuntu", os-version: "eoan", example: "eos-s3-counter"} + - {toolchain: "eos-s3", os: "ubuntu", os-version: "focal", example: "eos-s3-counter"} + - {toolchain: "eos-s3", os: "centos", os-version: "7", example: "eos-s3-counter"} + - {toolchain: "eos-s3", os: "centos", os-version: "8", example: "eos-s3-counter"} + + - {toolchain: "xc7", os: "ubuntu", os-version: "xenial", example: "xc7-counter"} + - {toolchain: "xc7", os: "ubuntu", os-version: "bionic", example: "xc7-counter"} + - {toolchain: "xc7", os: "ubuntu", os-version: "eoan", example: "xc7-counter"} + - {toolchain: "xc7", os: "ubuntu", os-version: "focal", example: "xc7-counter"} + - {toolchain: "xc7", os: "centos", os-version: "7", example: "xc7-counter"} + - {toolchain: "xc7", os: "centos", os-version: "8", example: "xc7-counter"} + + - {toolchain: "xc7", os: "ubuntu", os-version: "xenial", example: "xc7-picosoc"} + - {toolchain: "xc7", os: "ubuntu", os-version: "bionic", example: "xc7-picosoc"} + - {toolchain: "xc7", os: "ubuntu", os-version: "eoan", example: "xc7-picosoc"} + - {toolchain: "xc7", os: "ubuntu", os-version: "focal", example: "xc7-picosoc"} + - {toolchain: "xc7", os: "centos", os-version: "7", example: "xc7-picosoc"} + - {toolchain: "xc7", os: "centos", os-version: "8", example: "xc7-picosoc"} + + - {toolchain: "xc7", os: "ubuntu", os-version: "xenial", example: "xc7-litex"} + - {toolchain: "xc7", os: "ubuntu", os-version: "bionic", example: "xc7-litex"} + - {toolchain: "xc7", os: "ubuntu", os-version: "eoan", example: "xc7-litex"} + - {toolchain: "xc7", os: "ubuntu", os-version: "focal", example: "xc7-litex"} + - {toolchain: "xc7", os: "centos", os-version: "7", example: "xc7-litex"} + - {toolchain: "xc7", os: "centos", os-version: "8", example: "xc7-litex"} + + - {toolchain: "xc7", os: "ubuntu", os-version: "xenial", example: "xc7-linux"} + - {toolchain: "xc7", os: "ubuntu", os-version: "bionic", example: "xc7-linux"} + - {toolchain: "xc7", os: "ubuntu", os-version: "eoan", example: "xc7-linux"} + - {toolchain: "xc7", os: "ubuntu", os-version: "focal", example: "xc7-linux"} + - {toolchain: "xc7", os: "centos", os-version: "7", example: "xc7-linux"} + - {toolchain: "xc7", os: "centos", os-version: "8", example: "xc7-linux"} + + env: + LANG: "en_US.UTF-8" + DOCKER_NAME: test + IN_DOCKER_EXEC: "docker exec -t test bash -ex -c" + + steps: + - name: Prepare Repository + uses: actions/checkout@v2 + + - name: Set Up Python + uses: actions/setup-python@v1 + + - name: Install Prerequisites + run: | + sudo locale-gen $LANG + pip3 install git+https://github.com/antmicro/tuttest#egg=tuttest dataclasses + + - name: Set Up Docker + run: | + docker create --name $DOCKER_NAME --env LANG="en_US.UTF-8" --env LANGUAGE="en_US" --env DEBIAN_FRONTEND="noninteractive" --env INSTALL_DIR=~/opt/symbiflow/ -v $PWD:$PWD --workdir $PWD --tty ${{matrix.os}}:${{matrix.os-version}} + docker start $DOCKER_NAME + + - name: Test Main README.rst + run: | + rm README.rst && make README.rst && .github/scripts/git-check.sh + + - name: (tuttest) Install SymbiFlow Toolchain + run: | + source .github/scripts/tuttest_exec.sh + tuttest_exec README.rst install-req-${{matrix.os}} | ${IN_DOCKER_EXEC} "$(cat /dev/stdin)" + tuttest_exec README.rst wget-conda | ${IN_DOCKER_EXEC} "$(cat /dev/stdin)" + tuttest_exec ${{matrix.toolchain}}/README.rst ${{matrix.toolchain}}-setup-toolchain | ${IN_DOCKER_EXEC} "$(cat /dev/stdin)" + + - name: (tuttest) Test Example + run: | + source .github/scripts/tuttest_exec.sh + tuttest_exec ${{matrix.toolchain}}/README.rst ${{matrix.toolchain}}-prepare-env,${{matrix.example}} | ${IN_DOCKER_EXEC} "$(cat /dev/stdin)" + + - uses: actions/upload-artifact@v2 + with: + path: | + **/*.bit + !xc7/litex_demo/pythondata-cpu-microwatt/**/*.bit diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1097adb..0000000 --- a/.travis.yml +++ /dev/null @@ -1,55 +0,0 @@ -os: linux -dist: focal -language: minimal - -services: - - docker - -env: - # Testing QuickLogic toolchain on all OSes - - TOOLCHAIN=eos-s3 OS=ubuntu OS_VERSION=xenial - - TOOLCHAIN=eos-s3 OS=ubuntu OS_VERSION=bionic - - TOOLCHAIN=eos-s3 OS=ubuntu OS_VERSION=eoan - - TOOLCHAIN=eos-s3 OS=ubuntu OS_VERSION=focal - - TOOLCHAIN=eos-s3 OS=centos OS_VERSION=7 - - TOOLCHAIN=eos-s3 OS=centos OS_VERSION=8 - # Testing Xilinx 7 Series toolchain on all OSes - - TOOLCHAIN=xc7 OS=ubuntu OS_VERSION=xenial - - TOOLCHAIN=xc7 OS=ubuntu OS_VERSION=bionic - - TOOLCHAIN=xc7 OS=ubuntu OS_VERSION=eoan - - TOOLCHAIN=xc7 OS=ubuntu OS_VERSION=focal - - TOOLCHAIN=xc7 OS=centos OS_VERSION=7 - - TOOLCHAIN=xc7 OS=centos OS_VERSION=8 - -before_install: - - sudo locale-gen "en_US.UTF-8" - - export LANG="en_US.UTF-8" - - source .github/travis/common.sh - # Get tuttest and setup a docker container to run the test in. - - pip install git+https://github.com/antmicro/tuttest#egg=tuttest - - export DOCKER_NAME=test - - export IN_DOCKER_EXEC="docker exec -t $DOCKER_NAME bash -ex -c" - - docker create - --name $DOCKER_NAME - --env LANG="en_US.UTF-8" - --env LANGUAGE="en_US" - --env DEBIAN_FRONTEND="noninteractive" - --env INSTALL_DIR=~/opt/symbiflow/ - -v /home/travis:/home/travis - --workdir $PWD - --tty - $OS:$OS_VERSION - - docker start $DOCKER_NAME - -install: - # Check the top level README file is up to date. - - rm README.rst && make README.rst && .github/travis/git-check.sh - # Install the toolchain into the docker container. - - tuttest README.rst install-wget-${OS} | ${IN_DOCKER_EXEC} "$(cat /dev/stdin)" - - tuttest README.rst wget-conda | ${IN_DOCKER_EXEC} "$(cat /dev/stdin)" - - tuttest ${TOOLCHAIN}/README.rst ${TOOLCHAIN}-setup-toolchain | ${IN_DOCKER_EXEC} "$(cat /dev/stdin)" - -script: - # Run the tests inside the docker container. - - if [ "$TOOLCHAIN" = "xc7" ]; then EXTRA_TESTS=,xc7-picosoc; fi - - tuttest ${TOOLCHAIN}/README.rst ${TOOLCHAIN}-prepare-env,${TOOLCHAIN}-counter${EXTRA_TESTS} | ${IN_DOCKER_EXEC} "$(cat /dev/stdin)" diff --git a/README.rst b/README.rst index 5e4fe88..1f8e862 100644 --- a/README.rst +++ b/README.rst @@ -35,21 +35,22 @@ If you have not already done so, clone this repository and ``cd`` into it: Prerequisites ------------- -The only required prerequisite is ``wget``. You can install it using: + +Install the following prerequisites before using symbiflow-examples: * For Ubuntu: .. code:: bash - :name: install-wget-ubuntu + :name: install-req-ubuntu apt update && apt install -y wget * For CentOS: .. code:: bash - :name: install-wget-centos + :name: install-req-centos - yum install -y wget + yum install -y wget which Toolchain installation ---------------------- @@ -90,7 +91,10 @@ and so you will need to add some ``sudo`` commands to the instructions below. conda env create -f xc7/environment.yml conda activate xc7 mkdir -p $INSTALL_DIR/xc7/install - wget -qO- https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/continuous/install/66/20200914-111752/symbiflow-arch-defs-install-05d68df0.tar.xz | tar -xJC $INSTALL_DIR/xc7/install + wget -qO- https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/presubmit/install/1049/20201123-030526/symbiflow-arch-defs-install-05bd35c7.tar.xz | tar -xJC $INSTALL_DIR/xc7/install + mkdir -p $INSTALL_DIR/xc7/install/share/symbiflow/arch + wget -qO- https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/presubmit/install/1049/20201123-030526/symbiflow-xc7a50t_test.tar.xz | tar -xJC $INSTALL_DIR/xc7/install/share/symbiflow/arch + wget -qO- https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/presubmit/install/1049/20201123-030526/symbiflow-xc7a100t_test.tar.xz | tar -xJC $INSTALL_DIR/xc7/install/share/symbiflow/arch conda deactivate * For the EOS S3 devices: @@ -156,6 +160,8 @@ To build the litex example, run the following commands: .. code:: bash :name: xc7-litex + mkdir xc7/litex_demo + pushd xc7/litex_demo wget https://raw.githubusercontent.com/enjoy-digital/litex/master/litex_setup.py chmod +x litex_setup.py ./litex_setup.py init @@ -163,7 +169,8 @@ To build the litex example, run the following commands: wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14.tar.gz tar -xf riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14.tar.gz export PATH=$PATH:$PWD/riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14/bin/ - pushd litex/litex/boards/targets && ./arty.py --toolchain symbiflow --cpu-type vexriscv --build && popd + pushd litex/litex/boards/targets && ./arty.py --toolchain symbiflow --cpu-type vexriscv --sys-clk-freq 80e6 --no-ident-version --build && popd + popd To build the linux-litex-demo example, run the following commands: diff --git a/README.src.rst b/README.src.rst index eb6becc..23e8066 100644 --- a/README.src.rst +++ b/README.src.rst @@ -35,21 +35,22 @@ If you have not already done so, clone this repository and ``cd`` into it: Prerequisites ------------- -The only required prerequisite is ``wget``. You can install it using: + +Install the following prerequisites before using symbiflow-examples: * For Ubuntu: .. code:: bash - :name: install-wget-ubuntu + :name: install-req-ubuntu apt update && apt install -y wget * For CentOS: .. code:: bash - :name: install-wget-centos + :name: install-req-centos - yum install -y wget + yum install -y wget which Toolchain installation ---------------------- @@ -69,9 +70,9 @@ This section describes how to install the toolchain. This procedure is divided i 2. Choose the install directory -The install directory can either be in your home directory -such as ``~/opt/symbiflow`` or in a system directory such as ``/opt/symbiflow``. -If you choose a system directory, you will need root permission to perform the installation, +The install directory can either be in your home directory +such as ``~/opt/symbiflow`` or in a system directory such as ``/opt/symbiflow``. +If you choose a system directory, you will need root permission to perform the installation, and so you will need to add some ``sudo`` commands to the instructions below. .. code:: bash diff --git a/xc7/README.rst b/xc7/README.rst index 5941d29..51c9bd5 100644 --- a/xc7/README.rst +++ b/xc7/README.rst @@ -42,7 +42,10 @@ Choose the installation directory (see the `README <../README.rst>`_ one level u conda env create -f xc7/environment.yml conda activate xc7 mkdir -p $INSTALL_DIR/xc7/install - wget -qO- https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/continuous/install/66/20200914-111752/symbiflow-arch-defs-install-05d68df0.tar.xz | tar -xJC $INSTALL_DIR/xc7/install + wget -qO- https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/presubmit/install/1049/20201123-030526/symbiflow-arch-defs-install-05bd35c7.tar.xz | tar -xJC $INSTALL_DIR/xc7/install + mkdir -p $INSTALL_DIR/xc7/install/share/symbiflow/arch + wget -qO- https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/presubmit/install/1049/20201123-030526/symbiflow-xc7a50t_test.tar.xz | tar -xJC $INSTALL_DIR/xc7/install/share/symbiflow/arch + wget -qO- https://storage.googleapis.com/symbiflow-arch-defs/artifacts/prod/foss-fpga-tools/symbiflow-arch-defs/presubmit/install/1049/20201123-030526/symbiflow-xc7a100t_test.tar.xz | tar -xJC $INSTALL_DIR/xc7/install/share/symbiflow/arch conda deactivate .. toolchain_include_end_label @@ -89,6 +92,8 @@ To build the litex example, run the following commands: .. code:: bash :name: xc7-litex + mkdir xc7/litex_demo + pushd xc7/litex_demo wget https://raw.githubusercontent.com/enjoy-digital/litex/master/litex_setup.py chmod +x litex_setup.py ./litex_setup.py init @@ -96,7 +101,8 @@ To build the litex example, run the following commands: wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14.tar.gz tar -xf riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14.tar.gz export PATH=$PATH:$PWD/riscv64-unknown-elf-gcc-8.1.0-2019.01.0-x86_64-linux-ubuntu14/bin/ - pushd litex/litex/boards/targets && ./arty.py --toolchain symbiflow --cpu-type vexriscv --build && popd + pushd litex/litex/boards/targets && ./arty.py --toolchain symbiflow --cpu-type vexriscv --sys-clk-freq 80e6 --no-ident-version --build && popd + popd To build the linux-litex-demo example, run the following commands: diff --git a/xc7/environment.yml b/xc7/environment.yml index 24fc2b2..493a6bf 100644 --- a/xc7/environment.yml +++ b/xc7/environment.yml @@ -3,9 +3,9 @@ channels: - symbiflow dependencies: - symbiflow::symbiflow-yosys=0.8_6021_gd8b2d1a2=20200708_083630 - - symbiflow::symbiflow-yosys-plugins=1.0.0.7_0060_g7454cd6=20200902_114536 - - symbiflow::symbiflow-vtr=8.0.0.rc2_4003_g8980e4621 - - symbiflow::prjxray-db=0.0_0232_g303a61d=20200902_114536 + - symbiflow::symbiflow-yosys-plugins=1.0.0.7_0174_g5e6370a=20201012_171341 + - symbiflow::symbiflow-vtr=8.0.0.rc2_5097_gf1a3bcc2a=20200916_072439 + - symbiflow::prjxray-db=0.0_0239_gd87c844=20201120_180018 - symbiflow::prjxray-tools - make - lxml