forked from mido3ds/ode-solver-chip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun
executable file
·39 lines (29 loc) · 1.19 KB
/
run
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
#!/bin/bash
set -e
run-daemon() {
if [[ `docker ps|grep ghdld_vlsi|wc -l` = 0 ]]; then
echo running container daemon...
docker run --rm -it -d -v "`pwd`":"`pwd`" -w "`pwd`" -u 1000:1000 --name ghdld_vlsi ghdl/ext sleep 1h >/dev/null
echo daemon is up
fi
}
main() {
run-daemon
mkdir -p out/waves
cd out
docker exec -w "$PWD" ghdld_vlsi bash -c "
find ../src/ | grep .vhd | xargs -l ghdl -i --ieee=synopsys -fexplicit || echo
find ../test/non_vunit | grep .vhd | xargs -l ghdl -i --ieee=synopsys -fexplicit
set -e
ghdl --gen-makefile --ieee=synopsys -fexplicit ${UNIT} > Makefile.${UNIT}
sed -i 's/\$(GHDL) -r /timeout 30s .\//' Makefile.${UNIT}
make -f Makefile.${UNIT} all GHDLFLAGS='-g -Wbinding -Wreserved -Wlibrary -Wvital-generic -Wdelayed-checks -Wbody -Wspecs -Wunused --mb-comments --std=08 --ieee=synopsys -fexplicit'
make -f Makefile.${UNIT} run GHDLRUNFLAGS+=--vcd=waves/${UNIT}.vcd GHDLRUNFLAGS+=--stop-time=300ms GHDLRUNFLAGS+=--assert-level=failure # if in test mode, assert-level=error
"
}
if [[ "$#" -lt "1" ]]; then
echo "Usage: run unit-name"
exit 1
fi
UNIT=$1
main