1- FROM --platform=$TARGETPLATFORM ubuntu:22 .04 AS base
1+ FROM --platform=$TARGETPLATFORM ubuntu:24 .04 AS base
22
33# Chisel 3 docker image for Chip Dev
44# ==========
@@ -10,24 +10,50 @@ USER root
1010RUN apt-get update && apt-get upgrade -y && apt install ca-certificates -y
1111
1212FROM base AS base-amd64
13- RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse\n" > /etc/apt/sources.list; \
14- echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse\n" >> /etc/apt/sources.list; \
15- echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse\n" >> /etc/apt/sources.list; \
16- echo "deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse\n" >> /etc/apt/sources.list;
17- RUN apt-get update && apt-get install default-jdk sudo git make autoconf g++ flex bison curl wget gnupg ninja-build cmake -y && apt-get clean -y
13+ RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble main restricted universe multiverse\n" > /etc/apt/sources.list; \
14+ echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-updates main restricted universe multiverse\n" >> /etc/apt/sources.list; \
15+ echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ noble-backports main restricted universe multiverse\n" >> /etc/apt/sources.list; \
16+ echo "deb http://security.ubuntu.com/ubuntu/ noble-security main restricted universe multiverse\n" >> /etc/apt/sources.list;
17+ RUN apt-get update && apt-get install default-jdk sudo git make autoconf g++ flex bison curl wget gnupg ninja-build help2man cmake -y && apt-get clean -y
18+ WORKDIR /workspace/
1819# install firtool
19- RUN wget -q -O - https://github.com/llvm/circt/releases/download/firtool-1.38.0/firrtl-bin-ubuntu-20.04.tar.gz | tar -zx && mv firtool-1.38.0/bin/firtool /usr/local/bin/
20+ RUN mkdir circt && \
21+ wget -O - https://github.com/llvm/circt/releases/download/firtool-1.62.1/circt-full-sources.tar.gz | tar -xz -C circt && \
22+ cd /workspace/circt && \
23+ mkdir -p llvm/build && cd llvm/build && \
24+ cmake -G Ninja /workspace/circt/llvm/llvm \
25+ -DLLVM_ENABLE_PROJECTS="mlir" \
26+ -DLLVM_TARGETS_TO_BUILD="host" \
27+ -DCMAKE_JOB_POOLS="compile=8;link=1" \
28+ -DCMAKE_JOB_POOL_LINK="link" \
29+ -DCMAKE_JOB_POOL_COMPILE="compile" \
30+ -DLLVM_ENABLE_ASSERTIONS=ON \
31+ -DCMAKE_BUILD_TYPE=RELEASE \
32+ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON && ninja && \
33+ mkdir -p /workspace/circt/build && cd /workspace/circt/build && \
34+ sed -ie 's/"unknown git version"/"firtool-1.62.1"/g' /workspace/circt/cmake/modules/GenVersionFile.cmake && \
35+ cmake -G Ninja /workspace/circt \
36+ -DMLIR_DIR=/workspace/circt/llvm/build/lib/cmake/mlir \
37+ -DLLVM_DIR=/workspace/circt/llvm/build/lib/cmake/llvm \
38+ -DCMAKE_JOB_POOLS="compile=8;link=1" \
39+ -DCMAKE_JOB_POOL_LINK="link" \
40+ -DCMAKE_JOB_POOL_COMPILE="compile" \
41+ -DLLVM_ENABLE_ASSERTIONS=ON \
42+ -DCMAKE_BUILD_TYPE=RELEASE \
43+ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON && ninja && \
44+ mv /workspace/circt/build/bin/* /usr/local/bin/ && cd /workspace && rm -rf /workspace/circt
45+
2046
2147FROM base AS base-arm64
22- RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy main restricted universe multiverse" > /etc/apt/sources.list; \
23- echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy -updates main restricted universe multiverse" >> /etc/apt/sources.list; \
24- echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ jammy -backports main restricted universe multiverse" >> /etc/apt/sources.list; \
25- echo "deb http://ports.ubuntu.com/ubuntu-ports/ jammy -security main restricted universe multiverse" >> /etc/apt/sources.list;
26- RUN apt-get update && apt-get install default-jdk sudo git make autoconf g++ flex bison curl wget gnupg ninja-build cmake -y && apt-get clean -y
48+ RUN echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ noble main restricted universe multiverse" > /etc/apt/sources.list; \
49+ echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ noble -updates main restricted universe multiverse" >> /etc/apt/sources.list; \
50+ echo "deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ noble -backports main restricted universe multiverse" >> /etc/apt/sources.list; \
51+ echo "deb http://ports.ubuntu.com/ubuntu-ports/ noble -security main restricted universe multiverse" >> /etc/apt/sources.list;
52+ RUN apt-get update && apt-get install default-jdk sudo git make autoconf g++ flex bison curl wget gnupg ninja-build help2man cmake -y && apt-get clean -y
2753WORKDIR /workspace/
2854# install firtool
2955RUN mkdir circt && \
30- wget -O - https://github.com/llvm/circt/releases/download/firtool-1.38.0 /circt-full-sources.tar.gz | tar -xz -C circt && \
56+ wget -O - https://github.com/llvm/circt/releases/download/firtool-1.62.1 /circt-full-sources.tar.gz | tar -xz -C circt && \
3157 cd /workspace/circt && \
3258 mkdir -p llvm/build && cd llvm/build && \
3359 cmake -G Ninja /workspace/circt/llvm/llvm \
@@ -40,7 +66,7 @@ RUN mkdir circt && \
4066 -DCMAKE_BUILD_TYPE=RELEASE \
4167 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON && ninja && \
4268 mkdir -p /workspace/circt/build && cd /workspace/circt/build && \
43- sed -ie 's/"unknown git version"/"firtool-1.38.0 "/g' /workspace/circt/cmake/modules/GenVersionFile.cmake && \
69+ sed -ie 's/"unknown git version"/"firtool-1.62.1 "/g' /workspace/circt/cmake/modules/GenVersionFile.cmake && \
4470 cmake -G Ninja /workspace/circt \
4571 -DMLIR_DIR=/workspace/circt/llvm/build/lib/cmake/mlir \
4672 -DLLVM_DIR=/workspace/circt/llvm/build/lib/cmake/llvm \
@@ -50,12 +76,12 @@ RUN mkdir circt && \
5076 -DLLVM_ENABLE_ASSERTIONS=ON \
5177 -DCMAKE_BUILD_TYPE=RELEASE \
5278 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON && ninja && \
53- mv /workspace/circt/build/bin/firtool /usr/local/bin/ && cd /workspace && rm -rf /workspace/circt
79+ mv /workspace/circt/build/bin/* /usr/local/bin/ && cd /workspace && rm -rf /workspace/circt
5480
5581FROM base-${TARGETARCH} AS env
5682
5783WORKDIR /workspace/
58- RUN git clone --progress https://github.com/verilator/verilator && cd /workspace/verilator && git pull && git checkout v4.226 && autoconf && ./configure && make -j8 && make install && make clean && rm -rf /workspace/verilator
84+ RUN git clone --progress https://github.com/verilator/verilator && cd /workspace/verilator && git pull && git checkout v5.036 && autoconf && ./configure && make -j8 && make install && make clean && rm -rf /workspace/verilator
5985
6086WORKDIR /workspace/
6187
@@ -72,11 +98,22 @@ FROM env AS scala-arm64
7298RUN curl -fL https://github.com/VirtusLab/coursier-m1/releases/latest/download/cs-aarch64-pc-linux.gz | gzip -d > cs && chmod +x cs && ./cs setup -y && rm -rf cs-aarch64-pc-linux.gz
7399
74100# build chisel
75- FROM scala-${TARGETARCH}
101+ FROM scala-${TARGETARCH} AS final
76102ENV PATH="${PATH}:/root/.local/share/coursier/bin/:/usr/local/bin/"
77- RUN git clone --progress https://github.com/chipsalliance/chisel.git && cd /workspace/chisel/ && git checkout v5.1.0 && sbt compile && sbt "unipublish / publishLocal" && rm -rf /workspace/chisel
103+ RUN git clone --progress https://github.com/chipsalliance/chisel.git && cd /workspace/chisel/ && git checkout v6.7.0 && sbt compile && sbt "unipublish / publishLocal" && rm -rf /workspace/chisel
104+
105+ # install systemc 3.0.1
106+ FROM final
107+ WORKDIR /workspace
108+ RUN apt-get update && apt-get install libtool -y && apt-get clean -y
109+ RUN wget -O - https://github.com/accellera-official/systemc/archive/refs/tags/3.0.1.tar.gz | tar -xz && \
110+ cd /workspace/systemc-3.0.1 && mkdir build && cd build && \
111+ cmake -S .. -B . -DCMAKE_INSTALL_PREFIX=/opt/systemc -DBUILD_SHARED_LIBS=OFF && make -j8 && make install && cd /workspace && rm -rf systemc-3.0.1
78112
79113# clean up chisel sources
80114WORKDIR /workspace/
81115ENV COURSIER_CACHE="/workspace/.cache/coursier/v1"
116+ ENV CHISEL_FIRTOOL_PATH=/usr/local/bin
117+ ENV SYSTEMC_INCLUDE=/opt/systemc/include
118+ ENV SYSTEMC_LIBDIR=/opt/systemc/lib
82119CMD ["bash"]
0 commit comments