aboutsummaryrefslogtreecommitdiffstats
path: root/icezum
diff options
context:
space:
mode:
authorobijuan <juan@iearobotics.com>2017-02-11 11:31:45 +0100
committerobijuan <juan@iearobotics.com>2017-02-11 11:31:45 +0100
commitfefc6e76ffe3d88dfbd1badce83600e3cb919179 (patch)
treefa77f57064cc615090aa714c97d6f74ba0c56397 /icezum
parent544101c7674cdc4d7dd06d4d401a444870143d48 (diff)
parent2e9f36985f1b320a8cf5d57fba40aa822cd0f6ab (diff)
downloadghdl-yosys-plugin-fefc6e76ffe3d88dfbd1badce83600e3cb919179.tar.gz
ghdl-yosys-plugin-fefc6e76ffe3d88dfbd1badce83600e3cb919179.tar.bz2
ghdl-yosys-plugin-fefc6e76ffe3d88dfbd1badce83600e3cb919179.zip
blink example for the icezum alhambra board added
Diffstat (limited to 'icezum')
-rw-r--r--icezum/blink/Makefile32
-rw-r--r--icezum/blink/README.md16
-rw-r--r--icezum/blink/blink.pcf11
-rw-r--r--icezum/blink/blink.vhdl35
-rw-r--r--icezum/led_on/Makefile1
5 files changed, 94 insertions, 1 deletions
diff --git a/icezum/blink/Makefile b/icezum/blink/Makefile
new file mode 100644
index 0000000..e7c2964
--- /dev/null
+++ b/icezum/blink/Makefile
@@ -0,0 +1,32 @@
+PROJ = blink
+PIN_DEF = blink.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/blink/README.md b/icezum/blink/README.md
new file mode 100644
index 0000000..e61330b
--- /dev/null
+++ b/icezum/blink/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/blink/blink.pcf b/icezum/blink/blink.pcf
new file mode 100644
index 0000000..2f686f6
--- /dev/null
+++ b/icezum/blink/blink.pcf
@@ -0,0 +1,11 @@
+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
+
+
diff --git a/icezum/blink/blink.vhdl b/icezum/blink/blink.vhdl
new file mode 100644
index 0000000..9279622
--- /dev/null
+++ b/icezum/blink/blink.vhdl
@@ -0,0 +1,35 @@
+library ieee;
+use ieee.std_logic_1164.all;
+use ieee.numeric_std.all;
+
+entity blink is
+ port (clk : in std_logic;
+ led0, led1, led2, led3, led4, led5, led6, led7 : out std_logic);
+end blink;
+
+architecture synth of blink is
+ signal clk_4hz: std_logic;
+begin
+ process (clk)
+ -- 3_000_000 is 0x2dc6c0
+ variable counter : unsigned (23 downto 0);
+ begin
+ if rising_edge(clk) then
+ if counter = 2_999_999 then
+ counter := x"000000";
+ clk_4hz <= not clk_4hz;
+ else
+ counter := counter + 1;
+ end if;
+ end if;
+ end process;
+
+ led0 <= clk_4hz;
+ led1 <= clk_4hz;
+ led2 <= clk_4hz;
+ led3 <= clk_4hz;
+ led4 <= clk_4hz;
+ led5 <= clk_4hz;
+ led6 <= clk_4hz;
+ led7 <= clk_4hz;
+end synth;
diff --git a/icezum/led_on/Makefile b/icezum/led_on/Makefile
index 53f078b..b85feb3 100644
--- a/icezum/led_on/Makefile
+++ b/icezum/led_on/Makefile
@@ -7,7 +7,6 @@ all: $(PROJ).rpt $(PROJ).bin
%.blif: %.vhdl
ghdl -a $(PROJ).vhdl
yosys -m ../../ghdl.so -p 'ghdl $(PROJ); synth_ice40 -blif $@'
- ##yosys -p 'synth_ice40 -top top -blif $@' $<
%.asc: $(PIN_DEF) %.blif
arachne-pnr -d $(subst hx,,$(subst lp,,$(DEVICE))) -o $@ -p $^