1
0
mirror of git://projects.qi-hardware.com/nn-usb-fpga.git synced 2025-01-09 19:00:14 +02:00
nn-usb-fpga/Examples/blink/logic/Makefile

92 lines
2.4 KiB
Makefile
Raw Permalink Normal View History

2010-04-03 04:51:59 +03:00
DESIGN = blink
PINS = $(DESIGN).ucf
DEVICE = xc3s500e-VQ100-4
2010-04-03 04:51:59 +03:00
BGFLAGS = -g TdoPin:PULLNONE -g DonePin:PULLUP \
-g CRC:enable -g StartUpClk:CCLK
SIM_CMD = vsim
2010-04-03 04:51:59 +03:00
SIM_COMP_SCRIPT = simulation/$(DESIGN)_TB.do
SIMGEN_OPTIONS = -p $(FPGA_ARCH) -lang $(LANGUAGE)
2010-05-12 17:36:30 +03:00
IVERILOG = iverilog
2010-04-03 04:51:59 +03:00
SAKC_IP = 192.168.254.101
SRC = $(DESIGN).v
2010-05-12 17:36:30 +03:00
SIM_SRC = $(DESIGN)_TB.v \
sim/unisims/BUFG.v \
sim/unisims/DCM.v \
sim/unisims/FDDRRSE.v
2010-04-03 04:51:59 +03:00
all: bits
remake: clean-build all
clean:
rm -f *~ */*~ a.out *.log *.key *.edf *.ps trace.dat
rm -f *.bit
2010-04-03 04:51:59 +03:00
cleanall: clean
2010-05-12 17:36:30 +03:00
rm -rf build simulation/work simulation/transcript simulation/vsim.wlf simulation/blink_TB.vvp simulation/blink_TB.vcd
2010-04-03 04:51:59 +03:00
bits: $(DESIGN).bit
#
# Synthesis
#
build/project.src:
@[ -d build ] || mkdir build
@rm -f $@
for i in $(SRC); do echo verilog work ../$$i >> $@; done
for i in $(SRC_HDL); do echo VHDL work ../$$i >> $@; done
build/project.xst: build/project.src
echo "run" > $@
echo "-top $(DESIGN) " >> $@
echo "-p $(DEVICE)" >> $@
echo "-opt_mode Area" >> $@
echo "-opt_level 1" >> $@
echo "-ifn project.src" >> $@
echo "-ifmt mixed" >> $@
echo "-ofn project.ngc" >> $@
echo "-ofmt NGC" >> $@
echo "-rtlview yes" >> $@
build/project.ngc: build/project.xst $(SRC)
cd build && xst -ifn project.xst -ofn project.log
build/project.ngd: build/project.ngc $(PINS)
cd build && ngdbuild -p $(DEVICE) project.ngc -uc ../$(PINS)
build/project.ncd: build/project.ngd
cd build && map -pr b -p $(DEVICE) project
build/project_r.ncd: build/project.ncd
cd build && par -w project project_r.ncd
build/project_r.twr: build/project_r.ncd
cd build && trce -v 25 project_r.ncd project.pcf
$(DESIGN).bit: build/project_r.ncd build/project_r.twr
cd build && bitgen project_r.ncd -l -w $(BGFLAGS)
@mv -f build/project_r.bit $@
build/project_r.v: build/project_r.ncd
2010-05-12 18:06:23 +03:00
cd build && ngd2ver project.ngd -w project.v
2010-05-12 17:36:30 +03:00
modelsim:
cd simulation; $(SIM_CMD) -do $(DESIGN)_TB.do
timesim: build/project_r.v
cd simulation; $(SIM_CMD) -do $(DESIGN)_TIMING_TB.do
2010-04-03 04:51:59 +03:00
2010-05-12 17:36:30 +03:00
iversim:
2010-05-12 18:06:23 +03:00
$(IVERILOG) -o simulation/$(DESIGN)_TB.vvp $(VINCDIR) $(SRC) $(SIM_SRC) -s $(DESIGN)_TB
2010-05-12 17:36:30 +03:00
vvp simulation/$(DESIGN)_TB.vvp; mv $(DESIGN)_TB.vcd simulation/
gtkwave simulation/$(DESIGN)_TB.vcd&
2010-04-03 04:51:59 +03:00
upload: $(DESIGN).bit
scp $(DESIGN).bit root@$(SAKC_IP):