aboutsummaryrefslogtreecommitdiff
path: root/fmc/build
diff options
context:
space:
mode:
authorPaul Selkirk <paul@psgd.org>2015-10-29 14:48:57 -0400
committerPaul Selkirk <paul@psgd.org>2015-10-29 14:48:57 -0400
commitc88137ebab8561777b5ffb3ae045960990b2760d (patch)
treee03fbc67bcfe3139e41e30faafde7ad2dda66641 /fmc/build
parent3d96445bf19f3fd15b2ad9fe4cd7a08bad9c0e41 (diff)
add fmc
Diffstat (limited to 'fmc/build')
-rw-r--r--fmc/build/.gitignore53
-rw-r--r--fmc/build/Makefile70
-rw-r--r--fmc/build/xilinx.mk176
-rw-r--r--fmc/build/xilinx.opt42
4 files changed, 341 insertions, 0 deletions
diff --git a/fmc/build/.gitignore b/fmc/build/.gitignore
new file mode 100644
index 0000000..865bda8
--- /dev/null
+++ b/fmc/build/.gitignore
@@ -0,0 +1,53 @@
+coregen-tmp
+*.xrpt
+novena_fmc.mcs
+novena_fmc.cfi
+novena_fmc.prm
+novena_fmc.bgn
+novena_fmc.bit
+novena_fmc.drc
+novena_fmc_bd.bmm
+novena_fmc_par.ncd
+novena_fmc_par.par
+novena_fmc_par.pad
+novena_fmc_par_pad.csv
+novena_fmc_par_pad.txt
+novena_fmc_par.grf
+novena_fmc_par.ptwx
+novena_fmc_par.unroutes
+novena_fmc_par.xpi
+novena_fmc.ncd
+novena_fmc.pcf
+novena_fmc.ngm
+novena_fmc.mrp
+novena_fmc.map
+smartguide.ncd
+novena_fmc.psr
+novena_fmc_summary.xml
+novena_fmc_usage.xml
+novena_fmc.ngd
+novena_fmc.bld
+xlnx_auto*
+novena_fmc_top.lso
+novena_fmc.srp
+netlist.lst
+xst
+novena_fmc.ngc
+novena_fmc.prj
+novena_fmc.scr
+novena_fmc.post_map.twr
+novena_fmc.post_map.twx
+smartpreview.twr
+novena_fmc.twr
+novena_fmc.twx
+smartpreview.twr
+novena_fmc_err.twr
+novena_fmc_err.twx
+novena_fmc.lso
+novena_fmc_bitgen.xwb
+novena_fmc_bitgen.xwbt
+usage_statistics_webtalk.html
+par_usage_statistics.html
+webtalk.log
+_xmsgs
+default.xreport
diff --git a/fmc/build/Makefile b/fmc/build/Makefile
new file mode 100644
index 0000000..7c73c89
--- /dev/null
+++ b/fmc/build/Makefile
@@ -0,0 +1,70 @@
+project = novena_fmc
+vendor = xilinx
+family = spartan6
+part = xc6slx45csg324-3
+top_module = novena_fmc_top
+isedir = /opt/Xilinx/14.7/ISE_DS
+xil_env = . $(isedir)/settings64.sh
+ucf = ../ucf/$(project).ucf
+
+vfiles = \
+ ../rtl/novena_fmc_top.v \
+ ../../common/rtl/novena_regs.v \
+ ../../common/rtl/novena_clkmgr.v \
+ ../../common/rtl/clkmgr_dcm.v \
+ ../../../common/core_selector/src/rtl/core_selector.v \
+ ../../../common/core_selector/src/rtl/global_selector.v \
+ ../../../common/core_selector/src/rtl/hash_selector.v \
+ ../../../common/core_selector/src/rtl/rng_selector.v \
+ ../../../common/core_selector/src/rtl/cipher_selector.v \
+ ../../../common/core_selector/src/rtl/math_selector.v \
+ ../../../../comm/fmc/src/rtl/cdc_bus_pulse.v \
+ ../../../../comm/fmc/src/rtl/fmc_arbiter_cdc.v \
+ ../../../../comm/fmc/src/rtl/fmc_arbiter.v \
+ ../../../../comm/fmc/src/rtl/fmc_d_phy.v \
+ ../../../../comm/fmc/src/rtl/fmc_indicator.v \
+ ../../../../comm/fmc/src/rtl/fmc_regs.v \
+ ../../../../hash/sha1/src/rtl/sha1.v \
+ ../../../../hash/sha1/src/rtl/sha1_core.v \
+ ../../../../hash/sha1/src/rtl/sha1_w_mem.v \
+ ../../../../hash/sha256/src/rtl/sha256.v \
+ ../../../../hash/sha256/src/rtl/sha256_core.v \
+ ../../../../hash/sha256/src/rtl/sha256_k_constants.v \
+ ../../../../hash/sha256/src/rtl/sha256_w_mem.v \
+ ../../../../hash/sha512/src/rtl/sha512.v \
+ ../../../../hash/sha512/src/rtl/sha512_core.v \
+ ../../../../hash/sha512/src/rtl/sha512_h_constants.v \
+ ../../../../hash/sha512/src/rtl/sha512_k_constants.v \
+ ../../../../hash/sha512/src/rtl/sha512_w_mem.v \
+ ../../../../rng/avalanche_entropy/src/rtl/avalanche_entropy.v \
+ ../../../../rng/avalanche_entropy/src/rtl/avalanche_entropy_core.v \
+ ../../../../rng/rosc_entropy/src/rtl/rosc.v \
+ ../../../../rng/rosc_entropy/src/rtl/rosc_entropy.v \
+ ../../../../rng/rosc_entropy/src/rtl/rosc_entropy_core.v \
+ ../../../../rng/trng/src/rtl/trng.v \
+ ../../../../rng/trng/src/rtl/trng_csprng.v \
+ ../../../../rng/trng/src/rtl/trng_csprng_fifo.v \
+ ../../../../rng/trng/src/rtl/trng_mixer.v \
+ ../../../../cipher/aes/src/rtl/aes.v \
+ ../../../../cipher/aes/src/rtl/aes_core.v \
+ ../../../../cipher/aes/src/rtl/aes_decipher_block.v \
+ ../../../../cipher/aes/src/rtl/aes_encipher_block.v \
+ ../../../../cipher/aes/src/rtl/aes_inv_sbox.v \
+ ../../../../cipher/aes/src/rtl/aes_key_mem.v \
+ ../../../../cipher/aes/src/rtl/aes_sbox.v \
+ ../../../../cipher/chacha/src/rtl/chacha.v \
+ ../../../../cipher/chacha/src/rtl/chacha_core.v \
+ ../../../../cipher/chacha/src/rtl/chacha_qr.v \
+ ../../../../math/modexp/src/rtl/adder.v \
+ ../../../../math/modexp/src/rtl/blockmem1r1w.v \
+ ../../../../math/modexp/src/rtl/blockmem2r1wptr.v \
+ ../../../../math/modexp/src/rtl/blockmem2r1w.v \
+ ../../../../math/modexp/src/rtl/blockmem2rptr1w.v \
+ ../../../../math/modexp/src/rtl/modexp.v \
+ ../../../../math/modexp/src/rtl/modexp_core.v \
+ ../../../../math/modexp/src/rtl/montprod.v \
+ ../../../../math/modexp/src/rtl/residue.v \
+ ../../../../math/modexp/src/rtl/shl.v \
+ ../../../../math/modexp/src/rtl/shr.v
+
+include xilinx.mk
diff --git a/fmc/build/xilinx.mk b/fmc/build/xilinx.mk
new file mode 100644
index 0000000..7a8d9d4
--- /dev/null
+++ b/fmc/build/xilinx.mk
@@ -0,0 +1,176 @@
+# The top level module should define the variables below then include
+# this file. The files listed should be in the same directory as the
+# Makefile.
+#
+# variable description
+# ---------- -------------
+# project project name (top level module should match this name)
+# top_module top level module of the project
+# libdir path to library directory
+# libs library modules used
+# vfiles all local .v files
+# xilinx_cores all local .xco files
+# vendor vendor of FPGA (xilinx, altera, etc.)
+# family FPGA device family (spartan3e)
+# part FPGA part name (xc4vfx12-10-sf363)
+# flashsize size of flash for mcs file (16384)
+# optfile (optional) xst extra opttions file to put in .scr
+# map_opts (optional) options to give to map
+# par_opts (optional) options to give to par
+# intstyle (optional) intstyle option to all tools
+# ucf constraint file, defaults to $(project).ucf
+#
+# Library modules should have a modules.mk in their root directory,
+# namely $(libdir)/<libname>/module.mk, that simply adds to the vfiles
+# and xilinx_cores variable.
+#
+# all the .xco files listed in xilinx_cores will be generated with core, with
+# the resulting .v and .ngc files placed back in the same directory as
+# the .xco file.
+#
+# TODO: .xco files are device dependant, should use a template based system
+
+coregen_work_dir ?= ./coregen-tmp
+#map_opts ?= -timing -ol high -detail -pr b -register_duplication -w -xe n
+# from https://github.com/fpga-logi/logi-hard/blob/master/build_lib/synth/xilinx.mk:
+map_opts ?= -w -logic_opt off -ol high -t 1 -xt 0 -register_duplication off -r 4 -global_opt off -mt off -ir off -pr off -lc off -power off
+par_opts ?= -ol high
+isedir ?= /opt/Xilinx/13.3/ISE_DS
+xil_env ?= . $(isedir)/settings32.sh
+flashsize ?= 8192
+ucf ?= $(project).ucf
+
+libmks = $(patsubst %,$(libdir)/%/module.mk,$(libs))
+mkfiles = $(libmks) xilinx.mk
+include $(libmks)
+
+corengcs = $(foreach core,$(xilinx_cores),$(core:.xco=.ngc))
+local_corengcs = $(foreach ngc,$(corengcs),$(notdir $(ngc)))
+vfiles += $(foreach core,$(xilinx_cores),$(core:.xco=.v))
+junk += $(local_corengcs)
+
+.PHONY: default xilinx_cores clean twr etwr
+default: $(project).bit $(project).mcs
+xilinx_cores: $(corengcs)
+twr: $(project).twr
+etwr: $(project)_err.twr
+
+define cp_template
+$(2): $(1)
+ cp $(1) $(2)
+endef
+$(foreach ngc,$(corengcs),$(eval $(call cp_template,$(ngc),$(notdir $(ngc)))))
+
+%.ngc %.v: %.xco
+ @echo "=== rebuilding $@"
+ if [ -d $(coregen_work_dir) ]; then \
+ rm -rf $(coregen_work_dir)/*; \
+ else \
+ mkdir -p $(coregen_work_dir); \
+ fi
+ cd $(coregen_work_dir); \
+ $(xil_env); \
+ coregen -b $$OLDPWD/$<; \
+ cd -
+ xcodir=`dirname $<`; \
+ basename=`basename $< .xco`; \
+ if [ ! -r $(coregen_work_dir/$$basename.ngc) ]; then \
+ echo "'$@' wasn't created."; \
+ exit 1; \
+ else \
+ cp $(coregen_work_dir)/$$basename.v $(coregen_work_dir)/$$basename.ngc $$xcodir; \
+ fi
+junk += $(coregen_work_dir)
+
+date = $(shell date +%F-%H-%M)
+
+# some common junk
+junk += *.xrpt
+
+programming_files: $(project).bit $(project).mcs
+ mkdir -p $@/$(date)
+ mkdir -p $@/latest
+ for x in .bit .mcs .cfi _bd.bmm; do cp $(project)$$x $@/$(date)/$(project)$$x; cp $(project)$$x $@/latest/$(project)$$x; done
+ $(xil_env); xst -help | head -1 | sed 's/^/#/' | cat - $(project).scr > $@/$(date)/$(project).scr
+
+$(project).mcs: $(project).bit
+ $(xil_env); \
+ promgen -w -s $(flashsize) -p mcs -o $@ -u 0 $^
+junk += $(project).mcs $(project).cfi $(project).prm
+
+$(project).bit: $(project)_par.ncd
+ $(xil_env); \
+ bitgen $(intstyle) -g UnusedPin:Pullnone -g DriveDone:yes -g StartupClk:Cclk -w $(project)_par.ncd $(project).bit
+junk += $(project).bgn $(project).bit $(project).drc $(project)_bd.bmm
+
+
+$(project)_par.ncd: $(project).ncd
+ $(xil_env); \
+ if par $(intstyle) $(par_opts) -w $(project).ncd $(project)_par.ncd; then \
+ :; \
+ else \
+ $(MAKE) etwr; \
+ fi
+junk += $(project)_par.ncd $(project)_par.par $(project)_par.pad
+junk += $(project)_par_pad.csv $(project)_par_pad.txt
+junk += $(project)_par.grf $(project)_par.ptwx
+junk += $(project)_par.unroutes $(project)_par.xpi
+
+$(project).ncd: $(project).ngd
+ if [ -r $(project)_par.ncd ]; then \
+ cp $(project)_par.ncd smartguide.ncd; \
+ smartguide="-smartguide smartguide.ncd"; \
+ else \
+ smartguide=""; \
+ fi; \
+ $(xil_env); \
+ map $(intstyle) $(map_opts) $$smartguide $<
+junk += $(project).ncd $(project).pcf $(project).ngm $(project).mrp $(project).map
+junk += smartguide.ncd $(project).psr
+junk += $(project)_summary.xml $(project)_usage.xml
+
+$(project).ngd: $(project).ngc $(ucf)
+ $(xil_env); ngdbuild $(intstyle) $(project).ngc -uc $(ucf)
+junk += $(project).ngd $(project).bld
+
+$(project).ngc: $(vfiles) $(local_corengcs) $(project).scr $(project).prj
+ $(xil_env); xst $(intstyle) -ifn $(project).scr
+junk += xlnx_auto* $(top_module).lso $(project).srp
+junk += netlist.lst xst $(project).ngc
+
+$(project).prj: $(vfiles) $(mkfiles)
+ for src in $(vfiles); do echo "verilog work $$src" >> $(project).tmpprj; done
+ sort -u $(project).tmpprj > $(project).prj
+ rm -f $(project).tmpprj
+junk += $(project).prj
+
+optfile += $(wildcard $(project).opt)
+top_module ?= $(project)
+$(project).scr: $(optfile) $(mkfiles) ./xilinx.opt
+ echo "run" > $@
+ echo "-p $(part)" >> $@
+ echo "-top $(top_module)" >> $@
+ echo "-ifn $(project).prj" >> $@
+ echo "-ofn $(project).ngc" >> $@
+ cat ./xilinx.opt $(optfile) >> $@
+junk += $(project).scr
+
+$(project).post_map.twr: $(project).ncd
+ $(xil_env); trce -e 10 $< $(project).pcf -o $@
+junk += $(project).post_map.twr $(project).post_map.twx smartpreview.twr
+
+$(project).twr: $(project)_par.ncd
+ $(xil_env); trce $< $(project).pcf -o $(project).twr
+junk += $(project).twr $(project).twx smartpreview.twr
+
+$(project)_err.twr: $(project)_par.ncd
+ $(xil_env); trce -e 10 $< $(project).pcf -o $(project)_err.twr
+junk += $(project)_err.twr $(project)_err.twx
+junk += $(project).lso $(project)_bitgen.xwb $(project)_bitgen.xwbt
+junk += usage_statistics_webtalk.html par_usage_statistics.html webtalk.log _xmsgs default.xreport
+
+.gitignore: $(mkfiles)
+ echo programming_files $(junk) | sed 's, ,\n,g' > .gitignore
+
+clean::
+ rm -rf $(junk)
diff --git a/fmc/build/xilinx.opt b/fmc/build/xilinx.opt
new file mode 100644
index 0000000..7fe9d8b
--- /dev/null
+++ b/fmc/build/xilinx.opt
@@ -0,0 +1,42 @@
+-ifmt mixed
+-ofmt NGC
+-opt_mode speed
+-opt_level 1
+-iuc NO
+-keep_hierarchy no
+-netlist_hierarchy as_optimized
+-rtlview no
+-glob_opt AllClockNets
+-read_cores yes
+-write_timing_constraints NO
+-cross_clock_analysis NO
+-hierarchy_separator /
+-bus_delimiter <>
+-case maintain
+-slice_utilization_ratio 100
+-bram_utilization_ratio 100
+#-dsp_utilization_ratio 100
+-safe_implementation No
+-fsm_extract YES
+-fsm_encoding Auto
+-fsm_style lut
+-ram_extract Yes
+-ram_style Auto
+-rom_extract Yes
+-rom_style Auto
+-shreg_extract YES
+-auto_bram_packing NO
+-resource_sharing YES
+-async_to_sync NO
+#-use_dsp48 auto
+-iobuf YES
+-max_fanout 500
+-register_duplication YES
+-register_balancing No
+-optimize_primitives NO
+-use_clock_enable Auto
+-use_sync_set Auto
+-use_sync_reset Auto
+-iob auto
+-equivalent_register_removal YES
+-slice_utilization_ratio_maxmargin 5