-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
89 lines (66 loc) · 1.97 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
TOOL := ghdl
SRCDIR := src
WORKDIR := work
OUTDIR := out
TARGET := $(WORKDIR)/work-obj93.cf
SIM_ENTITIES := vectors_tb
SIM_ENTITIES += hamming_tb
SIM_ENTITIES += spc_tb
SIM_ENTITIES += ecc_tb
SIM_ENTITIES += combinations_tb
TOPLEVEL := pkg_matrix_tb
SIM_TARGETS := $(addsuffix .sim, $(addprefix $(OUTDIR)/, $(SIM_ENTITIES)))
SIMLOG := $(OUTDIR)/$(TOPLEVEL).sim
SIM_OPTIONS :=
SIM_OPTIONS += --assert-level=error
#SIM_OPTIONS += --backtrace-severity=error
#SIM_OPTIONS += --wave=$(OUTDIR)/$(TOPLEVEL).ghw
.phony:
all: $(SIM_TARGETS)
clean:
@rm -rf $(WORKDIR)
@rm -rf $(OUTDIR)
$(OUTDIR)/%.sim: $(OUTDIR) $(OUTDIR)/%.analysis
@echo
@echo "NOTE: Starting simulation of $*"
@echo "NOTE: Writing simulation log to $(OUTDIR)/$*.sim"
$(TOOL) -r --workdir=work $* --wave=$(OUTDIR)/$*.ghw $(SIM_OPTIONS) > $(OUTDIR)/$*.sim
@echo "NOTE: Simulation of $* succesful"
@echo
$(OUTDIR)/%.analysis: $(TARGET)
@$(TOOL) -m --workdir=work $*
# $(SIMLOG): simulation
# simulation: $(OUTDIR) analysis
# @$(MAKE) simulate_default || $(MAKE) simulate_error
# simulate_default:
# @echo
# @echo "NOTE: Starting simulation of $(TOPLEVEL)"
# @echo "NOTE: Writing simulation log to $(SIMLOG)"
# @echo
# @$(TOOL) -r --workdir=work $(TOPLEVEL) $(SIM_OPTIONS) > $(SIMLOG)
# @echo NOTE: Simulation of $(TOPLEVEL) succesfull
# @echo
# simulate_error:
# @echo
# @echo ERROR: Simulation failed. Displaying last 20 lines of simulation log
# @echo "NOTE: Simulation log path: ./$(SIMLOG)"
# @echo
# @tail -n 20 $(SIMLOG)
# .phony is there to analysis runs even if target is allready there
# could be created just with ghdl -i
analysis: $(TARGET) .phony
@$(TOOL) -m --workdir=work $(TOPLEVEL)
$(TARGET): $(WORKDIR)
@$(TOOL) -i --workdir=work $(SRCDIR)/*.vhdl
$(WORKDIR):
@mkdir $(WORKDIR)
$(OUTDIR):
@mkdir $(OUTDIR)
synth: clean_synth
vivado -mode batch -source synth.tcl
rm -f vivado*.*
rm -rf .Xil
clean_synth:
rm -rf .Xil
rm -rf synth
rm -f vivado*.*