-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
79 lines (64 loc) · 1.61 KB
/
Makefile
File metadata and controls
79 lines (64 loc) · 1.61 KB
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
BASE_DIR = $(shell pwd)
BUILD_DIR = $(BASE_DIR)/build
SCRIPTS_DIR = $(BASE_DIR)/scripts
SIM_DIR = $(BASE_DIR)/sims
SYNTH_DIR = $(BASE_DIR)/synth
TB_DIR = $(SIM_DIR)/tb
COCOTB_DIR = $(SIM_DIR)/cocotb
LIB ?= app
FZF ?= $(shell [ -x "$$(command -v fzf)" ] && echo true || echo false)
STA_TOOL ?= yosys
.PHONY: pre fmt build run clean update localpublish tb cocotb sta sta-yosys sta-vivado
pre:
@mkdir -p $(BUILD_DIR)
@mkdir -p $(SIM_DIR)
@mkdir -p $(SYNTH_DIR)
@mkdir -p $(TB_DIR)
@mkdir -p $(COCOTB_DIR)
fmt:
@scalafmt
build: pre
@sbt compile
run: pre
@sbt $(LIB)/run
clean:
@rm -rf $(SYNTH_DIR)
@rm -rf $(SIM_DIR)/logs
@rm -rf $(SIM_DIR)/build
update:
@sbt clean bloopInstall
@sbt update
@sbt reload
localpublish:
@sbt clean
@sbt publishLocal
tb: pre
@if [ "$(FZF)" = "true" ] ; then \
FZF=true bash $(SCRIPTS_DIR)/tb.sh ; \
else \
bash $(SCRIPTS_DIR)/tb.sh ; \
fi
cocotb: pre
@touch $(COCOTB_DIR)/cocotb.make
@echo "TOPLEVEL_LANG ?= verilog" > $(COCOTB_DIR)/cocotb.make
@echo "SIM = icarus" >> $(COCOTB_DIR)/cocotb.make
@echo "" >> $(COCOTB_DIR)/cocotb.make
@echo "include $(shell cocotb-config --makefiles)/Makefile.sim" >> $(COCOTB_DIR)/cocotb.make
@if [ "$(FZF)" = "true" ] ; then \
FZF=true bash $(SCRIPTS_DIR)/cocotb.sh; \
else \
bash $(SCRIPTS_DIR)/cocotb.sh; \
fi
sta-yosys: pre
@if [ "$(FZF)" = "true" ] ; then \
FZF=true bash $(SCRIPTS_DIR)/sta_yosys.sh ; \
else \
bash $(SCRIPTS_DIR)/sta_yosys.sh ; \
fi
sta-vivado: pre
@if [ "$(FZF)" = "true" ] ; then \
FZF=true bash $(SCRIPTS_DIR)/sta_vivado.sh ; \
else \
bash $(SCRIPTS_DIR)/sta_vivado.sh ; \
fi
sta: sta-$(STA_TOOL)