aboutsummaryrefslogtreecommitdiffstats
path: root/examples/ecp5_versa/Makefile
diff options
context:
space:
mode:
authorMartin <hackfin@section5.ch>2020-02-14 20:15:22 +0100
committerGitHub <noreply@github.com>2020-02-14 20:15:22 +0100
commit27b14ac284407755a31aa644219948102730f179 (patch)
tree4b2f696cd4cd104705383467cb27fb711afcf2fd /examples/ecp5_versa/Makefile
parentfe9f2c4eb258f9e4e20a60742750698b09c9ed4b (diff)
downloadghdl-yosys-plugin-27b14ac284407755a31aa644219948102730f179.tar.gz
ghdl-yosys-plugin-27b14ac284407755a31aa644219948102730f179.tar.bz2
ghdl-yosys-plugin-27b14ac284407755a31aa644219948102730f179.zip
Added ECP5 example for Lattice versa devkit (#85)
- LED blinky - Added support for vendor primitives - Workarounds in Verilog for BRAM and primitive wrapping - Docker support Makefiles - openocd support files
Diffstat (limited to 'examples/ecp5_versa/Makefile')
-rw-r--r--examples/ecp5_versa/Makefile52
1 files changed, 52 insertions, 0 deletions
diff --git a/examples/ecp5_versa/Makefile b/examples/ecp5_versa/Makefile
new file mode 100644
index 0000000..6031055
--- /dev/null
+++ b/examples/ecp5_versa/Makefile
@@ -0,0 +1,52 @@
+LIB = ../../library
+
+GHDL ?= ghdl
+
+GHDL_FLAGS = -Plib
+
+CLK_FREQ = 25000000
+
+GHDL_GENERICS=-gCLK_FREQUENCY=$(CLK_FREQ)
+LPF = versa_ecp5.lpf
+PACKAGE = CABGA381
+NEXTPNR_FLAGS = --um5g-45k --freq 100
+NEXTPNR_FLAGS += --lpf-allow-unconstrained
+OPENOCD_JTAG_CONFIG = ../../openocd/ecp5-versa.cfg
+OPENOCD_DEVICE_CONFIG = ../../openocd/LFE5UM5G-45F.cfg
+
+WORKDIR = work
+# Files to synthesize:
+VHDL_SYN_FILES = versa_ecp5_top.vhdl pll_mac.vhd
+VHDL_SYN_FILES += soc_iomap_pkg.vhdl
+VHDL_SYN_FILES += uart.vhdl uart_tx.vhdl uart_rx.vhdl fifobuf.vhdl
+
+TOPLEVEL = versa_ecp5_top
+TOPLEVEL_PARAMETER = _$(CLK_FREQ)
+
+VERILOG_FILES = $(LIB)/wrapper/primitives.v
+VERILOG_FILES += $(LIB)/wrapper/wrapper.v
+VERILOG_FILES += $(LIB)/wrapper/bram.v
+
+SVFFILE = versa_ecp5_top.svf
+DEPENDENCIES = lib/ecp5um-std93.cf
+
+all: $(SVFFILE)
+
+include ../docker.mk
+include ../ghdlsynth.mk
+
+lib:
+ mkdir $@
+
+lib/ecp5um-std93.cf: $(LIB)/ecp5u/components.vhdl | lib
+ $(GHDL) -i --workdir=$(dir $@) --work=ecp5um \
+ $<
+
+pll_mac.vhd: $(DEPENDENCIES)
+
+prog: $(SVFFILE)
+ $(OPENOCD) -f $(OPENOCD_JTAG_CONFIG) -f $(OPENOCD_DEVICE_CONFIG) \
+ -c "transport select jtag; init; svf $<; exit"
+
+clean:
+ rm -fr lib work *.json *.svf *.config *-report.txt