aboutsummaryrefslogtreecommitdiffstats
path: root/machxo2/examples/demo-vhdl.sh
blob: 4bdab54a8a25dc411c56c1bca2e47864ae3fd218 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh

if [ $# -lt 1 ]; then
    echo "Usage: $0 prefix"
    exit -1
fi

if ! grep -q "LOC" $1.vhd; then
    echo "$1.vhd does not have LOC constraints for tinyfpga_a."
    exit -2
fi

if [ ! -z ${TRELLIS_DB+x} ]; then
    DB_ARG="--db $TRELLIS_DB"
fi

set -ex

${YOSYS:-yosys} -p "ghdl --std=08 prims.vhd ${1}.vhd -e;
                    attrmap -tocase LOC
                    synth_machxo2 -json ${1}-vhdl.json"
${NEXTPNR:-../../nextpnr-machxo2} --1200 --package QFN32 --no-iobs --json $1-vhdl.json --textcfg $1-vhdl.txt
ecppack --compress $DB_ARG $1-vhdl.txt $1-vhdl.bit
tinyproga -b $1-vhdl.bit