-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.questa
executable file
·130 lines (116 loc) · 4.32 KB
/
Makefile.questa
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
#-*- mode: makefile -*-
# Time-stamp: <2022-07-07 09:21:13>
# -----------------------------------------------------------------------------------------------
# Make-file to run Mentor Graphics QuestaSim/ModelSim targets
# -----------------------------------------------------------------------------------------------
MAKE = @make --no-print-directory -f $(PATH2SCRIPT)/Makefile.questa
DIR = $(shell basename `pwd`)
OPTIMIZE ?= +acc
TIMESCALE ?= 1ns/1ps
VSIM_MODE ?= "-c"
PARAMETERS ?= $(shell tail -n 1 .vlog_lint 2>/dev/null)
VLOG_OPTIONS ?=
DEF ?=
VLOG = vlog -lint -incr -sv $(OPTIMIZE) -timescale $(TIMESCALE) $(PARAMETERS) $(VLOG_OPTIONS) $(DEF)
.PHONY: help
help:
@echo ""
@echo "Usage: make [target(s)]"
@echo "where target is any of:"
@echo ""
@echo " compile - SV compilation ALL files in current directory (and target woklib)"
@echo " Note: -- compilation order: *_pkg.sv, *_if.sv, *.v, other *.sv"
@echo " -- compilation options: see 'variable' targets'"
@echo " -- use file: '.vlog_lint' to add parameters for 'vlog'"
@echo " vlog - SV compilation for single sv-file (options as note2)"
@echo " clean - removes derived files and work libs"
@echo " all - run all (targets: worklib, compile, clean)"
@echo " rall - run rebuld all (targets: clean, worklib, compile, clean)"
@echo ""
@echo " variables - list of make-file variables"
.PHONY: worklib
worklib:
@-if [ ! -d work ] ; then \
vlib work; \
fi
@vmap work work 1>/dev/null
.PHONY: compile
PKG_FILES = $(shell ls 2>/dev/null *_pkg.sv)
IF_FILES = $(shell ls 2>/dev/null *_if.sv)
V_FILES = $(shell ls 2>/dev/null *.v)
SVM_FILES = $(shell ls 2>/dev/null *.sv | grep -v _if | grep -v _pkg)
RPT_FILE = mentor_lint.tmp.log
compile:
$(MAKE) worklib
@echo "+-----------------------------------------------------+"
@echo "| Run compilation: |"
@echo "+-----------------------------------------------------+"
@rm -rf $(RPT_FILE) && touch $(RPT_FILE)
@-if [ "$(PKG_FILES)" != "" ] ; then \
$(VLOG) $(PKG_FILES) | tee -a $(RPT_FILE) ; \
fi
@-if [ "$(IF_FILES)" != "" ] ; then \
$(VLOG) $(IF_FILES) | tee -a $(RPT_FILE) ; \
fi
@-if [ "$(V_FILES)" != "" ] ; then \
$(VLOG) $(V_FILES) | tee -a $(RPT_FILE) ; \
fi
@-if [ "$(SVM_FILES)" != "" ] ; then \
$(VLOG) $(SVM_FILES) | tee -a $(RPT_FILE) ; \
fi
@echo "+-----------------------------------------------------+"
@echo "| Summary of Vlog report (Error and Warning only): |"
@echo "+-----------------------------------------------------+"
@cat $(RPT_FILE) | grep -s Error --color=auto || true
@cat $(RPT_FILE) | grep -s Warning --color=auto || true
@echo "| Done. |"
@echo "+-----------------------------------------------------+"
@rm -rf $(RPT_FILE)
IN_FILES = $(filter-out $@,$(MAKECMDGOALS))
.PHONY: vlog
vlog:
$(MAKE) worklib
@echo "+-----------------------------------------------------+"
@echo "| Run compilation: |"
@echo "+-----------------------------------------------------+"
@rm -rf $(RPT_FILE) && touch $(RPT_FILE)
$(VLOG) $(IN_FILES) | tee -a $(RPT_FILE)
@echo "+-----------------------------------------------------+"
@echo "| Summary of Vlog report (Error and Warning only): |"
@echo "+-----------------------------------------------------+"
@cat $(RPT_FILE) | grep -s Error --color=auto || true
@cat $(RPT_FILE) | grep -s Warning --color=auto || true
@echo "| Done. |"
@echo "+-----------------------------------------------------+"
@rm -rf $(RPT_FILE)
# .PHONY: lint
# LINT_FILE ?= $(shell ls *.sv)
# lint:
# $(MAKE) worklib
# $(VLOG) $(LINT_FILE)
.PHONY: clean
clean:
rm -rf work modelsim.ini
.PHONY: all
all:
$(MAKE) worklib
$(MAKE) compile
$(MAKE) clean
.PHONY: rall
rall:
$(MAKE) clean
$(MAKE) all
.PHONY: variables
variables:
@echo "List of variables:"
@echo "OPTIMIZE = $(OPTIMIZE)"
@echo "TIMESCALE = $(TIMESCALE)"
@echo "VSIM_MODE = $(VSIM_MODE)"
@echo "PARAMETERS = $(PARAMETERS)"
@echo "VLOG = $(VLOG)"
# This is for the sake of Emacs.
# Local Variables:
# time-stamp-end: "$"
# time-stamp-format: "<%:y-%02m-%02d %02H:%02M:%02S>"
# time-stamp-start: "Time-stamp: "
# End: