-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathMakefile
67 lines (49 loc) · 1.43 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
##
## Make and program TinyFPGA BX
##
BASENAME = usbserial
TARGETNAME = $(BASENAME)_tbx
PROJTOP = $(TARGETNAME)
RTL_USB_DIR = usb
SOURCES = \
$(RTL_USB_DIR)/edge_detect.v \
$(RTL_USB_DIR)/serial.v \
$(RTL_USB_DIR)/usb_fs_in_arb.v \
$(RTL_USB_DIR)/usb_fs_in_pe.v \
$(RTL_USB_DIR)/usb_fs_out_arb.v \
$(RTL_USB_DIR)/usb_fs_out_pe.v \
$(RTL_USB_DIR)/usb_fs_pe.v \
$(RTL_USB_DIR)/usb_fs_rx.v \
$(RTL_USB_DIR)/usb_fs_tx_mux.v \
$(RTL_USB_DIR)/usb_fs_tx.v \
$(RTL_USB_DIR)/usb_reset_det.v \
$(RTL_USB_DIR)/usb_serial_ctrl_ep.v \
$(RTL_USB_DIR)/usb_uart_bridge_ep.v \
$(RTL_USB_DIR)/usb_uart_core.v \
$(RTL_USB_DIR)/usb_uart_i40.v \
pll.v
SRC = $(PROJTOP).v $(SOURCES)
PIN_DEF = pins.pcf
DEVICE = lp8k
PACKAGE = cm81
CLK_MHZ = 48
all: $(PROJTOP).rpt $(PROJTOP).bin
pll.v:
icepll -i 16 -o $(CLK_MHZ) -m -f $@
synth: $(PROJTOP).json
$(PROJTOP).json: $(SRC)
yosys -q -p 'synth_ice40 -top $(PROJTOP) -json $@' $^
%.asc: $(PIN_DEF) %.json
nextpnr-ice40 --$(DEVICE) --freq $(CLK_MHZ) --opt-timing --package $(PACKAGE) --pcf $(PIN_DEF) --json $*.json --asc $@
gui: $(PIN_DEF) $(PROJTOP).json
nextpnr-ice40 --$(DEVICE) --package $(PACKAGE) --pcf $(PIN_DEF) --json $(PROJTOP).json --asc $(PROJTOP).asc --gui
%.bin: %.asc
icepack $< $@
%.rpt: %.asc
icetime -d $(DEVICE) -mtr $@ $<
prog: $(PROJTOP).bin
tinyprog -p $<
clean:
rm -f $(PROJTOP).json $(PROJTOP).asc $(PROJTOP).rpt $(PROJTOP).bin pll.v
.SECONDARY:
.PHONY: all synth prog clean gui