-
Notifications
You must be signed in to change notification settings - Fork 717
/
build-chip-verilator.sh
executable file
·59 lines (49 loc) · 1.52 KB
/
build-chip-verilator.sh
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
#!/bin/bash
# Copyright lowRISC contributors (OpenTitan project).
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
# Build a chip-level verilator simulation
#
# Expects three arguments: the toplevel to build, the fusesoc core and
# the intermediate Verilated binary name
set -e
if [ $# != 1 ]; then
echo >&2 "Usage: build-chip-verilator.sh <toplevel>"
exit 1
fi
tl="$1"
case "$tl" in
earlgrey)
fileset=fileset_top
fusesoc_core=lowrisc:dv:chip_verilator_sim
vname=Vchip_sim_tb
verilator_options="--threads 4"
make_options="-j 4"
;;
englishbreakfast)
fileset=fileset_topgen
fusesoc_core=lowrisc:systems:chip_englishbreakfast_verilator
vname=Vchip_englishbreakfast_verilator
# Englishbreakfast on CI runs on a 2-core CPU
verilator_options="--threads 2"
make_options="-j 2"
util/topgen-fusesoc.py --files-root=. --topname=top_englishbreakfast
;;
*)
echo >&2 "Unknown toplevel: $tl"
exit 1
esac
# Move to project root
cd "$(git rev-parse --show-toplevel)"
. util/build_consts.sh
set -x
mkdir -p "$OBJ_DIR/hw"
mkdir -p "$BIN_DIR/hw/top_${tl}"
fusesoc --cores-root=. \
run --flag=$fileset --target=sim --setup --build \
--build-root="$OBJ_DIR/hw" \
$fusesoc_core \
--verilator_options="${verilator_options}" \
--make_options="${make_options}"
cp "$OBJ_DIR/hw/sim-verilator/${vname}" \
"$BIN_DIR/hw/top_${tl}/Vchip_${tl}_verilator"