-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
64 lines (50 loc) · 1.93 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
# Copyright 2023 ETH Zurich and University of Bologna.
# Solderpad Hardware License, Version 0.51, see LICENSE for details.
# SPDX-License-Identifier: SHL-0.51
#
# Paul Scheffler <[email protected]>
GIT ?= git
BENDER ?= bender
VSIM ?= vsim
all: build run
clean: sim_clean
# Ensure half-built targets are purged
.DELETE_ON_ERROR:
ifdef gui
VSIM_ARGS := -do
else
VSIM_ARGS := -c -do
endif
# --------------
# RTL SIMULATION
# --------------
VLOG_ARGS += -suppress vlog-2583 -suppress vlog-13314 -suppress vlog-13233 -timescale \"1 ns / 1 ps\"
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
sim_all: scripts/compile.tcl
sim_clean:
rm -rf scripts/compile.tcl
rm -rf work
# Download (partially non-free) simulation models from publically available sources;
# by running these targets or targets depending on them, you accept this (see README.md).
models/s27ks0641:
mkdir -p $@
rm -rf model_tmp && mkdir model_tmp
cd model_tmp; wget https://www.infineon.com/dgdl/Infineon-S27KL0641_S27KS0641_VERILOG-SimulationModels-v05_00-EN.zip?fileId=8ac78c8c7d0d8da4017d0f6349a14f68
cd model_tmp; mv 'Infineon-S27KL0641_S27KS0641_VERILOG-SimulationModels-v05_00-EN.zip?fileId=8ac78c8c7d0d8da4017d0f6349a14f68' model.zip
cd model_tmp; unzip model.zip
cd model_tmp; mv 'S27KL0641 S27KS0641' exe_folder
cd model_tmp/exe_folder; unzip S27ks0641.exe
cp model_tmp/exe_folder/S27ks0641/model/s27ks0641.v $@
cp model_tmp/exe_folder/S27ks0641/model/s27ks0641_verilog.sdf models/s27ks0641/s27ks0641.sdf
rm -rf model_tmp
scripts/compile.tcl: Bender.yml models/s27ks0641
$(call generate_vsim, $@, -t rtl -t test -t hyper_test,..)
build: scripts/compile.tcl
$(VSIM) -c -do "source scripts/compile.tcl; exit"
run: clean build
$(VSIM) $(VSIM_ARGS) "source scripts/start.tcl"