summaryrefslogtreecommitdiffstats
path: root/libtoprammer/fpga/common/makefile
blob: d04c0becb4b0e6ed0ce01e4f1f6ea9acffcbb0f3 (plain)
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
BITGEN		:= bitgen
PAR		:= par
MAP		:= map
NGDBUILD	:= ngdbuild
XST		:= xst

MKDIR		:= mkdir
CP		:= cp
RM		:= rm
LN		:= ln

COMMONDIR	:= ../../common
PART		:= 2s15vq100-5

BITGEN_OPTS	:= -w -g DebugBitstream:No -g Binary:no \
		   -g Gclkdel0:11111 -g Gclkdel1:11111 \
		   -g Gclkdel2:11111 -g Gclkdel3:11111 \
		   -g ConfigRate:4 -g CclkPin:PullUp \
		   -g M0Pin:PullUp -g M1Pin:PullUp -g M2Pin:PullUp \
		   -g ProgPin:PullUp -g DonePin:PullUp \
		   -g TckPin:PullUp -g TdiPin:PullUp \
		   -g TdoPin:PullUp -g TmsPin:PullUp \
		   -g UnusedPin:PullDown -g UserID:0xFFFFFFFF \
		   -g StartUpClk:CClk \
		   -g DONE_cycle:4 -g GTS_cycle:5 \
		   -g GSR_cycle:6 -g GWE_cycle:6 \
		   -g LCK_cycle:NoWait \
		   -g Security:None -g DonePipe:No -g DriveDone:No

XST_OPT_MODE	?= Speed
XST_OPT_LEVEL	?= 2
XST_EXTRA	?=

SRCS		?= $(NAME).v

%.bit: %.ncd
	$(BITGEN) $(BITGEN_OPTS) $< $@

%.ncd: %_map.ncd
	$(PAR) -w -ol std -t 1 $< $@ `basename $@ .ncd`.pcf

%_map.ncd: %.ngd
	$(MAP) -p $(PART) -cm area -pr b -k 4 -c 100 -o $@ \
		$< `basename $< .ngd`.pcf

%.ngd: %.ngc %.ucf
	$(NGDBUILD) -aul -dd __ngo -uc `basename $@ .ngd`.ucf \
		-p $(PART) $< $@

%.ngc: %.xst %.lso %.prj $(SRCS)
	$(MKDIR) -p __xst/tmp
	$(XST) -ifn $<

%.ucf:
	[ -f '$@' ] || $(LN) -s '$(COMMONDIR)/common.ucf' '$@'

%.lso:
	echo 'work' > '$@'

%.prj:
	echo 'verilog work "$(SRCS)"' > '$@'

%.xst:
	$(CP) '$(COMMONDIR)/common.xst' '$@'
	echo '-ifn $(NAME).prj' >> '$@'
	echo '-ofn $(NAME)' >> '$@'
	echo '-lso $(NAME).lso' >> '$@'
	echo "-top `echo -n '$(NAME)' | tr - _`" >> '$@'
	echo '-opt_mode $(XST_OPT_MODE)' >> '$@'
	echo '-opt_level $(XST_OPT_LEVEL)' >> '$@'
	[ -n '$(XST_EXTRA)' ] && echo '$(XST_EXTRA)' >> '$@' || true

all: $(NAME).bit

clean:
	$(RM) -rf __ngo __xst *.bgn *.bit *.bld *.drc *_map.mrp \
		*_map.ncd *_map.ngm *.ncd *.ngc *.ngd *.ngr \
		*.pad *_pad.csv *_pad.txt *.par *.pcf *.srp \
		*.unroutes *_usage.xml *.xpi *_map.map *_summary.xml \
		*.twr *_details.xml *.ptwx *.xrpt xlnx_auto_* \
		*.lso *.prj *.xst
	[ -h '$(NAME).ucf' ] && $(RM) -f '$(NAME).ucf' || true

.PHONY: all clean
bues.ch cgit interface