forked from FPGA-Research/heichips25-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
157 lines (107 loc) · 4.48 KB
/
Makefile
File metadata and controls
157 lines (107 loc) · 4.48 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
all: macro copy-final
PDK_ROOT ?= ~/.ciel
PDK ?= ihp-sg13g2
RUN_TAG = $(shell ls librelane/runs/ -1 | tail -n 1)
TOP = heichips25_usb_cdc
# Macro - LibreLane
macro:
cd librelane; librelane config.yaml --pdk $(PDK)
.PHONY: macro
macro-openroad:
cd librelane; librelane config.yaml --pdk $(PDK) --last-run --flow OpenInOpenROAD
.PHONY: macro-openroad
macro-klayout:
cd librelane; librelane config.yaml --pdk $(PDK) --last-run --flow OpenInKLayout
.PHONY: macro-klayout
check-logo:
KLAYOUT_PATH=~/.ciel/ihp-sg13g2/libs.tech/klayout/ klayout -e src/logo/gds/logo_usb_cdc.gds
insert-logo:
mkdir -p librelane/runs/${RUN_TAG}/final_gds_bkp/
cp librelane/runs/${RUN_TAG}/final/gds/${TOP}.gds librelane/runs/${RUN_TAG}/final_gds_bkp/${TOP}.gds
python3 scripts/insert_logo.py librelane/runs/${RUN_TAG}/final/gds/${TOP}.gds src/logo/gds/logo_usb_cdc.gds librelane/runs/${RUN_TAG}/final/gds/${TOP}.gds
check-final:
KLAYOUT_PATH=~/.ciel/ihp-sg13g2/libs.tech/klayout/ klayout -e librelane/runs/${RUN_TAG}/final/gds/${TOP}.gds
copy-macro:
mkdir -p macro/
rm -rf macro/*
cp -r librelane/runs/${RUN_TAG}/final/* macro/
.PHONY: copy-macro
# Simulation & Verification
sim:
cd tb; python3 testbench.py
.PHONY: sim
sim-gl:
cd tb; GL=1 python3 testbench.py
.PHONY: sim-gl
# FPGA Emulation
## iCE40HX8K
ICE40HX8K_SOURCES = $(wildcard fpga/ice40hx8k/*.sv) $(wildcard src/*.sv)
synth-ice40hx8k: ice40hx8k.json
pnr-ice40hx8k: ice40hx8k.bit
upload-ice40hx8k: ice40hx8k.bit
openFPGALoader --board=ice40_generic -f ice40hx8k.bit
ice40hx8k.json: $(ICE40HX8K_SOURCES)
yosys -l $(basename $@)-yosys.log -DSYNTHESIS -DICE40HX8K -p 'synth_ice40 -top ice40hx8k_top -json $@' $^
ice40hx8k.asc: ice40hx8k.json fpga/ice40hx8k/ice40hx8k-evb.pcf
nextpnr-ice40 --hx8k --json $< \
--pcf fpga/ice40hx8k/ice40hx8k-evb.pcf \
--package ct256 \
--asc $@
ice40hx8k.bit: ice40hx8k.asc
icepack $< $@
## iCEBreaker
ICEBREAKER_SOURCES = $(wildcard fpga/icebreaker/*.sv) $(wildcard src/*.sv) $(wildcard src/usb_cdc/usb_cdc/*.v)
synth-icebreaker: icebreaker.json
pnr-icebreaker: icebreaker.bit
upload-icebreaker: icebreaker.bit
openFPGALoader --board=ice40_generic -f icebreaker.bit
icebreaker.json: $(ICEBREAKER_SOURCES)
yosys -l $(basename $@)-yosys.log -DSYNTHESIS -DICEBREAKER -p 'synth_ice40 -top icebreaker_top -json $@' $^
icebreaker.asc: icebreaker.json fpga/icebreaker/icebreaker.pcf
nextpnr-ice40 --up5k --json $< \
--pcf fpga/icebreaker/icebreaker.pcf \
--package sg48 \
--asc $@
icebreaker.bit: icebreaker.asc
icepack $< $@
## ULX3S
ULX3S_SOURCES = $(wildcard fpga/ulx3s/*.sv) $(wildcard src/*.sv)
synth-ulx3s: ulx3s.json
pnr-ulx3s: ulx3s.bit
upload-ulx3s: ulx3s.bit
openFPGALoader --board=ulx3s -f ulx3s.bit
ulx3s.json: $(ULX3S_SOURCES)
yosys -l $(basename $@)-yosys.log -DSYNTHESIS -DULX3S -p 'synth_ecp5 -top ulx3s_top -json $@' $^
ulx3s.config: ulx3s.json fpga/ulx3s/ulx3s_v20.lpf
nextpnr-ecp5 --85k --json $< \
--lpf fpga/ulx3s/ulx3s_v20.lpf \
--package CABGA381 \
--textcfg $@
ulx3s.bit: ulx3s.config
ecppack $< $@ --compress
## Basys 3
BASYS3_SOURCES = $(wildcard fpga/basys3/*.sv) $(wildcard src/*.sv)
synth-basys3: basys3.json
pnr-basys3: basys3.bit
upload-basys3: basys3.bit
openFPGALoader --board=basys3 -f basys3.bit
basys3.json: $(BASYS3_SOURCES)
yosys -l $(basename $@)-yosys.log -DSYNTHESIS -DBASYS3 -p "synth_xilinx -flatten -abc9 ${SYNTH_OPTS} -arch xc7 -top basys3_top; write_json basys3.json" $^
# The chip database only needs to be generated once
# that is why we don't clean it with make clean
nix-openxc7/xc7a35tcpg236.bin:
pypy3 ${NEXTPNR_XILINX_PYTHON_DIR}/bbaexport.py --device xc7a35tcpg236-1 --bba xc7a35tcpg236.bba
bbasm -l xc7a35tcpg236.bba nix-openxc7/xc7a35tcpg236.bin
rm -f xc7a35tcpg236.bba
basys3.fasm: basys3.json nix-openxc7/xc7a35tcpg236.bin fpga/basys3/Basys-3-Master.xdc
nextpnr-xilinx --chipdb nix-openxc7/xc7a35tcpg236.bin --xdc fpga/basys3/Basys-3-Master.xdc --json basys3.json --fasm $@ ${PNR_ARGS} ${PNR_DEBUG}
basys3.frames: basys3.fasm
fasm2frames --part xc7a35tcpg236-1 --db-root ${PRJXRAY_DB_DIR}/artix7 $< > $@
basys3.bit: basys3.frames
xc7frames2bit --part_file ${PRJXRAY_DB_DIR}/artix7/xc7a35tcpg236-1/part.yaml --part_name xc7a35tcpg236-1 --frm_file $< --output_file $@
# Common
clean:
rm -f ice40hx8k.json ice40hx8k.asc ice40hx8k.bit ice40hx8k-yosys.log
rm -f icebreaker.json icebreaker.asc icebreaker.bit icebreaker-yosys.log
rm -f ulx3s.json ulx3s.config ulx3s.bit ulx3s-yosys.log
rm -f basys3.json basys3.bin basys3.fasm basys3.frames basys3.bit basys3-yosys.log