################################################################################
|
################################################################################
|
##
|
##
|
## Filename: Makefile
|
## Filename: Makefile
|
##
|
##
|
## Project: XuLA2 board
|
## Project: XuLA2 board
|
##
|
##
|
## Purpose: In case you don't want to fire up ISE, this Makefile attempts
|
## Purpose: In case you don't want to fire up ISE, this Makefile attempts
|
## to coordinate the build process without it. While it works in
|
## to coordinate the build process without it. While it works in
|
## testing, there are some problems to this approach. The first is that
|
## testing, there are some problems to this approach. The first is that
|
## if you bust timing, you may never know it--nothing will tell you it
|
## if you bust timing, you may never know it--nothing will tell you it
|
## failed. Second, the output file is different from the output file
|
## failed. Second, the output file is different from the output file
|
## produced via ISE. Still ... for a command line make script, it is a
|
## produced via ISE. Still ... for a command line make script, it is a
|
## (good) start.
|
## (good) start.
|
##
|
##
|
## Makefile targets:
|
## Makefile targets:
|
##
|
##
|
## xula.bit The FPGA bitfile or configuration file
|
## xula.bit The FPGA bitfile or configuration file
|
##
|
##
|
## objdir Makes a directory for temporary build files, which can
|
## objdir Makes a directory for temporary build files, which can
|
## then be removed later with a clean target. While a
|
## then be removed later with a clean target. While a
|
## great idea in principle, this doesn't work well in
|
## great idea in principle, this doesn't work well in
|
## practice since Xilinx's ISE never uses it.
|
## practice since Xilinx's ISE never uses it.
|
##
|
##
|
## clean Removes intermediate build files.
|
## clean Removes intermediate build files.
|
##
|
##
|
## Creator: Dan Gisselquist, Ph.D.
|
## Creator: Dan Gisselquist, Ph.D.
|
## Gisselquist Technology, LLC
|
## Gisselquist Technology, LLC
|
##
|
##
|
################################################################################
|
################################################################################
|
##
|
##
|
## Copyright (C) 2015, Gisselquist Technology, LLC
|
## Copyright (C) 2015, Gisselquist Technology, LLC
|
##
|
##
|
## This program is free software (firmware): you can redistribute it and/or
|
## This program is free software (firmware): you can redistribute it and/or
|
## modify it under the terms of the GNU General Public License as published
|
## modify it under the terms of the GNU General Public License as published
|
## by the Free Software Foundation, either version 3 of the License, or (at
|
## by the Free Software Foundation, either version 3 of the License, or (at
|
## your option) any later version.
|
## your option) any later version.
|
##
|
##
|
## This program is distributed in the hope that it will be useful, but WITHOUT
|
## This program is distributed in the hope that it will be useful, but WITHOUT
|
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
## ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
## for more details.
|
## for more details.
|
##
|
##
|
## License: GPL, v3, as defined and found on www.gnu.org,
|
## License: GPL, v3, as defined and found on www.gnu.org,
|
## http:##www.gnu.org/licenses/gpl.html
|
## http:##www.gnu.org/licenses/gpl.html
|
##
|
##
|
##
|
##
|
################################################################################
|
################################################################################
|
##
|
##
|
##
|
##
|
DIR_SPACES := $(subst /, ,$(CURDIR))
|
DIR_SPACES := $(subst /, ,$(CURDIR))
|
DIR_NAME := $(word $(words $(DIR_SPACES)), $(DIR_SPACES))
|
DIR_NAME := $(word $(words $(DIR_SPACES)), $(DIR_SPACES))
|
PROJECT := xula
|
PROJECT := xula
|
BRD := lx25
|
BRD := lx25
|
PART := xc6s$(BRD)-ftg256-2
|
PART := xc6s$(BRD)-ftg256-2
|
OBJDIR := obj-xilinx
|
OBJDIR := obj-xilinx
|
UCFFILE := ../xula.ucf
|
UCFFILE := ../xula.ucf
|
ifeq ($(shell uname),Linux)
|
ifeq ($(shell uname),Linux)
|
MKDIR:=mkdir
|
MKDIR:=mkdir
|
else
|
else
|
MKDIR:=gmkdir
|
MKDIR:=gmkdir
|
endif
|
endif
|
SRCDIR := ../rtl
|
SRCDIR := ../rtl
|
CPUDIR := ../rtl/cpu
|
CPUDIR := ../rtl/cpu
|
JTAGBUS := wbufifo.v wbubus.v wbucompactlines.v wbucompress.v \
|
JTAGBUS := wbufifo.v wbubus.v wbucompactlines.v wbucompress.v \
|
wbudecompress.v wbudeword.v wbuexec.v wbuidleint.v wbuinput.v \
|
wbudecompress.v wbudeword.v wbuexec.v wbuidleint.v wbuinput.v \
|
wbuoutput.v wbureadcw.v wbusixchar.v wbutohex.v
|
wbuoutput.v wbureadcw.v wbusixchar.v wbutohex.v
|
PERIPHERALS: wbgpio.v wbpwmaudio.v rxuart.v txuart.v uartdev.v \
|
PERIPHERALS: wbgpio.v wbpwmaudio.v rxuart.v txuart.v uartdev.v \
|
rtcdate.v rtclight.v
|
rtcdate.v rtclight.v
|
CPUSRC := zipsystem.v \
|
CPUSRC := zipsystem.v \
|
busdelay.v wbarbiter.v wbdblpriarb.v \
|
busdelay.v wbarbiter.v wbdblpriarb.v \
|
zipcpu.v cpuops.v pfcache.v idecode.v pipemem.v pipefetch.v div.v \
|
zipcpu.v cpuops.v pfcache.v idecode.v pipemem.v pipefetch.v div.v \
|
zipcounter.v zipjiffies.v ziptimer.v wbdmac.v wbwatchdog.v
|
zipcounter.v zipjiffies.v ziptimer.v wbdmac.v wbwatchdog.v
|
SOURCES := toplevel.v jtagser.v busmaster.v \
|
SOURCES := toplevel.v jtagser.v busmaster.v \
|
ioslave.v memdev.v hexmap.v icontrol.v builddate.v \
|
ioslave.v memdev.v hexmap.v icontrol.v builddate.v \
|
wbspiflash.v lldspi.v \
|
wbspiflash.v lldspi.v \
|
wbsdramng.v wbscope.v wbscopc.v $(JTAGBUS)
|
wbsdramng.v wbscope.v wbscopc.v $(JTAGBUS)
|
|
|
RTLFILES := $(addprefix $(SRCDIR)/,$(SOURCES)) $(addprefix $(CPUDIR)/,$(CPUSRC))
|
RTLFILES := $(addprefix $(SRCDIR)/,$(SOURCES)) $(addprefix $(CPUDIR)/,$(CPUSRC))
|
|
|
|
|
all: objdir xula.bit
|
all: objdir xula.bit
|
|
|
.PHONY: objdir
|
.PHONY: objdir
|
objdir:
|
objdir:
|
@bash -c "if [ ! -e $(OBJDIR)/ ]; then $(MKDIR) -p $(OBJDIR)/; fi"
|
@bash -c "if [ ! -e $(OBJDIR)/ ]; then $(MKDIR) -p $(OBJDIR)/; fi"
|
|
|
$(OBJDIR)/$(PROJECT).ngc: $(RTLFILES) $(PROJECT).xst
|
$(OBJDIR)/$(PROJECT).ngc: $(RTLFILES) $(PROJECT).xst
|
$(MKDIR) -p xst/projnav.tmp/
|
$(MKDIR) -p xst/projnav.tmp/
|
xst -intstyle ise -ifn $(PROJECT).xst -ofn $(OBJDIR)/$(PROJECT).syr
|
xst -intstyle ise -ifn $(PROJECT).xst -ofn $(OBJDIR)/$(PROJECT).syr
|
mv $(PROJECT).ngc $(OBJDIR)/$(PROJECT).ngc
|
mv $(PROJECT).ngc $(OBJDIR)/$(PROJECT).ngc
|
mv $(PROJECT).ngr $(OBJDIR)/$(PROJECT).ngr
|
mv $(PROJECT).ngr $(OBJDIR)/$(PROJECT).ngr
|
|
|
$(OBJDIR)/$(PROJECT).ngd: $(OBJDIR)/$(PROJECT).ngc
|
$(OBJDIR)/$(PROJECT).ngd: $(OBJDIR)/$(PROJECT).ngc
|
ngdbuild -intstyle ise -dd _ngo -nt timestamp \
|
ngdbuild -intstyle ise -dd _ngo -nt timestamp \
|
-uc $(UCFFILE) -p $(PART) $(OBJDIR)/$(PROJECT).ngc $(OBJDIR)/$(PROJECT).ngd
|
-uc $(UCFFILE) -p $(PART) $(OBJDIR)/$(PROJECT).ngc $(OBJDIR)/$(PROJECT).ngd
|
|
|
MAPOPTS := -w -detail -logic_opt on -ol high -xe n -t 1 -xt 0 -r 4 \
|
MAPOPTS := -w -logic_opt on -ol high -xe n -t 1 -xt 0 -r 4 \
|
-global_opt area -equivalent_register_removal on -mt 2 -detail \
|
-global_opt speed -equivalent_register_removal on -mt 2 -detail \
|
-ir off -ignore_keep_hierarchy -pr off -lc area -power off
|
-ir off -ignore_keep_hierarchy -pr off -lc area -power off
|
$(OBJDIR)/$(PROJECT).ncd: $(OBJDIR)/$(PROJECT).ngd
|
$(OBJDIR)/$(PROJECT).ncd: $(OBJDIR)/$(PROJECT).ngd
|
map -intstyle ise -p $(PART) $(MAPOPTS) \
|
map -intstyle ise -p $(PART) $(MAPOPTS) \
|
-o $(OBJDIR)/$(PROJECT)_map.ncd $(OBJDIR)/$(PROJECT).ngd $(OBJDIR)/$(PROJECT).pcf
|
-o $(OBJDIR)/$(PROJECT)_map.ncd $(OBJDIR)/$(PROJECT).ngd $(OBJDIR)/$(PROJECT).pcf
|
|
|
$(OBJDIR)/$(PROJECT).ncd: $(OBJDIR)/$(PROJECT)_map.ncd
|
$(OBJDIR)/$(PROJECT).ncd: $(OBJDIR)/$(PROJECT)_map.ncd
|
par -w -intstyle ise -ol std -mt 4 $(OBJDIR)/$(PROJECT)_map.ncd $(OBJDIR)/$(PROJECT).ncd $(OBJDIR)/$(PROJECT).pcf
|
par -w -intstyle ise -ol std -mt 4 $(OBJDIR)/$(PROJECT)_map.ncd $(OBJDIR)/$(PROJECT).ncd $(OBJDIR)/$(PROJECT).pcf
|
|
|
$(PROJECT).bit: $(OBJDIR)/$(PROJECT).ncd
|
$(PROJECT).bit: $(OBJDIR)/$(PROJECT).ncd
|
bitgen -f $(PROJECT).ut $(OBJDIR)/$(PROJECT).ncd $(PROJECT).bit
|
bitgen -f $(PROJECT).ut $(OBJDIR)/$(PROJECT).ncd $(PROJECT).bit
|
|
|
timing: $(OBJDIR)/$(PROJECT).ncd $(OBJDIR)/$(PROJECT).pcf
|
timing: $(OBJDIR)/$(PROJECT).ncd $(OBJDIR)/$(PROJECT).pcf
|
trce -intstyle ise -v 3 -s 2 -n 3 -fastpaths -xml $(OBJDIR)/$(PROJECT).twx -o $(OBJDIR)/$(PROJECT).ncd -o $(OBJDIR)/$(PROJECT).twr $(OBJDIR)/$(PROJECT).pcf
|
trce -intstyle ise -v 3 -s 2 -n 3 -fastpaths -xml $(OBJDIR)/$(PROJECT).twx -o $(OBJDIR)/$(PROJECT).ncd -o $(OBJDIR)/$(PROJECT).twr $(OBJDIR)/$(PROJECT).pcf
|
|
|
.PHONY: clean
|
.PHONY: clean
|
clean:
|
clean:
|
@-rm -rf $(OBJDIR)
|
@-rm -rf $(OBJDIR)
|
@-rm -f *.ngc *.ngd *.ncd *.pcf *.lso *.ngr *.bgn *.bld *.cmd_log
|
@-rm -f *.ngc *.ngd *.ncd *.pcf *.lso *.ngr *.bgn *.bld *.cmd_log
|
@-rm -f *.drc *.gise *.map *.mrp *.ngm *.syr *.xwbt *.xrpt
|
@-rm -f *.drc *.gise *.map *.mrp *.ngm *.syr *.xwbt *.xrpt
|
@-rm -f *.pad *.par *.psr *.ptwx *.unroutes *.xpi *.csv *.xml
|
@-rm -f *.pad *.par *.psr *.ptwx *.unroutes *.xpi *.csv *.xml
|
@-rm -f *.html *.xrpt *.log *.stx *.tcl *.txt *.twr *.twx
|
@-rm -f *.html *.xrpt *.log *.stx *.tcl *.txt *.twr *.twx
|
@-rm -rf _ngo _xmsgs xlnx_* ipcore_dir iseconfig templates xst
|
@-rm -rf _ngo _xmsgs xlnx_* ipcore_dir iseconfig templates xst
|
@echo "All cleaned up"
|
@echo "All cleaned up"
|
|
|