-
Notifications
You must be signed in to change notification settings - Fork 31
/
Makefrag
75 lines (61 loc) · 2.62 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
ROCKETCHIP_DIR=$(base_dir)/rocket-chip
SCALA_VERSION := 2.12
SCALA_PATH := 4
SBT ?= java -Xmx2G -Xss8M -XX:MaxPermSize=256M -jar $(ROCKETCHIP_DIR)/sbt-launch.jar ++$(SCALA_VERSION).$(SCALA_PATCH)
lookup_scala_srcs = $(shell find $(1)/ -iname "*.scala" 2> /dev/null)
space :=
space +=
PACKAGES=rocket-chip testchipip icenet sifive-blocks
PACKAGE_DIRS=$(addprefix $(base_dir)/,$(PACKAGES))
SCALA_SOURCES=$(foreach pkg_dir,$(PACKAGE_DIRS),$(call lookup_scala_srcs,$(pkg_dir)/src/main/scala)) $(call lookup_scala_srcs,$(base_dir)/src/main/scala)
ROCKET_CLASSES=$(foreach pkg_dir,$(ROCKETCHIP_DIR)/chisel3 $(PACKAGE_DIRS),$(pkg_dir)/target/scala-$(SCALA_VERSION)/classes)
ROCKET_CLASSPATH=$(subst $(space),:,$(ROCKET_CLASSES))
FIRRTL_JAR ?= $(ROCKETCHIP_DIR)/lib/firrtl.jar
FIRRTL ?= java -Xmx2G -Xss8M -XX:MaxPermSize=256M -cp $(ROCKET_CLASSPATH):$(FIRRTL_JAR) firrtl.Driver
$(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 $(ROCKETCHIP_DIR)/firrtl/utils/bin/firrtl.jar $(FIRRTL_JAR)
build_dir=$(sim_dir)/generated-src
testchip_dir = $(base_dir)/testchipip
icenet_dir = $(base_dir)/icenet
CHISEL_ARGS ?=
FIRRTL_FILE=$(build_dir)/$(PROJECT).$(MODEL).$(CONFIG).fir
ANNO_FILE=$(build_dir)/$(PROJECT).$(MODEL).$(CONFIG).anno.json
VERILOG_FILE=$(build_dir)/$(PROJECT).$(MODEL).$(CONFIG).v
BLACKBOX_FILE=$(build_dir)/firrtl_black_box_resource_files.f
$(FIRRTL_FILE) $(ANNO_FILE): $(SCALA_SOURCES) $(bootrom_img) $(FIRRTL_JAR)
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) -td $(build_dir) -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 $< $@