-
Notifications
You must be signed in to change notification settings - Fork 68
172 lines (152 loc) · 6.41 KB
/
main.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
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
test-difftest-main:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Mill Installation
run: |
sudo curl -L https://github.com/com-lihaoyi/mill/releases/download/0.11.1/0.11.1 > /usr/local/bin/mill
chmod +x /usr/local/bin/mill
- name: Generate Verilog
run: |
make difftest_verilog NOOP_HOME=$GITHUB_WORKSPACE
test-difftest-nutshell:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Prepare environment
run: |
cd $GITHUB_WORKSPACE/..
git config --global url."https://github.com/".insteadOf [email protected]:
git config --global url."https://".insteadOf git://
git clone https://github.com/OpenXiangShan/xs-env
cd xs-env
sudo -s ./setup-tools.sh
source ./setup.sh
- name: Prepare NutShell
run: |
cd $GITHUB_WORKSPACE/../xs-env
rm -r NutShell
git clone -b dev-difftest --single-branch https://github.com/OSCPU/NutShell.git
cd NutShell && git submodule update --init
rm -r difftest
cp -r $GITHUB_WORKSPACE .
- name: Simulation without DiffTest
run: |
cd $GITHUB_WORKSPACE/../xs-env
source ./env.sh
cd $GITHUB_WORKSPACE/../xs-env/NutShell
source ./env.sh
make clean
make emu NO_DIFF=1 EMU_TRACE=1
./build/emu -b 0 -e 100 -i ./ready-to-run/microbench.bin --dump-wave -C 10000
./build/emu -b 0 -e 100 -i ./ready-to-run/microbench.bin --dump-wave-full -C 10000
- name: Simulation with No Diff
run: |
cd $GITHUB_WORKSPACE/../xs-env
source ./env.sh
cd $GITHUB_WORKSPACE/../xs-env/NutShell
source ./env.sh
make clean
make emu
./build/emu -b 0 -e 0 -i ./ready-to-run/microbench.bin --no-diff
- name: Basic Difftest
run: |
cd $GITHUB_WORKSPACE/../xs-env
source ./env.sh
cd $GITHUB_WORKSPACE/../xs-env/NutShell
source ./env.sh
./build/emu -b 0 -e 0 -i ./ready-to-run/microbench.bin --diff ./ready-to-run/riscv64-nemu-interpreter-so
- name: Difftest with Snapshot
run: |
cd $GITHUB_WORKSPACE/../xs-env
source ./env.sh
cd $GITHUB_WORKSPACE/../xs-env/NutShell
source ./env.sh
make clean
make emu EMU_SNAPSHOT=1
./build/emu -b 0 -e 0 -i ./ready-to-run/microbench.bin --diff ./ready-to-run/riscv64-nemu-interpreter-so
- name: Difftest with Trace
run: |
cd $GITHUB_WORKSPACE/../xs-env
source ./env.sh
cd $GITHUB_WORKSPACE/../xs-env/NutShell
source ./env.sh
make clean
make emu EMU_TRACE=1
./build/emu -b 10 -e 12 -i ./ready-to-run/microbench.bin --dump-wave --diff ./ready-to-run/riscv64-nemu-interpreter-so
./build/emu -b 10 -e 12 -i ./ready-to-run/microbench.bin --dump-wave-full --diff ./ready-to-run/riscv64-nemu-interpreter-so
- name: Difftest with two threads
run: |
cd $GITHUB_WORKSPACE/../xs-env
source ./env.sh
cd $GITHUB_WORKSPACE/../xs-env/NutShell
source ./env.sh
make clean
make emu EMU_THREADS=2
./build/emu -b 0 -e 0 -i ./ready-to-run/microbench.bin --diff ./ready-to-run/riscv64-nemu-interpreter-so
- name: Difftest with Verilator Coverage
run: |
cd $GITHUB_WORKSPACE/../xs-env
source ./env.sh
cd $GITHUB_WORKSPACE/../xs-env/NutShell
source ./env.sh
make clean
rm -rf *.coverage
make emu EMU_COVERAGE=1
./build/emu -e 0 -i ./ready-to-run/microbench.bin --diff ./ready-to-run/riscv64-nemu-interpreter-so -C 10000 --dump-coverage
make -C difftest coverage
ls -lh *.coverage
- name: Difftest with DiffTrace
run: |
cd $GITHUB_WORKSPACE/../xs-env
source ./env.sh
cd $GITHUB_WORKSPACE/../xs-env/NutShell
source ./env.sh
make clean
make emu
./build/emu -e 0 -i ./ready-to-run/microbench.bin --diff ./ready-to-run/riscv64-nemu-interpreter-so --dump-difftrace microbench
./build/emu -e 0 -i ./ready-to-run/microbench.bin --diff ./ready-to-run/riscv64-nemu-interpreter-so --load-difftrace microbench
- name: Difftest with Footprints
run: |
cd $GITHUB_WORKSPACE/../xs-env
source ./env.sh
cd $GITHUB_WORKSPACE/../xs-env/NutShell
source ./env.sh
make clean
make emu
./build/emu -e 0 -i ./ready-to-run/microbench.bin --diff ./ready-to-run/riscv64-nemu-interpreter-so --dump-footprints microbench.bin
./build/emu -e 0 -i microbench.bin --diff ./ready-to-run/riscv64-nemu-interpreter-so --as-footprints
- name: Difftest with Global DPI-C Enable
run: |
cd $GITHUB_WORKSPACE/../xs-env
source ./env.sh
cd $GITHUB_WORKSPACE/../xs-env/NutShell
source ./env.sh
make clean
sed -i 's/hasGlobalEnable: Boolean = false/hasGlobalEnable: Boolean = true/' difftest/src/main/scala/DPIC.scala
make emu
./build/emu -b 0 -e 0 -i ./ready-to-run/microbench.bin --diff ./ready-to-run/riscv64-nemu-interpreter-so
- name: Difftest with Coverage-Guided Fuzzer
run: |
git clone https://github.com/OpenXiangShan/riscv-isa-sim.git
export SPIKE_HOME=$(pwd)/riscv-isa-sim
make -C riscv-isa-sim/difftest CPU=NUTSHELL SANCOV=1 -j2
git clone https://github.com/OpenXiangShan/xfuzz.git
export XFUZZ_HOME=$(pwd)/xfuzz
cargo install cargo-make
cd xfuzz && git submodule update --init && make build-all
cd $GITHUB_WORKSPACE/../xs-env
source ./env.sh
cd $GITHUB_WORKSPACE/../xs-env/NutShell
source ./env.sh
make clean
make emu XFUZZ=1 REF=$SPIKE_HOME/difftest/build/riscv64-spike-so LLVM_COVER=1
./build/fuzzer -v -- ./ready-to-run/microbench.bin -e 0