From d6f06fcd8eadbfa7f7065e29b4650093570c80b6 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sat, 29 Feb 2020 17:38:25 +0100 Subject: testsuite/synth: add test for #1146 --- testsuite/synth/issue1146/ent.vhdl | 36 ++++++++++++++++++++++++++++++++++ testsuite/synth/issue1146/testsuite.sh | 13 ++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 testsuite/synth/issue1146/ent.vhdl create mode 100755 testsuite/synth/issue1146/testsuite.sh (limited to 'testsuite/synth') diff --git a/testsuite/synth/issue1146/ent.vhdl b/testsuite/synth/issue1146/ent.vhdl new file mode 100644 index 000000000..8ba3c3f3c --- /dev/null +++ b/testsuite/synth/issue1146/ent.vhdl @@ -0,0 +1,36 @@ +entity ent is + generic ( + t1 : time := 2 sec; + t2 : time := 5 sec + ); +end; + +architecture a of ent is + constant t3 : time := t1 + t2; + constant diff : time := abs (t1 - t2); + + constant shorter : time := minimum(t1, t2); + constant longer : time := maximum(t1, t2); + + constant ratio1 : natural := t1 / t2; + constant ratio2 : natural := (t1 / 2) / (t2 * 0.5); + constant ratio3 : natural := (t1 * 2) / (t2 / 0.5); +begin + assert t3 > 6 sec; + assert t3 = 7 sec; + assert t3 < 8 sec; + + assert t3 /= 1 ns; + + assert t3 >= shorter; + assert shorter <= longer; + + assert diff = longer - shorter; + assert -diff = +(shorter-longer); + + assert ratio1 = ratio2; + assert ratio1 = ratio3; + + assert t1 * 2 = 2 * t1; + assert t1 * 0.5 = 0.5 * t1; +end; diff --git a/testsuite/synth/issue1146/testsuite.sh b/testsuite/synth/issue1146/testsuite.sh new file mode 100755 index 000000000..730cf6d16 --- /dev/null +++ b/testsuite/synth/issue1146/testsuite.sh @@ -0,0 +1,13 @@ +#! /bin/sh + +. ../../testenv.sh + +GHDL_STD_FLAGS=--std=08 +for t in ent; do + synth $t.vhdl -e $t > syn_$t.vhdl + analyze syn_$t.vhdl +done + +clean + +echo "Test successful" -- cgit v1.2.3