diff options
-rw-r--r-- | icezum/pushbutton/Makefile | 32 | ||||
-rw-r--r-- | icezum/pushbutton/README.md | 17 | ||||
-rw-r--r-- | icezum/pushbutton/pushbutton.pcf | 7 | ||||
-rw-r--r-- | icezum/pushbutton/pushbutton.vhdl | 14 | ||||
-rw-r--r-- | icezum/pushbutton_and/Makefile | 32 | ||||
-rw-r--r-- | icezum/pushbutton_and/README.md | 17 | ||||
-rw-r--r-- | icezum/pushbutton_and/pushbutton_and.pcf | 4 | ||||
-rw-r--r-- | icezum/pushbutton_and/pushbutton_and.vhdl | 18 |
8 files changed, 141 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..6aba730 --- /dev/null +++ b/icezum/pushbutton/README.md @@ -0,0 +1,17 @@ +A hello world example for the **Icezum Alhambra board** +Testing the sw1 pushbutton. The state of the button and its negated are wired +to led0 and led7 respectively + +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; diff --git a/icezum/pushbutton_and/Makefile b/icezum/pushbutton_and/Makefile new file mode 100644 index 0000000..2042685 --- /dev/null +++ b/icezum/pushbutton_and/Makefile @@ -0,0 +1,32 @@ +PROJ = pushbutton_and +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_and/README.md b/icezum/pushbutton_and/README.md new file mode 100644 index 0000000..b4734c5 --- /dev/null +++ b/icezum/pushbutton_and/README.md @@ -0,0 +1,17 @@ +A hello world example for the **Icezum Alhambra board** +Testing the sw1 and sw1 pushbutton with an AND gate. The state of the AND +and its negated are wired to the led0 and led7 respectively + +Execute + +```sh +$ make +``` + +for synthesizing the example and + +```sh +$ make prog +``` + +for programing the board diff --git a/icezum/pushbutton_and/pushbutton_and.pcf b/icezum/pushbutton_and/pushbutton_and.pcf new file mode 100644 index 0000000..31883fc --- /dev/null +++ b/icezum/pushbutton_and/pushbutton_and.pcf @@ -0,0 +1,4 @@ +set_io sw1 10
+set_io sw2 11
+set_io led0 95
+set_io led7 104
diff --git a/icezum/pushbutton_and/pushbutton_and.vhdl b/icezum/pushbutton_and/pushbutton_and.vhdl new file mode 100644 index 0000000..0a9831d --- /dev/null +++ b/icezum/pushbutton_and/pushbutton_and.vhdl @@ -0,0 +1,18 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +entity pushbutton_and is + port (sw1, sw2 : in std_logic; + led0, led7 : out std_logic); +end pushbutton_and; + +architecture synth of pushbutton_and is + +signal a : std_logic; + +begin + a <= sw1 and sw2; + led0 <= a; + led7 <= not a; +end synth; |