aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbryan newbold <bnewbold@leaflabs.com>2013-06-19 13:04:46 -0400
committerbryan newbold <bnewbold@leaflabs.com>2013-06-19 13:04:46 -0400
commit10199d449f4d20786af2e8abb303d65db98f7d30 (patch)
tree462776b66d4ea656759bb27f95ccd514b6bb4464
parent18c3d14cad3e41d82ec231e4f519dd12449c5633 (diff)
downloadbasic-hdl-template-10199d449f4d20786af2e8abb303d65db98f7d30.tar.gz
basic-hdl-template-10199d449f4d20786af2e8abb303d65db98f7d30.zip
proper Makefile syntax; device-specific; mcs bitwidth
-rw-r--r--Makefile36
-rw-r--r--contrib/example-device.mk7
-rw-r--r--contrib/xilinx.mk5
3 files changed, 32 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index d479720..16ffb50 100644
--- a/Makefile
+++ b/Makefile
@@ -1,30 +1,38 @@
# Edit project-specific variables in this file.
-project = project
-top_module = main
-vendor = xilinx
+project := project
+top_module := main
+vendor := xilinx
# This is the chipset from the Xilinx SP605 dev board
-family = spartan6
-device = xc6slx45t
-speedgrade = -3
-device_package = fgg484
-part = $(device)$(speedgrade)-$(device_package)
+family := spartan6
+device := xc6slx45t
+speedgrade := -3
+device_package := fgg484
+part := $(device)$(speedgrade)-$(device_package)
# is this build host 64 or 32 bits?
-hostbits = 64
-iseenv= /opt/Xilinx/14.3/ISE_DS/
+hostbits := 64
+iseenv := /opt/Xilinx/14.3/ISE_DS/
# list all .v files explicitly with vfiles (no hdl/*.v business)
-vfiles = hdl/project.v
+vfiles := hdl/project.v
+#vfiles += hdl/yours.v
# can only specify a single test bench file here (for now)
-tbfiles = tb/tb.v
+tbfiles := tb/tb.v
+#tbfiles += hdl/yours.v
# list of .xco files, eg "cores/bram.xco". do not include DCM files.
-#xilinx_cores = cores/bram.xco
-xilinx_cores =
+xilinx_cores :=
+#xilinx_cores += cores/example.xco
+
+# bitfile bitwidth for flash uploads
+mcs_datawidth = 16
# Bulk of the actual Makefile is in a different file.
include ./contrib/xilinx.mk
+
+# Example hardware-specific targets (eg, upload via SPI)
+include ./contrib/example-device.mk
diff --git a/contrib/example-device.mk b/contrib/example-device.mk
new file mode 100644
index 0000000..88d2e28
--- /dev/null
+++ b/contrib/example-device.mk
@@ -0,0 +1,7 @@
+# Device-specific make targets
+
+.PHONY: spi_upload
+
+spi_upload: build/$(project).bit
+ @echo "unimplemented!"
+
diff --git a/contrib/xilinx.mk b/contrib/xilinx.mk
index 89bd465..253b91e 100644
--- a/contrib/xilinx.mk
+++ b/contrib/xilinx.mk
@@ -48,6 +48,7 @@ iseenvfile?= $(iseenv)/settings$(hostbits).sh
xil_env ?= mkdir -p build/; cd ./build; source $(iseenvfile) > /dev/null
sim_env ?= cd ./tb; source $(iseenvfile) > /dev/null
flashsize ?= 8192
+mcs_datawidth ?= 16
PWD := $(shell pwd)
intstyle ?= -intstyle xflow
@@ -115,11 +116,11 @@ programming_files: build/$(project).bit build/$(project).mcs
@bash -c "$(xil_env); xst -help | head -1 | sed 's/^/#/' | cat - build/$(project).scr > $@/$(date)/$(project).scr"
build/$(project).mcs: build/$(project).bit
- @bash -c "$(xil_env); promgen -w -s $(flashsize) -p mcs -o $(project).mcs -u 0 $(project).bit"
+ @bash -c "$(xil_env); promgen -w -data_width $(mcs_datawidth) -s $(flashsize) -p mcs -o $(project).mcs -u 0 $(project).bit"
build/$(project).bit: build/$(project)_par.ncd
@bash -c "$(xil_env); \
- bitgen $(intstyle) -g DriveDone:yes -g StartupClk:Cclk -w $(project)_par.ncd $(project).bit"
+ bitgen $(intstyle) -g Binary:yes -g DriveDone:yes -g StartupClk:Cclk -w $(project)_par.ncd $(project).bit"
build/$(project)_par.ncd: build/$(project).ncd