-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (51 loc) · 1.77 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
# File is modified from https://github.com/mortenjc/systemverilog/blob/main/Makefile
# Under copyright (C) 2021 Morten Jagd Christensen, LICENSE: BSD2
.SUFFIXES:
include Makefile.macros
VLCOVFLAGS = --annotate logs/annotate --annotate-all --annotate-min 1
# User only needs to edit below
MODULES =
UNITS = alu timer cp0
UNITS.alu = modules/mux modules/adder units/au units/lu
UNITS.timer = modules/register units/alu $(UNITS.alu)
UNITS.cp0 = modules/barrel_shifter32 modules/register modules/mux
# User only needs to edit above
TARGETS = $(addsuffix Test, $(addprefix bin/, $(MODULES))) $(addsuffix Test, $(addprefix bin/, $(UNITS)))
vpath %.sv src/modules src/units
all: directories $(TARGETS)
# Create dependencies using macros
# main targets
$(foreach module, $(MODULES), $(eval $(call make_bintargets,$(module))))
$(foreach unit, $(UNITS), $(eval $(call make_bintargets,$(unit))))
# dependencies
$(foreach module, $(MODULES), $(eval $(call make_mktargets,$(module),modules)))
$(foreach unit, $(UNITS), $(eval $(call make_mktargets,$(unit),units,$(UNITS.$(unit)))))
%: directories bin/%Test
@if [ -f bin/$@Test ]; then \
./bin/$@Test; \
else \
echo "Test for $@ not found!"; \
exit 1; \
fi
#
runtest: all $(TARGETS)
@for test in $(TARGETS); do ./$$test || exit 1; done
coverage: runtest
verilator_coverage $(VLCOVFLAGS) -write-info logs/merged.info logs/coverage1.dat logs/coverage2.dat
genhtml: coverage
genhtml logs/merged.info --output-directory logs/html
gtest:
@./scripts/makegtest
# make sure build directory is created
.PHONY: directories
#
directories: build
build:
@mkdir -p build bin
# Misc clean targets
clean:
@rm -fr build *.bak bin logs
realclean: clean
@rm -fr googletest db output_files simulation
include simulations/Makefile
include example_asm/Makefile