aboutsummaryrefslogtreecommitdiffstats
path: root/tests/various
diff options
context:
space:
mode:
authorJim Lawson <ucbjrl@berkeley.edu>2019-02-19 14:35:15 -0800
committerJim Lawson <ucbjrl@berkeley.edu>2019-02-19 14:35:15 -0800
commit5c4a72c43ef61420b4b099d87949b0fdba0f4b55 (patch)
tree91a718281febfe383312d7598fa0c58f0065ab6f /tests/various
parent5c504c5ae676488f7e0b53f827f189fa7cacb2c8 (diff)
downloadyosys-5c4a72c43ef61420b4b099d87949b0fdba0f4b55.tar.gz
yosys-5c4a72c43ef61420b4b099d87949b0fdba0f4b55.tar.bz2
yosys-5c4a72c43ef61420b4b099d87949b0fdba0f4b55.zip
Fix normal (non-array) hierarchy -auto-top.
Add simple test.
Diffstat (limited to 'tests/various')
-rw-r--r--tests/various/hierarchy.sh56
-rwxr-xr-xtests/various/run-test.sh10
2 files changed, 65 insertions, 1 deletions
diff --git a/tests/various/hierarchy.sh b/tests/various/hierarchy.sh
new file mode 100644
index 000000000..dcb4dc056
--- /dev/null
+++ b/tests/various/hierarchy.sh
@@ -0,0 +1,56 @@
+#!/usr/bin/env bash
+# Simple test of hierarchy -auto-top.
+
+set -e
+
+../../yosys -q -s - <<- EOY 2>&1 | grep "Automatically selected TOP as design top module"
+ read_verilog << EOV
+ module TOP(a, y);
+ input a;
+ output [31:0] y;
+
+ aoi12 p [31:0] (a, y);
+ endmodule
+
+ module aoi12(a, y);
+ input a;
+ output y;
+ assign y = ~a;
+ endmodule
+ EOV
+ hierarchy -auto-top
+EOY
+
+../../yosys -q -s - <<- EOY 2>&1 | grep "Automatically selected TOP as design top module"
+ read_verilog << EOV
+ module aoi12(a, y);
+ input a;
+ output y;
+ assign y = ~a;
+ endmodule
+
+ module TOP(a, y);
+ input a;
+ output [31:0] y;
+
+ aoi12 foo (a, y);
+ endmodule
+ EOV
+ hierarchy -auto-top
+EOY
+
+../../yosys -q -s - <<- EOY 2>&1 | grep "Automatically selected noTop as design top module."
+ read_verilog << EOV
+ module aoi12(a, y);
+ input a;
+ output y;
+ assign y = ~a;
+ endmodule
+
+ module noTop(a, y);
+ input a;
+ output [31:0] y;
+ endmodule
+ EOV
+ hierarchy -auto-top
+EOY
diff --git a/tests/various/run-test.sh b/tests/various/run-test.sh
index 67e1beb23..7cd1a8650 100755
--- a/tests/various/run-test.sh
+++ b/tests/various/run-test.sh
@@ -1,6 +1,14 @@
-#!/bin/bash
+#!/usr/bin/env bash
set -e
for x in *.ys; do
echo "Running $x.."
../../yosys -ql ${x%.ys}.log $x
done
+# Run any .sh files in this directory (with the exception of the file - run-test.sh
+shell_tests=$(echo *.sh | sed -e 's/run-test.sh//')
+if [ "$shell_tests" ]; then
+ for s in $shell_tests; do
+ echo "Running $s.."
+ bash $s >& ${s%.sh}.log
+ done
+fi