Skip to content

Commit 1765f67

Browse files
authored
Merge pull request #16 from PyFPGA/add-implementation
Add nextpnr-apicula, nextpnr-icestorm and nextpnr-trellis. Remove independent dockerfiles already included in others.
2 parents c25c327 + b2c3774 commit 1765f67

22 files changed

Lines changed: 275 additions & 415 deletions

‎.github/workflows/deploy.yml‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ name: Deploy Docker Images
33
on:
44
push:
55
paths:
6-
- 'recipes/Dockerfile.langutils'
7-
- 'recipes/Dockerfile.synthesis'
8-
- 'recipes/Dockerfile.simulation'
6+
- 'dockerfiles/Dockerfile.langutils'
7+
- 'dockerfiles/Dockerfile.synthesis'
8+
- 'dockerfiles/Dockerfile.simulation'
9+
- 'dockerfiles/Dockerfile.nextpnr-apicula'
10+
- 'dockerfiles/Dockerfile.nextpnr-icestorm'
11+
- 'dockerfiles/Dockerfile.nextpnr-trellis'
912
schedule:
1013
- cron: '0 21 * * 5'
1114

@@ -19,6 +22,9 @@ jobs:
1922
- langutils
2023
- synthesis
2124
- simulation
25+
- nextpnr-apicula
26+
- nextpnr-icestorm
27+
- nextpnr-trellis
2228
steps:
2329
- uses: actions/checkout@v2
2430
- name: Login to GitHub Container Registry
@@ -28,6 +34,6 @@ jobs:
2834
username: ${{ github.actor }}
2935
password: ${{ secrets.GITHUB_TOKEN }}
3036
- name: Build Docker image for ${{ matrix.name }}
31-
run: docker build -f recipes/Dockerfile.${{ matrix.name }} -t ghcr.io/pyfpga/${{ matrix.name }} .
37+
run: docker build -f dockerfiles/Dockerfile.${{ matrix.name }} -t ghcr.io/pyfpga/${{ matrix.name }} .
3238
- name: Push Docker image for ${{ matrix.name }}
3339
run: docker push ghcr.io/pyfpga/${{ matrix.name }}

