Skip to content

Commit 00a7357

Browse files
committed
Slight polish of CI scripts
1 parent 479d77c commit 00a7357

File tree

3 files changed

+71
-35
lines changed

3 files changed

+71
-35
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,17 @@ jobs:
55
runs-on: macos-latest
66
steps:
77
- uses: actions/checkout@v2
8-
- run: brew install verilator
98
- run: git submodule update --init --recursive
109
- run: ./flow.sh lint
11-
Simulation:
10+
Synthesis:
1211
runs-on: macos-latest
1312
steps:
1413
- uses: actions/checkout@v2
15-
- run: brew install icarus-verilog
16-
- run: brew install verilator
17-
- run: iverilog -V
18-
- run: verilator -V
1914
- run: git submodule update --init --recursive
20-
- run: ./flow.sh sim
21-
Synthesis:
15+
- run: ./flow.sh syn
16+
Simulation:
2217
runs-on: macos-latest
2318
steps:
2419
- uses: actions/checkout@v2
25-
- run: brew install yosys
2620
- run: git submodule update --init --recursive
27-
- run: ./flow.sh syn
21+
- run: ./flow.sh sim

flow.sh

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,20 @@
66
# -o pipefail: causes a pipeline to fail if any command fails
77
set -eu -o pipefail
88

9-
# Current script path; doesn't support symlink
10-
CURDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
9+
#-------------------------------------------------------------
10+
# Get current script path (applicable even if is a symlink)
11+
#-------------------------------------------------------------
12+
13+
SOURCE="${BASH_SOURCE[0]}"
14+
while [ -h "$SOURCE" ]; do
15+
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
16+
SOURCE="$(readlink "$SOURCE")"
17+
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
18+
done
19+
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
20+
21+
# Functions to install the flow
22+
source script/setup.sh
1123

1224
ret=0
1325

@@ -88,14 +100,15 @@ main() {
88100

89101
# Print help
90102
if [[ $1 == "-h" || $1 == "help" ]]; then
91-
92103
help
93104
exit 0
94105
fi
95106

96107

97108
if [[ $1 == "lint" ]]; then
98109

110+
install_verilator
111+
# Disable break on error bc Verilator exit with 1 with warnings
99112
set +e
100113

101114
printinfo "Start Verilator lint"
@@ -148,19 +161,21 @@ main() {
148161
fi
149162

150163
if [[ $1 == "sim" ]]; then
151-
# Install SVUT if missing in $PATH
152-
source script/setup.sh
164+
# Install SVUT and Icarus Verilog if needed
165+
install_svut
166+
install_icarus
153167
# Run all testsuites against all configurations
154-
cd "$CURDIR/test/svut"
168+
cd "$DIR/test/svut"
155169
./run.sh --no-debug-log --no-wave
156170
ret=$?
157171
echo "Execution status: $ret"
158172
exit $ret
159173
fi
160174

161175
if [[ $1 == "syn" ]]; then
176+
install_yosys
162177
printinfo "Start synthesis flow"
163-
cd "$CURDIR/syn/yosys"
178+
cd "$DIR/syn/yosys"
164179
# AXI4 synthesis
165180
./syn_asic.sh axicb_axi4.ys | tee axi4.log
166181
ret=$?

script/setup.sh

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,51 @@
33
#-------------------------------------------------------------
44
# Install SVUT from https://github.com/dpretet/svut if missing
55
#-------------------------------------------------------------
6+
install_svut() {
7+
if [[ ! $(type svutRun) ]];
8+
then
9+
svut_dir="$DIR/.svut"
10+
if [[ ! -d $svut_dir ]]; then
11+
echo "INFO: Install SVUT (https://github.com/dpretet/svut)"
12+
git clone "https://github.com/dpretet/svut.git" "$svut_dir"
13+
fi
14+
echo "INFO: Enable SVUT in PATH"
15+
export PATH=$svut_dir/:$PATH
16+
fi
17+
}
18+
19+
#-------------------------------------------------------------
20+
# Install Verilator with brew
21+
#-------------------------------------------------------------
22+
install_verilator() {
23+
if [[ ! $(type verilator) ]];
24+
then
25+
echo "INFO: Enable Verilator"
26+
brew install verilator
27+
verilator -V
28+
fi
29+
}
630

7-
# Get current script path (applicable even if is a symlink)
8-
SOURCE="${BASH_SOURCE[0]}"
9-
while [ -h "$SOURCE" ]; do
10-
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
11-
SOURCE="$(readlink "$SOURCE")"
12-
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
13-
done
14-
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
31+
#-------------------------------------------------------------
32+
# Install Icarus-verilog with brew
33+
#-------------------------------------------------------------
34+
install_icarus() {
35+
if [[ ! $(type iverilog) ]];
36+
then
37+
echo "INFO: Enable Icarus-Verilog"
38+
brew install icarus-verilog
39+
iverilog -V
40+
fi
41+
}
1542

16-
# Clone SVUT and setup $PATH
17-
if [[ ! $(type svutRun) ]];
18-
then
19-
svut_dir="$DIR/.svut"
20-
if [[ ! -d $svut_dir ]]; then
21-
echo "INFO: Install SVUT (https://github.com/dpretet/svut)"
22-
git clone "https://github.com/dpretet/svut.git" "$svut_dir"
43+
#-------------------------------------------------------------
44+
# Install Icarus-verilog with brew
45+
#-------------------------------------------------------------
46+
install_icarus() {
47+
if [[ ! $(type yosys) ]];
48+
then
49+
echo "INFO: Enable Yosys"
50+
brew install yosys
51+
iverilog -V
2352
fi
24-
echo "INFO: Enable SVUT in PATH"
25-
export PATH=$svut_dir/:$PATH
26-
fi
53+
}

0 commit comments

Comments
 (0)