aboutsummaryrefslogtreecommitdiffstats
path: root/icezum
diff options
context:
space:
mode:
authorJuan Gonzalez-Gomez <juan@iearobotics.com>2017-02-11 10:55:40 +0100
committertgingold <tgingold@users.noreply.github.com>2017-02-11 10:55:40 +0100
commit2e9f36985f1b320a8cf5d57fba40aa822cd0f6ab (patch)
tree38f2d2991dba375ad668c291d32463bbf1010d1c /icezum
parent726355628b623bf84ec0d97707589be9df2a8d5a (diff)
downloadghdl-yosys-plugin-2e9f36985f1b320a8cf5d57fba40aa822cd0f6ab.tar.gz
ghdl-yosys-plugin-2e9f36985f1b320a8cf5d57fba40aa822cd0f6ab.tar.bz2
ghdl-yosys-plugin-2e9f36985f1b320a8cf5d57fba40aa822cd0f6ab.zip
Added a hello world example (led_on) for the icezum Alhambra board (#2)
Diffstat (limited to 'icezum')
-rw-r--r--icezum/led_on/Makefile32
-rw-r--r--icezum/led_on/README.md16
-rw-r--r--icezum/led_on/led_on.pcf9
-rw-r--r--icezum/led_on/led_on.vhdl20
4 files changed, 77 insertions, 0 deletions
diff --git a/icezum/led_on/Makefile b/icezum/led_on/Makefile
new file mode 100644
index 0000000..8ef70dd
--- /dev/null
+++ b/icezum/led_on/Makefile
@@ -0,0 +1,32 @@
+PROJ = led_on
+PIN_DEF = led_on.pcf
+DEVICE = hx1k
+
+all: $(PROJ).rpt $(PROJ).bin
+
+%.blif: %.vhdl
+ ghdl -a $(PROJ).vhdl
+ yosys -m ../../ghdl.so -p 'ghdl led_on; synth_ice40 -blif $@'
+ ##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 work-obj93.cf
+
+.SECONDARY:
+.PHONY: all prog clean
diff --git a/icezum/led_on/README.md b/icezum/led_on/README.md
new file mode 100644
index 0000000..9073c11
--- /dev/null
+++ b/icezum/led_on/README.md
@@ -0,0 +1,16 @@
+A hello world example for the **Icezum Alhambra board**
+It just turn on the led0 and turn off the others
+
+Execute
+
+```sh
+$ make
+```
+
+for synthesizing the example and
+
+```sh
+$ make prog
+```
+
+for programing the board
diff --git a/icezum/led_on/led_on.pcf b/icezum/led_on/led_on.pcf
new file mode 100644
index 0000000..522e201
--- /dev/null
+++ b/icezum/led_on/led_on.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
+
diff --git a/icezum/led_on/led_on.vhdl b/icezum/led_on/led_on.vhdl
new file mode 100644
index 0000000..49a88ad
--- /dev/null
+++ b/icezum/led_on/led_on.vhdl
@@ -0,0 +1,20 @@
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+
+entity led_on is
+ port (led0, led1, led2, led3, led4, led5, led6, led7 : out std_logic);
+end led_on;
+
+architecture test of led_on is
+begin
+
+ -- Turn on the Led0
+ led0 <= '1';
+
+ -- Turn off the other leds
+ (led1, led2, led3, led4, led5, led6, led7) <= std_logic_vector'("0000000");
+
+end test;
+
+