sv: Add test scripts for typedefs
authorDavid Shah <dave@ds0.me>
Fri, 20 Sep 2019 12:00:26 +0000 (13:00 +0100)
committerDavid Shah <dave@ds0.me>
Thu, 3 Oct 2019 08:54:14 +0000 (09:54 +0100)
Signed-off-by: David Shah <dave@ds0.me>
Makefile
tests/svtypes/.gitignore [new file with mode: 0644]
tests/svtypes/run-test.sh [new file with mode: 0755]
tests/svtypes/typedef_memory.ys [new file with mode: 0644]
tests/svtypes/typedef_memory_2.ys [new file with mode: 0644]

index 2644721beeb153055132e99e42d26943a2769e3e..4dfed54eb057d4048a98e3a67e1ad789ffb05efa 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -708,6 +708,7 @@ test: $(TARGETS) $(EXTRA_TARGETS)
        +cd tests/various && bash run-test.sh
        +cd tests/sat && bash run-test.sh
        +cd tests/svinterfaces && bash run-test.sh $(SEEDOPT)
+       +cd tests/svtypes && bash run-test.sh $(SEEDOPT)
        +cd tests/proc && bash run-test.sh
        +cd tests/opt && bash run-test.sh
        +cd tests/aiger && bash run-test.sh $(ABCOPT)
diff --git a/tests/svtypes/.gitignore b/tests/svtypes/.gitignore
new file mode 100644 (file)
index 0000000..b48f808
--- /dev/null
@@ -0,0 +1,3 @@
+/*.log
+/*.out
+/run-test.mk
diff --git a/tests/svtypes/run-test.sh b/tests/svtypes/run-test.sh
new file mode 100755 (executable)
index 0000000..09a30ee
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+set -e
+{
+echo "all::"
+for x in *.ys; do
+       echo "all:: run-$x"
+       echo "run-$x:"
+       echo "  @echo 'Running $x..'"
+       echo "  @../../yosys -ql ${x%.ys}.log $x"
+done
+for x in *.sv; do
+       if [ ! -f "${x%.sv}.ys"  ]; then
+               echo "all:: check-$x"
+               echo "check-$x:"
+               echo "  @echo 'Checking $x..'"
+               echo "  @../../yosys -ql ${x%.sv}.log -p \"prep -top top; sat -verify -prove-asserts\" $x"
+       fi
+done
+} > run-test.mk
+exec ${MAKE:-make} -f run-test.mk
diff --git a/tests/svtypes/typedef_memory.ys b/tests/svtypes/typedef_memory.ys
new file mode 100644 (file)
index 0000000..bc1127d
--- /dev/null
@@ -0,0 +1,3 @@
+read -sv typedef_memory.sv
+prep -top top
+select -assert-count 1 t:$mem r:SIZE=16 %i r:WIDTH=4 %i
\ No newline at end of file
diff --git a/tests/svtypes/typedef_memory_2.ys b/tests/svtypes/typedef_memory_2.ys
new file mode 100644 (file)
index 0000000..571e289
--- /dev/null
@@ -0,0 +1,4 @@
+read -sv typedef_memory_2.sv
+prep -top top
+dump
+select -assert-count 1 t:$mem r:SIZE=16 %i r:WIDTH=4 %i
\ No newline at end of file