Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@ name: Deploy Docker Images
on:
push:
paths:
- 'recipes/Dockerfile.langutils'
- 'recipes/Dockerfile.synthesis'
- 'recipes/Dockerfile.simulation'
- 'dockerfiles/Dockerfile.langutils'
- 'dockerfiles/Dockerfile.synthesis'
- 'dockerfiles/Dockerfile.simulation'
- 'dockerfiles/Dockerfile.nextpnr-apicula'
- 'dockerfiles/Dockerfile.nextpnr-icestorm'
- 'dockerfiles/Dockerfile.nextpnr-trellis'
schedule:
- cron: '0 21 * * 5'

Expand All @@ -19,6 +22,9 @@ jobs:
- langutils
- synthesis
- simulation
- nextpnr-apicula
- nextpnr-icestorm
- nextpnr-trellis
steps:
- uses: actions/checkout@v2
- name: Login to GitHub Container Registry
Expand All @@ -28,6 +34,6 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker image for ${{ matrix.name }}
run: docker build -f recipes/Dockerfile.${{ matrix.name }} -t ghcr.io/pyfpga/${{ matrix.name }} .
run: docker build -f dockerfiles/Dockerfile.${{ matrix.name }} -t ghcr.io/pyfpga/${{ matrix.name }} .
- name: Push Docker image for ${{ matrix.name }}
run: docker push ghcr.io/pyfpga/${{ matrix.name }}
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ Below is a list of the available containers and their included tools.
* [Surelog](https://github.com/chipsalliance/Surelog)
* `synthesis`: tools for logic synthesis
* [GHDL](https://github.com/ghdl/ghdl)
* [Yosys](https://github.com/YosysHQ/yosys)
* [Yosys](https://github.com/YosysHQ/yosys) (now including [sv-elab](https://github.com/povik/sv-elab))
* [ghdl-yosys-plugin](https://github.com/ghdl/ghdl-yosys-plugin)
* [sv-elab](https://github.com/povik/sv-elab)
* [synlig](https://github.com/chipsalliance/synlig)
* `simulation`: tools for simulation
* [GHDL](https://github.com/ghdl/ghdl)
* [iVerilog](https://github.com/steveicarus/iverilog)
* [Verilator](https://github.com/verilator/verilator)
* [cocotb](https://github.com/cocotb/cocotb)
* [nextpnr](https://github.com/YosysHQ/nextpnr) based containers: place and route + bitstream manipulation
* `nextpnr-apicula`: for gowin FPGAs ([apicula](https://github.com/yosyshq/apicula))
* `nextpnr-icestorm`: for Lattice iCe40 FPGAs ([icestrom](https://github.com/YosysHQ/icestorm))
* `nextpnr-trellis`: for Lattice ecp5 FPGAs ([trellis](https://github.com/YosysHQ/prjtrellis))

In the CI pipeline, the Dockerfile is used to build a Docker image, which is then pushed to the GitHub Container Registry.
From there, it can be pulled and run as a container whenever needed.
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
set -e
IMAGE=$1
docker build -f recipes/Dockerfile.$IMAGE --network=host -t ghcr.io/pyfpga/$IMAGE .
docker build -f dockerfiles/Dockerfile.$IMAGE --network=host -t ghcr.io/pyfpga/$IMAGE .
59 changes: 41 additions & 18 deletions recipes/Dockerfile.langutils → dockerfiles/Dockerfile.langutils
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,61 @@ WORKDIR /tmp
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update -qq

RUN apt-get install -y --no-install-recommends \
ca-certificates \
git
RUN apt-get install -y --no-install-recommends \
bison \
build-essential \
cargo \
cmake \
curl \
default-jre \
flex \
python3 \
python3-orderedmultidict

#
# vhd2vl
# vhd2vl (https://github.com/ldoolitt/vhd2vl)
#

RUN apt-get install -y --no-install-recommends \
bison \
build-essential \
flex

RUN git clone --depth 1 https://github.com/ldoolitt/vhd2vl
RUN cd vhd2vl && make -j$(nproc) && make install

#
# sv2v
# sv2v (https://github.com/zachjs/sv2v)
#

RUN apt-get install -y --no-install-recommends \
curl

RUN curl -sSL https://get.haskellstack.org/ | sh

RUN git clone --depth 1 https://github.com/zachjs/sv2v.git
RUN cd sv2v && make -j$(nproc) && cp bin/sv2v /usr/local/bin

RUN rm -f /usr/local/bin/stack

#
# Slang
# Slang (https://github.com/MikePopoloski/slang)
#

RUN apt-get install -y --no-install-recommends \
build-essential \
cmake \
python3

RUN git clone --depth 1 https://github.com/MikePopoloski/slang.git
RUN cd slang && cmake -B build && cmake --build build -j$(nproc) \
&& cmake --install build --strip

#
# Surelog
# Surelog (https://github.com/chipsalliance/Surelog)
#

RUN apt-get install -y --no-install-recommends \
build-essential \
cmake \
default-jre \
python3 \
python3-orderedmultidict

RUN git clone --depth 1 https://github.com/alainmarcel/Surelog.git
RUN cd Surelog && git submodule update --init --depth 1 --recursive \
&& cmake -B build \
Expand All @@ -57,27 +70,37 @@ RUN cd Surelog && git submodule update --init --depth 1 --recursive \
&& cmake --install build --strip

#
# Verible
# Verible (https://github.com/chipsalliance/verible)
#

RUN apt-get install -y --no-install-recommends \
build-essential \
curl

RUN curl -fsSL https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64 \
-o /usr/local/bin/bazel && chmod +x /usr/local/bin/bazel

RUN git clone --depth 1 https://github.com/chipsalliance/verible.git
RUN cd verible && bazel build -c opt :install-binaries \
&& .github/bin/simple-install.sh /usr/local/bin

RUN rm -f /usr/local/bin/bazel

#
# svlint
# svlint (https://github.com/dalance/svlint)
#

RUN apt-get install -y --no-install-recommends \
cargo

RUN cargo install --root /usr/local --git https://github.com/dalance/svlint.git svlint

#
# clean-up
# Optimization
#

RUN rm -f /usr/local/bin/stack /usr/local/bin/bazel
RUN strip /usr/local/bin/* 2>/dev/null || true
RUN find /usr/local/lib -name "*.so*" -exec strip --strip-unneeded {} + 2>/dev/null || true

#------------------------------------------------------------------------------

Expand Down
57 changes: 57 additions & 0 deletions dockerfiles/Dockerfile.nextpnr-apicula
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# https://github.com/yosyshq/apicula
# https://github.com/YosysHQ/nextpnr

FROM ubuntu:latest AS builder

WORKDIR /tmp

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update -qq
RUN apt-get install -y --no-install-recommends \
ca-certificates \
git
RUN apt-get install -y --no-install-recommends \
build-essential \
cmake \
libboost-all-dev \
libeigen3-dev \
python3-dev

#
# Apicula
#

RUN apt-get install -y --no-install-recommends python3 python3-pip
RUN pip3 install --no-cache-dir --break-system-packages \
apycula \
msgpack \
cattrs

#
# NextPNR
#

RUN git clone --depth 1 https://github.com/YosysHQ/nextpnr
RUN cd nextpnr && git submodule update --init --recursive \
&& mkdir -p build && cd build \
&& cmake .. -DARCH="himbaechel" -DHIMBAECHEL_UARCH="gowin" -DTRELLIS_INSTALL_PREFIX=/usr/local \
&& make -j$(nproc) && make install

#
# Optimization
#

RUN strip /usr/local/bin/* 2>/dev/null || true

#------------------------------------------------------------------------------

FROM ubuntu:latest AS runtime

RUN apt-get update -qq && apt-get install -y --no-install-recommends \
python3 \
&& rm -rf /var/lib/apt/lists/*

COPY --from=builder /usr/local /usr/local

RUN ldconfig
50 changes: 50 additions & 0 deletions dockerfiles/Dockerfile.nextpnr-icestorm
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# https://github.com/YosysHQ/icestorm
# https://github.com/YosysHQ/nextpnr

FROM ubuntu:latest AS builder

WORKDIR /tmp

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update -qq
RUN apt-get install -y --no-install-recommends \
ca-certificates \
git
RUN apt-get install -y --no-install-recommends \
build-essential \
cmake \
libboost-all-dev \
libeigen3-dev \
libftdi-dev

#
# IceStorm
#

RUN git clone --depth 1 https://github.com/YosysHQ/icestorm.git
RUN cd icestorm && make -j$(nproc) && make install

#
# NextPNR
#

RUN git clone --depth 1 https://github.com/YosysHQ/nextpnr
RUN cd nextpnr && git submodule update --init --recursive \
&& mkdir -p build && cd build \
&& cmake .. -DARCH=ice40 -DTRELLIS_INSTALL_PREFIX=/usr/local \
&& make -j$(nproc) && make install

#
# Optimization
#

RUN strip /usr/local/bin/* 2>/dev/null || true

#------------------------------------------------------------------------------

FROM ubuntu:latest AS runtime

COPY --from=builder /usr/local /usr/local

RUN ldconfig
52 changes: 52 additions & 0 deletions dockerfiles/Dockerfile.nextpnr-trellis
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# https://github.com/YosysHQ/prjtrellis
# https://github.com/YosysHQ/nextpnr

FROM ubuntu:latest AS builder

WORKDIR /tmp

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update -qq
RUN apt-get install -y --no-install-recommends \
ca-certificates \
git
RUN apt-get install -y --no-install-recommends \
build-essential \
cmake \
libboost-all-dev \
libeigen3-dev \
openocd \
python3-dev

#
# Trellis
#

RUN git clone --depth 1 --recursive https://github.com/YosysHQ/prjtrellis
RUN cd prjtrellis/libtrellis && cmake -DCMAKE_INSTALL_PREFIX=/usr/local . \
&& make -j$(nproc) && make install

#
# NextPNR
#

RUN git clone --depth 1 https://github.com/YosysHQ/nextpnr
RUN cd nextpnr && git submodule update --init --recursive \
&& mkdir -p build && cd build \
&& cmake .. -DARCH=ecp5 -DTRELLIS_INSTALL_PREFIX=/usr/local \
&& make -j$(nproc) && make install

#
# Optimization
#

RUN strip /usr/local/bin/* 2>/dev/null || true

#------------------------------------------------------------------------------

FROM ubuntu:latest AS runtime

COPY --from=builder /usr/local /usr/local

RUN ldconfig
Loading
Loading