Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: First Docker setup with slang pipeline #5

Draft
wants to merge 35 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
8e6fe3f
ci: add `python` env to `docker` container
joennlae Jan 31, 2023
0944ee0
ci: unholy commit to run workflow
joennlae Jan 31, 2023
c6dccea
ci: end of the line fix
joennlae Jan 31, 2023
e5f8924
ci: use correct `pip` package name on ubuntu
joennlae Jan 31, 2023
1a5e448
ci: conditional container build + `build` ci with container
joennlae Jan 31, 2023
cc46200
ci: remove safe directory warning for container
joennlae Jan 31, 2023
0cfc4ac
ci: github action add safe directory workaround
joennlae Jan 31, 2023
fac9957
ci: cleanup
joennlae Jan 31, 2023
cd2e28b
ci: add `morty` pickle + `slang` parsing test
joennlae Jan 31, 2023
0e22e2e
ci: add `wget` to docker container
joennlae Jan 31, 2023
c957adf
ci: source `cargo` in container
joennlae Jan 31, 2023
13f086d
fix(ci): fix `docker` build
joennlae Feb 3, 2023
68271bc
feat(cva6): update to correct includes for `cva6`
joennlae Feb 3, 2023
45de7fe
feat(slang): add `slang` check of `cva6` using `bender` + `morty`
joennlae Feb 3, 2023
47f3b9f
ci: add `true` to `slang` check to pass actions atm
joennlae Feb 3, 2023
c5fa813
ci: fix `slang` check action
joennlae Feb 3, 2023
7efac83
ci: add `unzip` to container
joennlae Feb 3, 2023
f1074a0
ci: `docker` update env
joennlae Feb 16, 2023
9718c13
ips: update `cva6` commit
joennlae Feb 16, 2023
d8100bb
ci: update `slang` check
joennlae Feb 16, 2023
613337e
ci: change `cargo` path in container
joennlae Feb 16, 2023
c6737cb
ci: use `bash` as shell + correct `cargo` path
joennlae Feb 17, 2023
4af71f1
chore: update `cva6` ref in `Bender.lock`
joennlae Feb 17, 2023
cb5dd13
ci: update `slang-check` by adding the `--top`
joennlae Feb 17, 2023
4f5cd16
chore: update `cva6` rev
joennlae Feb 17, 2023
c2098b6
fix: add correct `cargo` path
joennlae Feb 17, 2023
98dc82f
bender: update `Bender.lock`
joennlae Feb 22, 2023
804aa11
slang: add target synthesis + defines
joennlae Feb 22, 2023
895ee2f
bender: update `Bender.lock` cva6 rev
joennlae Feb 23, 2023
ad5e755
cheshire_pkg: update `ariane_cfg_t` to match upstream
joennlae Feb 23, 2023
a8b58f0
bender: update `Bender.lock` cva6 rev
joennlae Feb 23, 2023
0c13ef9
feat(cva6): add `AxiAddrWidth` into cheshire top
joennlae Mar 6, 2023
c7b9239
bender: update `lock` with newer `cva6` rev
joennlae Mar 6, 2023
9f8eaa7
ci: add `slang` check for `cheshire` (currently failing)
joennlae Mar 6, 2023
60031a8
bender: update bender with new cva6 rev
joennlae Mar 13, 2023
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
25 changes: 21 additions & 4 deletions .github/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@

FROM ubuntu:22.04

RUN apt update && apt upgrade -y && apt install -y curl python3 build-essential git cmake
SHELL ["/bin/bash", "-c"]

ARG RISCV_GCC_VERSION=8.3.0-2020.04.0
RUN apt update && apt upgrade -y && apt install -y curl python3 build-essential git cmake python3-pip wget unzip

# ARG RISCV_GCC_VERSION=8.3.0-2020.04.0
# risvc-gnu-compiler
RUN curl -Ls -o riscv-gcc.tar.gz https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-${RISCV_GCC_VERSION}-x86_64-linux-ubuntu14.tar.gz && \
RUN curl -Ls -o riscv-gcc.tar.gz https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2022.06.10/riscv64-elf-ubuntu-20.04-nightly-2022.06.10-nightly.tar.gz && \
mkdir -p /tools/riscv && chmod 777 /tools/riscv && \
tar -C /tools/riscv -xf riscv-gcc.tar.gz --strip-components=1
tar -C /tools/riscv -xf riscv-gcc.tar.gz --strip-components=1 && \
rm riscv-gcc.tar.gz

ENV PATH="${PATH}:/tools/riscv/bin"

