usb-avr-cpld experiment board with FTDI FT232RL, ATMEGA88 & XC9572XL
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.2 KiB

  1. # variables
  2. DESIGN = cpldtest
  3. PART = xc9572xl-10-vq44
  4. CURDIR = $(shell pwd)
  5. CONFDIR = ${CURDIR}/config
  6. UCFDIR = ${CURDIR}/constraints
  7. WORKDIR = ${CURDIR}/work
  8. NETLISTDIR = ${CURDIR}/netlist
  9. BINDIR = ${CURDIR}/binary
  10. REPORTS = ${CURDIR}/reports
  11. SRC_LIST = $(shell cat $(CONFDIR)/$(DESIGN).prj | sed -r 's:^.*"../(.*)":\1:')
  12. # synthesis options
  13. XSTFLAGS = run -ifmt VHDL -ofmt NGC -opt_level 2 -fsm_encoding sequential -pld_xp yes -pld_mp yes \
  14. -keep_hierarchy yes -safe_implementation no -wysiwyg yes -ifn $(CONFDIR)/$(DESIGN).prj \
  15. -p $(PART) -ofn $(DESIGN) -top $(DESIGN)E -tmpdir xsttmp -xsthdpdir xsthdpdir
  16. NGDFLAGS = -nt timestamp -verbose -dd ngd -p $(PART) \
  17. -uc $(UCFDIR)/$(DESIGN).ucf -sd $(NETLISTDIR)
  18. FITFLAGS = -loc on -optimize speed -nomlopt -wysiwyg -unused float -keepio -slew fast -p $(PART)
  19. TFLAGS = -detail -iopath
  20. # create directories
  21. DUMMY:=$(shell mkdir -p $(WORKDIR))
  22. DUMMY:=$(shell mkdir -p $(BINDIR))
  23. DUMMY:=$(shell mkdir -p $(REPORTS))
  24. .PHONY: all clean
  25. all : programmingfile
  26. programmingfile : $(WORKDIR)/$(DESIGN).jed
  27. cp $(WORKDIR)/$(DESIGN).jed $(BINDIR)/
  28. # generate script for xst in command line mode
  29. $(WORKDIR)/xst.conf : $(CONFDIR)/$(DESIGN).prj
  30. touch $(WORKDIR)/xst.conf
  31. echo $(XSTFLAGS) >> $(WORKDIR)/xst.conf
  32. # generate netlist constraints file
  33. $(WORKDIR)/$(DESIGN).ngc: $(SRC_LIST) $(WORKDIR)/xst.conf
  34. cd $(WORKDIR); xst -ifn xst.conf
  35. cp $(WORKDIR)/xst.srp $(REPORTS)/$(DESIGN)_xst.txt
  36. # generate native generic database file (ngd)
  37. $(WORKDIR)/$(DESIGN).ngd : $(WORKDIR)/$(DESIGN).ngc $(UCFDIR)/$(DESIGN).ucf
  38. cd $(WORKDIR); ngdbuild $(NGDFLAGS) $(DESIGN).ngc $(DESIGN).ngd
  39. cp $(WORKDIR)/$(DESIGN).bld $(REPORTS)/$(DESIGN).bld
  40. # generate vm6 file
  41. $(WORKDIR)/$(DESIGN).vm6 : $(WORKDIR)/$(DESIGN).ngd
  42. cd $(WORKDIR); cpldfit $(FITFLAGS) $(DESIGN).ngd
  43. cp $(WORKDIR)/$(DESIGN).rpt $(REPORTS)/$(DESIGN).rpt
  44. # generate programming file
  45. $(WORKDIR)/$(DESIGN).jed : $(WORKDIR)/$(DESIGN).vm6
  46. cd $(WORKDIR); hprep6 -i $(DESIGN).vm6
  47. # clean all
  48. clean :
  49. rm -rf $(WORKDIR)/*
  50. rm -rf $(BINDIR)/$(DESIGN).jed
  51. rm -rf $(REPORTS)/$(DESIGN).trp
  52. distclean :
  53. rm -rf $(WORKDIR)
  54. rm -rf $(BINDIR)
  55. rm -rf $(REPORTS)