SHELL	= /bin/csh

DESIGN	= pico16

FOUNDR	= XILINX
CELL	= lca_lib

PART	= 4010pg191-5
XNFLIB	= $(XACT)/lib_pico
CSTFILE	= $(DESIGN).cst

#PPROPT	= placer_effort=2 router_effort=2
# placer_effort : 1 (quick) to 5 (better)
# router_effort : 1 (quick) to 4 (better)


all : xnf

xnf : $(DESIGN).xnf
exo : $(DESIGN).exo


$(DESIGN).xnf : $(DESIGN).sfl
	auto $(DESIGN) nld4 $(FOUNDR) $(CELL)
	sed s/-connected// $(DESIGN).nld_last/$(DESIGN).nld > $(DESIGN).tmp
	mv $(DESIGN).tmp $(DESIGN).nld_last/$(DESIGN).nld
	auto $(DESIGN) xnf $(FOUNDR) $(CELL)
#	@auto $(DESIGN) clean

$(DESIGN).lca : $(DESIGN).xnf
	xnfmerge -d $(XNFLIB) $(DESIGN) $(DESIGN)
# if XACT 4.0
#	ppr $(DESIGN) parttype=$(PART) $(PPROPT)
# if XACT 5.0
	xnfprep $(DESIGN) parttype=$(PART) cstfile=$(CSTFILE)
	ppr $(DESIGN) parttype=$(PART) cstfile=$(CSTFILE) $(PPROPT)

$(DESIGN).exo : $(DESIGN).lca
	makebits -f crc:enable $(DESIGN)
	makeprom -f exo -u 0 $(DESIGN)

clean:
	-auto $(DESIGN) clean
	-rm -f *.bib *.bid *.bit *.mbo *.mrg *.prm *.tsi *.xff *.xtf *.lcb
	-rm -f *.log *.prp *.rpf *.rpt
