generated from chipsalliance/chisel-template
-
Notifications
You must be signed in to change notification settings - Fork 12
186 lines (183 loc) · 7.27 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
name: Test
on: [push, pull_request, workflow_dispatch]
jobs:
test-windows:
name: Test on Windows
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Mkdir Ccache
run: 'New-Item -Path D:\ccache -ItemType Directory -Force'
- name: Cache verilator build
id: cache-verilator-build
uses: actions/cache@v3
with:
path: 'D:\ccache'
key: verilator-build-cache
- name: Setup Verilator
run: C:\msys64\usr\bin\bash.exe -l -c "pacman -Sy --noconfirm --needed base-devel mingw-w64-x86_64-ccache mingw-w64-x86_64-toolchain git flex mingw-w64-x86_64-cmake mingw-w64-x86_64-autotools mingw-w64-x86_64-python3 && export PATH=/mingw64/bin:/usr/local/bin:/usr/bin:/usr/bin/core_perl && export CCACHE_DIR=/d/ccache && cd ~ && git clone --depth 1 -b v4.228 https://github.com/verilator/verilator && cd verilator && autoconf && (./configure --prefix=/mingw64 || cat config.log) && cp /usr/include/FlexLexer.h /mingw64/include && make -j$(nproc) && make install"
- run: echo 'C:\msys64\usr\bin' | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- run: echo 'C:\msys64\mingw64\bin' | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Setup Developer Command
uses: ilammy/msvc-dev-cmd@v1
- name: Compile executables for testing
run: cd csrc; .\build.bat
- name: SBT Test
run: sbt test
test-macos:
name: Test on macOS
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Clang
run: brew install llvm && echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH
- name: Setup Verilator
run: brew install verilator
- name: Compile executables for testing
run: cd csrc && ./build.sh
- name: SBT Test
run: sbt test
test-linux:
name: Test on Linux
runs-on: ubuntu-latest
steps:
- name: Setup Clang
run: sudo apt-get update && sudo apt-get install -y clang-15 lldb-15 lld-15 clangd-15 clang-tidy-15 clang-format-15 clang-tools-15 llvm-15-dev lld-15 lldb-15 llvm-15-tools libomp-15-dev libc++-15-dev libc++abi-15-dev libclang-common-15-dev libclang-15-dev libclang-cpp15-dev libunwind-15-dev
- name: Update Clang Version
run: curl -LO https://gist.githubusercontent.com/howardlau1999/7ea2cffedc0491c46fa14e1f2355a9a8/raw/7886c0344e8f010a9d515a3de20983e604ae5a0a/update-alternatives-clang.sh && sudo bash update-alternatives-clang.sh 15 100
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup Verilator
run: sudo apt install -y verilator
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '19'
- name: Cache Scala
uses: coursier/cache-action@v6
- name: Compile executables for testing
run: cd csrc && ./build.sh
- name: SBT Test
run: sbt test
test-in-docker:
name: Test in Devcontainer Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- uses: docker/setup-buildx-action@v2
- uses: docker/build-push-action@v4
with:
context: .devcontainer
cache-from: type=gha
cache-to: type=gha,mode=max
push: false
load: true
tags: howardlau1999/yatcpu:latest
- name: Run test in Docker
run: docker run --user $(id -u) --rm -v $PWD:/yatcpu -w /yatcpu howardlau1999/yatcpu bash -c "cd csrc && ./build.sh && cd .. && sbt test"
old-riscv-compliance-test:
name: Run old RISC-V compliance test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: yatcpu
- name: Checkout RISC-V compliance test
uses: actions/checkout@v3
with:
repository: "riscv-non-isa/riscv-arch-test"
path: riscv-arch-test
ref: 2.6.1
- name: Setup Toolchain
run: sudo apt-get update && sudo apt-get install -y verilator binutils-riscv64-unknown-elf gcc-riscv64-unknown-elf
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '19'
- name: Set up GCC
uses: egor-tensin/setup-gcc@v1
with:
version: 11
- name: Cache Scala
uses: coursier/cache-action@v6
- name: Generate Verilog
run: cd yatcpu && sbt "runMain board.verilator.VerilogGenerator"
- name: Compile Verilated model
run: cd yatcpu/verilog/verilator && verilator --exe --cc --trace Top.v sim_main.cpp && make -C obj_dir -f VTop.mk
- name: Run RISC-V compliance test
run: cd riscv-arch-test && make VERBOSE=1
env:
RISCV_TARGET_FLAGS: "-memory 1048576"
TARGET_SIM: ${{ github.workspace }}/yatcpu/verilog/verilator/obj_dir/VTop
RISCV_TARGET: yatcpu
TARGETDIR: ${{ github.workspace }}/yatcpu/riscv-target
new-riscv-compilance-test-riscof:
name: Run new RISC-V compliance test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: yatcpu
- name: Setup Toolchain
run: sudo apt-get update && sudo apt-get install -y verilator binutils-riscv64-unknown-elf gcc-riscv64-unknown-elf
- name: Setup ccache
uses: hendrikmuhs/[email protected]
with:
append-timestamp: false
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '19'
- name: Set up GCC
uses: egor-tensin/setup-gcc@v1
with:
version: 11
- name: Cache Scala
uses: coursier/cache-action@v6
- name: Generate Verilog
run: cd yatcpu && sbt "runMain board.verilator.VerilogGenerator"
- name: Compile Verilated model
run: |
cd yatcpu/verilog/verilator
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
verilator --exe --cc --trace Top.v sim_main.cpp
make -C obj_dir -f VTop.mk
- name: Setup RISCOF
run: |
pip3 install git+https://github.com/riscv/riscof.git
- name: Setup spike
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
sudo apt-get install device-tree-compiler
cd ${{ github.workspace }}
git clone https://github.com/riscv-software-src/riscv-isa-sim.git
cd riscv-isa-sim
mkdir build
cd build
../configure --prefix=/usr
make -j$(nproc)
sudo make install
- name: Setup test suite
run: |
cd ${{ github.workspace }}
riscof --verbose info arch-test --clone
- name: Run RISCOF compliance test
run: |
cd ${{ github.workspace }}/yatcpu/riscof-target
riscof run --config=config.ini --no-browser --no-clean --suite=${{ github.workspace }}/riscv-arch-test/riscv-test-suite/ --env=${{ github.workspace }}/riscv-arch-test/riscv-test-suite/env