-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefrag
executable file
·93 lines (71 loc) · 2.92 KB
/
Makefrag
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
lib_dir=$(base_dir)/lib
ROCKETCHIP_DIR=$(base_dir)/rocket-chip
EXTRA_PACKAGES=testchipip
rocketchip_stamp=$(base_dir)/lib/rocketchip.stamp
SBT ?= java -Xmx2G -Xss8M -XX:MaxPermSize=256M -jar $(ROCKETCHIP_DIR)/sbt-launch.jar
extra_stamps = $(addprefix $(lib_dir)/,$(addsuffix .stamp,$(EXTRA_PACKAGES)))
lookup_scala_srcs = $(shell find $(1)/ -iname "*.scala" 2> /dev/null)
libs: $(rocketchip_stamp) $(extra_stamps)
FIRRTL_JAR ?= $(ROCKETCHIP_DIR)/firrtl/utils/bin/firrtl.jar
FIRRTL ?= java -Xmx2G -Xss8M -XX:MaxPermSize=256M -cp $(FIRRTL_JAR) firrtl.Driver
$(rocketchip_stamp): $(call lookup_scala_srcs, $(ROCKETCHIP_DIR)) $(FIRRTL_JAR)
cd $(ROCKETCHIP_DIR) && $(SBT) pack
mkdir -p $(lib_dir)
cp $(ROCKETCHIP_DIR)/target/pack/lib/*.jar $(lib_dir)
touch $(rocketchip_stamp)
-include $(base_dir)/Makefrag.pkgs
$(base_dir)/Makefrag.pkgs: $(base_dir)/generate-pkg-mk.sh
bash $(base_dir)/generate-pkg-mk.sh $(EXTRA_PACKAGES) > $@
$(FIRRTL_JAR): $(call lookup_scala_srcs, $(ROCKETCHIP_DIR)/firrtl/src/main/scala)
$(MAKE) -C $(ROCKETCHIP_DIR)/firrtl SBT="$(SBT)" root_dir=$(ROCKETCHIP_DIR)/firrtl build-scala
mkdir -p $(ROCKETCHIP_DIR)/lib
cp -p $(FIRRTL_JAR) $(ROCKETCHIP_DIR)/lib
build_dir=$(sim_dir)/generated-src
bootrom_img = $(base_dir)/bootrom/bootrom.rv64.img $(base_dir)/bootrom/bootrom.rv32.img
CHISEL_ARGS ?=
FIRRTL_FILE=$(build_dir)/$(PROJECT).$(MODEL).$(CONFIG).fir
ANNO_FILE=$(build_dir)/$(PROJECT).$(MODEL).$(CONFIG).anno
VERILOG_FILE=$(build_dir)/$(PROJECT).$(MODEL).$(CONFIG).v
$(FIRRTL_FILE) $(ANNO_FILE): $(rocketchip_stamp) $(extra_stamps) $(call lookup_scala_srcs,$(base_dir)/src/main/scala) $(bootrom_img)
mkdir -p $(build_dir)
cd $(base_dir) && $(SBT) "runMain $(PROJECT).Generator $(CHISEL_ARGS) $(build_dir) $(PROJECT) $(MODEL) $(CFG_PROJECT) $(CONFIG)"
$(VERILOG_FILE): $(FIRRTL_FILE) $(ANNO_FILE) $(FIRRTL_JAR)
$(FIRRTL) -i $(FIRRTL_FILE) -o $(VERILOG_FILE) -X verilog -faf $(ANNO_FILE)
regression-tests = \
rv64ud-v-fcvt \
rv64ud-p-fdiv \
rv64ud-v-fadd \
rv64uf-v-fadd \
rv64um-v-mul \
rv64mi-p-breakpoint \
rv64uc-v-rvc \
rv64ud-v-structural \
rv64si-p-wfi \
rv64um-v-divw \
rv64ua-v-lrsc \
rv64ui-v-fence_i \
rv64ud-v-fcvt_w \
rv64uf-v-fmin \
rv64ui-v-sb \
rv64ua-v-amomax_d \
rv64ud-v-move \
rv64ud-v-fclass \
rv64ua-v-amoand_d \
rv64ua-v-amoxor_d \
rv64si-p-sbreak \
rv64ud-v-fmadd \
rv64uf-v-ldst \
rv64um-v-mulh \
rv64si-p-dirty
output_dir=$(sim_dir)/output
$(output_dir)/%: $(RISCV)/riscv64-unknown-elf/share/riscv-tests/isa/%
mkdir -p $(output_dir)
ln -sf $< $@
$(output_dir)/.dummy:
mkdir -p $(output_dir)
touch $@
bmarks_dir=$(base_dir)/test/riscv-bmarks
bmarks = \
matmul
$(addprefix $(bmarks_dir)/,$(addsuffix .riscv,$(bmarks))): $(wildcard $(addprefix $(bmarks_dir)/,$(addsuffix /*,$(bmarks))))
$(MAKE) -C $(bmarks_dir)