forked from ucb-bar/riscv-sodor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.in
executable file
·109 lines (77 loc) · 3.39 KB
/
Makefile.in
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
#=======================================================================
# UCB Chisel C++ Simulator Generator: Makefile
#-----------------------------------------------------------------------
# Christopher Celio (celio@eecs.berkeley.edu)
#
# This makefile will generate an emulator from chisel code
# Many different processors are provided. To switch between which
# processor you would like to build, change the bash environment
# variable $MK_TARGET_PROC as follows:
# "export MK_TARGET_PROC=rv32_1stage"
# "export MK_TARGET_PROC=rv32_2stage"
# "export MK_TARGET_PROC=rv32_5stage"
# "export MK_TARGET_PROC=rv32_ucode"
include @top_builddir@/prefix.mk
all_targets := rv32_1stage rv32_2stage rv32_3stage rv32_5stage rv32_ucode
targets := $(all_targets)
MK_TARGET_PROC?=rv32_1stage
prerequisites := $(if $(chiseldir),chisel-timestamp)
all: $(prerequisites) $(patsubst %,emulator/%/emulator,$(targets))
install: all
install -d $(RISCV)/bin
$(if $(findstring rv32_1stage,$(targets)),install -s -p -m 755 emulator/rv32_1stage/emulator $(RISCV)/bin/rv32_1stage-emulator)
$(if $(findstring rv32_2stage,$(targets)),install -s -p -m 755 emulator/rv32_2stage/emulator $(RISCV)/bin/rv32_2stage-emulator)
$(if $(findstring rv32_3stage,$(targets)),install -s -p -m 755 emulator/rv32_3stage/emulator $(RISCV)/bin/rv32_3stage-emulator)
$(if $(findstring rv32_5stage,$(targets)),install -s -p -m 755 emulator/rv32_5stage/emulator $(RISCV)/bin/rv32_5stage-emulator)
$(if $(findstring rv32_ucode,$(targets)),install -s -p -m 755 emulator/rv32_ucode/emulator $(RISCV)/bin/rv32_ucode-emulator)
dist-src:
cd $(srcDir) && git archive --prefix=sodor/ -o $(buildDir)/sodor-`git rev-parse --short HEAD`.tar.gz HEAD
compile:
$(SBT) "project ${MK_TARGET_PROC}" compile
shell:
$(SBT) "project ${MK_TARGET_PROC}" shell
debug:
$(SBT) "project ${MK_TARGET_PROC}" "last run"
console:
$(SBT) "project ${MK_TARGET_PROC}" console
run-emulator: $(patsubst %,emulator/%/generated-src/timestamp,$(targets))
run-emulator-debug: $(patsubst %,emulator/%/generated-src-debug/timestamp,$(targets))
clean-tests:
make -C $(patsubst %,emulator/%,$(all_targets)) clean-tests
clean:
-find sbt -type d -name target -exec rm -rf {} \+
for d in $(patsubst %,emulator/%,$(all_targets)) ; do \
make -C $$d clean ; \
done
reports: test-results.xml report-cpi report-bp report-stats
report-cpi: $(patsubst %,%-report-cpi,$(targets))
report-bp: $(patsubst %,%-report-bp,$(targets))
report-stats: $(patsubst %,%-report-stats,$(targets))
chisel-timestamp: $(wildcard $(chiseldir)/src/main/scala/*.scala)
cd $(chiseldir) && sbt publish-local
date > $@
test-results.xml: $(wildcard $(patsubst %,emulator/%/output/*.out,$(targets)))
$(srcDir)/project/check $^ > test-results.xml
%-report-cpi:
-grep CPI emulator/$(patsubst %-report-cpi,%,$@)/output/*.out
%-report-bp:
-grep Acc emulator/$(patsubst %-report-bp,%,$@)/output/*.out
%-report-stats:
-grep "#" emulator/$(patsubst %-report-stats,%,$@)/output/*.out
emulator/%/generated-src/timestamp: emulator/%/emulator
@echo
@echo running basedir/Makefile: make run-emulator
@echo
make -C $(dir $<) run
install -d $(dir $@)
date > $@
emulator/%/generated-src-debug/timestamp:
@echo
@echo running basedir/Makefile: make run-emulator-debug
@echo
make -C $(dir $<) run-debug
install -d $(dir $@)
date > $@
emulator/%/emulator: $(prerequisites)
make -C $(dir $@)
.PHONY: run-emulator target clean clean-tests