aboutsummaryrefslogtreecommitdiffstats
path: root/machxo2/examples/simtest.sh
diff options
context:
space:
mode:
authorWilliam D. Jones <thor0505@comcast.net>2021-02-08 17:22:09 -0500
committergatecat <gatecat@ds0.me>2021-02-12 10:36:59 +0000
commit3dbd5b0932d4851ac6c3cddf63ed0d6642d3c842 (patch)
tree51a0d3e7583a73a5b68b855456e34a19442d5e4f /machxo2/examples/simtest.sh
parent730e543ca65e97f1518fd0a9e692b233e15dcdbd (diff)
downloadnextpnr-3dbd5b0932d4851ac6c3cddf63ed0d6642d3c842.tar.gz
nextpnr-3dbd5b0932d4851ac6c3cddf63ed0d6642d3c842.tar.bz2
nextpnr-3dbd5b0932d4851ac6c3cddf63ed0d6642d3c842.zip
machxo2: Add prefix parameter to simtest.sh. Remove show command from
simtest.sh. Update README.md.
Diffstat (limited to 'machxo2/examples/simtest.sh')
-rw-r--r--machxo2/examples/simtest.sh27
1 files changed, 15 insertions, 12 deletions
diff --git a/machxo2/examples/simtest.sh b/machxo2/examples/simtest.sh
index 53f2e728..2c7f6f30 100644
--- a/machxo2/examples/simtest.sh
+++ b/machxo2/examples/simtest.sh
@@ -1,11 +1,11 @@
#!/usr/bin/env bash
-if [ $# -lt 1 ]; then
- echo "Usage: $0 mode"
+if [ $# -lt 2 ]; then
+ echo "Usage: $0 prefix mode"
exit -1
fi
-case $1 in
+case $2 in
"pack")
NEXTPNR_MODE="--pack-only"
;;
@@ -21,16 +21,19 @@ case $1 in
;;
esac
+if [ ! -f ${1}_tb.v ]; then
+ echo "No testbench file (${1}_tb.v) found for ${1}.v"
+ exit -3
+fi
+
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 ${1}.v
+ synth_machxo2 -json ${1}.json"
+${NEXTPNR:-../../nextpnr-machxo2} $NEXTPNR_MODE --1200 --package QFN32 --no-iobs --json ${1}.json --write ${2}${1}.json
${YOSYS:-yosys} -p "read_verilog -lib +/machxo2/cells_sim.v
- read_json ${1}blinky.json
+ read_json ${2}${1}.json
clean -purge
- show -format png -prefix ${1}blinky
- write_verilog -noattr -norename ${1}blinky.v"
-iverilog -o blinky_simtest ${CELLS_SIM:-`${YOSYS:yosys}-config --datdir/machxo2/cells_sim.v`} blinky_tb.v ${1}blinky.v
-vvp -N ./blinky_simtest
+ write_verilog -noattr -norename ${2}${1}.v"
+iverilog -o ${1}_simtest ${CELLS_SIM:-`${YOSYS:yosys}-config --datdir/machxo2/cells_sim.v`} ${1}_tb.v ${2}${1}.v
+vvp -N ./${1}_simtest