aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2016-12-29 13:46:20 +0100
committerClifford Wolf <clifford@clifford.at>2016-12-29 13:47:36 +0100
commit47d28bff1206fb007238b16fe4ad9fea76970002 (patch)
tree25ebfec188a9e4ebb8af3a7e0e53efaa64835300 /examples
parent7d8337a138fef3417b9f41cc6635c9562f4d9b4a (diff)
downloadicestorm-47d28bff1206fb007238b16fe4ad9fea76970002.tar.gz
icestorm-47d28bff1206fb007238b16fe4ad9fea76970002.tar.bz2
icestorm-47d28bff1206fb007238b16fe4ad9fea76970002.zip
Added iCEZUM example
Diffstat (limited to 'examples')
-rw-r--r--examples/icezum/.gitignore4
-rw-r--r--examples/icezum/Makefile30
-rw-r--r--examples/icezum/example.v25
-rw-r--r--examples/icezum/icezum.pcf9
4 files changed, 68 insertions, 0 deletions
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