forked from SpinalHDL/VexiiRiscv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
66 lines (49 loc) · 1.34 KB
/
Makefile
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
PROJ_NAME = IceSoc
RTL_NAME = IceSoc
BUILD_DIR = build
RTL_DIR = hw/rtl
CONSTR_DIR = hw/constr
LOG_DIR = logs
RTL = $(wildcard ${RTL_DIR}/*.v)
CONSTR = ${CONSTR_DIR}/${PROJ_NAME}.pcf
BIN = ${BUILD_DIR}/${PROJ_NAME}.bin
TARGET = ${BUILD_DIR}/${PROJ_NAME}
PNRFLAGS = --top ${RTL_NAME} --package sg48 --report ${LOG_DIR}/pnr_report.json
PNRFLAGS += --routed-svg ${LOG_DIR}/route.svg
SYNTHFLAGS = -dsp -abc2
VERBOSE ?=
ifeq (${VERBOSE}, yes)
output = | tee
PNRFLAGS += -v --log ${LOG_DIR}/pnr.log
else
ifeq (${VERBOSE}, no_log)
output = ; touch
PNRFLAGS += -q
else
output = >
PNRFLAGS += -q --log ${LOG_DIR}/pnr.log
endif
endif
all: mkdir compile
rtl:
sbt "runMain vexiiriscv.soc.icesoc.IceSocGen" ${output} ${LOG_DIR}/spinal.log
mkdir:
@mkdir -p ${BUILD_DIR} ${LOG_DIR}
synth: ${TARGET}.asc
time: ${TARGET}.bin
icetime -tmd up5k ${TARGET}.asc
compile: ${TARGET}.bin
clean:
rm -rf ${BUILD_DIR} ${RTL}
${RTL}: rtl
@echo "RTL Generated: $@"
${TARGET}.json: ${RTL}
@echo "Synthesizing..."
yosys -p "synth_ice40 ${SYNTHFLAGS} -top ${RTL_NAME} -json $@" $^ ${output} ${LOG_DIR}/yosys.log
${TARGET}.asc: ${CONSTR} ${TARGET}.json
@echo "Place&Route ing..."
nextpnr-ice40 ${PNRFLAGS} --up5k --pcf $< --json $(filter-out $<,$^) --asc $@
${TARGET}.bin: ${TARGET}.asc
@echo "Compiling $@"
icepack $^ $@
.PHONY: rtl mkdir synth clean compile time