From 47d28bff1206fb007238b16fe4ad9fea76970002 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Thu, 29 Dec 2016 13:46:20 +0100 Subject: Added iCEZUM example --- examples/icezum/.gitignore | 4 ++++ examples/icezum/Makefile | 30 ++++++++++++++++++++++++++++++ examples/icezum/example.v | 25 +++++++++++++++++++++++++ examples/icezum/icezum.pcf | 9 +++++++++ 4 files changed, 68 insertions(+) create mode 100644 examples/icezum/.gitignore create mode 100644 examples/icezum/Makefile create mode 100644 examples/icezum/example.v create mode 100644 examples/icezum/icezum.pcf (limited to 'examples') diff --git a/examples/icezum/.gitignore b/examples/icezum/.gitignore new file mode 100644 index 0000000..c1fa30b --- /dev/null +++ b/examples/icezum/.gitignore @@ -0,0 +1,4 @@ +example.bin +example.blif +example.asc +example.rpt diff --git a/examples/icezum/Makefile b/examples/icezum/Makefile new file mode 100644 index 0000000..cad44d2 --- /dev/null +++ b/examples/icezum/Makefile @@ -0,0 +1,30 @@ +PROJ = example +PIN_DEF = icezum.pcf +DEVICE = hx1k + +all: $(PROJ).rpt $(PROJ).bin + +%.blif: %.v + yosys -p 'synth_ice40 -top top -blif $@' $< + +%.asc: $(PIN_DEF) %.blif + arachne-pnr -d $(subst hx,,$(subst lp,,$(DEVICE))) -o $@ -p $^ + +%.bin: %.asc + icepack $< $@ + +%.rpt: %.asc + icetime -d $(DEVICE) -mtr $@ $< + +prog: $(PROJ).bin + iceprog $< + +sudo-prog: $(PROJ).bin + @echo 'Executing prog as root!!!' + sudo iceprog $< + +clean: + rm -f $(PROJ).blif $(PROJ).asc $(PROJ).rpt $(PROJ).bin + +.SECONDARY: +.PHONY: all prog clean diff --git a/examples/icezum/example.v b/examples/icezum/example.v new file mode 100644 index 0000000..9bdf587 --- /dev/null +++ b/examples/icezum/example.v @@ -0,0 +1,25 @@ +module top ( + input clk, + output LED0, + output LED1, + output LED2, + output LED3, + output LED4, + output LED5, + output LED6, + output LED7 +); + + localparam BITS = 3; + localparam LOG2DELAY = 20; + + reg [BITS+LOG2DELAY-1:0] counter = 0; + reg [BITS-1:0] outcnt; + + always@(posedge clk) begin + counter <= counter + 1; + outcnt <= counter >> LOG2DELAY; + end + + assign {LED7, LED6, LED5, LED4, LED3, LED2, LED1, LED0} = 1 << outcnt; +endmodule diff --git a/examples/icezum/icezum.pcf b/examples/icezum/icezum.pcf new file mode 100644 index 0000000..4139e7f --- /dev/null +++ b/examples/icezum/icezum.pcf @@ -0,0 +1,9 @@ +set_io LED0 95 +set_io LED1 96 +set_io LED2 97 +set_io LED3 98 +set_io LED4 99 +set_io LED5 101 +set_io LED6 102 +set_io LED7 104 +set_io clk 21 -- cgit v1.2.3