‎README.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,18 @@ Below is a list of the available containers and their included tools.
1313
* [Surelog](https://github.com/chipsalliance/Surelog)
1414
* `synthesis`: tools for logic synthesis
1515
* [GHDL](https://github.com/ghdl/ghdl)
16-
* [Yosys](https://github.com/YosysHQ/yosys)
16+
* [Yosys](https://github.com/YosysHQ/yosys) (now including [sv-elab](https://github.com/povik/sv-elab))
1717
* [ghdl-yosys-plugin](https://github.com/ghdl/ghdl-yosys-plugin)
18-
* [sv-elab](https://github.com/povik/sv-elab)
1918
* [synlig](https://github.com/chipsalliance/synlig)
2019
* `simulation`: tools for simulation
2120
* [GHDL](https://github.com/ghdl/ghdl)
2221
* [iVerilog](https://github.com/steveicarus/iverilog)
2322
* [Verilator](https://github.com/verilator/verilator)
2423
* [cocotb](https://github.com/cocotb/cocotb)
24+
* [nextpnr](https://github.com/YosysHQ/nextpnr) based containers: place and route + bitstream manipulation
25+
* `nextpnr-apicula`: for gowin FPGAs ([apicula](https://github.com/yosyshq/apicula))
26+
* `nextpnr-icestorm`: for Lattice iCe40 FPGAs ([icestrom](https://github.com/YosysHQ/icestorm))
27+
* `nextpnr-trellis`: for Lattice ecp5 FPGAs ([trellis](https://github.com/YosysHQ/prjtrellis))
2528

2629
In the CI pipeline, the Dockerfile is used to build a Docker image, which is then pushed to the GitHub Container Registry.
2730
From there, it can be pulled and run as a container whenever needed.

‎build.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/bash
22
set -e
33
IMAGE=$1
4-
docker build -f recipes/Dockerfile.$IMAGE --network=host -t ghcr.io/pyfpga/$IMAGE .
4+
docker build -f dockerfiles/Dockerfile.$IMAGE --network=host -t ghcr.io/pyfpga/$IMAGE .
Lines changed: 41 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,48 +5,61 @@ WORKDIR /tmp
55
ENV DEBIAN_FRONTEND=noninteractive
66

77
RUN apt-get update -qq
8+
89
RUN apt-get install -y --no-install-recommends \
910
ca-certificates \
1011
git
11-
RUN apt-get install -y --no-install-recommends \
12-
bison \
13-
build-essential \
14-
cargo \
15-
cmake \
16-
curl \
17-
default-jre \
18-
flex \
19-
python3 \
20-
python3-orderedmultidict
2112

2213
#
23-
# vhd2vl
14+
# vhd2vl (https://github.com/ldoolitt/vhd2vl)
2415
#
2516

17+
RUN apt-get install -y --no-install-recommends \
18+
bison \
19+
build-essential \
20+
flex
21+
2622
RUN git clone --depth 1 https://github.com/ldoolitt/vhd2vl
2723
RUN cd vhd2vl && make -j$(nproc) && make install
2824

2925
#
30-
# sv2v
26+
# sv2v (https://github.com/zachjs/sv2v)
3127
#
3228

29+
RUN apt-get install -y --no-install-recommends \
30+
curl
31+
3332
RUN curl -sSL https://get.haskellstack.org/ | sh
3433

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

37+
RUN rm -f /usr/local/bin/stack
38+
3839
#
39-
# Slang
40+
# Slang (https://github.com/MikePopoloski/slang)
4041
#
4142

43+
RUN apt-get install -y --no-install-recommends \
44+
build-essential \
45+
cmake \
46+
python3
47+
4248
RUN git clone --depth 1 https://github.com/MikePopoloski/slang.git
4349
RUN cd slang && cmake -B build && cmake --build build -j$(nproc) \
4450
&& cmake --install build --strip
4551

4652
#
47-
# Surelog
53+
# Surelog (https://github.com/chipsalliance/Surelog)
4854
#
4955

56+
RUN apt-get install -y --no-install-recommends \
57+
build-essential \
58+
cmake \
59+
default-jre \
60+
python3 \
61+
python3-orderedmultidict
62+
5063
RUN git clone --depth 1 https://github.com/alainmarcel/Surelog.git
5164
RUN cd Surelog && git submodule update --init --depth 1 --recursive \
5265
&& cmake -B build \
@@ -57,27 +70,37 @@ RUN cd Surelog && git submodule update --init --depth 1 --recursive \
5770
&& cmake --install build --strip
5871

5972
#
60-
# Verible
73+
# Verible (https://github.com/chipsalliance/verible)
6174
#
6275

76+
RUN apt-get install -y --no-install-recommends \
77+
build-essential \
78+
curl
79+
6380
RUN curl -fsSL https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-amd64 \
6481
-o /usr/local/bin/bazel && chmod +x /usr/local/bin/bazel
6582

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

87+
RUN rm -f /usr/local/bin/bazel
88+
7089
#
71-
# svlint
90+
# svlint (https://github.com/dalance/svlint)
7291
#
7392

93+
RUN apt-get install -y --no-install-recommends \
94+
cargo
95+
7496
RUN cargo install --root /usr/local --git https://github.com/dalance/svlint.git svlint
7597

7698
#
77-
# clean-up
99+
# Optimization
78100
#
79101

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

82105
#------------------------------------------------------------------------------
83106

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# https://github.com/yosyshq/apicula
2+
# https://github.com/YosysHQ/nextpnr
3+
4+
FROM ubuntu:latest AS builder
5+
6+
WORKDIR /tmp
7+
8+
ENV DEBIAN_FRONTEND=noninteractive
9+
10+
RUN apt-get update -qq
11+
RUN apt-get install -y --no-install-recommends \
12+
ca-certificates \
13+
git
14+
RUN apt-get install -y --no-install-recommends \
15+
build-essential \
16+
cmake \
17+
libboost-all-dev \
18+
libeigen3-dev \
19+
python3-dev
20+
21+
#
22+
# Apicula
23+
#
24+
25+
RUN apt-get install -y --no-install-recommends python3 python3-pip
26+
RUN pip3 install --no-cache-dir --break-system-packages \
27+
apycula \
28+
msgpack \
29+
cattrs
30+
31+
#
32+
# NextPNR
33+
#
34+
35+
RUN git clone --depth 1 https://github.com/YosysHQ/nextpnr
36+
RUN cd nextpnr && git submodule update --init --recursive \
37+
&& mkdir -p build && cd build \
38+
&& cmake .. -DARCH="himbaechel" -DHIMBAECHEL_UARCH="gowin" -DTRELLIS_INSTALL_PREFIX=/usr/local \
39+
&& make -j$(nproc) && make install
40+
41+
#
42+
# Optimization
43+
#
44+
45+
RUN strip /usr/local/bin/* 2>/dev/null || true
46+
47+
#------------------------------------------------------------------------------
48+
49+
FROM ubuntu:latest AS runtime
50+
51+
RUN apt-get update -qq && apt-get install -y --no-install-recommends \
52+
python3 \
53+
&& rm -rf /var/lib/apt/lists/*
54+
55+
COPY --from=builder /usr/local /usr/local
56+
57+
RUN ldconfig
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# https://github.com/YosysHQ/icestorm
2+
# https://github.com/YosysHQ/nextpnr
3+
4+
FROM ubuntu:latest AS builder
5+
6+
WORKDIR /tmp
7+
8+
ENV DEBIAN_FRONTEND=noninteractive
9+
10+
RUN apt-get update -qq
11+
RUN apt-get install -y --no-install-recommends \
12+
ca-certificates \
13+
git
14+
RUN apt-get install -y --no-install-recommends \
15+
build-essential \
16+
cmake \
17+
libboost-all-dev \
18+
libeigen3-dev \
19+
libftdi-dev
20+
21+
#
22+
# IceStorm
23+
#
24+
25+
RUN git clone --depth 1 https://github.com/YosysHQ/icestorm.git
26+
RUN cd icestorm && make -j$(nproc) && make install
27+
28+
#
29+
# NextPNR
30+
#
31+
32+
RUN git clone --depth 1 https://github.com/YosysHQ/nextpnr
33+
RUN cd nextpnr && git submodule update --init --recursive \
34+
&& mkdir -p build && cd build \
35+
&& cmake .. -DARCH=ice40 -DTRELLIS_INSTALL_PREFIX=/usr/local \
36+
&& make -j$(nproc) && make install
37+
38+
#
39+
# Optimization
40+
#
41+
42+
RUN strip /usr/local/bin/* 2>/dev/null || true
43+
44+
#------------------------------------------------------------------------------
45+
46+
FROM ubuntu:latest AS runtime
47+
48+
COPY --from=builder /usr/local /usr/local
49+
50+
RUN ldconfig
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# https://github.com/YosysHQ/prjtrellis
2+
# https://github.com/YosysHQ/nextpnr
3+
4+
FROM ubuntu:latest AS builder
5+
6+
WORKDIR /tmp
7+
8+
ENV DEBIAN_FRONTEND=noninteractive
9+
10+
RUN apt-get update -qq
11+
RUN apt-get install -y --no-install-recommends \
12+
ca-certificates \
13+
git
14+
RUN apt-get install -y --no-install-recommends \
15+
build-essential \
16+
cmake \
17+
libboost-all-dev \
18+
libeigen3-dev \
19+
openocd \
20+
python3-dev
21+
22+
#
23+
# Trellis
24+
#
25+
26+
RUN git clone --depth 1 --recursive https://github.com/YosysHQ/prjtrellis
27+
RUN cd prjtrellis/libtrellis && cmake -DCMAKE_INSTALL_PREFIX=/usr/local . \
28+
&& make -j$(nproc) && make install
29+
30+
#
31+
# NextPNR
32+
#
33+
34+
RUN git clone --depth 1 https://github.com/YosysHQ/nextpnr
35+
RUN cd nextpnr && git submodule update --init --recursive \
36+
&& mkdir -p build && cd build \
37+
&& cmake .. -DARCH=ecp5 -DTRELLIS_INSTALL_PREFIX=/usr/local \
38+
&& make -j$(nproc) && make install
39+
40+
#
41+
# Optimization
42+
#
43+
44+
RUN strip /usr/local/bin/* 2>/dev/null || true
45+
46+
#------------------------------------------------------------------------------
47+
48+
FROM ubuntu:latest AS runtime
49+
50+
COPY --from=builder /usr/local /usr/local
51+
52+
RUN ldconfig

0 commit comments

Comments
 (0)