From f1592d01eeb73b23d628bc802f242ac49f30d33e Mon Sep 17 00:00:00 2001 From: Kalle Raiskila Date: Sun, 31 Jan 2016 12:51:34 +0200 Subject: Allow DESTDIR and PREFIX overrides from environment. --- config.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config.mk b/config.mk index b6c0f6a..fa17007 100644 --- a/config.mk +++ b/config.mk @@ -1,4 +1,4 @@ CXX = clang CC = $(CXX) -DESTDIR = -PREFIX = /usr/local +DESTDIR ?= +PREFIX ?= /usr/local -- cgit v1.2.3 From 438c0b55aea79da73f9be6ace4ddf2b77b749774 Mon Sep 17 00:00:00 2001 From: Kalle Raiskila Date: Sun, 31 Jan 2016 13:01:18 +0200 Subject: Port example to iceblink40 board. --- examples/iceblink/Makefile | 26 ++++++++++++++++++++++++++ examples/iceblink/README | 10 ++++++++++ examples/iceblink/example.v | 24 ++++++++++++++++++++++++ examples/iceblink/iceblink.pcf | 5 +++++ 4 files changed, 65 insertions(+) create mode 100644 examples/iceblink/Makefile create mode 100644 examples/iceblink/README create mode 100644 examples/iceblink/example.v create mode 100644 examples/iceblink/iceblink.pcf diff --git a/examples/iceblink/Makefile b/examples/iceblink/Makefile new file mode 100644 index 0000000..8f908a8 --- /dev/null +++ b/examples/iceblink/Makefile @@ -0,0 +1,26 @@ +PROJ = example +PIN_DEF = iceblink.pcf +DEVICE = 1k + +all: $(PROJ).bin + +%.blif: %.v + yosys -p 'synth_ice40 -top top -blif $@' $< + +%.asc: $(PIN_DEF) %.blif + arachne-pnr -d $(DEVICE) -o $@ -p $^ -P vq100 + +%.bin: %.asc + icepack $< $@ + +prog: $(PROJ).bin + iCEburn.py -e -v -w $< + +sudo-prog: $(PROJ).bin + @echo 'Executing prog as root!!!' + iCEburn.py -e -v -w $< + +clean: + rm -f $(PROJ).blif $(PROJ).asc $(PROJ).bin + +.PHONY: all prog clean diff --git a/examples/iceblink/README b/examples/iceblink/README new file mode 100644 index 0000000..d43a7ae --- /dev/null +++ b/examples/iceblink/README @@ -0,0 +1,10 @@ +Note, there are at least two similar looking versions of the iCEblink40 evaluation board: +-iCEblink40-HX1K +-iCEblink40-LP1K + +This example assumes the iCEblink40-HX1K board. + +The iCEblink40 boards have an on-board programmer with USB interface from Digilent. +You need iCEburn to program the FPGA via this interface (or the original vendor +tools). +https://github.com/davidcarne/iceBurn diff --git a/examples/iceblink/example.v b/examples/iceblink/example.v new file mode 100644 index 0000000..6bccc1e --- /dev/null +++ b/examples/iceblink/example.v @@ -0,0 +1,24 @@ +/* Binary counter displayed on LEDs (the 4 green ones on the right). + * Changes value about once a second. + */ +module top ( + input clk, + output LED2, + output LED3, + output LED4, + output LED5 +); + + localparam BITS = 4; + localparam LOG2DELAY = 22; + + reg [BITS+LOG2DELAY-1:0] counter = 0; + reg [BITS-1:0] outcnt; + + always@(posedge clk) begin + counter <= counter + 1; + outcnt <= counter >> LOG2DELAY; + end + + assign {LED2, LED3, LED4, LED5} = outcnt; +endmodule diff --git a/examples/iceblink/iceblink.pcf b/examples/iceblink/iceblink.pcf new file mode 100644 index 0000000..0d5e6c1 --- /dev/null +++ b/examples/iceblink/iceblink.pcf @@ -0,0 +1,5 @@ +set_io LED2 59 +set_io LED3 56 +set_io LED4 53 +set_io LED5 51 +set_io clk 13 -- cgit v1.2.3