-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
45 lines (35 loc) · 1.1 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
# modified from fomu workshop blink example:
# https://github.com/im-tomu/fomu-workshop
YOSYSFLAGS?=
PNRFLAGS ?= --up5k --package sg48 --pcf blink.pcf
# Default target: build bitstream file
all: blink.bit
@true
.DEFAULT: all
# Use *Yosys* to generate the synthesized netlist.
# This is called the **synthesis** and **tech mapping** step.
blink.json: blink.v
yosys \
$(YOSYSFLAGS) \
-p 'synth_ice40 -top top -json blink.json' blink.v
# Use **nextpnr** to generate the FPGA configuration.
# This is called the **place** and **route** step.
blink.asc: blink.json blink.pcf
nextpnr-ice40 \
$(PNRFLAGS) \
--json blink.json \
--asc blink.asc
# Use icepack to convert the FPGA configuration into a "bitstream" loadable onto the FPGA.
# This is called the bitstream generation step.
blink.bit: blink.asc
icepack blink.asc blink.bit
# use progam.py to load bitstream onto up5k using SPI
load: blink.bit
python3 program.py blink.bit
.PHONY: load
# Cleanup the generated files.
clean:
-rm -f blink.json # Generate netlist
-rm -f blink.asc # FPGA configuration
-rm -f blink.bit # FPGA bitstream
.PHONY: clean