aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-04-29 12:16:04 +0200
committerTristan Gingold <tgingold@free.fr>2022-04-29 12:19:23 +0200
commitd9b5e0e8e2de7d575df18fcc7be84a8ba8375052 (patch)
treef93fbb6870bcb223838c964a10a7965185e90cba
parentbdb90f2f54f4ccd1c290d872c5bafcb4ba3e1778 (diff)
downloadghdl-d9b5e0e8e2de7d575df18fcc7be84a8ba8375052.tar.gz
ghdl-d9b5e0e8e2de7d575df18fcc7be84a8ba8375052.tar.bz2
ghdl-d9b5e0e8e2de7d575df18fcc7be84a8ba8375052.zip
testsuite/synth: add tests for previous commit (enum comparison)
-rw-r--r--testsuite/synth/enum01/test2.vhdl54
-rwxr-xr-xtestsuite/synth/enum01/testsuite.sh2
2 files changed, 56 insertions, 0 deletions
diff --git a/testsuite/synth/enum01/test2.vhdl b/testsuite/synth/enum01/test2.vhdl
new file mode 100644
index 000000000..02f3bdc08
--- /dev/null
+++ b/testsuite/synth/enum01/test2.vhdl
@@ -0,0 +1,54 @@
+use work.test_pkg.all;
+
+entity test2 is
+ port (
+ eq : out boolean;
+ neq : out boolean;
+ lt : out boolean;
+ lte : out boolean;
+ gt : out boolean;
+ gte : out boolean
+ );
+end entity;
+
+architecture a of test2 is
+ function is_eq (l, r : number_t) return boolean is
+ begin
+ return l = r;
+ end is_eq;
+
+ function is_ne (l, r : number_t) return boolean is
+ begin
+ return l /= r;
+ end is_ne;
+
+ function is_lt (l, r : number_t) return boolean is
+ begin
+ return l < r;
+ end is_lt;
+
+ function is_le (l, r : number_t) return boolean is
+ begin
+ return l <= r;
+ end is_le;
+
+ function is_gt (l, r : number_t) return boolean is
+ begin
+ return l > r;
+ end is_gt;
+
+ function is_ge (l, r : number_t) return boolean is
+ begin
+ return l >= r;
+ end is_ge;
+
+ constant x : number_t := ONE;
+ constant y : number_t := THREE;
+begin
+ eq <= is_eq (x, y);
+ neq <= is_ne (x, y);
+ lt <= is_lt (x, y);
+ lte <= is_le (x, y);
+ gt <= is_gt (x, y);
+ gte <= is_ge (x, y);
+end architecture;
diff --git a/testsuite/synth/enum01/testsuite.sh b/testsuite/synth/enum01/testsuite.sh
index 511dcb1f4..4f1d78b1f 100755
--- a/testsuite/synth/enum01/testsuite.sh
+++ b/testsuite/synth/enum01/testsuite.sh
@@ -11,4 +11,6 @@ analyze test_pkg.vhdl syn_test.vhdl tb_test.vhdl
elab_simulate tb_test --ieee-asserts=disable-at-0 --assert-level=error
clean
+synth test_pkg.vhdl test2.vhdl -e test2 > syn_test2.vhdl
+
echo "Test successful"