aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAimylios <20016942+aimylios@users.noreply.github.com>2020-04-19 14:20:37 +0200
committertgingold <tgingold@users.noreply.github.com>2020-04-19 16:08:35 +0200
commit8bb8453af7acd34705a449cac9cd8427d6db43ba (patch)
tree9243aaa5ec9c4f91abd7291af432dbba41772815
parentd941c8f65bbbb90f97c17e26b5610624c2198b10 (diff)
downloadghdl-yosys-plugin-8bb8453af7acd34705a449cac9cd8427d6db43ba.tar.gz
ghdl-yosys-plugin-8bb8453af7acd34705a449cac9cd8427d6db43ba.tar.bz2
ghdl-yosys-plugin-8bb8453af7acd34705a449cac9cd8427d6db43ba.zip
Improve examples for Lattice iCEstick
- move "leds" examples to subdirectory - add Makefile - add *.json files to .gitignore - adjust README.md and fix some typos
-rw-r--r--.gitignore1
-rw-r--r--README.md12
-rw-r--r--examples/icestick/leds/Makefile34
-rw-r--r--examples/icestick/leds/blink.vhdl (renamed from examples/icestick/blink.vhdl)0
-rw-r--r--examples/icestick/leds/fixed1.vhdl (renamed from examples/icestick/fixed1.vhdl)0
-rw-r--r--examples/icestick/leds/leds.pcf (renamed from examples/icestick/leds.pcf)0
-rw-r--r--examples/icestick/leds/leds.vhdl (renamed from examples/icestick/leds.vhdl)0
-rw-r--r--examples/icestick/leds/multi1.vhdl (renamed from examples/icestick/multi1.vhdl)0
-rw-r--r--examples/icestick/leds/multi2.vhdl (renamed from examples/icestick/multi2.vhdl)0
-rw-r--r--examples/icestick/leds/rotate1.vhdl (renamed from examples/icestick/rotate1.vhdl)0
-rw-r--r--examples/icestick/leds/rotate2.vhdl (renamed from examples/icestick/rotate2.vhdl)0
-rw-r--r--examples/icestick/leds/rotate3.vhdl (renamed from examples/icestick/rotate3.vhdl)0
-rw-r--r--examples/icestick/leds/rotate4.vhdl (renamed from examples/icestick/rotate4.vhdl)0
-rw-r--r--examples/icestick/leds/spin1.vhdl (renamed from examples/icestick/spin1.vhdl)0
-rw-r--r--examples/icestick/leds/spin2.vhdl (renamed from examples/icestick/spin2.vhdl)0
-rwxr-xr-xtestsuite/examples/test-icestick/testsuite.sh3
16 files changed, 45 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 2929063..33d93af 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
.gdb_history
*.bin
*.asc
+*.json
*.blif
*.cf
*.rpt
diff --git a/README.md b/README.md
index 359746b..ba8b0a2 100644
--- a/README.md
+++ b/README.md
@@ -53,7 +53,7 @@ yosys-config --exec ln -s "$GHDL_PREFIX/lib/ghdl_yosys.so" --datdir/plugins/ghdl
- Get [yosys](https://github.com/YosysHQ/yosys) sources.
-- Get ghdlsynth-beta and:
+- Get ghdl-yosys-plugin and:
- Patch yosys sources using `yosys.diff`.
- Copy `src/*` to `yosys/frontends/ghdl`.
- Configure yosys by adding (to) `Makefile.conf`:
@@ -70,7 +70,7 @@ GHDL_DIR := <ghdl install dir>
Example for icestick, using ghdl, yosys, nextpnr and icestorm:
```sh
-cd examples/icestick/
+cd examples/icestick/leds/
# Analyse VHDL sources
ghdl -a leds.vhdl
@@ -78,7 +78,7 @@ ghdl -a spin1.vhdl
# Synthesize the design.
# NOTE: if ghdl is built as a module, set MODULE to '-m ghdl' or '-m path/to/ghdl.so'
-yosys $MODULE -p 'ghdl leds; synth_ice40 --json leds.json'
+yosys $MODULE -p 'ghdl leds; synth_ice40 -json leds.json'
# P&R
nextpnr-ice40 --package hx1k --pcf leds.pcf --asc leds.asc --json leds.json
@@ -90,7 +90,11 @@ icepack leds.asc leds.bin
iceprog leds.bin
```
-Alternatively, it is possible to analyze, elaborate and synthesize VHDL sources at once, instead of calling ghdl and yosys in two steps. In this example: `yosys $MODULE -p 'ghdl leds.vhdl spin1.vhdl -e leds; synth_ice40 --json leds.json`.
+Alternatively, it is possible to analyze, elaborate and synthesize VHDL sources at once, instead of calling ghdl and yosys in two steps. In this example:
+
+```
+yosys $MODULE -p 'ghdl leds.vhdl spin1.vhdl -e leds; synth_ice40 -json leds.json'
+```
## Docker
diff --git a/examples/icestick/leds/Makefile b/examples/icestick/leds/Makefile
new file mode 100644
index 0000000..77a610d
--- /dev/null
+++ b/examples/icestick/leds/Makefile
@@ -0,0 +1,34 @@
+PROJ = blink
+#PROJ = fixed1
+#PROJ = multi1
+#PROJ = multi2
+#PROJ = rotate1
+#PROJ = rotate2
+#PROJ = rotate3
+#PROJ = rotate4
+#PROJ = spin1
+#PROJ = spin2
+
+PIN_DEF = leds.pcf
+DEVICE = hx1k
+
+all: $(PROJ).bin
+
+%.json: leds.vhdl %.vhdl
+ yosys -m ghdl -p 'ghdl $^ -e leds; synth_ice40 -json $@'
+
+%.asc: %.json
+ nextpnr-ice40 --package $(DEVICE) --pcf $(PIN_DEF) --json $< --asc $@
+
+%.bin: %.asc
+ icepack $< $@
+
+prog: $(PROJ).bin
+ iceprog $<
+
+clean:
+ rm -f $(PROJ).json $(PROJ).asc $(PROJ).bin
+
+.SECONDARY:
+
+.PHONY: all prog clean
diff --git a/examples/icestick/blink.vhdl b/examples/icestick/leds/blink.vhdl
index d7e6dd4..d7e6dd4 100644
--- a/examples/icestick/blink.vhdl
+++ b/examples/icestick/leds/blink.vhdl
diff --git a/examples/icestick/fixed1.vhdl b/examples/icestick/leds/fixed1.vhdl
index b1bbf4b..b1bbf4b 100644
--- a/examples/icestick/fixed1.vhdl
+++ b/examples/icestick/leds/fixed1.vhdl
diff --git a/examples/icestick/leds.pcf b/examples/icestick/leds/leds.pcf
index 397bdc4..397bdc4 100644
--- a/examples/icestick/leds.pcf
+++ b/examples/icestick/leds/leds.pcf
diff --git a/examples/icestick/leds.vhdl b/examples/icestick/leds/leds.vhdl
index 95aa5cf..95aa5cf 100644
--- a/examples/icestick/leds.vhdl
+++ b/examples/icestick/leds/leds.vhdl
diff --git a/examples/icestick/multi1.vhdl b/examples/icestick/leds/multi1.vhdl
index a304765..a304765 100644
--- a/examples/icestick/multi1.vhdl
+++ b/examples/icestick/leds/multi1.vhdl
diff --git a/examples/icestick/multi2.vhdl b/examples/icestick/leds/multi2.vhdl
index 78bf298..78bf298 100644
--- a/examples/icestick/multi2.vhdl
+++ b/examples/icestick/leds/multi2.vhdl
diff --git a/examples/icestick/rotate1.vhdl b/examples/icestick/leds/rotate1.vhdl
index 34c7afd..34c7afd 100644
--- a/examples/icestick/rotate1.vhdl
+++ b/examples/icestick/leds/rotate1.vhdl
diff --git a/examples/icestick/rotate2.vhdl b/examples/icestick/leds/rotate2.vhdl
index e51ec6c..e51ec6c 100644
--- a/examples/icestick/rotate2.vhdl
+++ b/examples/icestick/leds/rotate2.vhdl
diff --git a/examples/icestick/rotate3.vhdl b/examples/icestick/leds/rotate3.vhdl
index 213512f..213512f 100644
--- a/examples/icestick/rotate3.vhdl
+++ b/examples/icestick/leds/rotate3.vhdl
diff --git a/examples/icestick/rotate4.vhdl b/examples/icestick/leds/rotate4.vhdl
index e89aaa5..e89aaa5 100644
--- a/examples/icestick/rotate4.vhdl
+++ b/examples/icestick/leds/rotate4.vhdl
diff --git a/examples/icestick/spin1.vhdl b/examples/icestick/leds/spin1.vhdl
index 79e305c..79e305c 100644
--- a/examples/icestick/spin1.vhdl
+++ b/examples/icestick/leds/spin1.vhdl
diff --git a/examples/icestick/spin2.vhdl b/examples/icestick/leds/spin2.vhdl
index 0f23964..0f23964 100644
--- a/examples/icestick/spin2.vhdl
+++ b/examples/icestick/leds/spin2.vhdl
diff --git a/testsuite/examples/test-icestick/testsuite.sh b/testsuite/examples/test-icestick/testsuite.sh
index 7184fcc..a649937 100755
--- a/testsuite/examples/test-icestick/testsuite.sh
+++ b/testsuite/examples/test-icestick/testsuite.sh
@@ -7,8 +7,9 @@ src=../../../examples/icestick
# spin2
+LEDS_SRC=$src/leds
for f in fixed1 blink multi1 multi2 spin1 rotate1 rotate2 rotate3 rotate4; do
- synth_ice40 $src/leds.vhdl $src/${f}.vhdl -e leds
+ synth_ice40 $LEDS_SRC/leds.vhdl $LEDS_SRC/${f}.vhdl -e leds
done
UART_SRC=$src/uart/hdl