# TOP - Name of the top-level module # DEVICE - Name of the FPGA device (device-package-speed) # PRJ - Name of .prj file with names of all source files. See XST manual. # UCF - Name of the user constraints file # SEARCH_DIRS - Directories to search when searching for netlists (.ngc, ...). # See NGDBUILD manual. # INTSTYLE - Style of screen output. (ise | xflow | silent) # Targets desctiption: # - synthesize : Synthesize all VHDL and Verilog source files, libraries, etc. # defined in PRJ files and produces NGC file. # - translate : Translate all netlist files (.ngc, ...) into the NGD file, # where the design is described in terms of deneral logic elements # such as (RAM, flip-flop, XOR, ...). # - map : Map the general logic from NGD file to the components in the # target FPGA and produces NCD_MAP file. # - par : PAR stands for Plase & Route. This procedure takes NCD_MAP file, # places all components and makes routes between them (depending # on the chosen optimization mode) and produces NCD file. # - clean : Clean build directory, dependency (*.d) files and call # - all : Transfer placed and routed NCD file into the bit file, which can # be then used to configure particular FPGA # Dependicies are handled, so in most cases only 'download' target is called. DEVICE := xc6slx9-2tqg144 TOP := lx_rocon_top OUT := _build OUTB := lx-rocon REQB := $(OUT)/$(OUTB) PRJ := lx_rocon_top.prj UCF := lx-rocon.ucf SEARCH_DIRS := ipcore_dir INTSTYLE := xflow SRC := .. #=============================================================================== # Abbreviations of frequently used file names. NGC := $(OUTB).ngc NGD := $(OUTB).ngd PCF := $(OUTB).pcf NCD_MAP := $(OUTB)_map.ncd NCD := $(OUTB).ncd BIT := $(OUTB).bit BIN := $(OUTB).bin REQ_NGC := $(REQB).ngc REQ_NGD := $(REQB).ngd REQ_PCF := $(REQB).pcf REQ_NCD_MAP := $(REQB)_map.ncd REQ_NCD := $(REQB).ncd REQ_BIT := $(REQB).bit REQ_BIN := $(REQB).bin REQ_SRC := . #=============================================================================== # Attempt to create a output directory. $(shell [ -d ${OUT} ] || mkdir -p ${OUT}) # Verify if it was successful. OUTPUT_DIR := $(shell cd $(OUT) && /bin/pwd) $(if $(OUTPUT_DIR),,$(error output directory "$(OUT)" does not exist)) #=============================================================================== .PHONY: all all: gen .PHONY: re-synthesize re-synthesize $(REQ_NGC): $(addprefix $(REQ_SRC)/,$(PRJ)) cd $(OUT); \ echo " \ run \ $(addprefix -ifn $(SRC)/,$(PRJ)) \ -ifmt mixed \ -ofn $(NGC) \ -ofmt NGC \ -top $(TOP) \ -p $(DEVICE) \ -opt_mode Speed \ -keep_hierarchy soft \ -opt_level 1" | xst | tee xst.log .PHONY: re-translate re-translate $(REQ_NGD): $(REQ_NGC) $(REQ_UCF) cd $(OUT); \ ngdbuild -intstyle $(INTSTYLE) -p $(DEVICE) -uc $(SRC)/$(UCF) \ $(addprefix -sd $(SRC)/,$(SEARCH_DIRS)) \ $(NGC) \ $(NGD) .PHONY: re-map re-map $(REQ_NCD_MAP) $(REQ_PCF): $(REQ_NGD) cd $(OUT); \ map -intstyle $(INTSTYLE) -o $(NCD_MAP) $(NGD) $(PCF) .PHONY: re-par re-par $(REQ_NCD): $(REQ_NCD_MAP) $(REQ_PCF) cd $(OUT); \ par -intstyle $(INTSTYLE) $(NCD_MAP) -w $(NCD) $(PCF) .PHONY: re-gen re-gen $(REQ_BIT) $(REQ_BIN): $(REQ_NCD) cd $(OUT); \ bitgen -g Binary:yes -w $(NCD) $(OUTB) $(PCF) #=============================================================================== .PHONY: clean clean: rm -rf $(OUT) .PHONY: synthesize synthesize: $(REQ_NGC) .PHONY: translate translate: $(REQ_NGD) .PHONY: map map: $(REQ_NCD_MAP) $(REQ_PCF) .PHONY: par par: $(REQ_NCD) .PHONY: gen gen: $(REQ_BIT) $(REQ_BIN)