aboutsummaryrefslogtreecommitdiffstats
path: root/icezum
diff options
context:
space:
mode:
authorobijuan <juan@iearobotics.com>2017-02-12 16:56:33 +0100
committerobijuan <juan@iearobotics.com>2017-02-12 16:56:33 +0100
commitff7dc01a1da2e980f3488592ce3f78fdc4f59191 (patch)
tree575177cae33f6fff687cf620626bbc36587861e9 /icezum
parentfefc6e76ffe3d88dfbd1badce83600e3cb919179 (diff)
downloadghdl-yosys-plugin-ff7dc01a1da2e980f3488592ce3f78fdc4f59191.tar.gz
ghdl-yosys-plugin-ff7dc01a1da2e980f3488592ce3f78fdc4f59191.tar.bz2
ghdl-yosys-plugin-ff7dc01a1da2e980f3488592ce3f78fdc4f59191.zip
Icezum Alhambra board example: Testing the pushbutton
Diffstat (limited to 'icezum')
-rw-r--r--icezum/pushbutton/Makefile32
-rw-r--r--icezum/pushbutton/README.md16
-rw-r--r--icezum/pushbutton/pushbutton.pcf7
-rw-r--r--icezum/pushbutton/pushbutton.vhdl14
4 files changed, 69 insertions, 0 deletions
diff --git a/icezum/pushbutton/Makefile b/icezum/pushbutton/Makefile
new file mode 100644
index 0000000..d483e9a
--- /dev/null
+++ b/icezum/pushbutton/Makefile
@@ -0,0 +1,32 @@
+PROJ = pushbutton
+PIN_DEF = $(PROJ).pcf
+DEVICE = hx1k
+
+all: $(PROJ).rpt $(PROJ).bin
+
+%.blif: %.vhdl
+ ghdl -a $(PROJ).vhdl
+ yosys -m ../../ghdl.so -p 'ghdl $(PROJ); synth_ice40 -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 work-obj93.cf
+
+.SECONDARY:
+.PHONY: all prog clean
diff --git a/icezum/pushbutton/README.md b/icezum/pushbutton/README.md
new file mode 100644
index 0000000..e61330b
--- /dev/null
+++ b/icezum/pushbutton/README.md
@@ -0,0 +1,16 @@
+A hello world example for the **Icezum Alhambra board**
+It just blinks all the leds
+
+Execute
+
+```sh
+$ make
+```
+
+for synthesizing the example and
+
+```sh
+$ make prog
+```
+
+for programing the board
diff --git a/icezum/pushbutton/pushbutton.pcf b/icezum/pushbutton/pushbutton.pcf
new file mode 100644
index 0000000..807307f
--- /dev/null
+++ b/icezum/pushbutton/pushbutton.pcf
@@ -0,0 +1,7 @@
+set_io sw1 10
+set_io led0 95
+set_io led7 104
+
+
+
+
diff --git a/icezum/pushbutton/pushbutton.vhdl b/icezum/pushbutton/pushbutton.vhdl
new file mode 100644
index 0000000..8ad516e
--- /dev/null
+++ b/icezum/pushbutton/pushbutton.vhdl
@@ -0,0 +1,14 @@
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+
+entity pushbutton is
+ port (sw1 : in std_logic;
+ led0, led7 : out std_logic);
+end pushbutton;
+
+architecture synth of pushbutton is
+begin
+ led0 <= sw1;
+ led7 <= not sw1;
+end synth;