forked from esperantotech/boom-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefrag
73 lines (51 loc) · 3.23 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
SHELL=/bin/bash
lib_dir=$(base_dir)/lib
rocketchip_stamp=$(base_dir)/lib/rocketchip.stamp
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)
$(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)/$(PROJECT).$(MODEL).$(CONFIG).fir: $(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)"
# Compiling Verilog code may also generate a *.conf file.
# EXTRA arguments allows for options such as black-boxing of the SeqMems.
$(build_dir)/$(long_name).conf : $(build_dir)/$(long_name).v ;
$(build_dir)/$(PROJECT).$(MODEL).$(CONFIG).v: $(build_dir)/$(PROJECT).$(MODEL).$(CONFIG).fir $(FIRRTL_JAR)
$(FIRRTL) -i $< -o $@ -X verilog -faf $(build_dir)/$(notdir $(basename $@)).anno.json $(EXTRA_FIRRTL_ARGS)
#--------------------------------------------------------------------
# Run assembly tests and benchmarks
#--------------------------------------------------------------------
# Important Makefile fragment .d is auto-generated by compiling Chisel code -- configuration-specific.
ifneq ($(filter run% %.run %.out %.vpd %.vcd %.fsdb %.verdi,$(MAKECMDGOALS)),)
include $(build_dir)/$(long_name).d
endif
.PRECIOUS: $(output_dir)/%.vpd $(output_dir)/%.fsdb
$(output_dir)/%.run: $(output_dir)/% $(sim)
cd $(sim_dir) && $(sim) +max-cycles=$(timeout_cycles) $< 2> /dev/null 2> $@ && [ $$PIPESTATUS -eq 0 ]
$(output_dir)/%.out: $(output_dir)/% $(sim)
cd $(sim_dir) && $(sim) $(PERMISSIVE) +max-cycles=$(timeout_cycles) $(SIMFLAGS) +verbose $(PERMISSIVEOFF) $< $(disasm) $@ && [ $$PIPESTATUS -eq 0 ]
$(output_dir)/%.vpd: $(output_dir)/% $(sim_debug)
cd $(sim_dir) && $(sim_debug) $(PERMISSIVE) +max-cycles=$(timeout_cycles) $(SIMFLAGS) +verbose $(DUMP_FLAG)$@ $(PERMISSIVEOFF) $< $(disasm) $(patsubst %.vpd,%.out,$@) && [ $$PIPESTATUS -eq 0 ]
$(output_dir)/%.fsdb: $(output_dir)/% $(sim_fsdb_debug)
cd $(sim_dir) && $(sim_fsdb_debug) $(PERMISSIVE) +max-cycles=$(timeout_cycles) $(SIMFLAGS) +verbose $(DUMP_FSDB_FLAG)$@ $(PERMISSIVEOFF) $< $(disasm) $(patsubst %.fsdb,%.out,$@) && [ $$PIPESTATUS -eq 0 ]
$(output_dir)/%.verdi: $(output_dir)/%.fsdb
verdi -ssf $< $(VCS_NONCC_OPTS)
run: run-asm-tests run-bmark-tests
run-debug: run-asm-tests-debug run-bmark-tests-debug
run-fast: run-asm-tests-fast run-bmark-tests-fast
.PHONY: run-asm-tests run-bmark-tests
.PHONY: run-asm-tests-debug run-bmark-tests-debug
.PHONY: run run-debug run-fast
.PHONY: $(output_dir)/%.verdi