aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2017-10-21 19:14:06 +0100
committerDavid Shah <davey1576@gmail.com>2017-10-21 19:14:06 +0100
commit88f91de113c894173b1887f91cde52edc8ac50e2 (patch)
tree0b82835e568baafea2d766b3308b22107957f6a7 /examples
parentec419b42067780c38bd6f38cc6f0706d15b87d1e (diff)
downloadicestorm-88f91de113c894173b1887f91cde52edc8ac50e2.tar.gz
icestorm-88f91de113c894173b1887f91cde52edc8ac50e2.tar.bz2
icestorm-88f91de113c894173b1887f91cde52edc8ac50e2.zip
Basic example, outputs work but inputs don't
Diffstat (limited to 'examples')
-rw-r--r--examples/up5k/.gitignore4
-rw-r--r--examples/up5k/Makefile36
-rw-r--r--examples/up5k/example.v10
-rw-r--r--examples/up5k/up5k.pcf3
4 files changed, 53 insertions, 0 deletions
diff --git a/examples/up5k/.gitignore b/examples/up5k/.gitignore
new file mode 100644
index 0000000..c1fa30b
--- /dev/null
+++ b/examples/up5k/.gitignore
@@ -0,0 +1,4 @@
+example.bin
+example.blif
+example.asc
+example.rpt
diff --git a/examples/up5k/Makefile b/examples/up5k/Makefile
new file mode 100644
index 0000000..ea16f06
--- /dev/null
+++ b/examples/up5k/Makefile
@@ -0,0 +1,36 @@
+PROJ = example
+PIN_DEF = up5k.pcf
+DEVICE = up5k
+# Relative paths for easier development without messing with installed version
+ARACHNE = ../../../arachne-pnr/bin/arachne-pnr
+ARACHNE_ARGS = -c ../../icebox/chipdb-5k.txt
+ICEPACK = ../../icepack/icepack
+ICETIME = ../../icetime/icetime
+ICEPROG = ../../iceprog/iceprog
+
+all: $(PROJ).bin
+
+%.blif: %.v
+ yosys -p 'synth_ice40 -top top -blif $@' $<
+
+%.asc: $(PIN_DEF) %.blif
+ $(ARACHNE) $(ARACHNE_ARGS) -d $(subst up,,$(subst hx,,$(subst lp,,$(DEVICE)))) -o $@ -p $^
+
+%.bin: %.asc
+ $(ICEPACK) $< $@
+
+%.rpt: %.asc
+ $(ICETIME) -d $(DEVICE) -mtr $@ $<
+
+prog: $(PROJ).bin
+ $(ICEPROG) -S $<
+
+sudo-prog: $(PROJ).bin
+ @echo 'Executing prog as root!!!'
+ sudo $(ICEPROG) -S $<
+
+clean:
+ rm -f $(PROJ).blif $(PROJ).asc $(PROJ).rpt $(PROJ).bin
+
+.SECONDARY:
+.PHONY: all prog clean
diff --git a/examples/up5k/example.v b/examples/up5k/example.v
new file mode 100644
index 0000000..01b76b8
--- /dev/null
+++ b/examples/up5k/example.v
@@ -0,0 +1,10 @@
+module top (
+ input btn,
+ output LED0,
+ output LED1,
+);
+
+assign LED0 = !btn;
+assign LED1 = btn;
+
+endmodule
diff --git a/examples/up5k/up5k.pcf b/examples/up5k/up5k.pcf
new file mode 100644
index 0000000..b1d1263
--- /dev/null
+++ b/examples/up5k/up5k.pcf
@@ -0,0 +1,3 @@
+set_io LED0 12
+set_io LED1 21
+set_io btn 26