diff options
author | William D. Jones <thor0505@comcast.net> | 2021-02-08 00:07:39 -0500 |
---|---|---|
committer | gatecat <gatecat@ds0.me> | 2021-02-12 10:36:59 +0000 |
commit | 0aa472fb3adac0b76ef0b69831d5b83ff1200fe2 (patch) | |
tree | c69533dd8069cfd146d56483949d67dd14741c34 /machxo2/examples | |
parent | b9eb443e549ab8c81e0c6bc94538f9f2fe2821d4 (diff) | |
download | nextpnr-0aa472fb3adac0b76ef0b69831d5b83ff1200fe2.tar.gz nextpnr-0aa472fb3adac0b76ef0b69831d5b83ff1200fe2.tar.bz2 nextpnr-0aa472fb3adac0b76ef0b69831d5b83ff1200fe2.zip |
machxo2: Add prefix paramter to demo.sh.
Diffstat (limited to 'machxo2/examples')
-rw-r--r-- | machxo2/examples/.gitignore | 4 | ||||
-rw-r--r-- | machxo2/examples/README.md | 25 | ||||
-rw-r--r-- | machxo2/examples/demo.sh | 20 | ||||
-rw-r--r-- | machxo2/examples/demorgb.sh | 10 |
4 files changed, 37 insertions, 22 deletions
diff --git a/machxo2/examples/.gitignore b/machxo2/examples/.gitignore index 91167252..955c6e29 100644 --- a/machxo2/examples/.gitignore +++ b/machxo2/examples/.gitignore @@ -7,5 +7,5 @@ pack*.v place*.v pnr*.v abc.history -/tinyfpga.txt -/tinyfpga.bit +*.txt +*.bit diff --git a/machxo2/examples/README.md b/machxo2/examples/README.md index bcffeea3..fd84dc93 100644 --- a/machxo2/examples/README.md +++ b/machxo2/examples/README.md @@ -18,16 +18,14 @@ This contains a simple example of running `nextpnr-machxo2`: All possible inputs and resulting outputs can be tested in reasonable time by using `yosys`' built-in SAT solver or [`z3`](https://github.com/Z3Prover/z3), an external SMT solver. -* `demo.sh` creates a blinky bitstream for [TinyFPGA Ax](https://tinyfpga.com/a-series-guide.html) +* `demo.sh` creates bitstreams for [TinyFPGA Ax](https://tinyfpga.com/a-series-guide.html) and writes the resulting bitstream to MachXO2's internal flash using [`tinyproga`](https://github.com/tinyfpga/TinyFPGA-A-Programmer). -As `nextpnr-machxo2` is developed the contents `simple.sh`, `simtest.sh`, and -`mitertest.sh` are subject to change. +As `nextpnr-machxo2` is developed the contents `simple.sh`, `simtest.sh`, `mitertest.sh`, and `demo.sh` are subject to change. ## How To Run -The following applies to all `sh` scripts except `demo.sh`, which requires no -arguments. +The following applies to all `sh` scripts except `demo.sh`. Each `sh` script runs yosys and nextpnr to validate a blinky design in various ways. The `mode` argument to each script- `pack`, `place`, or `pnr`- stop @@ -42,8 +40,23 @@ SMT solver. To keep file count lower, all yosys scripts are written inline inside the `sh` scripts using the `-p` option. +`demo.sh` requires a prefix that matches one of the self-contained Verilog +examples in this directory. For instance, to create a bitstream from +`tinyfpga.v`, use `demo.sh tinyfpga`. The script will catch Verilog files which +are not meant to be programmed onto TinyFPA Ax. + ### Clean -To clean output files from _all_ scripts, run: `rm -rf *.dot *.json *.png *.vcd *.smt2 *.log tinyfpga.txt tinyfpga.bit {pack,place,pnr}*.v blinky_simtest*` +To clean output files from _all_ scripts, run: + +``` +rm -rf *.dot *.json *.png *.vcd *.smt2 *.log *.txt *.bit {pack,place,pnr}*.v blinky_simtest* +``` + +## Verilog Examples +* `blinky.v`/`blinky_tb.v`- A blinky example meant for simulation. +* `tinyfpga.v`- Blink the LED on TinyFPA Ax. +* `rgbcount.v`- Blink an RGB LED using TinyFPGA Ax, more closely-based on + [the TinyFPGA Ax guide](https://tinyfpga.com/a-series-guide.html). ## Environment Variables For Scripts diff --git a/machxo2/examples/demo.sh b/machxo2/examples/demo.sh index 6979f111..00cb0cd0 100644 --- a/machxo2/examples/demo.sh +++ b/machxo2/examples/demo.sh @@ -1,10 +1,22 @@ #!/bin/sh +if [ $# -lt 1 ]; then + echo "Usage: $0 prefix" + exit -1 +fi + +if ! grep -q "(\*.*LOC.*\*)" $1.v; then + echo "$1.v does not have LOC constraints for tinyfpga_a." + exit -2 +fi + if [ ! -z ${TRELLIS_DB+x} ]; then DB_ARG="--db $TRELLIS_DB" fi -${YOSYS:-yosys} -p 'synth_machxo2 -json tinyfpga.json' tinyfpga.v -${NEXTPNR:-../../nextpnr-machxo2} --1200 --package QFN32 --no-iobs --json tinyfpga.json --textcfg tinyfpga.txt -ecppack --compress $DB_ARG tinyfpga.txt tinyfpga.bit -tinyproga -b tinyfpga.bit +set -ex + +${YOSYS:-yosys} -p "synth_machxo2 -json $1.json" $1.v +${NEXTPNR:-../../nextpnr-machxo2} --1200 --package QFN32 --no-iobs --json $1.json --textcfg $1.txt +ecppack --compress $DB_ARG $1.txt $1.bit +tinyproga -b $1.bit diff --git a/machxo2/examples/demorgb.sh b/machxo2/examples/demorgb.sh deleted file mode 100644 index f68db8c3..00000000 --- a/machxo2/examples/demorgb.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -if [ ! -z ${TRELLIS_DB+x} ]; then - DB_ARG="--db $TRELLIS_DB" -fi - -${YOSYS:-yosys} -p 'synth_machxo2 -json rgbcount.json' rgbcount.v -${NEXTPNR:-../../nextpnr-machxo2} --1200 --package QFN32 --no-iobs --json rgbcount.json --textcfg rgbcount.txt -ecppack --compress $DB_ARG rgbcount.txt rgbcount.bit -tinyproga -b rgbcount.bit |