1 |
4 |
vk.semicon |
MODULE=RS_dec
|
2 |
|
|
DEPS ?=
|
3 |
|
|
SOURCE_FILES ?= $(wildcard ../../rtl/*.v)
|
4 |
|
|
|
5 |
|
|
ADEPS ?=$(DEPS)
|
6 |
|
|
LIBS = ${ADEPS:%=-sd ../../../%/syn/xilinx}
|
7 |
|
|
MAP_OPTIONS ?= -timing
|
8 |
|
|
PAR_OPTIONS ?=
|
9 |
|
|
|
10 |
|
|
all: ${MODULE}.bit ${MODULE}.twr ${MODULE}_timesim.v
|
11 |
|
|
|
12 |
|
|
# (Re)generate $(MODULE).prj file:
|
13 |
|
|
config:
|
14 |
|
|
echo -n > $(MODULE).prj
|
15 |
|
|
for src in $(SOURCE_FILES); do \
|
16 |
|
|
echo verilog work $$src >> $(MODULE).prj; \
|
17 |
|
|
done
|
18 |
|
|
$(foreach dir, ${ADEPS}, \
|
19 |
|
|
for src in ../../../$(dir)/rtl/*.v; do \
|
20 |
|
|
echo verilog work $$src >> $(MODULE).prj; \
|
21 |
|
|
done; )
|
22 |
|
|
|
23 |
|
|
# Synthesize the HDL files into an NGC file. This rule is triggered if
|
24 |
|
|
# any of the HDL files are changed or the synthesis options are changed.
|
25 |
|
|
%.ngc: %.xst
|
26 |
|
|
echo "XST start: $$(date)" > time.log
|
27 |
|
|
xst -intstyle silent -ifn $*.xst -ofn $*.syr
|
28 |
|
|
echo "XST finish: $$(date)" >> time.log
|
29 |
|
|
|
30 |
|
|
# Take the output of the synthesizer and create the NGD file. This rule
|
31 |
|
|
# will also be triggered if constraints file is changed.
|
32 |
|
|
%.ngd: %.ngc %.ucf
|
33 |
|
|
ngdbuild -intstyle silent -dd _ngo $(LIBS) -uc $*.ucf $*.ngc $*.ngd
|
34 |
|
|
|
35 |
|
|
# Map the NGD file and physical-constraints to the FPGA to create the mapped NCD file.
|
36 |
|
|
%_map.ncd %.pcf: %.ngd
|
37 |
|
|
echo "Map start: $$(date)" >> time.log
|
38 |
|
|
map -intstyle silent $(MAP_OPTIONS) -o $*_map.ncd $*.ngd $*.pcf
|
39 |
|
|
echo "Map finish: $$(date)" >> time.log
|
40 |
|
|
|
41 |
|
|
# Place & route the mapped NCD file to create the final NCD file.
|
42 |
|
|
%.ncd: %_map.ncd %.pcf
|
43 |
|
|
echo "PAR start: $$(date)" >> time.log
|
44 |
|
|
par -intstyle silent $(PAR_OPTIONS) $*_map.ncd $*.ncd $*.pcf
|
45 |
|
|
echo "PAR finish: $$(date)" >> time.log
|
46 |
|
|
|
47 |
|
|
# Generate BIT file:
|
48 |
|
|
%.bit: %.ncd
|
49 |
|
|
echo "bitgen start: $$(date)" >> time.log
|
50 |
|
|
bitgen -intstyle silent -f ../../../include/syn/bitgen.ut $*.ncd
|
51 |
|
|
echo "bitgen finish: $$(date)" >> time.log
|
52 |
|
|
|
53 |
|
|
# Create the FPGA timing report after place & route.
|
54 |
|
|
%.twr: %.ncd %.pcf
|
55 |
|
|
echo "TRCE start: $$(date)" >> time.log
|
56 |
|
|
trce -intstyle silent -v 3 -s 4 $*.ncd -o $*.twr $*.pcf
|
57 |
|
|
echo "TRCE finish: $$(date)" >> time.log
|
58 |
|
|
|
59 |
|
|
%_timesim.v %_timesim.sdf: %.pcf %.ncd
|
60 |
|
|
echo "netgen start: $$(date)" >> time.log
|
61 |
|
|
netgen -intstyle silent -s 4 -pcf $*.pcf -sdf_anno true -insert_glbl true -w -ofmt verilog -sim $*.ncd $*_timesim.v
|
62 |
|
|
echo "netgen finish: $$(date)" >> time.log
|
63 |
|
|
|
64 |
|
|
clean:
|
65 |
|
|
${RM} *.bld *.map *.ncd *.ng? *.pad *.csv *.pcf *.nlf *.xpi *.bgn *.drc *.ngm *.ngr *.xrpt *.ise *.restore *twx time.log deps.v
|
66 |
|
|
rm -rf _ngo xst _xmsgs *_xdb
|
67 |
|
|
|
68 |
|
|
all-clean: clean
|
69 |
|
|
${RM} *.mrp *.par *.syr *.txt *.sdf *.twr *.unroutes *.xml *~ *.bit *_timesim.v *_pad.txt
|
70 |
|
|
|
71 |
|
|
# Preserve intermediate files.
|
72 |
|
|
.PRECIOUS: %.ngc %.ngd %_map.ncd %.ncd %.twr %.vm6 %.jed
|