-
Notifications
You must be signed in to change notification settings - Fork 1
/
eth.mk
77 lines (63 loc) · 2.33 KB
/
eth.mk
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
# Copyright 2023 ETH Zurich
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Author: Alessandro Ottaviano <[email protected]>
BENDER ?= bender
QUESTA ?= questa-2022.3
TBENCH ?= eth_tb
DUT ?= eth_rgmii_synth
# Design and simulation variables
ETH_ROOT ?= $(shell $(BENDER) path fe-ethernet)
QUESTA_FLAGS := -permissive -suppress 3009 -suppress 8386 -error 7 +UVM_NO_RELNOTES
#QUESTA_FLAGS :=
ifdef DEBUG
VOPT_FLAGS := $(QUESTA_FLAGS) +acc
VSIM_FLAGS := $(QUESTA_FLAGS)
RUN_AND_EXIT := log -r /*; run -all
else
VOPT_FLAGS := $(QUESTA_FLAGS) -O5 +acc=p+$(TBENCH). +noacc=p+$(DUT).
VSIM_FLAGS := $(QUESTA_FLAGS) -c
RUN_AND_EXIT := run -all; exit
endif
######################
# Nonfree components #
######################
ETH_NONFREE_REMOTE ?= [email protected]:pulp-restricted/pulp-ethernet-nonfree.git
ETH_NONFREE_COMMIT ?= cd8dcd3
eth-nonfree-init:
git clone $(ETH_NONFREE_REMOTE) $(ETH_ROOT)/nonfree
cd $(ETH_ROOT)/nonfree && git checkout $(ETH_NONFREE_COMMIT)
-include $(ETH_ROOT)/nonfree/nonfree.mk
##############
# Simulation #
##############
$(ETH_ROOT)/target/sim/vsim/compile.eth.tcl: Bender.yml
$(BENDER) script vsim -t test \
--vlog-arg="-svinputport=compat" \
--vlog-arg="-override_timescale 1ns/1ps" \
--vlog-arg="-suppress 2583" > $@
echo 'vopt $(VOPT_FLAGS) $(TBENCH) -o $(TBENCH)_opt' >> $@
eth-sim-init: $(ETH_ROOT)/target/sim/vsim/compile.eth.tcl
eth-hw-build: eth-sim-init
$(QUESTA) vsim -c -do "quit -code [source $(ETH_ROOT)/target/sim/vsim/compile.eth.tcl]"
eth-hw-sim:
$(QUESTA) vsim $(VSIM_FLAGS) -do \
"set TESTBENCH $(TBENCH); \
set VSIM_FLAGS \"$(VSIM_FLAGS)\"; \
source $(ETH_ROOT)/target/sim/vsim/start.eth.tcl ; \
$(RUN_AND_EXIT)"
#################################
# Phonies (KEEP AT END OF FILE) #
#################################
.PHONY: eth-all eth-nonfree-init eth-sim-init eth-hw-build eth-hw-sim