-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathMakefile
More file actions
188 lines (140 loc) · 5.73 KB
/
Makefile
File metadata and controls
188 lines (140 loc) · 5.73 KB
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# 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)))))
HOSTNAME := $(shell hostname)
ETH_HOST = $(shell echo $(HOSTNAME) | grep -q "\.ee\.ethz\.ch$$" && echo 1 || echo 0)
ifeq ($(ETH_HOST),1)
QUESTA ?= questa-2023.4-zr
else
QUESTA ?=
endif
BENDER ?= bender
VSIM ?= $(QUESTA) vsim
VOPT ?= $(QUESTA) vopt
VLIB ?= $(QUESTA) vlib
QSIM ?= $(QUESTA) qsim
QOPT ?= $(QUESTA) qopt
Q1VE ?= q1ve --qverify
VENV := venv
top_level ?= pulp_cluster
library ?= work
elf-bin ?= stimuli.riscv
bwruntest = $(ROOT_DIR)/pulp-runtime/scripts/bwruntests.py
REGRESSIONS := $(ROOT_DIR)/regression_tests
VLOG_ARGS_LINT += -suppress vlog-2583 -suppress vlog-13314 -suppress vlog-13233 \"+incdir+$(shell pwd)/include\"
VLOG_ARGS += -suppress vlog-2583 -suppress vlog-13314 -suppress vlog-13233 -timescale \"1ns / 1ps\" \"+incdir+$(shell pwd)/include\"
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 ?= beb98ce
nonfree-init:
git clone $(NONFREE_REMOTE) nonfree
cd nonfree && git checkout $(NONFREE_COMMIT)
################
# Dependencies #
################
.PHONY: init
init: checkout generate_idma_rtl
.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 #
######
.PHONY: sw-init sw-clean
sw-init: pulp-runtime fault_injection_sim regression_tests
sw-clean:
@rm -rf pulp-runtime fault_injection_sim regression_tests
## Clone pulp-runtime as SW stack
PULP_RUNTIME_REMOTE ?= https://github.com/FondazioneChipsIT/pulp-runtime.git
PULP_RUNTIME_COMMIT ?= 9bd23d2b2b6b6c74fc26a3ab3402fbebc589dace # branch: chips-it
pulp-runtime:
git clone $(PULP_RUNTIME_REMOTE) $@
cd $@ && git checkout $(PULP_RUNTIME_COMMIT)
## Clone fault injection scripts
FAULT_SIM_REMOTE ?= https://github.com/pulp-platform/InjectaFault.git
FAULT_SIM_COMMIT ?= 84ddcff # branch: rt/rename-var
fault_injection_sim:
git clone $(FAULT_SIM_REMOTE) $@
cd $@ && git checkout $(FAULT_SIM_COMMIT)
## Clone regression tests
REGRESSION_TESTS_REMOTE ?= https://github.com/FondazioneChipsIT/regression_tests.git
REGRESSION_TESTS_COMMIT ?= dd41d893ee371df7407ce2c0128d2d3a45c4ec71 # branch: chips-it
regression_tests:
git clone $(REGRESSION_TESTS_REMOTE) $@
cd $@ && git checkout $(REGRESSION_TESTS_COMMIT)
cd $@ && git submodule update --init --recursive
########################
# Build and simulation #
########################
.PHONY: sim-clean compile build run
sim-clean:
rm -rf scripts/compile.tcl
rm -rf work
include bender-common.mk
include bender-sim.mk
scripts/compile.tcl: | Bender.lock
$(call generate_vsim, $@, $(common_defs) $(common_targs) -t idma $(sim_defs) $(sim_targs),..)
echo 'vlog "$(realpath $(ROOT_DIR))/tb/dpi/elfloader.cpp" -ccflags "-std=c++11"' >> $@
scripts/compile.tcl-mchan: | Bender.lock
$(call generate_vsim, scripts/compile.tcl, $(common_defs) $(common_targs) -t mchan $(sim_defs) $(sim_targs),..)
echo 'vlog "$(realpath $(ROOT_DIR))/tb/dpi/elfloader.cpp" -ccflags "-std=c++11"' >> scripts/compile.tcl
include bender-synth.mk
scripts/synth-compile.tcl: | Bender.lock
$(BENDER) script synopsys $(common_targs) $(common_defs) $(synth_targs) $(synth_defs) > $@
scripts/compile_lint.tcl:
echo 'set ROOT $(ROOT_DIR)' > $@
$(BENDER) script vsim --vlog-arg="$(VLOG_ARGS_LINT)" $(common_defs) $(common_targs) | grep -v "set ROOT" >> $@
echo >> $@
$(library):
$(QUESTA) vlib $(library)
venv:
python3 -m venv $(VENV) && \
$(VENV)/bin/python -m pip install -U pip && \
$(VENV)/bin/python -m pip install -r $(shell bender path idma)/requirements.txt
generate_idma_rtl: venv
. "$(VENV)/bin/activate" && $(MAKE) -C $(shell bender path idma) idma_hw_all
compile: $(library)
@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 'quit -code [source scripts/compile.tcl]'
build_qone: compile
$(QOPT) $(compile_flag) -debug +designfile -suppress 3053 -suppress 8885 -work $(library) $(top_level)_tb -o $(top_level)_tb_optimized
build: generate_idma_rtl compile
$(VOPT) $(compile_flag) -suppress 3053 -suppress 8885 -work $(library) $(top_level)_tb -o $(top_level)_tb_optimized +acc
compile_lint: $(library)
@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_lint.tcl || { echo "ERROR: scripts/compile_lint.tcl file does not exist. Did you run make scripts in bender mode?"; exit 1; }
$(Q1VE) -od lint/comp_lint_results -c -do " \
onerror {exit}; \
do scripts/compile_lint.tcl; \
exit"
lint: compile_lint
$(Q1VE) -od lint/lint_results -c -do " \
lint methodology ip -goal release; \
lint run -d $(top_level); \
exit"
cdc: compile_lint
$(Q1VE) -od cdc_results -c -do " \
cdc run -d $(top_level); \
exit"
run:
$(VSIM) +permissive -suppress 3053 -suppress 8885 -lib $(library) +MAX_CYCLES=$(max_cycles) +UVM_TESTNAME=$(test_case) +APP=$(elf-bin) +notimingchecks +nospecify -t 1ps \
${top_level}_tb_optimized +permissive-off ++$(elf-bin) ++$(target-options) ++$(cl-bin) | tee sim.log
####################
# Regression tests #
####################
include regression.mk