aboutsummaryrefslogtreecommitdiffstats
path: root/machxo2/examples/simple.sh
blob: c977bf1af953e1279ce7312d1c0a6207258d2e1d (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
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env bash

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

case $1 in
    "pack")
        NEXTPNR_MODE="--pack-only"
        ;;
    "place")
        NEXTPNR_MODE="--no-route"
        ;;
    "pnr")
        NEXTPNR_MODE=""
        ;;
    *)
        echo "Mode string must be \"pack\", \"place\", or \"pnr\""
        exit -2
        ;;
esac

set -ex

${YOSYS:-yosys} -p "read_verilog blinky.v
                    synth_machxo2 -json blinky.json
                    show -format png -prefix blinky"
${NEXTPNR:-../../nextpnr-machxo2} $NEXTPNR_MODE --1200 --package QFN32 --no-iobs --json blinky.json --write ${1}blinky.json
${YOSYS:-yosys} -p "read_verilog -lib +/machxo2/cells_sim.v
                    read_json ${1}blinky.json
                    clean -purge
                    show -format png -prefix ${1}blinky
                    write_verilog -noattr -norename ${1}blinky.v"