diff --git a/Makefile b/Makefile index 47b9463..7ed3fa0 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,6 @@ -TARGETS = $(shell find lib/ -name "*.make") +FOLDER ?= lib + +TARGETS = $(shell find $(FOLDER)/ -name "*.make") INSTR := $(foreach number,$(TARGETS),make -C $(shell dirname $(number)) -f $(shell basename $(number)) $(MAKECMDGOALS) &&) true all: diff --git a/make/ise.mk b/make/ise.mk new file mode 100644 index 0000000..255bbce --- /dev/null +++ b/make/ise.mk @@ -0,0 +1,50 @@ +.PHONY: clean +all: bit + +netlist: $(PRJ).ngc +translate: $(PRJ).ngd +map: $(PRJ)_map.ncd +par: $(PRJ).ncd +bit: $(PRJ).bit +prom : $(PRJ).mcs +timing : $(PRJ).twr + +# Netlist +$(PRJ).ngc: $(DIRS) $(PREQ) ./project/$(PRJ).ucf + xst -intstyle xflow -ifn ./project/$(PRJ).xst + +# Translate +$(PRJ).ngd: $(NETLISTS) $(PRJ).ngc ./project/$(PRJ).ucf + ngdbuild -p $(DEVICE) -sd $(NETLIST_DIR) -dd _ngo -nt timestamp -uc ./project/$(PRJ).ucf $(PRJ).ngc $(PRJ).ngd + +# Map +$(PRJ)_map.ncd: $(PRJ).ngd + map -intstyle xflow -p $(DEVICE) -timing -logic_opt on -ol high -t 1 -register_duplication -cm area -ignore_keep_hierarchy -pr off -k 4 -power off -o $(PRJ)_map.ncd $(PRJ).ngd $(PRJ).pcf + +# PAR +$(PRJ).ncd: $(PRJ)_map.ncd + par -w -intstyle xflow -ol high -t 1 $(PRJ)_map.ncd $(PRJ).ncd $(PRJ).pcf + +# Timing +$(PRJ).twr: $(PRJ).ncd $(PRJ).pcf ./project/$(PRJ).ucf + trce -intstyle xflow -v 3 $(PRJ).ncd -ucf ./project/$(PRJ).ucf -o $(PRJ).twr $(PRJ).pcf + +# Bitgen +$(PRJ).bit: $(PRJ).ncd ./project/$(PRJ).ut + bitgen -intstyle xflow -f ./project/$(PRJ).ut $(PRJ).ncd + +# Promgen +$(PRJ).mcs: $(PRJ).bit + promgen -w -p mcs -c FF -o $(PRJ) -ver 0 $(PRJ).bit -x xcf32p + +$(DIRS): + mkdir -p $(DIRS) + +clean: + rm -rf ./_ngo + rm -rf ./xst + rm -rf ./xlnx_auto_0_xdb + rm -f xlnx_auto_0.ise + rm -f smartpreview.twr + rm -f $(PRJ)*.* + diff --git a/projects/mips_sys/ise101/mips_sys/Makefile b/projects/mips_sys/ise101/mips_sys/Makefile index b33327f..9a85ec6 100644 --- a/projects/mips_sys/ise101/mips_sys/Makefile +++ b/projects/mips_sys/ise101/mips_sys/Makefile @@ -1,62 +1,10 @@ -.PHONY: clean - -all: bit - PRJ := mips_sys PREQ := ./project/$(PRJ).prj ./project/$(PRJ).xst ./project/$(PRJ).lso DEVICE := "xc4vsx35-ff668-10" DIRS := ./xst/tmp NETLIST_DIR := ../../../../lib/CPUs/MIPS/syn/ise101 -NETLIST_MIPS_TOP := $(NETLIST_DIR)/mips_top.ngc +NETLISTS := $(NETLIST_DIR)/mips_top.ngc -netlist: $(PRJ).ngc -translate: $(PRJ).ngd -map: $(PRJ)_map.ncd -par: $(PRJ).ncd -bit: $(PRJ).bit -prom : $(PRJ).mcs -timing : $(PRJ).twr +include ../../../../make/ise.mk -$(NETLIST_MIPS_TOP): - make -C $(NETLIST_DIR) - -# Netlist -$(PRJ).ngc: $(DIRS) $(PREQ) ./project/$(PRJ).ucf - xst -intstyle xflow -ifn ./project/$(PRJ).xst - -# Translate -$(PRJ).ngd: $(NETLIST_MIPS_TOP) $(PRJ).ngc ./project/$(PRJ).ucf - ngdbuild -p $(DEVICE) -sd $(NETLIST_DIR) -dd _ngo -nt timestamp -uc ./project/$(PRJ).ucf $(PRJ).ngc $(PRJ).ngd - -# Map -$(PRJ)_map.ncd: $(PRJ).ngd - map -intstyle xflow -p $(DEVICE) -timing -logic_opt on -ol high -t 1 -register_duplication -cm area -ignore_keep_hierarchy -pr off -k 4 -power off -o $(PRJ)_map.ncd $(PRJ).ngd $(PRJ).pcf - -# PAR -$(PRJ).ncd: $(PRJ)_map.ncd - par -w -intstyle xflow -ol high -t 1 $(PRJ)_map.ncd $(PRJ).ncd $(PRJ).pcf - -# Timing -$(PRJ).twr: $(PRJ).ncd $(PRJ).pcf ./project/$(PRJ).ucf - trce -intstyle xflow -v 3 $(PRJ).ncd -ucf ./project/$(PRJ).ucf -o $(PRJ).twr $(PRJ).pcf - -# Bitgen -$(PRJ).bit: $(PRJ).ncd ./project/$(PRJ).ut - bitgen -intstyle xflow -f ./project/$(PRJ).ut $(PRJ).ncd - -# Promgen -$(PRJ).mcs: $(PRJ).bit - promgen -w -p mcs -c FF -o $(PRJ) -ver 0 $(PRJ).bit -x xcf32p - -$(DIRS): - mkdir -p $(DIRS) - -clean: - rm -rf ./_ngo - rm -rf ./xst - rm -rf ./xlnx_auto_0_xdb - rm -f xlnx_auto_0.ise - rm -f smartpreview.twr - rm -f $(PRJ)*.* -