From 5bf9308b47bfb71ebec95316351c4ee1039a3a90 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 6 Aug 2019 07:50:13 +0200 Subject: Add a testcase for #881 --- testsuite/gna/issue881/t87.vhdl | 17 +++++++++++++++++ testsuite/gna/issue881/t87io.vhdl | 19 +++++++++++++++++++ testsuite/gna/issue881/testsuite.sh | 21 +++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 testsuite/gna/issue881/t87.vhdl create mode 100644 testsuite/gna/issue881/t87io.vhdl create mode 100755 testsuite/gna/issue881/testsuite.sh (limited to 'testsuite/gna') diff --git a/testsuite/gna/issue881/t87.vhdl b/testsuite/gna/issue881/t87.vhdl new file mode 100644 index 000000000..847bf4e47 --- /dev/null +++ b/testsuite/gna/issue881/t87.vhdl @@ -0,0 +1,17 @@ +entity t87 is +end; + +architecture behav of t87 is + constant t1 : time := 1 ns; + constant t2 : natural := time'pos (t1); +begin + assert t1 = 1000 ps; + process + variable v : natural; + begin + -- Time resolution must be ps + v := time'pos(ps); + assert v = 1 severity failure; + wait; + end process; +end behav; diff --git a/testsuite/gna/issue881/t87io.vhdl b/testsuite/gna/issue881/t87io.vhdl new file mode 100644 index 000000000..3b2c70c18 --- /dev/null +++ b/testsuite/gna/issue881/t87io.vhdl @@ -0,0 +1,19 @@ +entity t87io is +end; + +use std.textio.all; + +architecture behav of t87io is + constant t1 : time := 1 ns; + constant t2 : natural := time'pos (t1); +begin + assert t1 = 1000 ps; + process + variable v : natural; + begin + -- Time resolution must be ps + v := time'pos(ps); + assert v = 1 severity failure; + wait; + end process; +end behav; diff --git a/testsuite/gna/issue881/testsuite.sh b/testsuite/gna/issue881/testsuite.sh new file mode 100755 index 000000000..1ec9e0a4d --- /dev/null +++ b/testsuite/gna/issue881/testsuite.sh @@ -0,0 +1,21 @@ +#! /bin/sh + +. ../../testenv.sh + +# See #613 + +if ! $GHDL --help -a | grep -q time-resolution; then + echo "option --time-resolution not available" +else + analyze t87.vhdl + elab_simulate --time-resolution=ps t87 + elab_simulate --time-resolution=auto t87 + + analyze t87io.vhdl + elab_simulate --time-resolution=ps t87io + elab_simulate --time-resolution=auto t87io + + clean +fi + +echo "Test successful" -- cgit v1.2.3