Expand All @@ -30,3 +33,17 @@ RUN mkdir -p /tools/slang && chmod 777 /tools/slang && \
cd slang && git checkout ${SLANG_VERSION} && \
cmake -B build && cmake --build build -j$(nproc) && \
cmake --install build --strip

# install rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

ENV PATH="${PATH}:/root/.cargo/bin"
# install morty via cargo
RUN cargo install --git https://github.com/pulp-platform/morty.git

# install python dependencies
COPY .github/requirements.txt .
RUN pip3 install -r requirements.txt

# remove safe directory check in git
RUN git config --global --add safe.directory '*'
110 changes: 84 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# SPDX-License-Identifier: Apache-2.0

# Author: Paul Scheffler <[email protected]>
# Author: Jannis Schoenleber <[email protected]>

name: build

Expand All @@ -11,47 +12,104 @@ on: [ push, pull_request, workflow_dispatch ]
jobs:

# TODO: somehow handle reproducible boot ROM builds
# TODO: migrate to and/or replicate on docker
build-docker:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Check if Dockerfile changed
id: dockerfile
uses: dorny/paths-filter@v2
with:
filters: |
dockerfile:
- '.github/Dockerfile'
-
name: Login to Docker Hub
if: steps.dockerfile.outputs.dockerfile == 'true' # only run if Dockerfile changed
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Set up Docker Buildx
if: steps.dockerfile.outputs.dockerfile == 'true' # only run if Dockerfile changed
uses: docker/setup-buildx-action@v2
-
name: Build and push
if: steps.dockerfile.outputs.dockerfile == 'true' # only run if Dockerfile changed
uses: docker/build-push-action@v3
with:
context: .
file: ./.github/Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/cheshire-ci:latest

build:
needs: build-docker
strategy:
matrix:
target: [sw, hw, sim, xilinx]
fail-fast: false
runs-on: ubuntu-latest
container:
image: pulpplatform/cheshire-ci:latest
steps:
-
name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
-
name: Install Python
uses: actions/setup-python@v2
with:
python-version: 3.9
cache: pip
-
name: Install Python requirements
run: pip install -r .github/requirements.txt
-
name: Install RISC-V GCC toolchain
run: |
curl -Ls -o riscv-gcc.tar.gz https://github.com/riscv-collab/riscv-gnu-toolchain/releases/download/2022.06.10/riscv64-elf-ubuntu-20.04-nightly-2022.06.10-nightly.tar.gz
sudo mkdir -p /tools/riscv && sudo chmod 777 /tools/riscv
tar -C /tools/riscv -xf riscv-gcc.tar.gz --strip-components=1
rm riscv-gcc.tar.gz
echo "PATH=$PATH:/tools/riscv/bin" >> ${GITHUB_ENV}
-
name: Install Bender
run: |
sudo mkdir -p /tools/bender && sudo chmod 777 /tools/bender
cd /tools/bender && curl --proto '=https' --tlsv1.2 -sSf https://pulp-platform.github.io/bender/init | bash -s -- ${BENDER_VERSION}
echo "PATH=$PATH:/tools/bender" >> ${GITHUB_ENV}
env:
BENDER_VERSION: 0.27.0
- # https://github.com/actions/runner-images/issues/6775#issuecomment-1409159167
name: Safe Directory workaround
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
-
name: Build target
run: make ${{ matrix.target }}-all
-
name: Check whether clean
run: git status && test -z "$(git status --porcelain --ignore-submodules)"

slang-check-cva6:
needs: build-docker
runs-on: ubuntu-latest
container:
image: pulpplatform/cheshire-ci:latest
steps:
-
name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- # https://github.com/actions/runner-images/issues/6775#issuecomment-1409159167
name: Safe Directory workaround
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
-
name: Check Slang
run: make slang-check-cva6
-
name: Check whether clean
run: git status && test -z "$(git status --porcelain --ignore-submodules)"

slang-check-cheshire:
needs: build-docker
runs-on: ubuntu-latest
container:
image: pulpplatform/cheshire-ci:latest
steps:
-
name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- # https://github.com/actions/runner-images/issues/6775#issuecomment-1409159167
name: Safe Directory workaround
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
-
name: Check Slang
run: make slang-check-cheshire
-
name: Check whether clean
run: git status && test -z "$(git status --porcelain --ignore-submodules)"
39 changes: 0 additions & 39 deletions .github/workflows/docker-image.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ target/sim/vsim/modelsim.ini
target/sim/vsim/transcript
target/sim/vsim/vsim.wlf
target/sim/vsim/work/

