-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
111 lines (86 loc) · 3.47 KB
/
Makefile
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
# Copyright 2023 ETH Zurich and University of Bologna
# Solderpad Hardware License, Version 0.51, see LICENSE for details.
# SPDX-License-Identifier: SHL-0.51
ROOT_DIR = $(strip $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))))
GIT ?= git
BENDER ?= bender
VSIM ?= vsim
VLIB ?= vlib
VOPT ?= vopt
top_level ?= pulp_cluster_tb
library ?= work
elf-bin ?= stimuli.riscv
bwruntest = $(ROOT_DIR)/pulp-runtime/scripts/bwruntests.py
CFLAGS ?= -I$(QUESTASIM_HOME)/include \
-I$(RISCV)/include/ \
-I/include -std=c++11 -I../tb/dpi -O3
VLOG_ARGS += -suppress vlog-2583 -suppress vlog-13314 -suppress vlog-13233 -timescale \"1 ns / 1 ps\" \"+incdir+$(shell pwd)/include\"
XVLOG_ARGS += -64bit -compile -vtimescale 1ns/1ns -quiet
define generate_vsim
echo 'set ROOT [file normalize [file dirname [info script]]/$3]' > $1
bender script vsim --vlog-arg="$(VLOG_ARGS)" $2 | grep -v "set ROOT" >> $1
echo >> $1
endef
######################
# Nonfree components #
######################
NONFREE_REMOTE ?= git@iis-git.ee.ethz.ch:pulp-restricted/pulp-cluster-nonfree.git
NONFREE_COMMIT ?= ff679262d78198a3ff54ff91811d7395e83998db
nonfree-init:
git clone $(NONFREE_REMOTE) nonfree
cd nonfree && git checkout $(NONFREE_COMMIT)
################
# Dependencies #
################
.PHONY: checkout
## Checkout/update dependencies using Bender
checkout:
bender checkout
touch Bender.lock
make scripts/compile.tcl
Bender.lock:
bender checkout
touch Bender.lock
######
# SW #
######
## Clone pulp-runtime as SW stack
pulp-runtime:
git clone https://github.com/pulp-platform/pulp-runtime.git $@
cd $@; git checkout 38ae6be6e28ff39f79218d333c41632a935bd584; cd ..
## Clone regression tests for bare-metal verification
regression-tests:
git clone https://github.com/pulp-platform/regression_tests.git $@
cd $@; git checkout 7343d39bb9d1137b6eb3f2561777df546cd1e421; cd ..
########################
# Build and simulation #
########################
sim_clean:
rm -rf scripts/compile.tcl
rm -rf work
scripts/compile.tcl: | Bender.lock
$(call generate_vsim, $@, -t rtl -t test -t cluster_standalone,..)
echo 'vlog "$(realpath $(ROOT_DIR))/tb/dpi/elfloader.cpp" -ccflags "-std=c++11"' >> $@
$(library):
$(VLIB) $(library)
compile: $(library) scripts/compile.tcl
@test -f Bender.lock || { echo "ERROR: Bender.lock file does not exist. Did you run make checkout in bender mode?"; exit 1; }
@test -f scripts/compile.tcl || { echo "ERROR: scripts/compile.tcl file does not exist. Did you run make scripts in bender mode?"; exit 1; }
$(VSIM) -c -do 'source scripts/compile.tcl; quit'
build: compile
$(VOPT) $(compile_flag) -suppress 3053 -suppress 8885 -work $(library) $(top_level) -o $(top_level)_optimized -debug
run:
$(VSIM) +permissive $(questa-flags) $(questa-cmd) -suppress 3053 -suppress 8885 -lib $(library) +MAX_CYCLES=$(max_cycles) +UVM_TESTNAME=$(test_case) +APP=$(elf-bin) +notimingchecks +nospecify -t 1ps \
${top_level}_optimized +permissive-off ++$(elf-bin) ++$(target-options) ++$(cl-bin) | tee sim.log
.PHONY: test-rt-par-bare
## Run only parallel tests on pulp-runtime
test-rt-par-bare: pulp-runtime regression-tests
cd regression-tests && $(bwruntest) --proc-verbose -v \
-t 3600 --yaml --max-procs 2 \
-o runtime-parallel.xml parallel-bare-tests.yaml
.PHONY: test-rt-mchan
## Run mchan tests on pulp-runtime
test-rt-mchan: pulp-runtime regression-tests
cd regression-tests && $(bwruntest) --proc-verbose -v \
-t 3600 --yaml --max-procs 2 \
-o runtime-mchan.xml pulp_cluster-mchan-tests.yaml