-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (59 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
67
68
69
70
71
72
# Project setup
PROJ = cpu
BUILD = ./build
PINMAP = sigma.pcf
# Files
FILES =
FILES += btb.v
FILES += control.v
FILES += cpu.v
FILES += csr_reg.v
FILES += decode.v
FILES += dmem.v
FILES += dmem_decode.v
FILES += dmem_encode.v
FILES += execute.v
FILES += fetch.v
FILES += hazard.v
FILES += imem.v
FILES += int_alu.v
FILES += int_reg.v
FILES += jump.v
FILES += mem_branch.v
FILES += writeback.v
FILES += top.v
.PHONY: all clean prog test ice40 ecp5
all: $(BUILD) ice40
ice40: $(BUILD)/$(PROJ)-ice40.asc
ecp5: $(BUILD)/$(PROJ)-ecp5.config
$(BUILD):
mkdir -p $@
$(BUILD)/$(PROJ)-ecp5.json: $(FILES)
yosys -Q -p "synth_ecp5 -top top -json $@" $^
$(BUILD)/$(PROJ)-ecp5.config: $(BUILD)/$(PROJ)-ecp5.json
nextpnr-ecp5 \
--no-print-critical-path-source \
--um5g-85k --speed 8 \
--json $< \
--textcfg $@
$(BUILD)/$(PROJ)-ice40.json: $(FILES)
yosys -q -p "synth_ice40 -top top -json $@" $^
$(BUILD)/$(PROJ)-ice40.asc: $(BUILD)/$(PROJ)-ice40.json
nextpnr-ice40 \
--freq 33 \
--no-print-critical-path-source \
--hx8k --package ct256 \
--pcf $(PINMAP) --pcf-allow-unconstrained \
--opt-timing \
--json $< \
--asc $@
$(BUILD)/$(PROJ)-ice40.bin: $(BUILD)/$(PROJ).asc
icepack $< $@
prog-ice40: $(BUILD)/$(PROJ)-ice40.bin
iceprog -S $<
clean:
rm -f build/*
test:
make -C ../aoc2020
iverilog -D IVERILOG -o soc.out $(FILES) soc_tb.v
vvp soc.out