build/
21 changes: 17 additions & 4 deletions Bender.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,14 @@ packages:
- apb
- register_interface
ariane:
revision: 1db4bcd5164742c09605a91045bfbab7d86c0ee0
revision: 35e1c869dfdc6471c2b74040a11210be86c582fb
version: null
source:
Git: https://github.com/pulp-platform/cva6
dependencies:
- axi
- axi_riscv_atomics
- common_cells
- register_interface
- riscv-dbg
- fpnew
- tech_cells_generic
axi:
revision: af8b0ce2653997301b1b792c4c6d207b95f63a56
Expand Down Expand Up @@ -86,6 +84,21 @@ packages:
source:
Git: https://github.com/pulp-platform/common_verification.git
dependencies: []
fpnew:
revision: 8dc44406b1ccbc4487121710c1883e805f893965
version: 0.6.6
source:
Git: https://github.com/pulp-platform/fpnew.git
dependencies:
- common_cells
- fpu_div_sqrt_mvp
fpu_div_sqrt_mvp:
revision: 86e1f558b3c95e91577c41b2fc452c86b04e85ac
version: 1.0.4
source:
Git: https://github.com/pulp-platform/fpu_div_sqrt_mvp.git
dependencies:
- common_cells
idma:
revision: 6ad5695b85ce253f3095871b958fb76b36d074c6
version: 0.3.1
Expand Down
2 changes: 1 addition & 1 deletion Bender.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies:
serial_link: { git: "https://github.com/pulp-platform/serial_link.git", version: =1.0.0 }
axi_vga: { git: "https://github.com/pulp-platform/axi_vga.git", version: =0.1.1 }
opentitan_peripherals: { git: "https://github.com/pulp-platform/opentitan_peripherals.git", version: =0.2.1 }
ariane: { git: "https://github.com/pulp-platform/cva6", rev: cheshire }
ariane: { git: "https://github.com/pulp-platform/cva6", rev: missing-vsim-include }

sources:
- hw/bootrom/cheshire_bootrom.sv
Expand Down
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ PLICOPT = -s 20 -t 2 -p 7
VLOG_ARGS ?= -suppress 2583 -suppress 13314
VSIM ?= vsim

BUILD_DIR ?= build

.PHONY: all nonfree-init sw-all hw-all bootrom-all sim-all xilinx-all

all: sw-all hw-all sim-all xilinx-all
Expand Down Expand Up @@ -131,3 +133,28 @@ target/xilinx/scripts/add_sources.tcl: Bender.yml
$(BENDER) script vivado -t fpga -t cv64a6_imafdc_sv39 -t cva6 > $@

xilinx-all: target/xilinx/scripts/add_sources.tcl


#############
# slang #
#############

.PHONY: $(BUILD_DIR)/cva6.pickle.sv $(BUILD_DIR)/cheshire_top.pickle.sv

$(BUILD_DIR):
mkdir -p $@

$(BUILD_DIR)/cheshire_top.pickle.sv: Bender.yml $(BUILD_DIR)
bender sources -f -t cv64a6_imafdc_sv39 -t synthesis -t cva6 | morty -f /dev/stdin -q -o $@ -D VERILATOR=1 --top cheshire_soc

$(BUILD_DIR)/cva6.pickle.sv: Bender.yml $(BUILD_DIR)
bender sources -f -d $(shell $(BENDER) path ariane) -t cv64a6_imafdc_sv39 -t synthesis -t cva6 | morty -f /dev/stdin -o $@ -D VERILATOR=1 --top cva6

pickle-cva6: $(BUILD_DIR)/cva6.pickle.sv

slang-check-cva6: pickle-cva6
slang $(BUILD_DIR)/cva6.pickle.sv -Wrange-width-oob

slang-check-cheshire: $(BUILD_DIR)/cheshire_top.pickle.sv
slang $(BUILD_DIR)/cheshire_top.pickle.sv -Wrange-width-oob --allow-use-before-declare -error-limit=4419 -top cheshire_soc || true
# adding || true to make test pass atm
2 changes: 1 addition & 1 deletion hw/cheshire_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ package cheshire_pkg;
CachedRegionLength: {
64'h8000_0000, 64'h0001_0000
},
Axi64BitCompliant: 1'b1,
AxiCompliant: 1'b1,
SwapEndianess: 1'b0,
/// Debug
DmBaseAddress: 64'h0,
Expand Down
3 changes: 2 additions & 1 deletion hw/cheshire_soc.sv
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ module cheshire_soc import cheshire_pkg::*; #(
assign cva6_out_resp = cva6_user_id_resp;

cva6 #(
.ArianeCfg ( CheshireArianeConfig )
.ArianeCfg ( CheshireArianeConfig ),
.AxiAddrWidth ( AxiAddrWidth )
) i_cva6 (
.clk_i,
.rst_ni,
Expand Down